Skip to content

Commit

Permalink
verilator: Treat make_options as a list
Browse files Browse the repository at this point in the history
  • Loading branch information
olofk committed May 17, 2024
1 parent d360d8f commit 18d858b
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 2 deletions.
1 change: 1 addition & 0 deletions edalize/tools/verilator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Verilator(Edatool):
"make_options": {
"type": "str",
"desc": "Additional arguments passed to make when compiling the simulation. This is commonly used to set OPT/OPT_FAST/OPT_SLOW.",
"list": True,
},
"mode": {
"type": "str",
Expand Down
21 changes: 20 additions & 1 deletion tests/test_tool_verilator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,26 @@


def test_tool_verilator(tool_fixture):
tf = tool_fixture("verilator")

tool_options = {
"make_options": ["a", "few", "make", "options"],
"verilator_options": ["some", "verilator", "options"],
}

tf = tool_fixture("verilator", tool_options=tool_options)

name = "design"

tf.tool.configure()
tf.compare_config_files(
[
name + ".vc",
]
)


def test_tool_verilator_minimal(tool_fixture):
tf = tool_fixture("verilator", ref_subdir="minimal")

name = "design"

Expand Down
2 changes: 1 addition & 1 deletion tests/tools/verilator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Vtop_module.mk: design.vc sv_file.sv vlog_file.v vlog05_file.v vlog_incfile anot
$(EDALIZE_LAUNCHER) verilator -f design.vc

Vtop_module: Vtop_module.mk c_file.c cpp_file.cpp
$(EDALIZE_LAUNCHER) make -f Vtop_module.mk
$(EDALIZE_LAUNCHER) make -f Vtop_module.mk a few make options
3 changes: 3 additions & 0 deletions tests/tools/verilator/design.vc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--Mdir .
--cc
some
verilator
options
+incdir+.
-CFLAGS -I.
sv_file.sv
Expand Down
9 changes: 9 additions & 0 deletions tests/tools/verilator/minimal/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#Auto generated by Edalize

all: Vtop_module

Vtop_module.mk: design.vc sv_file.sv vlog_file.v vlog05_file.v vlog_incfile another_sv_file.sv
$(EDALIZE_LAUNCHER) verilator -f design.vc

Vtop_module: Vtop_module.mk c_file.c cpp_file.cpp
$(EDALIZE_LAUNCHER) make -f Vtop_module.mk
19 changes: 19 additions & 0 deletions tests/tools/verilator/minimal/design.vc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--Mdir .
--cc
+incdir+.
-CFLAGS -I.
sv_file.sv
vlog_file.v
vlog05_file.v
another_sv_file.sv
--top-module top_module

--exe
c_file.c
cpp_file.cpp
-Gvlogparam_bool=1
-Gvlogparam_int=42
-Gvlogparam_str=\"hello\"
-Dvlogdefine_bool=1
-Dvlogdefine_int=42
-Dvlogdefine_str=hello

0 comments on commit 18d858b

Please sign in to comment.