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
Make CXXRTL testbench ~25% faster #1
Conversation
Actually, by removing |
Oh, thanks! If this is in response to my tweet, the slow speed in that case is entirely my fault and due to how that simulation was running in lockstep with OpenOCD, but extra speed when free-running is really useful. For me this patch changes the behaviour of the RTL, making the processor rapidly go off into the weeds. These are the CXXRTL output files I get with/without the patch, from |
That's interesting--this seems to be a bug! What about removing |
...which made me realise that the older free-running tb doesn't have any bounds checking on instruction addresses, oops. Quick fix is on master now.
this also gives me odd behaviour and processor instantly goes off into the weeds. Odd because this is the command line I'm using the the openocd testbench (test/sim/openocd):
And that runs fine. I think the The |
Do you have some binaries I can run for a quick test? I think I know what issue you're hitting but I'd like to check it more carefully first. |
Sure, here are hazard3-hellow-binaries-with-without-splitnets.zip Invoke as:
|
Okay, you're hitting YosysHQ/yosys#2780. There is an issue with how values are propagated to combinatorial output ports. This can be confirmed by applying the following patch, which papers over the underlying soundness issue: diff --git a/test/sim/tb_cxxrtl/tb.cpp b/test/sim/tb_cxxrtl/tb.cpp
index efb2fd6..0ccae7f 100644
--- a/test/sim/tb_cxxrtl/tb.cpp
+++ b/test/sim/tb_cxxrtl/tb.cpp
@@ -129,7 +129,7 @@ int main(int argc, char **argv) {
if (dump_waves)
vcd.sample(cycle * 2);
top.p_clk.set<bool>(true);
- top.step();
+ top.step(); top.step();
// Handle current data phase, then move current address phase to data phase
uint32_t rdata = 0;
if (bus_trans && bus_write) { I'll have to investigate how to fix this without losing performance. |
This more or less explains the nonsensical VCDs I was seeing :) thanks!
Confirming: this does indeed fix my symptoms with the |
I'd suggest removing |
Oops, yeah. Even with the
Else I get unescaped illegal characters in VCD signal names
IIRC flattening hierarchy also gets rid of these but makes the VCDs confusing when you have a design with lots of interaction across hierarchy levels. This is probably just hiding the symptom, probably the VCD writer just needs to escape those? I haven't looked at the code (edit; if I look deeper I will raise an issue :) ) |
Hold on. You should have the exact same VCD from a flattened and non-flattened design; CXXRTL uses the |
Sorry; when I said flattened I should have said I don't think |
My brain is fried from gdb debugging, sorry to waste your time by being imprecise |
It's okay ^^ |
What's happening is that GTKWave is hitting |
sigh YosysHQ/yosys#2881 |
Ok, so with my hack from YosysHQ/yosys#2883 I am now enjoying my colons in the sideways orientation, thank you very much |
The splitnets command removes a few feedback arcs.