summaryrefslogtreecommitdiffstats
path: root/scripts/presyn/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/presyn/Makefile')
-rw-r--r--scripts/presyn/Makefile22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/presyn/Makefile b/scripts/presyn/Makefile
new file mode 100644
index 0000000..d1c367e
--- /dev/null
+++ b/scripts/presyn/Makefile
@@ -0,0 +1,22 @@
+
+TOOLCHAIN_PREFIX = /opt/riscv32ic/bin/riscv32-unknown-elf-
+
+run: testbench.vvp firmware.hex
+ vvp -N testbench.vvp
+
+firmware.hex: firmware.S firmware.c firmware.lds
+ $(TOOLCHAIN_PREFIX)gcc -Os -ffreestanding -nostdlib -o firmware.elf firmware.S firmware.c \
+ --std=gnu99 -Wl,-Bstatic,-T,firmware.lds,-Map,firmware.map,--strip-debug -lgcc
+ $(TOOLCHAIN_PREFIX)objcopy -O binary firmware.elf firmware.bin
+ python3 ../../firmware/makehex.py firmware.bin 4096 > firmware.hex
+
+picorv32_presyn.v: picorv32_presyn.ys picorv32_regs.txt ../../picorv32.v
+ yosys -v0 picorv32_presyn.ys
+
+testbench.vvp: testbench.v picorv32_presyn.v
+ iverilog -o testbench.vvp testbench.v picorv32_presyn.v
+
+clean:
+ rm -f firmware.bin firmware.elf firmware.hex firmware.map
+ rm -f picorv32_presyn.v testbench.vvp testbench.vcd
+