mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
448fa8eb4c
Signed-off-by: Alex Forencich <alex@alexforencich.com>
53 lines
1.2 KiB
Makefile
53 lines
1.2 KiB
Makefile
# SPDX-License-Identifier: BSD-2-Clause-Views
|
|
# Copyright (c) 2020-2023 The Regents of the University of California
|
|
|
|
TOPLEVEL_LANG = verilog
|
|
|
|
SIM ?= icarus
|
|
WAVES ?= 0
|
|
|
|
COCOTB_HDL_TIMEUNIT = 1ns
|
|
COCOTB_HDL_TIMEPRECISION = 1ps
|
|
|
|
DUT = rx_hash
|
|
TOPLEVEL = $(DUT)
|
|
MODULE = test_$(DUT)
|
|
VERILOG_SOURCES += ../../rtl/$(DUT).v
|
|
|
|
# module parameters
|
|
export PARAM_DATA_WIDTH := 64
|
|
export PARAM_KEEP_WIDTH := $(shell expr $(PARAM_DATA_WIDTH) / 8 )
|
|
|
|
ifeq ($(SIM), icarus)
|
|
PLUSARGS += -fst
|
|
|
|
COMPILE_ARGS += $(foreach v,$(filter PARAM_%,$(.VARIABLES)),-P $(TOPLEVEL).$(subst PARAM_,,$(v))=$($(v)))
|
|
|
|
ifeq ($(WAVES), 1)
|
|
VERILOG_SOURCES += iverilog_dump.v
|
|
COMPILE_ARGS += -s iverilog_dump
|
|
endif
|
|
else ifeq ($(SIM), verilator)
|
|
COMPILE_ARGS += -Wno-SELRANGE -Wno-WIDTH
|
|
|
|
COMPILE_ARGS += $(foreach v,$(filter PARAM_%,$(.VARIABLES)),-G$(subst PARAM_,,$(v))=$($(v)))
|
|
|
|
ifeq ($(WAVES), 1)
|
|
COMPILE_ARGS += --trace-fst
|
|
endif
|
|
endif
|
|
|
|
include $(shell cocotb-config --makefiles)/Makefile.sim
|
|
|
|
iverilog_dump.v:
|
|
echo 'module iverilog_dump();' > $@
|
|
echo 'initial begin' >> $@
|
|
echo ' $$dumpfile("$(TOPLEVEL).fst");' >> $@
|
|
echo ' $$dumpvars(0, $(TOPLEVEL));' >> $@
|
|
echo 'end' >> $@
|
|
echo 'endmodule' >> $@
|
|
|
|
clean::
|
|
@rm -rf iverilog_dump.v
|
|
@rm -rf dump.fst $(TOPLEVEL).fst
|