Skip to content

Commit

Permalink
[bazel] Pass copt and features through the OT transition
Browse files Browse the repository at this point in the history
1. Pass the `copt` and `features` values through the OT platform
   transition.
2. Convert the aes_smoketest to the `opentitan_test` rule.

Signed-off-by: Chris Frantz <[email protected]>
  • Loading branch information
cfrantz committed Nov 18, 2023
1 parent beac109 commit cc37e04
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ci/scripts/run-english-breakfast-verilator-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bazel-bin/sw/host/opentitantool/opentitantool \
--interface=verilator \
--verilator-bin=$BIN_DIR/hw/top_englishbreakfast/Vchip_englishbreakfast_verilator \
--verilator-rom="$(find bazel-out/* -name 'test_rom_sim_verilator.32.vmem')" \
--verilator-flash="$(find bazel-out/* -name 'aes_smoketest_prog_sim_verilator.64.scr.vmem')" \
--verilator-flash="$(find bazel-out/* -name 'aes_smoketest_sim_verilator.64.scr.vmem')" \
console \
--exit-failure="(FAIL|FAULT).*\n" \
--exit-success="PASS.*\n" \
Expand Down
3 changes: 2 additions & 1 deletion hw/top_englishbreakfast/util/prepare_sw.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'//sw/device/lib/testing/test_rom',
'//sw/device/sca:aes_serial',
'//sw/device/examples/hello_world',
'//sw/device/tests:aes_smoketest_prog',
'//sw/device/tests:aes_smoketest_sim_verilator',
]


Expand Down Expand Up @@ -182,6 +182,7 @@ def main():
'build',
'--features=-rv32_bitmanip',
'--copt=-DOT_IS_ENGLISH_BREAKFAST_REDUCED_SUPPORT_FOR_INTERNAL_USE_ONLY_',
'--define=DISABLE_VERILATOR_BUILD=true',
] + BAZEL_BINARIES)


Expand Down
9 changes: 8 additions & 1 deletion rules/rv.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,23 @@ PER_DEVICE_DEPS = {
def _opentitan_transition_impl(settings, attr):
return {
"//command_line_option:platforms": attr.platform,
"//command_line_option:copt": settings["//command_line_option:copt"],
"//command_line_option:features": settings["//command_line_option:features"],
"//hw/bitstream/universal:rom": "//hw/bitstream/universal:none",
"//hw/bitstream/universal:otp": "//hw/bitstream/universal:none",
"//hw/bitstream/universal:env": "//hw/bitstream/universal:none",
}

opentitan_transition = transition(
implementation = _opentitan_transition_impl,
inputs = [],
inputs = [
"//command_line_option:copt",
"//command_line_option:features",
],
outputs = [
"//command_line_option:platforms",
"//command_line_option:copt",
"//command_line_option:features",
"//hw/bitstream/universal:rom",
"//hw/bitstream/universal:otp",
"//hw/bitstream/universal:env",
Expand Down
7 changes: 2 additions & 5 deletions sw/device/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,10 @@ alias(
visibility = ["//visibility:private"],
)

# TODO(#19926): The `opentitan_test` rule doesn't propagate --copt accross all
# dependencies, causing issues when compiling targets against
# --copt=-DOT_IS_ENGLISH_BREAKFAST_REDUCED_SUPPORT_FOR_INTERNAL_USE_ONLY_.
# Using `opentitan_functest` as a workaround.
opentitan_functest(
opentitan_test(
name = "aes_smoketest",
srcs = ["aes_smoketest.c"],
exec_env = EARLGREY_TEST_ENVS,
deps = [
"//hw/ip/aes:model",
"//hw/top_earlgrey/sw/autogen:top_earlgrey",
Expand Down

0 comments on commit cc37e04

Please sign in to comment.