-
Notifications
You must be signed in to change notification settings - Fork 1k
gowin: dsp: Add basic DSP block inferencing for various MULT cells #5411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
plaes
wants to merge
2
commits into
YosysHQ:main
Choose a base branch
from
plaes:wip-gowin-dsp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| module \$__MUL9X9 (input [8:0] A, input [8:0] B, output [17:0] Y); | ||
| parameter A_WIDTH = 9; | ||
| parameter B_WIDTH = 9; | ||
| parameter Y_WIDTH = 18; | ||
| parameter A_SIGNED = 0; | ||
| parameter B_SIGNED = 0; | ||
|
|
||
| wire [8:0] soa; | ||
| wire [8:0] sob; | ||
|
|
||
| MULT9X9 _TECHMAP_REPLACE_ ( | ||
| .A(A), | ||
| .B(B), | ||
| .SIA(8'b0), | ||
| .SIB(8'b0), | ||
| .ASIGN(A_SIGNED), | ||
| .BSIGN(B_SIGNED), | ||
| .ASEL(1'b0), | ||
| .BSEL(1'b0), | ||
| .SOA(soa), | ||
| .SOB(sob), | ||
| .DOUT(Y) | ||
| ); | ||
| endmodule | ||
|
|
||
| module \$__MUL18X18 (input [17:0] A, input [17:0] B, output [35:0] Y); | ||
| parameter A_WIDTH = 18; | ||
| parameter B_WIDTH = 18; | ||
| parameter Y_WIDTH = 36; | ||
| parameter A_SIGNED = 0; | ||
| parameter B_SIGNED = 0; | ||
|
|
||
| wire [17:0] soa; | ||
| wire [17:0] sob; | ||
|
|
||
| MULT18X18 _TECHMAP_REPLACE_ ( | ||
| .A(A), | ||
| .B(B), | ||
| .SIA(18'b0), | ||
| .SIB(18'b0), | ||
| .ASIGN(A_SIGNED), | ||
| .BSIGN(B_SIGNED), | ||
| .ASEL(1'b0), | ||
| .BSEL(1'b0), | ||
| .SOA(soa), | ||
| .SOB(sob), | ||
| .DOUT(Y) | ||
| ); | ||
| endmodule | ||
|
|
||
| module \$__MUL36X36 (input [35:0] A, input [35:0] B, output [72:0] Y); | ||
| parameter A_WIDTH = 36; | ||
| parameter B_WIDTH = 36; | ||
| parameter Y_WIDTH = 72; | ||
| parameter A_SIGNED = 0; | ||
| parameter B_SIGNED = 0; | ||
|
|
||
| MULT36X36 _TECHMAP_REPLACE_ ( | ||
| .A(A), | ||
| .B(B), | ||
| .ASIGN(A_SIGNED), | ||
| .BSIGN(B_SIGNED), | ||
| .DOUT(Y) | ||
| ); | ||
| endmodule | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| read_verilog ../common/mul.v | ||
| chparam -set X_WIDTH 8 -set Y_WIDTH 8 -set A_WIDTH 16 | ||
| hierarchy -top top | ||
| proc | ||
| # equivalence checking is somewhat slow (and missing simulation models) | ||
| synth_gowin -family gw1n | ||
|
|
||
| cd top # Constrain all select calls below inside the top module | ||
| select -assert-count 1 t:MULT9X9 | ||
| # XXX: Whats's `top/x_IBUF_I_O_MULT9X9_A_A_GND_G` ?? | ||
| # select -assert-none t:IBUF t:OBUF t:MULT9X9 %% t:* %D | ||
|
|
||
| design -reset | ||
| read_verilog ../common/mul.v | ||
| chparam -set X_WIDTH 16 -set Y_WIDTH 16 -set A_WIDTH 32 | ||
| hierarchy -top top | ||
| proc | ||
| synth_gowin -family gw1n | ||
| cd top # Constrain all select calls below inside the top module | ||
| select -assert-count 1 t:MULT18X18 | ||
| # XXX: top/x_IBUF_I_O_MULT18X18_A_A_GND_G ??? | ||
| # select -assert-none t:IBUF t:OBUF t:MULT18X18 %% t:* %D | ||
|
|
||
|
|
||
| design -reset | ||
| read_verilog ../common/mul.v | ||
| chparam -set X_WIDTH 32 -set Y_WIDTH 32 -set A_WIDTH 64 | ||
| hierarchy -top top | ||
| proc | ||
| # equivalence checking is too slow here | ||
| synth_gowin | ||
| cd top # Constrain all select calls below inside the top module | ||
| select -assert-count 1 t:MULT36X36 | ||
| # XXX: top/x_IBUF_I_O_MULT36X36_A_A_GND_G | ||
| # select -assert-none t:IBUF t:OBUF t:MULT36X36 %% t:* %D | ||
|
|
||
| # TODO: We end up with two 18x18 multipliers | ||
| # design -reset | ||
| # read_verilog ../common/mul.v | ||
| # chparam -set X_WIDTH 32 -set Y_WIDTH 16 -set A_WIDTH 48 | ||
| # hierarchy -top top | ||
| # proc | ||
| # # equivalence checking is too slow here | ||
| # synth_gowin | ||
| # cd top # Constrain all select calls below inside the top module | ||
| # select -assert-count 2 t:MULT18X18 | ||
| # select -assert-none t:IBUF t:OBUF t:MULT36X36 %% t:* %D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| read_verilog ../common/mul.v | ||
| chparam -set X_WIDTH 8 -set Y_WIDTH 8 -set A_WIDTH 16 | ||
| hierarchy -top top | ||
| proc | ||
| # equivalence checking is somewhat slow (and missing simulation models) | ||
| synth_gowin -family gw2a | ||
|
|
||
| cd top # Constrain all select calls below inside the top module | ||
| select -assert-count 1 t:MULT9X9 | ||
| # XXX: Whats's `top/x_IBUF_I_O_MULT9X9_A_A_GND_G` ?? | ||
| # select -assert-none t:IBUF t:OBUF t:MULT9X9 %% t:* %D | ||
|
|
||
| design -reset | ||
| read_verilog ../common/mul.v | ||
| chparam -set X_WIDTH 16 -set Y_WIDTH 16 -set A_WIDTH 32 | ||
| hierarchy -top top | ||
| proc | ||
| synth_gowin -family gw2a | ||
| cd top # Constrain all select calls below inside the top module | ||
| select -assert-count 1 t:MULT18X18 | ||
| # XXX: top/x_IBUF_I_O_MULT18X18_A_A_GND_G ??? | ||
| # select -assert-none t:IBUF t:OBUF t:MULT18X18 %% t:* %D | ||
|
|
||
|
|
||
| design -reset | ||
| read_verilog ../common/mul.v | ||
| chparam -set X_WIDTH 32 -set Y_WIDTH 32 -set A_WIDTH 64 | ||
| hierarchy -top top | ||
| proc | ||
| # equivalence checking is too slow here | ||
| synth_gowin -family gw2a | ||
| cd top # Constrain all select calls below inside the top module | ||
| select -assert-count 1 t:MULT36X36 | ||
| # XXX: top/x_IBUF_I_O_MULT36X36_A_A_GND_G | ||
| # select -assert-none t:IBUF t:OBUF t:MULT36X36 %% t:* %D | ||
|
|
||
| # TODO: We end up with two 18x18 multipliers | ||
| # design -reset | ||
| # read_verilog ../common/mul.v | ||
| # chparam -set X_WIDTH 32 -set Y_WIDTH 16 -set A_WIDTH 48 | ||
| # hierarchy -top top | ||
| # proc | ||
| # # equivalence checking is too slow here | ||
| # synth_gowin -family gw2a | ||
| # cd top # Constrain all select calls below inside the top module | ||
| # select -assert-count 2 t:MULT18X18 | ||
| # select -assert-none t:IBUF t:OBUF t:MULT36X36 %% t:* %D |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.