diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 6 | ||||
| -rw-r--r-- | clean.bat | 2 | ||||
| -rw-r--r-- | hdl/bin2bcd.sv (renamed from bin2bcd.sv) | 0 | ||||
| -rw-r--r-- | hdl/fibseq.sv (renamed from fibseq.sv) | 0 | ||||
| -rw-r--r-- | hdl/jtag_uart.sv (renamed from jtag_uart.sv) | 2 | ||||
| -rw-r--r-- | hdl/ntoa.sv (renamed from ntoa.sv) | 0 | ||||
| -rw-r--r-- | hdl/top.sv (renamed from top.sv) | 2 | ||||
| -rw-r--r-- | hdl/utils.svh (renamed from utils.svh) | 0 | ||||
| -rw-r--r-- | init.bat | 2 | ||||
| -rw-r--r-- | init.tcl | 27 | ||||
| -rw-r--r-- | jtag.cdf (renamed from programmer.cdf) | 0 | ||||
| -rw-r--r-- | mem/jtag_uart.hex (renamed from jtag_uart.hex) | 0 | ||||
| -rw-r--r-- | mem/rom.hex (renamed from rom.hex) | 0 | ||||
| -rw-r--r-- | sim/main.cpp (renamed from main.cpp) | 0 | ||||
| -rw-r--r-- | tcl/clean.tcl (renamed from clean.tcl) | 0 | ||||
| -rw-r--r-- | tcl/init.tcl | 38 |
16 files changed, 45 insertions, 34 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | SOURCES := $(wildcard **.sv **.cpp) | 1 | SOURCES := $(shell find -name \*.sv -o -name \*.cpp) |
| 2 | COLLATERAL := $(wildcard **.hex **.svh) | 2 | COLLATERAL := $(shell find -name \*.hex -o -name \*.svh) |
| 3 | 3 | ||
| 4 | OPTS ?= | 4 | OPTS ?= |
| 5 | 5 | ||
| @@ -9,7 +9,7 @@ sim: build/Vtop | |||
| 9 | 9 | ||
| 10 | build/Vtop: $(SOURCES) $(COLLATERAL) | 10 | build/Vtop: $(SOURCES) $(COLLATERAL) |
| 11 | @mkdir -p build | 11 | @mkdir -p build |
| 12 | verilator +1800-2017ext+sv -Wall -Wno-BLKSEQ -O3 $(OPTS) --Mdir build --trace --cc --build --exe --top-module top $(SOURCES) | 12 | verilator +1800-2017ext+sv -Wall -Wno-BLKSEQ -O3 -Ihdl $(OPTS) --Mdir build --trace --cc --build --exe --top-module top $(SOURCES) |
| 13 | 13 | ||
| 14 | clean: | 14 | clean: |
| 15 | rm -rf build | 15 | rm -rf build |
| @@ -1 +1 @@ | |||
| quartus_sh -t clean.tcl | quartus_sh -t tcl/clean.tcl | ||
diff --git a/bin2bcd.sv b/hdl/bin2bcd.sv index 9b1609b..9b1609b 100644 --- a/bin2bcd.sv +++ b/hdl/bin2bcd.sv | |||
diff --git a/fibseq.sv b/hdl/fibseq.sv index 752c0b6..752c0b6 100644 --- a/fibseq.sv +++ b/hdl/fibseq.sv | |||
diff --git a/jtag_uart.sv b/hdl/jtag_uart.sv index 5c4857d..eb0bc11 100644 --- a/jtag_uart.sv +++ b/hdl/jtag_uart.sv | |||
| @@ -39,7 +39,7 @@ alt_jtag_atlantic | |||
| 39 | `else | 39 | `else |
| 40 | 40 | ||
| 41 | bit [7:0] sim_rx_rom [0:(1<<16)-1]; | 41 | bit [7:0] sim_rx_rom [0:(1<<16)-1]; |
| 42 | initial $readmemh("jtag_uart.hex", sim_rx_rom); | 42 | initial $readmemh("mem/jtag_uart.hex", sim_rx_rom); |
| 43 | 43 | ||
| 44 | bit [15:0] sim_rx_addr; | 44 | bit [15:0] sim_rx_addr; |
| 45 | 45 | ||
| @@ -15,7 +15,7 @@ bit reset; | |||
| 15 | assign reset = !reset_n; | 15 | assign reset = !reset_n; |
| 16 | 16 | ||
| 17 | bit [7:0] rom [0:(1<<ROM_BITS)-1]; | 17 | bit [7:0] rom [0:(1<<ROM_BITS)-1]; |
| 18 | initial $readmemh("rom.hex", rom); | 18 | initial $readmemh("mem/rom.hex", rom); |
| 19 | 19 | ||
| 20 | bit [ROM_BITS-1:0] addr; | 20 | bit [ROM_BITS-1:0] addr; |
| 21 | 21 | ||
diff --git a/utils.svh b/hdl/utils.svh index ddba543..ddba543 100644 --- a/utils.svh +++ b/hdl/utils.svh | |||
| @@ -2,4 +2,4 @@ if exist toycpu.qpf ( | |||
| 2 | call clean.bat | 2 | call clean.bat |
| 3 | ) | 3 | ) |
| 4 | 4 | ||
| 5 | quartus_sh.exe -t init.tcl | 5 | quartus_sh.exe -t tcl/init.tcl |
diff --git a/init.tcl b/init.tcl deleted file mode 100644 index 4640ea1..0000000 --- a/init.tcl +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | project_new toycpu -revision toycpu -overwrite | ||
| 2 | |||
| 3 | set_global_assignment -name DEVICE 10CL025YU256I7G | ||
| 4 | |||
| 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 | ||
| 11 | |||
| 12 | set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to clk | ||
| 13 | set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to reset_n | ||
| 14 | |||
| 15 | create_base_clock -fmax "50 MHz" clk | ||
| 16 | |||
| 17 | set_global_assignment -name CDF_FILE programmer.cdf | ||
| 18 | set_global_assignment -name HEX_FILE rom.hex | ||
| 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 | ||
| 25 | set_global_assignment -name VERILOG_FILE utils.svh | ||
| 26 | |||
| 27 | project_close | ||
diff --git a/programmer.cdf b/jtag.cdf index cbe240b..cbe240b 100644 --- a/programmer.cdf +++ b/jtag.cdf | |||
diff --git a/jtag_uart.hex b/mem/jtag_uart.hex index 504999f..504999f 100644 --- a/jtag_uart.hex +++ b/mem/jtag_uart.hex | |||
diff --git a/clean.tcl b/tcl/clean.tcl index eeadcb7..eeadcb7 100644 --- a/clean.tcl +++ b/tcl/clean.tcl | |||
diff --git a/tcl/init.tcl b/tcl/init.tcl new file mode 100644 index 0000000..7bf3a13 --- /dev/null +++ b/tcl/init.tcl | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | project_new toycpu -revision toycpu -overwrite | ||
| 2 | |||
| 3 | set_global_assignment -name DEVICE 10CL025YU256I7G | ||
| 4 | |||
| 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 | proc pin {loc net} { | ||
| 10 | set_location_assignment -to $net "PIN_$loc" | ||
| 11 | set_instance_assignment -name IO_STANDARD "3.3V LVTTL" -to $net | ||
| 12 | } | ||
| 13 | |||
| 14 | pin E1 clk | ||
| 15 | pin J15 reset_n | ||
| 16 | |||
| 17 | create_base_clock -fmax "50 MHz" clk | ||
| 18 | |||
| 19 | proc add_files {typ ext dir} { | ||
| 20 | foreach name [glob -nocomplain -directory $dir -type f "*.$ext"] { | ||
| 21 | set_global_assignment -name "${typ}_FILE" $name | ||
| 22 | } | ||
| 23 | } | ||
| 24 | |||
| 25 | proc add_dir {dir} { | ||
| 26 | add_files CDF cdf $dir | ||
| 27 | add_files HEX hex $dir | ||
| 28 | add_files SDC sdc $dir | ||
| 29 | add_files VERILOG sv $dir | ||
| 30 | |||
| 31 | foreach subdir [glob -nocomplain -directory $dir -type d *] { | ||
| 32 | add_dir $subdir | ||
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | add_dir "." | ||
| 37 | |||
| 38 | project_close | ||
