beepo/tests/Makefile

47 lines
972 B
Makefile
Raw Normal View History

2023-11-21 05:08:22 -06:00
SLAPPER_DIR = ../slapper
SLAPPER_BUILD = $(SLAPPER_DIR)/target/release/slapper
SLAPPER = ./slapper
HBASM = ./hbasm
SPMEM = spmem.v
INPUT_FILE = inputs.txt
BUILD_DEPS = ../src/beepo.v ../src/instructions.v ../src/uart_tx.v ../src/multi7.v ../src/bus.v
%.clean: %/build
rm -r $<
$(SLAPPER_BUILD): $(SLAPPER_DIR)/src/main.rs
cargo build --manifest-path $(SLAPPER_DIR)/Cargo.toml -r
$(SLAPPER): $(SLAPPER_BUILD)
cp $< $@
%/build:
mkdir -p $@
%/build/program.bin: %/program.rhai %/build
$(HBASM) $< > $@
%/build/spmem_gen.v: %/build/program.bin $(SLAPPER)
$(SLAPPER) $< $(SPMEM) $@
%/build/out: $(INPUT_FILE) %/$(INPUT_FILE) $(BUILD_DEPS) %/top.v %/build/spmem_gen.v
iverilog -o $@ -c $< -c $(word 2, $^) -s tb_beepo
%/build/dump.vcd: %/build/out
vvp $<
%.wave: %/build/dump.vcd
gtkwave $<
%.assemble: %/build/program.bin
echo Done
%.insert-mem: %/build/spmem_gen.v
echo Done
%.synth: %/build/out
echo Done
%.run: %/build/dump.vcd
echo Done