@@ -45,6 +45,16 @@ def hex_riscv_command_gen(self):
4545 LINKER_SCRIPT = f"-Wl,-Bstatic,-T,{ self .test .linker_script_file } ,--strip-debug "
4646 CPUFLAGS = "-O2 -g -march=rv32i_zicsr -mabi=ilp32 -D__vexriscv__ -ffreestanding -nostdlib"
4747 # CPUFLAGS = "-O2 -g -march=rv32imc_zicsr -mabi=ilp32 -D__vexriscv__ -ffreestanding -nostdlib"
48+ includes = [
49+ f"-I{ ip } " for ip in self .get_ips_fw ()
50+ ] + [
51+ f"-I{ self .paths .FIRMWARE_PATH } " ,
52+ f"-I{ self .paths .FIRMWARE_PATH } /APIs" ,
53+ f"-I{ self .paths .USER_PROJECT_ROOT } /verilog/dv/cocotb" ,
54+ f"-I{ self .paths .VERILOG_PATH } /dv/generated" ,
55+ f"-I{ self .paths .VERILOG_PATH } /dv/" ,
56+ f"-I{ self .paths .VERILOG_PATH } /common/" ,
57+ ]
4858 includes = f" -I{ self .paths .FIRMWARE_PATH } -I{ self .paths .FIRMWARE_PATH } /APIs -I{ self .paths .VERILOG_PATH } /dv/generated -I{ self .paths .VERILOG_PATH } /dv/ -I{ self .paths .VERILOG_PATH } /common"
4959 includes += f" -I{ self .paths .USER_PROJECT_ROOT } /verilog/dv/cocotb { ' ' .join ([f'-I{ ip } ' for ip in self .get_ips_fw ()])} "
5060 elf_command = (
@@ -185,11 +195,13 @@ def write_iverilog_includes_file(self):
185195 self .iverilog_dirs += f" -I { include_dir } "
186196
187197 def iverilog_compile (self ):
198+ if os .path .isfile (f"{ self .test .compilation_dir } /sim.vvp" ):
199+ os .remove (f"{ self .test .compilation_dir } /sim.vvp" )
188200 macros = " -D" + " -D" .join (self .test .macros )
189201 compile_command = (
190202 f"cd { self .test .compilation_dir } &&"
191- f"iverilog -g2012 -Ttyp { macros } { self .iverilog_dirs } -o { self .test .compilation_dir } /sim.vvp"
192- f" { self .paths .CARAVEL_VERILOG_PATH } /rtl/toplevel_cocotb.v -s caravel_top "
203+ f"iverilog -g2012 -Ttyp { macros } { self .iverilog_dirs } -o { self .test .compilation_dir } /sim.vvp -s caravel_top "
204+ f" { self .paths .CARAVEL_VERILOG_PATH } /rtl/toplevel_cocotb.v"
193205 )
194206 docker_compilation_command = self ._iverilog_docker_command_str (compile_command )
195207 self .run_command_write_to_file (
@@ -238,8 +250,6 @@ def _iverilog_docker_command_str(self, command=""):
238250
239251 def find_symbolic_links (self , directory ):
240252 sym_links = []
241- if not os .path .exists (directory ):
242- return sym_links
243253 for root , dirs , files in os .walk (directory ):
244254 for dir_name in dirs :
245255 dir_path = os .path .join (root , dir_name )
@@ -283,6 +293,8 @@ def write_vcs_includes_file(self):
283293 self .test .set_user_project ()
284294
285295 def vcs_compile (self ):
296+ if os .path .isfile (f"{ self .test .compilation_dir } /simv" ):
297+ os .remove (f"{ self .test .compilation_dir } /simv" )
286298 macros = " +define+" + " +define+" .join (self .test .macros )
287299 vlogan_cmd = f"cd { self .test .compilation_dir } ; vlogan -full64 -sverilog +error+30 { self .paths .CARAVEL_VERILOG_PATH } /rtl/toplevel_cocotb.v { self .vcs_dirs } { macros } -l { self .test .compilation_dir } /analysis.log -o { self .test .compilation_dir } "
288300 self .run_command_write_to_file (
0 commit comments