Skip to content

Commit

Permalink
add cocotb switch for verilator flow
Browse files Browse the repository at this point in the history
  • Loading branch information
isomoye authored and olofk committed Jan 21, 2024
1 parent 18972c4 commit 99cbb50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions edalize/flows/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ def configure_tools(self, flow):
"vsim_options",
["-pli", "`cocotb-config --lib-name-path vpi questa`"],
),
"verilator": (
"verilator_options",
[
"--vpi",
"--public-flat-rw --prefix Vtop",
'-LDFLAGS "-Wl,-rpath,`cocotb-config --lib-dir` -L`cocotb-config --lib-dir` -lcocotbvpi_verilator -lgpi -lcocotb -lgpilog -lcocotbutils"',
],
),
}
(opt, val) = cocotb_options[tool]
self.edam["tool_options"][tool][opt] = (
Expand Down
3 changes: 3 additions & 0 deletions edalize/tools/verilator.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ def setup(self, edam):

self.vc = vc

if self.edam.get("flow_options", {}).get("cocotb_module"):
self.toplevel = "top"
verilator_file += " `cocotb-config --share`/lib/verilator/verilator.cpp"
mk_file = f"V{self.toplevel}.mk"
exe_file = f"V{self.toplevel}"
commands = EdaCommands()
Expand Down

0 comments on commit 99cbb50

Please sign in to comment.