Comments (5)
Good catch! Nice write up of the issue too, thanks.
Since Verilator is only a two-state simulator (no x or z), it doesn't manifest this problem, but any four-state simulator probably will. Another solution might be to initialize the SRAMs to 0 at startup.
from nyuziprocessor.
This patch should address the issue, but feel free to let me know if not.
from nyuziprocessor.
Sadly, if a logic/reg variable is driven in an always_ff block, the "vlog" compiler in the latest Modelsim seems doesn't allow any other block drive that single again, even it's an initial block. So the patch 7780328 just can't pass the compile.
The following patch is ok with the help of macro SIMULATION, but not very beautiful...
--- sram_1r1w_ce221ff.sv 2017-03-23 23:05:54.677195800 +0800
+++ sram_1r1w_patched.sv 2017-05-05 16:32:46.063266600 +0800
@@ -100,7 +100,11 @@
// Simulation
logic[DATA_WIDTH - 1:0] data[SIZE];
+`ifdef SIMULATION
+ always @(posedge clk)
+`else
always_ff @(posedge clk)
+`endif
begin
if (write_en)
data[write_addr] <= write_data;
@@ -120,6 +124,11 @@
initial
begin
+`ifdef SIMULATION
+ for (int i = 0; i < SIZE; i++)
+ data[i] = '0;
+`endif
+
if ($test$plusargs("dumpmems") != 0)
$display("sram1r1w %d %d", DATA_WIDTH, SIZE);
end
--- sram_2r1w_ce221ff.sv 2017-03-22 23:48:00.614532400 +0800
+++ sram_2r1w_patched.sv 2017-05-05 16:32:48.783422200 +0800
@@ -128,7 +128,11 @@
// Simulation
logic[DATA_WIDTH - 1:0] data[SIZE];
+`ifdef SIMULATION
+ always @(posedge clk)
+`else
always_ff @(posedge clk)
+`endif
begin
if (write_en)
data[write_addr] <= write_data;
@@ -160,6 +164,11 @@
initial
begin
+`ifdef SIMULATION
+ for (int i = 0; i < SIZE; i++)
+ data[i] = '0;
+`endif
+
if ($test$plusargs("dumpmems") != 0)
$display("sram2r1w %d %d", DATA_WIDTH, SIZE);
end
from nyuziprocessor.
Yeah, a bit hacky, but I'm not sure of another way to do this cleanly now. Pushed another patch.
I didn't add the SIMULATION guards in this patch. Did you need that because you are inferring the SRAM for the Xilinx part in that block? I would have expected the last block to not infer SRAMs properly (with an area and clock speed hit), but perhaps this works okay on Xilinx. It definitely doesn't on Altera. I think it might be preferable to have a VENDOR_XILINX block and explicitly instantiate the block RAM, like how it is done in VENDOR_ALTERA, to avoid any issues.
from nyuziprocessor.
Problem solved with 77a50a8, thanks for the time!
Yes, currently the SRAM in my design is inferred from this block because it just works... Thanks for the advice. I will make a VENDOR_XILINX block and submit a pull request after finished.
from nyuziprocessor.
Related Issues (20)
- Switch to github actions for CI build.
- Is this project going to support the openCL? HOT 2
- I saw a similar crash in the user_copy_fault test. HOT 2
- I want to use quartus to generate the RTL of GPU HOT 3
- Error building NyuziProcessor (probably NyuziToolchain) HOT 16
- Crash w/ latest version of Verilator
- Is there a problem with these lines of code in cache_lru.sv or is it just that I don't understand the algorithm? HOT 2
- Suggestions HOT 1
- hi how can i get linux driver HOT 3
- May be a icache miss thread still can be scheduled again? HOT 3
- Khronos ML summit HOT 2
- run_fpga command does not work properly for me HOT 6
- 00000000 Did not get ack for load memory, got c8 instead HOT 7
- make error HOT 6
- setup_tools.sh failure HOT 10
- ./scripts/setup_tools.sh error on MAC M1 HOT 2
- Questions related to integration. HOT 1
- TARGET_FILE:llvm-strip : build error HOT 1
- Performance measure using hash program HOT 8
- solution of ASM compiler identification is unknown
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nyuziprocessor.