summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile6
-rw-r--r--clean.bat2
-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.bat2
-rw-r--r--init.tcl27
-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.tcl38
16 files changed, 45 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index f532ce2..41fa7d9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
1SOURCES := $(wildcard **.sv **.cpp) 1SOURCES := $(shell find -name \*.sv -o -name \*.cpp)
2COLLATERAL := $(wildcard **.hex **.svh) 2COLLATERAL := $(shell find -name \*.hex -o -name \*.svh)
3 3
4OPTS ?= 4OPTS ?=
5 5
@@ -9,7 +9,7 @@ sim: build/Vtop
9 9
10build/Vtop: $(SOURCES) $(COLLATERAL) 10build/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
14clean: 14clean:
15 rm -rf build 15 rm -rf build
diff --git a/clean.bat b/clean.bat
index 6870b7a..6b31ea1 100644
--- a/clean.bat
+++ b/clean.bat
@@ -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
41bit [7:0] sim_rx_rom [0:(1<<16)-1]; 41bit [7:0] sim_rx_rom [0:(1<<16)-1];
42initial $readmemh("jtag_uart.hex", sim_rx_rom); 42initial $readmemh("mem/jtag_uart.hex", sim_rx_rom);
43 43
44bit [15:0] sim_rx_addr; 44bit [15:0] sim_rx_addr;
45 45
diff --git a/ntoa.sv b/hdl/ntoa.sv
index 6da1baf..6da1baf 100644
--- a/ntoa.sv
+++ b/hdl/ntoa.sv
diff --git a/top.sv b/hdl/top.sv
index 0244020..33c1fc5 100644
--- a/top.sv
+++ b/hdl/top.sv
@@ -15,7 +15,7 @@ bit reset;
15assign reset = !reset_n; 15assign reset = !reset_n;
16 16
17bit [7:0] rom [0:(1<<ROM_BITS)-1]; 17bit [7:0] rom [0:(1<<ROM_BITS)-1];
18initial $readmemh("rom.hex", rom); 18initial $readmemh("mem/rom.hex", rom);
19 19
20bit [ROM_BITS-1:0] addr; 20bit [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
diff --git a/init.bat b/init.bat
index 526f8ea..40d352b 100644
--- a/init.bat
+++ b/init.bat
@@ -2,4 +2,4 @@ if exist toycpu.qpf (
2 call clean.bat 2 call clean.bat
3) 3)
4 4
5quartus_sh.exe -t init.tcl 5quartus_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 @@
1project_new toycpu -revision toycpu -overwrite
2
3set_global_assignment -name DEVICE 10CL025YU256I7G
4
5set_global_assignment -name TOP_LEVEL_ENTITY top
6set_global_assignment -name VERILOG_INPUT_VERSION SYSTEMVERILOG_2005
7set_global_assignment -name VERILOG_MACRO "SYNTHESIS=1"
8
9set_location_assignment PIN_E1 -to clk
10set_location_assignment PIN_J15 -to reset_n
11
12set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to clk
13set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to reset_n
14
15create_base_clock -fmax "50 MHz" clk
16
17set_global_assignment -name CDF_FILE programmer.cdf
18set_global_assignment -name HEX_FILE rom.hex
19set_global_assignment -name SDC_FILE clocks.sdc
20set_global_assignment -name VERILOG_FILE bin2bcd.sv
21set_global_assignment -name VERILOG_FILE fibseq.sv
22set_global_assignment -name VERILOG_FILE jtag_uart.sv
23set_global_assignment -name VERILOG_FILE ntoa.sv
24set_global_assignment -name VERILOG_FILE top.sv
25set_global_assignment -name VERILOG_FILE utils.svh
26
27project_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/rom.hex b/mem/rom.hex
index ee75917..ee75917 100644
--- a/rom.hex
+++ b/mem/rom.hex
diff --git a/main.cpp b/sim/main.cpp
index 3f49cb6..3f49cb6 100644
--- a/main.cpp
+++ b/sim/main.cpp
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 @@
1project_new toycpu -revision toycpu -overwrite
2
3set_global_assignment -name DEVICE 10CL025YU256I7G
4
5set_global_assignment -name TOP_LEVEL_ENTITY top
6set_global_assignment -name VERILOG_INPUT_VERSION SYSTEMVERILOG_2005
7set_global_assignment -name VERILOG_MACRO "SYNTHESIS=1"
8
9proc 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
14pin E1 clk
15pin J15 reset_n
16
17create_base_clock -fmax "50 MHz" clk
18
19proc 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
25proc 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
36add_dir "."
37
38project_close