-
Notifications
You must be signed in to change notification settings - Fork 242
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
Gowin. Add fix for Single Port BSRAM #1332
Conversation
Add description of BSRAM harness In some cases, Gowin IDE adds a number of LUTs and DFFs to the BSRAM. Here we are trying to add similar elements. More details with pictures: https://github.com/YosysHQ/apicula/blob/master/doc/bsram-fix.md Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
Shouldn't this be done in Yosys during techmapping? |
For Tangnano4k no extra primitives are added, for Tangnano20k they are added that are different from Tangnano9k, and for szfga others are added. |
I think this kind of hardware-errata-level workaround is okay in nextpnr, if the vendor tools are also doing it during the place and route step. I just want to double check, these aren't only being added during memory inference, but also when you instantiate the primitives directly in the vendor tools? |
Definitely. And yes, in the new (relatively) families of chips used in Tangnano9k and Tangnano20k, some defect with the WRE and CE signals was corrected and these elements are not added, but it seems that the built-in output register was broken and therefore DFFs are still added, but according to a different scheme and for another reason. `default_nettype none
module top(
input wire clk,
input wire rst_i,
input wire wre,
input wire ce,
input wire oce,
input wire [7:0] in,
input wire [10:0] addr,
output wire [7:0] led
);
wire gnd, vcc;
assign gnd = 1'b0;
assign vcc = 1'b1;
//wire [27:0] dummy;
wire [34:0] dummy;
SPX9 mem(
.DO({dummy, led[0]}),
.DI({{28{gnd}}, in}),
.AD({addr, gnd, gnd, gnd}),
.CLK(clk),
.CE(ce),
.WRE(wre),
.OCE(oce),
.BLKSEL(3'b000),
.RESET(rst_i)
);
defparam mem.READ_MODE = 1'b0;
defparam mem.WRITE_MODE = 2'b01;
defparam mem.BIT_WIDTH = 9;
defparam mem.BLK_SEL = 3'b000;
defparam mem.RESET_MODE = "ASYNC";
endmodule |
Thanks for clarification. In this case I feel like you have one of the two reasonable options:
|
It seems that the internal registers on the BSRAM output pins in READ_MODE=1'b1 (pipeline) mode do not function properly because in the images generated by Gowin IDE an external register is added to each pin, and the BSRAM itself switches to READ_MODE=1'b0 (bypass) mode . This is observed on Tangnano9k and Tangnano20k boards. Here we repeat this fix. Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
For now, I’ll stick to the option with nextpnr - first we’ll work out all the errors without optimization. |
Add description of BSRAM harness
In some cases, Gowin IDE adds a number of LUTs and DFFs to the BSRAM. Here we are trying to add similar elements.
More details with pictures: https://github.com/YosysHQ/apicula/blob/master/doc/bsram-fix.md
Compatible with older Apicula databases.