Skip to content

Commit

Permalink
[autogen_testutils] Change how IPs with DIFs are detected
Browse files Browse the repository at this point in the history
In the next commit, we will remove all the autogenerated files in
sw/device/lib/dif/autogen. This will break how autogen_testutils
detects IPs with diff. The logic is change to the following: go
through the list of IPs for the top of interest, check in
sw/device/lib/dif if there is a file called dif_<ip>.h. This produces
exactly the same result.

Signed-off-by: Amaury Pouly <[email protected]>
  • Loading branch information
pamaury committed Jan 16, 2025
1 parent 344ee42 commit e5219e9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions util/autogen_testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"""

import argparse
import glob
import logging
import sys
from pathlib import Path
Expand Down Expand Up @@ -51,18 +50,17 @@ def main():
topcfg = hjson.loads(topcfg_text, use_decimal=True)

# Define autogen DIF directory.
autogen_dif_directory = REPO_TOP / "sw/device/lib/dif/autogen"
autogen_dif_directory = REPO_TOP / "sw/device/lib/dif"

# Create list of IPs to generate shared testutils code for. This is all IPs
# that have a DIF library, that the testutils functions can use. Note, the
# templates will take care of only generating ISR testutil functions for IPs
# that can actually generate interrupts.
ips_with_difs = []
for autogen_dif_filename in glob.iglob(str(autogen_dif_directory / "*.h")):
# NOTE: the line below takes as input a file path
# (/path/to/dif_uart_autogen.c) and returns the IP name in lower
# case snake mode (i.e., uart).
ip_name_snake = Path(autogen_dif_filename).stem[4:-8]

for ip_name_snake in sorted({m["type"] for m in topcfg["module"]}):
if not (autogen_dif_directory / f"dif_{ip_name_snake}.h").exists():
continue

hjson_file = topgen_lib.get_ip_hjson_path(ip_name_snake, topcfg, REPO_TOP)

Expand Down

0 comments on commit e5219e9

Please sign in to comment.