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

Add waveform with iverilog simulator #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ test/logs/*
gds/**/*.gltf

.DS_Store
results.xml
results.xml

sim_build/**
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export LIBPYTHON_LOC=$(shell cocotb-config --libpython)
test_%:
make compile
iverilog -o build/sim.vvp -s gpu -g2012 build/gpu.v
MODULE=test.test_$* vvp -M $$(cocotb-config --prefix)/cocotb/libs -m libcocotbvpi_icarus build/sim.vvp
MODULE=test.test_$* vvp -M $$(cocotb-config --prefix)/cocotb/libs -m libcocotbvpi_icarus build/sim.vvp -fst

compile:
make compile_alu
Expand All @@ -19,7 +19,12 @@ compile:
compile_%:
sv2v -w build/$*.v src/$*.sv

# TODO: Get gtkwave visualizaiton
# The gtkwave FST file -> sim_build/gpu.fst
test.test_%: compile
make -f Makefile.cocotb.mk MODULE=$@

show_%: %.vcd %.gtkw
gtkwave $^

clean:
rm -rf build/* sim_build
19 changes: 19 additions & 0 deletions Makefile.cocotb.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Makefile

# defaults
SIM ?= icarus
TOPLEVEL_LANG ?= verilog

# Enable wakeform
WAVES=1

VERILOG_SOURCES += build/gpu.v

# TOPLEVEL is the name of the toplevel module in your Verilog or VHDL file
TOPLEVEL = gpu

# MODULE is the basename of the Python test file
MODULE := test.test_matadd

# include cocotb's make rules to take care of the simulator setup
include $(shell cocotb-config --makefiles)/Makefile.sim