Skip to content

Commit

Permalink
remove logic related to verilator
Browse files Browse the repository at this point in the history
  • Loading branch information
M0stafaRady committed Nov 21, 2023
1 parent 0122173 commit 21577e6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/caravel_cocotb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
pip install flake8
- name: Run Flake8
run: flake8 $GITHUB_WORKSPACE/cocotb
run: flake8 $GITHUB_WORKSPACE/cocotb --config $GITHUB_WORKSPACE/cocotb/.flake8

- name: Install caravel_cocotb
run: |
Expand Down
8 changes: 3 additions & 5 deletions cocotb/caravel_cocotb/scripts/verify_cocotb/RunFlow.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def set_args(self, design_info):
self.args.pdk = "gf180"

self.args.iverilog = False
if not self.args.vcs and not self.args.verilator:
if not self.args.vcs:
self.args.iverilog = True

if self.args.emailto is None:
Expand Down Expand Up @@ -255,8 +255,7 @@ def __init__(
compile=False,
run_defaults=False,
CI=False,
no_gen_defaults=False,
verilator=False
no_gen_defaults=False
) -> None:
self.test = test
self.sim = sim
Expand Down Expand Up @@ -285,8 +284,7 @@ def __init__(
self.run_defaults = run_defaults
self.CI = CI
self.no_gen_defaults = no_gen_defaults
self.verilator = verilator


def argparse_to_CocotbArgs(self, args):
self.test = args.test
self.sim = args.sim
Expand Down
52 changes: 0 additions & 52 deletions cocotb/caravel_cocotb/scripts/verify_cocotb/RunTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ def runTest(self):
self.runTest_iverilog()
elif self.args.vcs:
self.runTest_vcs()
elif self.args.verilator:
self.runTest_verilator()

# iverilog function
def runTest_iverilog(self):
Expand Down Expand Up @@ -169,56 +167,6 @@ def _iverilog_docker_command_str(self, command=""):
command = self.docker_command_str(docker_image="efabless/dv:cocotb", docker_dir=docker_dir, env_vars=env_vars, addtional_switchs=display, command=command)
return command

# verilator function
def runTest_verilator(self):
macros = " -D" + " -D".join(self.test.macros)
env_vars = f"-e COCOTB_RESULTS_FILE={os.getenv('COCOTB_RESULTS_FILE')} -e CARAVEL_PATH={self.paths.CARAVEL_PATH} -e CARAVEL_VERILOG_PATH={self.paths.CARAVEL_VERILOG_PATH} -e VERILOG_PATH={self.paths.VERILOG_PATH} -e PDK_ROOT={self.paths.PDK_ROOT} -e PDK={self.paths.PDK} -e USER_PROJECT_VERILOG={self.paths.USER_PROJECT_ROOT}/verilog"
if self.test.sim == "GL_SDF":
self.logger.error(
f"iverilog can't run SDF for test {self.test.name} Please use anothor simulator like cvc"
)
return
self.test.set_user_project()
defines = GetDefines(self.test.includes_file)
seed = "" if self.args.seed is None else f"RANDOM_SEED={self.args.seed}"
verilator_command = (
f"cd {self.test.compilation_dir} && "
f" verilator {macros} --binary -j 0 --no-timing -bbox-unsup -Wno-fatal "
f" {self.paths.CARAVEL_VERILOG_PATH}/rtl/toplevel_cocotb.v --top caravel_top "
f' --vpi --public-flat-rw --prefix Vtop -LDFLAGS "-Wl,-rpath,$(cocotb-config --lib-dir) -L$(cocotb-config --lib-dir) -lcocotbvpi_verilator -lgpi -lcocotb -lgpilog -lcocotbutils" $(cocotb-config --share)/lib/verilator/verilator.cpp'
)#--cc --exe --build --timing -bbox-unsup
print(verilator_command)
run_command = (f"cd {self.test.test_dir} && TESTCASE={self.test.name} MODULE=module_trail {seed} {self.test.compilation_dir}/Vcaravel_top +{ ' +'.join(self.test.macros) } {' '.join([f'+{k}={v}' if v != ''else f'+{k}' for k, v in defines.defines.items()])}")
local_caravel_cocotb_path = caravel_cocotb.__file__.replace("__init__.py", "")
docker_caravel_cocotb_path = "/usr/local/lib/python3.8/dist-packages/caravel_cocotb/"
docker_dir = f"-v {self.paths.RUN_PATH}:{self.paths.RUN_PATH} -v {self.paths.CARAVEL_ROOT}:{self.paths.CARAVEL_ROOT} -v {self.paths.MCW_ROOT}:{self.paths.MCW_ROOT} -v {self.paths.PDK_ROOT}:{self.paths.PDK_ROOT} -v {local_caravel_cocotb_path}:{docker_caravel_cocotb_path} "
docker_dir += (f"-v {self.paths.USER_PROJECT_ROOT}:{self.paths.USER_PROJECT_ROOT}")
if os.path.exists("/mnt/scratch/"):
docker_dir += " -v /mnt/scratch/cocotb_runs/:/mnt/scratch/cocotb_runs/ "
display = " -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME/.Xauthority:/.Xauthority --network host --security-opt seccomp=unconfined "
docker_compilation_command = f"docker run --init -u $(id -u $USER):$(id -g $USER) -it --sig-proxy=true {display} {env_vars} {docker_dir} efabless/dv:cocotb sh -ec '{verilator_command}'"
docker_run_command = f"docker run --init -u $(id -u $USER):$(id -g $USER) -it --sig-proxy=true {display} {env_vars} {docker_dir} efabless/dv:cocotb sh -ec '{run_command}'"
if not os.path.isfile(f"{self.test.compilation_dir}/sim.vvp") or self.args.compile:
self.full_terminal = open(self.test.compilation_log, "w")
self.full_terminal.write("docker command for running iverilog and cocotb:\n% ")
self.full_terminal = open(self.test.compilation_log, "w")
self.full_terminal.write("docker command for running iverilog and cocotb:\n% ")
self.full_terminal.write(os.path.expandvars(docker_compilation_command) + "\n\n")
self.full_terminal.close()
run_command_write_to_file(
docker_compilation_command if not self.args.no_docker else verilator_command,
self.test.compilation_log,
self.logger,
quiet=True if self.args.verbosity == "quiet" else False
)

run_command_write_to_file(
docker_run_command if not self.args.no_docker else run_command,
None,
self.logger,
quiet=True if self.args.verbosity == "quiet" else False
)

# vcs function
def runTest_vcs(self):
self.write_vcs_includes_file()
Expand Down

0 comments on commit 21577e6

Please sign in to comment.