|
6 | 6 | # - Philippe Sauter <[email protected]> |
7 | 7 |
|
8 | 8 | # Tools |
9 | | -BENDER ?= bender |
10 | | -PYTHON3 ?= python3 |
11 | | -VERILATOR ?= /foss/tools/bin/verilator |
12 | | -YOSYS ?= yosys |
13 | | -OPENROAD ?= openroad |
14 | | -KLAYOUT ?= klayout |
15 | | -VSIM ?= vsim |
| 9 | +BENDER ?= bender |
16 | 10 |
|
17 | 11 | # Directories |
18 | 12 | # directory of the path to the last called Makefile (this one) |
@@ -59,81 +53,6 @@ sw: $(SW_HEX) |
59 | 53 |
|
60 | 54 | .PHONY: software sw |
61 | 55 |
|
62 | | -################## |
63 | | -# RTL Simulation # |
64 | | -################## |
65 | | -# Questasim/Modelsim/vsim |
66 | | -VLOG_ARGS = -svinputport=compat |
67 | | -VSIM_ARGS = -t 1ns -voptargs=+acc |
68 | | -VSIM_ARGS += -suppress vsim-3009 -suppress vsim-8683 -suppress vsim-8386 |
69 | | - |
70 | | -vsim/compile_rtl.tcl: Bender.lock Bender.yml |
71 | | - $(BENDER) script vsim -t rtl -t vsim -t simulation -t verilator -DSYNTHESIS -DSIMULATION --vlog-arg="$(VLOG_ARGS)" > $@ |
72 | | - |
73 | | -vsim/compile_netlist.tcl: Bender.lock Bender.yml |
74 | | - $(BENDER) script vsim -t ihp13 -t vsim -t simulation -t verilator -t netlist_yosys -DSYNTHESIS -DSIMULATION > $@ |
75 | | - |
76 | | -## Simulate RTL using Questasim/Modelsim/vsim |
77 | | -vsim: vsim/compile_rtl.tcl $(SW_HEX) |
78 | | - rm -rf vsim/work |
79 | | - cd vsim; $(VSIM) -c -do "source compile_rtl.tcl; exit" |
80 | | - cd vsim; $(VSIM) +binary="$(realpath $(SW_HEX))" -gui tb_croc_soc $(VSIM_ARGS) |
81 | | - |
82 | | -## Simulate netlist using Questasim/Modelsim/vsim |
83 | | -vsim-yosys: vsim/compile_netlist.tcl $(SW_HEX) yosys/out/croc_chip_yosys_debug.v |
84 | | - rm -rf vsim/work |
85 | | - cd vsim; $(VSIM) -c -do "source compile_netlist.tcl; source compile_tech.tcl; exit" |
86 | | - cd vsim; $(VSIM) -gui tb_croc_soc $(VSIM_ARGS) |
87 | | - |
88 | | - |
89 | | -# Verilator |
90 | | -# Turn off style warnings and well-defined SystemVerilog warnings that should be part of -Wno-style |
91 | | -VERILATOR_ARGS = -Wno-fatal -Wno-style \ |
92 | | - -Wno-BLKANDNBLK -Wno-WIDTHEXPAND -Wno-WIDTHTRUNC -Wno-WIDTHCONCAT -Wno-ASCRANGE |
93 | | - |
94 | | -VERILATOR_ARGS += --binary -j 0 |
95 | | -VERILATOR_ARGS += --timing --autoflush --trace-fst --trace-threads 2 --trace-structs |
96 | | -VERILATOR_ARGS += --unroll-count 1 --unroll-stmts 1 |
97 | | -VERILATOR_ARGS += --x-assign fast --x-initial fast |
98 | | -VERILATOR_CFLAGS += -O3 -march=native -mtune=native |
99 | | - |
100 | | -verilator/croc.f: Bender.lock Bender.yml |
101 | | - $(BENDER) script verilator -t rtl -t verilator -t cve2_include_tracer -DSYNTHESIS -DVERILATOR -DTRACE_EXECUTION > $@ |
102 | | - |
103 | | -verilator/obj_dir/Vtb_croc_soc: verilator/croc.f $(SW_HEX) |
104 | | - cd verilator; $(VERILATOR) $(VERILATOR_ARGS) -O3 --top tb_croc_soc -f croc.f |
105 | | - |
106 | | -## Simulate RTL using Verilator |
107 | | -verilator: verilator/obj_dir/Vtb_croc_soc |
108 | | - cd verilator; obj_dir/Vtb_croc_soc +binary="$(realpath $(SW_HEX))" | tee croc.log |
109 | | - |
110 | | -.PHONY: verilator vsim vsim-yosys |
111 | | - |
112 | | - |
113 | | -#################### |
114 | | -# Open Source Flow # |
115 | | -#################### |
116 | | -# Bender manages the different IPs and can be used to generate file-lists for synthesis |
117 | | -TOP_DESIGN ?= croc_chip |
118 | | -DUT_DESIGN ?= croc_soc |
119 | | -BENDER_TARGETS ?= asic ihp13 rtl synthesis |
120 | | -SV_DEFINES ?= VERILATOR SYNTHESIS COMMON_CELLS_ASSERTS_OFF |
121 | | - |
122 | | -## Generate croc.flist used to read design in yosys |
123 | | -yosys-flist: Bender.lock Bender.yml rtl/*/Bender.yml |
124 | | - $(BENDER) script flist-plus $(foreach t,$(BENDER_TARGETS),-t $(t)) $(foreach d,$(SV_DEFINES),-D $(d)=1) > $(PROJ_DIR)/croc.flist |
125 | | - |
126 | | -include yosys/yosys.mk |
127 | | -include openroad/openroad.mk |
128 | | - |
129 | | -klayout/croc_chip.gds: $(OR_OUT)/croc.def klayout/*.sh klayout/*.py |
130 | | - ./klayout/def2gds.sh |
131 | | - |
132 | | -## Generate merged .gds from openroads .def output |
133 | | -klayout: klayout/croc_chip.gds |
134 | | - |
135 | | -.PHONY: klayout yosys-flist |
136 | | - |
137 | 56 |
|
138 | 57 | ################# |
139 | 58 | # Documentation # |
@@ -162,12 +81,6 @@ help: Makefile |
162 | 81 |
|
163 | 82 | ## Delete generated files and directories |
164 | 83 | clean: |
165 | | - rm -f $(SV_FLIST) |
166 | | - rm -f klayout/croc_chip.gds |
167 | | - rm -rf verilator/obj_dir/ |
168 | | - rm -f verilator/croc.f |
169 | | - rm -f verilator/croc.vcd |
170 | | - $(MAKE) ys_clean |
171 | | - $(MAKE) or_clean |
| 84 | + $(MAKE) -C sw clean |
172 | 85 |
|
173 | 86 | .PHONY: clean |
0 commit comments