Skip to content

Commit

Permalink
Require tool in flows inherited from generic
Browse files Browse the repository at this point in the history
  • Loading branch information
olofk committed May 17, 2024
1 parent 8f8c871 commit 0497097
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion edalize/flows/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_tool_options(cls, flow_options):

def configure_flow(self, flow_options):
# Check for mandatory flow option "tool"
tool = self.flow_options.get("tool", "")
tool = self._require_flow_option(flow_options, "tool")

# Apply flow-defined tool options if any
fdto = self.FLOW_DEFINED_TOOL_OPTIONS.get(tool, {})
Expand Down
19 changes: 19 additions & 0 deletions tests/flows/sim/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#Auto generated by Edalize

all: post_build

pre_build:

design: sv_file.sv vlog_file.v vlog05_file.v vlog_incfile another_sv_file.sv design.scr | pre_build
$(EDALIZE_LAUNCHER) iverilog -stop_module -c design.scr -o design

run: design
$(EDALIZE_LAUNCHER) vvp -n -M. design -fst $(EXTRA_OPTIONS)

post_build: design

pre_run:

run: pre_run

post_run: run
11 changes: 11 additions & 0 deletions tests/flows/sim/design.scr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+define+vlogdefine_bool=1
+define+vlogdefine_int=42
+define+vlogdefine_str=hello
+parameter+top_module.vlogparam_bool=1
+parameter+top_module.vlogparam_int=42
+parameter+top_module.vlogparam_str="hello"
+incdir+.
sv_file.sv
vlog_file.v
vlog05_file.v
another_sv_file.sv
22 changes: 22 additions & 0 deletions tests/test_flow_sim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import pytest
from .edalize_flow_common import flow_fixture


def test_sim_no_tool(flow_fixture):
flow_options = {}
with pytest.raises(RuntimeError) as e:
ff = flow_fixture("sim", flow_options=flow_options)
assert "Flow 'sim' requires flow option 'tool' to be set" in str(e.value)


def test_sim(flow_fixture):
flow_options = {"tool": "icarus"}
ff = flow_fixture("sim", flow_options=flow_options)

ff.flow.configure()
ff.compare_config_files(
[
"design.scr",
"Makefile",
]
)

0 comments on commit 0497097

Please sign in to comment.