chipyard icon indicating copy to clipboard operation
chipyard copied to clipboard

`make sim-rtl` fails due to redeclaration of modules

Open allpan3 opened this issue 3 years ago • 11 comments

Background Work

Chipyard Version and Hash

Release: 1.9.0 Hash: 7475bfb1a05802ac4dfc3990a889f93164b8d798

OS Setup

BWRC machine

Other Setup

Ex: Prior steps taken / Documentation Followed / etc...

Current Behavior

When running make sim-rtl from vlsi directory, re-declaration of modules causes VCS to error out.

SS 2023-04-15 at 19 22 12

Expected Behavior

In version 1.8.1, this does not happen. Re-declaration is a warning and overrides the previous definition instead.

SS 2023-04-15 at 19 16 27

Other Information

Not really a bug, but I'm trying to figure out how to resolve this. Based on some experiments it seems like this is caused by the omission of -top TestDriver in VCS command options. In the previous version of Chipyard -top TestDriver is specified. Not sure why this changes an error to a warning.

Commit 83764d3 modified sim.mk to dump out sim-inputs.yml without tb_name, which removes the -top <> option from VCS invocation when running make sim-rtl. @harrisonliew What is the reason for this? And is there a way to specify -top? I tried setting sim.inputs.tb_name in my yaml but it looks like sim-inputs.yml takes precedence.

I know I can try to avoid having duplicated definitions but it's often involving PDKs so takes more work to resolve.

allpan3 avatar Apr 16 '23 03:04 allpan3

Fix for this: add -error=noMPD option in vcs to suppress the error. Not sure if this is a good long term solution.

allpan3 avatar Apr 19 '23 12:04 allpan3

-top was removed to remove a different VCS error, one which essentially said that two different designs were declared as the top.

You can add back sim.inputs.tb_name to the sim.mk so that it appears in sim-inputs.yml. If you specify -error=noMPD, I presume it just ignores redeclarations and assumes the last one is valid - this would work but could hide some problems later, so it's not good long-term.

Anyways, I think I see the root issue - it's that the SS and FF corners have different Verilog files (I presume this is the output of the TSMC memory compiler). I did a comparison of the two and they're only different by some timing params, which is expected. For RTL sim, these params don't get used; for gate-level timing-annotated sim, you would only want to use the file corresponding to the corner you want to check against. TL;DR, only 1 memory Verilog file should be used for simulation - perhaps you can modify the plugin's sram_compiler tool for now to only include the TT corner Verilog?

harrisonliew avatar Apr 19 '23 15:04 harrisonliew

Yea that makes sense. I will make the change in sram_compiler. The same issue also exists for the standard cell library. The Decap cells (*OD*DCAP*) have the same names across different Vt flavors. The plan is to shred them from the lvt and hvt files.

allpan3 avatar Apr 19 '23 20:04 allpan3

@allpan3 Hi, I'm currently trying to run simulation with TSMC SRAM but encounter some problems. During (both RTL and Gate-level) simulation, it keeps showing

Port 0 write address unknown at time xxx ns
Entire memory set to unknown.

May I contact you directly and maybe we could share some ideas on implementing Boom with TSMC PDK? Thanks!

YiKangOY avatar Dec 19 '23 11:12 YiKangOY

Hi @YiKangOY, did you try simulating the same code using Rocket core? My guess is that this is caused by the dual-port SRAMs used in Boom. Rocket core doesn't use any dual-port memory so your code should work.

I faced a similar issue with TSMC HPM n28. It has something to do with x-pessimism. The bottom line is that Boom expects no unknown data coming out from the SRAM. Check you SRAM macro's verilog model and see if there's a way to initialize its data for simulation. (I had a discussion with Jerry Zhao about a similar issue to this, and this seems to be the fix needed, but I haven't tested on my end.)

allpan3 avatar Dec 20 '23 01:12 allpan3

@allpan3 Thanks! I will try with Rocket core and see if there is further issue we can discuss on!

YiKangOY avatar Dec 20 '23 11:12 YiKangOY

@allpan3 Hi, thanks for your advice, I have integrate TSMC SRAM into Rocket successfully. But problem occured when I simulated Boom. In dual port SRAM, sometimes the two ports will access the same address, with one writing and one reading, thus triggering memory contention. May I ask, have you encountered similar issues?

I think the memory accessing logic is controlled by barstool. Is there any chance that we modify barstool so reading and writing to the same address within a cycle will not occur?

YiKangOY avatar Jan 11 '24 01:01 YiKangOY

@YiKangOY Yes, that was the exact same problem I encountered. From my understanding, this happens because Boom branch predictor sometimes allows reading and writing the same address in the same cycle, because those are just predictions and won't affect anything. However, the Verilog model of TSMC SRAM macro often sets memory content to X whenever "abnormal" operations take place. In my case, Boom eventually reads X from the BTB and uses that as the read address to the dcache SRAM, which triggers the logic to set all memory data to X.

The specific behaviors may be different for your IP. I didn't get a chance to test the solution for this since my access to the TSMC IP has expired, but try to see if your Verilog model offers some flag to initialize all memory content in simulation.

allpan3 avatar Jan 14 '24 03:01 allpan3

@allpan3 Hi, thanks for your advice! We modify the TSMC sram verilog model slightly and then we can run RTL simulation on Boom with TSMC sram.

YiKangOY avatar Jan 18 '24 07:01 YiKangOY

@allpan3 Hi, thanks for your advice! We modify the TSMC sram verilog model slightly and then we can run RTL simulation on Boom with TSMC sram.

@YiKangOY Nice, glad to hear that. Can you share what change you made to the Verilog model?

allpan3 avatar Jan 19 '24 21:01 allpan3

@allpan3 Sure, but the detail of TSMC PDK is confidential, maybe we can discuss in private? My email address: oyykyook[at]gmail.com.

YiKangOY avatar Jan 22 '24 02:01 YiKangOY