Skip to content

Commit

Permalink
[verilator] Create verilator exec env aliases in //hw/top
Browse files Browse the repository at this point in the history
To avoid a massive duplication, and as a first step toward a new
exec_env-less system, we will move all exec_env to //hw/top so that
they work for all tops. The easiest to change is verilator.
For now, only convert the test_rom_test to point to this new env.

Signed-off-by: Amaury Pouly <[email protected]>
  • Loading branch information
pamaury committed Oct 7, 2024
1 parent 13bf78a commit 5edffc8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
16 changes: 16 additions & 0 deletions hw/top/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,19 @@ alias_ip_sw(
englishbreakfast = "//hw/top_englishbreakfast/ip/pinmux/data/autogen:pinmux",
earlgrey = "//hw/top_earlgrey/ip/pinmux/data/autogen:pinmux",
)

# FIXME This alias will eventually disappear when we move away from execution environments
# as they are currently used. For the moment this is necessary.
EXEC_ENVS = [
"sim_verilator_base",
"sim_verilator",
]

[
alias_top(
name = exec_env,
earlgrey = "//hw/top_earlgrey:{}".format(exec_env),
englishbreakfast = "//hw/top_englishbreakfast:{}".format(exec_env),
)
for exec_env in EXEC_ENVS
]
28 changes: 28 additions & 0 deletions hw/top_englishbreakfast/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,31 @@ sim_verilator(
rom_scramble_config = "//hw/top_englishbreakfast/data:autogen/top_englishbreakfast.gen.hjson",
test_cmd = "testing-not-supported",
)

sim_verilator(
name = "sim_verilator",
testonly = True,
args = [
"--rcfile=",
"--logging=info",
"--interface=verilator",
"--verilator-bin=$(rootpath //hw:verilator)",
"--verilator-rom={rom}",
"--verilator-flash={firmware}",
],
base = ":sim_verilator_base",
data = [
"//hw:fusesoc_ignore",
"//hw:verilator",
],
exec_env = "sim_verilator",
param = {
"exit_success": DEFAULT_TEST_SUCCESS_MSG,
"exit_failure": DEFAULT_TEST_FAILURE_MSG,
},
rom = "//sw/device/lib/testing/test_rom:test_rom",
test_cmd = """
--exec="console --non-interactive --exit-success='{exit_success}' --exit-failure='{exit_failure}'"
no-op
""",
)
9 changes: 3 additions & 6 deletions sw/device/lib/testing/test_rom/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ opentitan_binary(
"//hw/top_earlgrey:fpga_cw305",
"//hw/top_earlgrey:fpga_cw340",
"//hw/top_earlgrey:sim_dv_base",
] +
select({
"//sw/device:is_english_breakfast": ["//hw/top_englishbreakfast:sim_verilator_base"],
"//conditions:default": ["//hw/top_earlgrey:sim_verilator_base"],
}),
"//hw/top:sim_verilator_base",
],
kind = "rom",
linker_script = ":linker_script",
deps = [
Expand Down Expand Up @@ -202,7 +199,7 @@ opentitan_test(
exec_env = {
"//hw/top_earlgrey:fpga_cw310_test_rom": None,
"//hw/top_earlgrey:sim_dv": None,
"//hw/top_earlgrey:sim_verilator": None,
"//hw/top:sim_verilator": None,
},
deps = [
"//sw/device/lib/testing/test_framework:ottf_main",
Expand Down

0 comments on commit 5edffc8

Please sign in to comment.