diff options
| author | Julian Blake Kongslie | 2021-03-23 21:18:21 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2021-03-23 21:18:21 -0700 |
| commit | 39b70c676387bfe06bcc931d3795afc11fd8f137 (patch) | |
| tree | 00a832c1ce7ece7033c0398a82d6a67b09781e43 | |
| parent | Replace dibble dabble algorithm with variant that tests after the add. (diff) | |
| download | toycpu-39b70c676387bfe06bcc931d3795afc11fd8f137.tar.xz | |
Changes for Windows-friendly builds.
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 31 | ||||
| -rw-r--r-- | bin2bcd.sv | 2 | ||||
| -rw-r--r-- | build.bat | 3 | ||||
| -rw-r--r-- | clocks.sdc | 1 | ||||
| -rw-r--r-- | init.bat | 3 | ||||
| -rw-r--r-- | init.tcl | 24 | ||||
| -rw-r--r-- | programmer.cdf | 13 |
7 files changed, 41 insertions, 36 deletions
| @@ -1,38 +1,15 @@ | |||
| 1 | VERILOG := $(wildcard **.sv) | 1 | SOURCES := $(wildcard **.sv **.cpp) |
| 2 | HEADERS := $(wildcard **.svh) | 2 | COLLATERAL := $(wildcard **.hex **.svh) |
| 3 | CPPSRCS := $(wildcard **.cpp) | ||
| 4 | COLLATERAL := $(wildcard **.hex) | ||
| 5 | 3 | ||
| 6 | OPTS ?= | 4 | OPTS ?= |
| 7 | 5 | ||
| 8 | QUARTUS ?= /opt/quartus-lite/20.1.1.720/ | ||
| 9 | |||
| 10 | QUARTUS_SH := $(QUARTUS)/quartus/bin/quartus_sh | ||
| 11 | |||
| 12 | sim: build/Vtop | 6 | sim: build/Vtop |
| 13 | $< | 7 | $< |
| 14 | .PHONY: sim | 8 | .PHONY: sim |
| 15 | 9 | ||
| 16 | gui: build/toycpu.qpf | 10 | build/Vtop: $(SOURCES) $(COLLATERAL) |
| 17 | cd build; $(QUARTUS_SH) --gui toycpu | ||
| 18 | .PHONY: gui | ||
| 19 | |||
| 20 | qpf: build/toycpu.qpf | ||
| 21 | .PHONY: qpf | ||
| 22 | |||
| 23 | pof: build/toycpu.pof | ||
| 24 | .PHONY: pof | ||
| 25 | |||
| 26 | build/Vtop: $(VERILOG) $(HEADERS) $(CPPSRCS) $(COLLATERAL) | ||
| 27 | @mkdir -p build | ||
| 28 | verilator +1800-2017ext+sv -Wall -Wno-BLKSEQ -O3 $(OPTS) --Mdir build --trace --cc --build --exe --top-module top $(VERILOG) $(CPPSRCS) | ||
| 29 | |||
| 30 | build/toycpu.pof: build/toycpu.qpf $(VERILOG) $(COLLATERAL) | ||
| 31 | cd build; $(QUARTUS_SH) --flow compile toycpu | ||
| 32 | |||
| 33 | build/toycpu.qpf: init.tcl | ||
| 34 | @mkdir -p build | 11 | @mkdir -p build |
| 35 | cd build; $(QUARTUS_SH) -t ../$< $(addprefix $(PWD),$(VERILOG)) | 12 | verilator +1800-2017ext+sv -Wall -Wno-BLKSEQ -O3 $(OPTS) --Mdir build --trace --cc --build --exe --top-module top $(SOURCES) |
| 36 | 13 | ||
| 37 | clean: | 14 | clean: |
| 38 | rm -rf build | 15 | rm -rf build |
| @@ -21,7 +21,7 @@ localparam DIGITS = $rtoi($ceil($ln(1 << BITS) / $ln(BASE))); | |||
| 21 | bit bin_b_valid; | 21 | bit bin_b_valid; |
| 22 | bit [BITS-1:0] bin_b_data; | 22 | bit [BITS-1:0] bin_b_data; |
| 23 | 23 | ||
| 24 | bit [DIGITS-1:0][BASE_BITS-1:0] bcd;; | 24 | bit [DIGITS-1:0][BASE_BITS-1:0] bcd; |
| 25 | 25 | ||
| 26 | bit [$clog2(BITS):0] work; | 26 | bit [$clog2(BITS):0] work; |
| 27 | 27 | ||
diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..730d487 --- /dev/null +++ b/build.bat | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | init.bat | ||
| 2 | |||
| 3 | quartus_sh.exe --flow compile toycpu | ||
diff --git a/clocks.sdc b/clocks.sdc new file mode 100644 index 0000000..f613011 --- /dev/null +++ b/clocks.sdc | |||
| @@ -0,0 +1 @@ | |||
| create_clock -period "50 MHz" clk | |||
diff --git a/init.bat b/init.bat new file mode 100644 index 0000000..20ea117 --- /dev/null +++ b/init.bat | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | if not exist toycpu.qpf { | ||
| 2 | quartus_sh.exe -t init.tcl | ||
| 3 | } | ||
| @@ -1,18 +1,26 @@ | |||
| 1 | global quartus | ||
| 2 | |||
| 3 | project_new toycpu -revision toycpu -overwrite | 1 | project_new toycpu -revision toycpu -overwrite |
| 4 | 2 | ||
| 5 | set_global_assignment -name DEVICE 10CL025YU256I7G | 3 | set_global_assignment -name DEVICE 10CL025YU256I7G |
| 6 | 4 | ||
| 7 | set_global_assignment -name TOP_LEVEL_ENTITY top | 5 | set_global_assignment -name TOP_LEVEL_ENTITY top |
| 6 | set_global_assignment -name VERILOG_INPUT_VERSION SYSTEMVERILOG_2005 | ||
| 7 | set_global_assignment -name VERILOG_MACRO "SYNTHESIS=1" | ||
| 8 | |||
| 9 | set_location_assignment PIN_E1 -to clk | ||
| 10 | set_location_assignment PIN_J15 -to reset_n | ||
| 8 | 11 | ||
| 9 | set_location_assignment -to clk PIN_E1 | 12 | set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to clk |
| 10 | set_location_assignment -to reset_n PIN_J15 | 13 | set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to reset_n |
| 11 | 14 | ||
| 12 | create_base_clock -fmax "50 MHz" -target clk clock_50m | 15 | create_base_clock -fmax "50 MHz" clk |
| 13 | 16 | ||
| 14 | foreach arg $quartus(args) { | 17 | set_global_assignment -name CDF_FILE programmer.cdf |
| 15 | set_global_assignment -name VERILOG_FILE $arg | 18 | set_global_assignment -name HEX_FILE rom.hex |
| 16 | } | 19 | set_global_assignment -name SDC_FILE clocks.sdc |
| 20 | set_global_assignment -name VERILOG_FILE bin2bcd.sv | ||
| 21 | set_global_assignment -name VERILOG_FILE fibseq.sv | ||
| 22 | set_global_assignment -name VERILOG_FILE jtag_uart.sv | ||
| 23 | set_global_assignment -name VERILOG_FILE ntoa.sv | ||
| 24 | set_global_assignment -name VERILOG_FILE top.sv | ||
| 17 | 25 | ||
| 18 | project_close | 26 | project_close |
diff --git a/programmer.cdf b/programmer.cdf new file mode 100644 index 0000000..cbe240b --- /dev/null +++ b/programmer.cdf | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | /* XXX Copy this from a working setup on Ducky hardware */ | ||
| 2 | JedecChain; | ||
| 3 | FileRevision(JESD32A); | ||
| 4 | DefaultMfr(6E); | ||
| 5 | |||
| 6 | P ActionCode(Cfg) | ||
| 7 | Device PartName(10CL025YU256) Path("C:/Users/mike/Desktop/toycpu/") File("toycpu.pof") MfrSpec(OpMask(1)); | ||
| 8 | |||
| 9 | ChainEnd; | ||
| 10 | |||
| 11 | AlteraBegin; | ||
| 12 | ChainType(JTAG); | ||
| 13 | AlteraEnd; | ||
