summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-09-17 22:10:39 -0600
committerAlejandro Soto <alejandro@34project.org>2022-09-17 22:10:39 -0600
commitb0cb20496d88cd017c4c51243d16ac3b060cc1d6 (patch)
treeb73bb171b9454501a8a3e101ab9d5f05c6b72945
parenta9aafdf34ed44f115edf43f29a733eb82f366eb6 (diff)
Update project structure to match Verilator Makefile
-rw-r--r--Makefile36
-rw-r--r--conspiracion.qsf4
-rw-r--r--rtl/bus/master.sv8
-rw-r--r--rtl/top/conspiracion.sv (renamed from rtl/conspiracion.sv)0
-rw-r--r--tb/top/conspiracion.cpp (renamed from tb/main.cpp)0
5 files changed, 30 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 787efa1..d30e6cb 100644
--- a/Makefile
+++ b/Makefile
@@ -5,24 +5,36 @@ RTL_DIR := rtl
TB_DIR := tb
VERILATOR := verilator
+RTL_FILES = $(shell find $(RTL_DIR)/ ! -path '$(RTL_DIR)/top/*' -type f -name '*.sv')
+RTL_FILES += $(shell find $(TB_DIR)/ ! -path '$(TB_DIR)/top/*' -type f -name '*.sv')
+TB_FILES = $(shell find $(TB_DIR)/ ! -path '$(TB_DIR)/top/*' -type f -name '*.cpp')
+
all: trace
clean:
rm -rf $(OBJ_DIR) $(VCD_DIR)
-trace: exe vcd
- cd $(VCD_DIR) && ../$(OBJ_DIR)/V$(TOP)
+trace: trace/$(TOP)
+
+trace/%: exe/% $(VCD_DIR)/%
+ cd $(VCD_DIR)/$* && ../../$(OBJ_DIR)/$*/V$*
+
+$(VCD_DIR)/%:
+ mkdir -p $@
+
+exe: exe/$(TOP)
-$(VCD_DIR):
- @mkdir $(VCD_DIR)
+exe/%: $(OBJ_DIR)/%/V%.mk
+ $(MAKE) -C $(OBJ_DIR)/$* -f V$*.mk
-exe: $(OBJ_DIR)/V$(TOP)
+.SECONDEXPANSION:
-$(OBJ_DIR)/V$(TOP): $(OBJ_DIR)/V$(TOP).mk
- $(MAKE) -C $(OBJ_DIR) -f V$(TOP).mk $(MAKEFLAGS)
+$(OBJ_DIR)/%.mk: \
+ $(RTL_DIR)/top/$$(word 1,$$(subst /, ,$$*)).sv \
+ $$(shell find $(RTL_DIR)/top/$$(dir $$*) -type f -name '*.sv' 2>/dev/null) \
+ $$(shell find $(TB_DIR)/top/$$(dir $$*) -type f -name '*.sv' 2>/dev/null) \
+ $(RTL_FILES) $(TB_FILES) $(TB_DIR)/top/$$(word 1,$$(subst /, ,$$*)).cpp \
+ $$(shell find $(TB_DIR)/top/$$(dir $$*) -type f -name '*.cpp' 2>/dev/null)
-$(OBJ_DIR)/V$(TOP).mk: $(wildcard $(RTL_DIR)/*.sv) $(wildcard $(TB_DIR)/*.cpp)
- $(VERILATOR) \
- --cc --exe --trace \
- -y $(RTL_DIR) --Mdir $(OBJ_DIR) \
- rtl/$(TOP).sv $(wildcard $(TB_DIR)/*.cpp)
+ mkdir -p $(dir $@)
+ $(VERILATOR) --cc --exe --trace -y $(RTL_DIR) --Mdir $(dir $@) --top $(word 1,$(subst /, ,$*)) $(patsubst tb/%,../tb/%,$^)
diff --git a/conspiracion.qsf b/conspiracion.qsf
index b79614d..fd11788 100644
--- a/conspiracion.qsf
+++ b/conspiracion.qsf
@@ -56,7 +56,7 @@ set_global_assignment -name POWER_BOARD_THERMAL_MODEL "NONE (CONSERVATIVE)"
set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top
set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
-set_global_assignment -name SYSTEMVERILOG_FILE rtl/conspiracion.sv
+set_global_assignment -name SYSTEMVERILOG_FILE rtl/top/conspiracion.sv
set_global_assignment -name QIP_FILE platform/synthesis/platform.qip
set_instance_assignment -name IO_STANDARD "SSTL-15 CLASS I" -to memory_oct_rzqin -tag __hps_sdram_p0
set_instance_assignment -name IO_STANDARD "SSTL-15 CLASS I" -to memory_mem_dq[0] -tag __hps_sdram_p0
@@ -212,4 +212,4 @@ set_location_assignment PIN_W20 -to out[7]
set_location_assignment PIN_Y21 -to done
-set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top \ No newline at end of file
+set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
diff --git a/rtl/bus/master.sv b/rtl/bus/master.sv
index 63ea2be..5d8c3a8 100644
--- a/rtl/bus/master.sv
+++ b/rtl/bus/master.sv
@@ -49,10 +49,10 @@ module bus_master
endcase
initial begin
- ready <= 0;
- avl_read <= 0;
- avl_write <= 0;
- state <= REQUEST;
+ ready = 0;
+ avl_read = 0;
+ avl_write = 0;
+ state = REQUEST;
end
endmodule
diff --git a/rtl/conspiracion.sv b/rtl/top/conspiracion.sv
index 83e7d10..83e7d10 100644
--- a/rtl/conspiracion.sv
+++ b/rtl/top/conspiracion.sv
diff --git a/tb/main.cpp b/tb/top/conspiracion.cpp
index d4bdbcb..d4bdbcb 100644
--- a/tb/main.cpp
+++ b/tb/top/conspiracion.cpp