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
Update Icarus Verilog build to support WAVES environment variable, 2023 version #3324
Conversation
Details: - Update Makefile.icarus to support WAVES by creating an iverilog_dump.v file that is automatically added to the build. - Remove VCD support from examples/simple_dff/dff.sv
Are we sure we want "It generates a VCD instead of an FST."? FST can be read just fine by GtkWave, and whoever is using icarus is most likely also using a free waveform viewer. And of course it's the significantly better format, with more information being preserved and files being much smaller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I'd go for FST traces unless there's a strong reason not to. And this will need a newsfragment, but I can do that after this PR goes in.
$(SIM_BUILD)/sim.vvp: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD) | ||
@echo "+timescale+$(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)" > $(SIM_BUILD)/cmds.f | ||
$(CMD) -o $(SIM_BUILD)/sim.vvp -D COCOTB_SIM=1 $(TOPMODULE_ARG) $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES) | ||
|
||
$(SIM_BUILD)/iverilog_dump.v: | $(SIM_BUILD) | ||
@echo 'module iverilog_dump();' > $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reduce the risk of accidentally clashing with a user module of that name can we prefix this module with something rare? A random number, cocotb_internal_implementation_of_iverilog_dump, something of that sort?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point. I think a cocotb_
prefix ought to be good enough? So how about cocotb_iverilog_dump.v
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be collisions no matter what name we're choosing, so feel free to use the one you like best.
There is more tlak about adding support for FST vs VCD into WAVES at some point more globally. For now just getting the feature in there in any way is a step forward. |
Happy to do FST. I just went with VCD because it is more "standard" ? But, true, I use GTKWave, so FST would work just fine. |
I also should update the docs, which currently mention the need to add a code fragment to your |
On FST vs VCD: We have other simulators writing waveforms in their proprietary format when WAVES is set, so doing the same for Icarus seems consistent. So I'd personally go for that, but I'll leave it up to you @ddribin, it's your PR after all! Thanks for working on it! Let me know when you're ready for a merge. |
Rerunning CI against a master merge. |
Codecov Report
@@ Coverage Diff @@
## master #3324 +/- ##
=======================================
Coverage 48.85% 48.85%
=======================================
Files 49 49
Lines 8816 8816
Branches 2446 2446
=======================================
Hits 4307 4307
Misses 3932 3932
Partials 577 577 |
I was going to ask if there's precedent for I just pushed changes for this and the documentation. Please take a look at the doc changes, but if there are no further comments, this is ready to merge. |
Details:
This is basically an updated version of PR #2239 against current top-of-tree. It generates a VCD instead of an FST. And it puts the waveform file in
sim_build/
.