Skip to content
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

Merged
merged 4 commits into from Jun 9, 2023

Conversation

ddribin
Copy link
Contributor

@ddribin ddribin commented Jun 4, 2023

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

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/.

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
@imphil
Copy link
Member

imphil commented Jun 6, 2023

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.

Copy link
Member

@imphil imphil left a 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();' > $@
Copy link
Member

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?

Copy link
Contributor Author

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 ?

Copy link
Member

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.

@ktbarrett
Copy link
Member

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.

@ddribin
Copy link
Contributor Author

ddribin commented Jun 7, 2023

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.

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.

@ddribin
Copy link
Contributor Author

ddribin commented Jun 7, 2023

I also should update the docs, which currently mention the need to add a code fragment to your .v file for Icarus.

@imphil
Copy link
Member

imphil commented Jun 7, 2023

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.

@imphil imphil closed this Jun 7, 2023
@imphil imphil reopened this Jun 7, 2023
@imphil
Copy link
Member

imphil commented Jun 7, 2023

Rerunning CI against a master merge.

@codecov
Copy link

codecov bot commented Jun 7, 2023

Codecov Report

Merging #3324 (9617ed9) into master (efe8d3a) will not change coverage.
The diff coverage is n/a.

❗ Current head 9617ed9 differs from pull request most recent head 5938f56. Consider uploading reports for the commit 5938f56 to get more accurate results

@@           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           

@ddribin
Copy link
Contributor Author

ddribin commented Jun 7, 2023

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.

I was going to ask if there's precedent for WAVES producing formats other than VCD. Given other simulators do produce something other than VCD, I'll switch to FST, by default. We can add an override option for VCD later.

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.

@ktbarrett ktbarrett merged commit 5d6b6b3 into cocotb:master Jun 9, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants