Skip to content

Commit

Permalink
[isr_testutils] Rewrite dependencies
Browse files Browse the repository at this point in the history
Some dependencies depend on the top. For now manually select the right
ones.

Signed-off-by: Amaury Pouly <[email protected]>
  • Loading branch information
pamaury committed Feb 12, 2025
1 parent 8186202 commit d78d08d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 36 deletions.
34 changes: 2 additions & 32 deletions sw/device/lib/testing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,9 @@ load("//rules/opentitan:defs.bzl", "OPENTITAN_CPU")

package(default_visibility = ["//visibility:public"])

cc_library(
alias(
name = "isr_testutils",
srcs = ["//sw/device/lib/testing/autogen:isr_testutils_src"],
hdrs = ["//sw/device/lib/testing/autogen:isr_testutils_hdr"],
target_compatible_with = [OPENTITAN_CPU],
deps = [
"//hw/top_earlgrey/sw/autogen:top_earlgrey",
"//sw/device/lib/dif:adc_ctrl",
"//sw/device/lib/dif:alert_handler",
"//sw/device/lib/dif:aon_timer",
"//sw/device/lib/dif:csrng",
"//sw/device/lib/dif:edn",
"//sw/device/lib/dif:entropy_src",
"//sw/device/lib/dif:flash_ctrl",
"//sw/device/lib/dif:gpio",
"//sw/device/lib/dif:hmac",
"//sw/device/lib/dif:i2c",
"//sw/device/lib/dif:keymgr",
"//sw/device/lib/dif:kmac",
"//sw/device/lib/dif:otbn",
"//sw/device/lib/dif:otp_ctrl",
"//sw/device/lib/dif:pattgen",
"//sw/device/lib/dif:pwrmgr",
"//sw/device/lib/dif:rv_plic",
"//sw/device/lib/dif:rv_timer",
"//sw/device/lib/dif:sensor_ctrl",
"//sw/device/lib/dif:spi_device",
"//sw/device/lib/dif:spi_host",
"//sw/device/lib/dif:sysrst_ctrl",
"//sw/device/lib/dif:uart",
"//sw/device/lib/dif:usbdev",
"//sw/device/lib/testing/test_framework:check",
],
actual = "//sw/device/lib/testing/autogen:isr_testutils",
)

cc_library(
Expand Down
22 changes: 22 additions & 0 deletions sw/device/lib/testing/autogen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,33 @@
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

load("//rules/opentitan:util.bzl", "flatten")
load("//hw/top:defs.bzl", "ALL_IP_NAMES", "opentitan_if_ip")
load("//rules/opentitan:defs.bzl", "OPENTITAN_CPU")
load("//rules:autogen.bzl", "opentitan_autogen_isr_testutils")

package(default_visibility = ["//visibility:public"])

opentitan_autogen_isr_testutils(
name = "isr_testutils",
target_compatible_with = [OPENTITAN_CPU],
top = "//hw/top:top_desc",
deps = [
"//hw/top:top_lib",
"//sw/device/lib/dif:rv_plic",
"//sw/device/lib/testing/test_framework:check",
] + flatten([
opentitan_if_ip(
ip,
["//sw/device/lib/dif/autogen:{}".format(ip)],
[],
)
for ip in ALL_IP_NAMES
]) +
# There is a special dependency for the adc_ctrl, see testutils template.
opentitan_if_ip(
"adc_ctrl",
["//sw/device/lib/dif:adc_ctrl"],
[],
),
)
7 changes: 4 additions & 3 deletions util/autogen_testutils/templates/isr_testutils.c.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ ${autogen_banner}

#include "sw/device/lib/dif/dif_rv_plic.h"
% for ip in ips_with_difs:
% if ip.irqs:
#include "sw/device/lib/dif/dif_${ip.name_snake}.h"
% endif
% if ip.name_snake == "adc_ctrl":
## See below.
#include "sw/device/lib/dif/dif_adc_ctrl.h"
% endif
% endfor
#include "sw/device/lib/testing/test_framework/check.h"

Expand Down
2 changes: 1 addition & 1 deletion util/autogen_testutils/templates/isr_testutils.h.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ${autogen_banner}
#include "sw/device/lib/dif/dif_rv_plic.h"
% for ip in ips_with_difs:
% if ip.irqs:
#include "sw/device/lib/dif/dif_${ip.name_snake}.h"
#include "sw/device/lib/dif/autogen/dif_${ip.name_snake}_autogen.h"
% endif
% endfor

Expand Down

0 comments on commit d78d08d

Please sign in to comment.