Skip to content

Commit

Permalink
Add cocotb compatibility for VCS
Browse files Browse the repository at this point in the history
  • Loading branch information
olofk committed Nov 26, 2024
1 parent adfb86a commit 21ef0a3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions edalize/flows/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause

import os

from edalize.flows.generic import Generic


Expand Down Expand Up @@ -37,6 +39,17 @@ def configure_tools(self, flow):
"vsim_options",
["-pli", "`cocotb-config --lib-name-path vpi questa`"],
),
"vcs": (
"vcs_options",
[
"-debug",
"+vpi",
"-P",
"pli.tab",
"-load",
"$(cocotb-config --lib-name-path vpi vcs)",
],
),
"verilator": (
"verilator_options",
[
Expand All @@ -53,6 +66,12 @@ def configure_tools(self, flow):

super().configure_tools(flow)

def configure(self):
if self.flow_options.get("tool") == "vcs":
with open(os.path.join(self.work_root, "pli.tab"), "w") as f:
f.write("acc+=rw,wn:*\n")
super().configure()

def run(self, args=None):
tool = self.flow_options.get("tool")
run_tool = self.flow.get_node(tool).inst
Expand Down

0 comments on commit 21ef0a3

Please sign in to comment.