From 407b0be30619051f19c16a32a0e44064eea1ef00 Mon Sep 17 00:00:00 2001 From: M0stafaRady Date: Sat, 1 Oct 2022 01:48:55 -0700 Subject: [PATCH] Update script to return fatal error when hex generation fails --- verilog/dv/cocotb/run.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/verilog/dv/cocotb/run.py b/verilog/dv/cocotb/run.py index 9eef36ea..162dbf3d 100644 --- a/verilog/dv/cocotb/run.py +++ b/verilog/dv/cocotb/run.py @@ -116,13 +116,15 @@ class RunTest: f"--strip-debug -ffreestanding -nostdlib -o {elf_out} {SOURCE_FILES} {c_file}") hex_command = f"{GCC_PATH}/{GCC_PREFIX}-objcopy -O verilog {elf_out} {hex_file} " sed_command = f"sed -ie 's/@10/@00/g' {hex_file}" - os.system(f"docker run -it -v /home:/home efabless/dv:latest sh -c 'cd {test_dir} && {elf_command} && {hex_command} && {sed_command} '") + hex_gen_state = os.system(f"docker run -it -v /home:/home efabless/dv:latest sh -c 'cd {test_dir} && {elf_command} && {hex_command} && {sed_command} '") self.full_terminal.write(os.path.expandvars(elf_command)+"\n"+"\n") self.full_terminal.write(os.path.expandvars(hex_command)+"\n"+"\n") self.full_terminal.write(os.path.expandvars(sed_command)+"\n"+"\n") self.cd_cocotb() self.full_terminal.close() - + if hex_gen_state != 0 : + print(f"fatal: Error when generating hex") + sys.exit() def cd_make(self): os.chdir(f"{os.getenv('VERILOG_PATH')}/dv/make")