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 Jan 8, 2024
1 parent 0877240 commit 49b57c5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
7 changes: 5 additions & 2 deletions ci/scripts/run-english-breakfast-verilator-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ ci/bazelisk.sh build \

# Run the one test.
# This needs to be run outside the bazel sandbox, so we do not use `bazel run`
#
# NOTE: we specify `-type f` in the find commands to avoid finding any
# additional symlinks bazel might have prepared when building the test targets.
bazel-bin/sw/host/opentitantool/opentitantool \
--rcfile="" \
--logging=info \
--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-rom="$(find bazel-out/* -type f -name 'test_rom_sim_verilator.32.vmem')" \
--verilator-flash="$(find bazel-out/* -type f -name 'aes_smoketest_sim_verilator.64.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 @@ -141,13 +141,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 49b57c5

Please sign in to comment.