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
|
2023-11-21 23:23:52 -06:00
|
|
|
BUILD_DEPS = ../src/beepo.v ../src/instructions.v ../src/uart_tx.v ../src/multi7.v ../src/mmu.v
|
2023-11-21 05:08:22 -06:00
|
|
|
|
|
|
|
%.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
|