-
Notifications
You must be signed in to change notification settings - Fork 896
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8cc9aa7
commit e523caa
Showing
6 changed files
with
68 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,29 +1,16 @@ | ||
bram $__MISTRAL_M10K | ||
init 1 | ||
abits 13 @D8192x1 | ||
dbits 1 @D8192x1 | ||
abits 12 @D4096x2 | ||
dbits 2 @D4096x2 | ||
abits 11 @D2048x5 | ||
dbits 5 @D2048x5 | ||
abits 10 @D1024x10 | ||
dbits 10 @D1024x10 | ||
abits 9 @D512x20 | ||
dbits 20 @D512x20 | ||
abits 8 @D256x40 | ||
dbits 40 @D256x40 | ||
groups 2 | ||
ports 1 1 | ||
wrmode 1 0 | ||
# read enable; write enable + byte enables (only for multiples of 8) | ||
enable 1 1 | ||
transp 0 0 | ||
clocks 1 1 | ||
clkpol 1 1 | ||
endbram | ||
|
||
|
||
match $__MISTRAL_M10K | ||
min efficiency 5 | ||
make_transp | ||
endmatch | ||
ram block $__MISTRAL_M10K { | ||
abits 13; | ||
widths 1 2 5 10 20 40 global; # TODO: per-port width | ||
cost 128; | ||
init no_undef; | ||
# the following is subject to change as more is implemented in nextpnr-mistral | ||
port sw "W" { | ||
clock posedge; | ||
wrtrans "R" old; | ||
} | ||
port sr "R" { | ||
clock posedge; | ||
rden; | ||
rdinit zero; | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,26 +1,26 @@ | ||
// Stub to invert M10K write-enable. | ||
|
||
module \$__MISTRAL_M10K (CLK1, A1ADDR, A1DATA, A1EN, B1ADDR, B1DATA, B1EN); | ||
module \$__MISTRAL_M10K (PORT_W_CLK, PORT_W_ADDR, PORT_W_WR_DATA, PORT_W_WR_EN, PORT_R_CLK, PORT_R_ADDR, PORT_R_RD_DATA, PORT_R_RD_EN); | ||
|
||
parameter INIT = 0; | ||
parameter WIDTH = 10; | ||
|
||
parameter CFG_ABITS = 10; | ||
parameter CFG_DBITS = 10; | ||
input PORT_W_CLK, PORT_R_CLK; | ||
input [12:0] PORT_W_ADDR, PORT_R_ADDR; | ||
input [WIDTH-1:0] PORT_W_WR_DATA; | ||
input PORT_W_WR_EN, PORT_R_RD_EN; | ||
output reg [WIDTH-1:0] PORT_R_RD_DATA; | ||
|
||
input CLK1; | ||
input [CFG_ABITS-1:0] A1ADDR, B1ADDR; | ||
input [CFG_DBITS-1:0] A1DATA; | ||
input A1EN, B1EN; | ||
output reg [CFG_DBITS-1:0] B1DATA; | ||
localparam CFG_ABITS = WIDTH == 40 ? 8 : WIDTH == 20 ? 9 : WIDTH == 10 ? 10 : WIDTH == 5 ? 11 : WIDTH == 2 ? 12 : 13; | ||
|
||
// Normal M10K configs use WREN[1], which is negative-true. | ||
// However, 8x40-bit mode uses WREN[0], which is positive-true. | ||
wire a1en; | ||
if (CFG_DBITS == 40) | ||
assign a1en = A1EN; | ||
wire wren; | ||
if (WIDTH == 40) | ||
assign wren = PORT_W_WR_EN; | ||
else | ||
assign a1en = !A1EN; | ||
assign wren = !PORT_W_WR_EN; | ||
|
||
MISTRAL_M10K #(.INIT(INIT), .CFG_ABITS(CFG_ABITS), .CFG_DBITS(CFG_DBITS)) _TECHMAP_REPLACE_ (.CLK1(CLK1), .A1ADDR(A1ADDR), .A1DATA(A1DATA), .A1EN(a1en), .B1ADDR(B1ADDR), .B1DATA(B1DATA), .B1EN(B1EN)); | ||
MISTRAL_M10K #(.INIT(INIT), .CFG_ABITS(CFG_ABITS), .CFG_DBITS(WIDTH)) _TECHMAP_REPLACE_ (.CLK1(PORT_W_CLK), .A1ADDR(PORT_W_ADDR), .A1DATA(PORT_W_WR_DATA), .A1EN(wren), .B1ADDR(PORT_R_ADDR), .B1DATA(PORT_R_RD_DATA), .B1EN(PORT_R_RD_EN)); | ||
|
||
endmodule |
This file contains 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 |
---|---|---|
@@ -1,18 +1,12 @@ | ||
bram MISTRAL_MLAB | ||
init 0 # TODO: Re-enable when Yosys remembers the original filename. | ||
abits 5 | ||
dbits 1 | ||
groups 2 | ||
ports 1 1 | ||
wrmode 1 0 | ||
# write enable | ||
enable 1 0 | ||
transp 0 0 | ||
clocks 1 0 | ||
clkpol 1 1 | ||
endbram | ||
|
||
match MISTRAL_MLAB | ||
min efficiency 5 | ||
make_outreg | ||
endmatch | ||
ram distributed $__MISTRAL_MLAB { | ||
abits 5; | ||
width 1; | ||
cost 4; | ||
init zero; # TODO: MLAB init in nextpnr-mistral | ||
prune_rom; | ||
port sw "W" { | ||
clock posedge; | ||
} | ||
port ar "R" { | ||
} | ||
} |
This file contains 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,13 @@ | ||
module \$__MISTRAL_MLAB (PORT_W_CLK, PORT_W_ADDR, PORT_W_WR_DATA, PORT_W_WR_EN, PORT_R_ADDR, PORT_R_RD_DATA); | ||
|
||
parameter INIT = 0; | ||
|
||
input PORT_W_CLK; | ||
input [4:0] PORT_W_ADDR, PORT_R_ADDR; | ||
input [4:0] PORT_W_WR_DATA; | ||
input PORT_W_WR_EN; | ||
output reg PORT_R_RD_DATA; | ||
|
||
MISTRAL_MLAB _TECHMAP_REPLACE_ (.CLK1(PORT_W_CLK), .A1ADDR(PORT_W_ADDR), .A1DATA(PORT_W_WR_DATA), .A1EN(PORT_W_WR_EN), .B1ADDR(PORT_R_ADDR), .B1DATA(PORT_R_RD_DATA)); | ||
|
||
endmodule |
This file contains 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