26 lines
803 B
Makefile
26 lines
803 B
Makefile
# (c) Peter McGoron 2022
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v.2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
TESTBENCH_BASE=mode${MODE}
|
|
AUXFILES=../spi_master.v ../spi_slave.v
|
|
|
|
CPP_TESTBENCH=${TESTBENCH_BASE}.cpp
|
|
WAVEFILE=${TESTBENCH_BASE}.vcd
|
|
|
|
FILES=${TESTBENCH_BASE}.v ${AUXFILES} ${CPP_TESTBENCH}
|
|
|
|
all: obj_dir/V${TESTBENCH_BASE}
|
|
./obj_dir/V${TESTBENCH_BASE} && gtkwave ${WAVEFILE}
|
|
|
|
obj_dir/V${TESTBENCH_BASE}.mk: ${FILES}
|
|
verilator -CFLAGS -Wall -Wno-unused -Wpedantic --trace --cc --exe ${FILES} --top ${TESTBENCH_BASE}
|
|
obj_dir/V${TESTBENCH_BASE}: obj_dir/V${TESTBENCH_BASE}.mk
|
|
make -C obj_dir -f V${TESTBENCH_BASE}.mk
|
|
|
|
run:
|
|
./obj_dir/V${TESTBENCH_CASE}
|
|
clean:
|
|
$(RM) obj_dir/*
|