Skip to content
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
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
.PHONY: test compile

export LIBPYTHON_LOC=$(shell cocotb-config --libpython)
TOPLEVEL=gpu

test_%:
make compile
iverilog -o build/sim.vvp -s gpu -g2012 build/gpu.v
make iverilog_dump_$*.sv
iverilog -o build/sim.vvp -s gpu -g2012 build/gpu.v -s iverilog_dump_$* iverilog_dump_$*.sv
MODULE=test.test_$* vvp -M $$(cocotb-config --prefix)/cocotb/libs -m libcocotbvpi_icarus build/sim.vvp

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

# TODO: Get gtkwave visualizaiton
iverilog_dump_%.sv:
echo 'module iverilog_dump_$*();' > $@
echo 'initial begin' >> $@
echo ' $$dumpfile("$*.vcd");' >> $@
echo ' $$dumpvars(0, $(TOPLEVEL));' >> $@
echo 'end' >> $@
echo 'endmodule' >> $@

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

clean:
rm -rf build/*
rm -f iverilog_dump*
rm -f *.vcd
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ tiny-gpu is setup to simulate the execution of both of the above kernels. Before
- Run `mkdir build` in the root directory of this repository.

Once you've installed the pre-requisites, you can run the kernel simulations with `make test_matadd` and `make test_matmul`.
You can also view the waveforms using `make show_matadd` and `make show_matmul`.

Executing the simulations will output a log file in `test/logs` with the initial data memory state, complete execution trace of the kernel, and final data memory state.

Expand Down