Skip to content

Commit

Permalink
[topgen] Fail more understandably if we start in an unexpected place
Browse files Browse the repository at this point in the history
This should fix issue lowRISC#24595. The problem that caused the issue is
that we compute paths to the various IP blocks that should be included
by following relative paths from the `-t` argument. This doesn't work
very well if the top_earlgrey.hjson file moves around!

A sensible design would probably point more explicitly at where to
find IPs, but this should hopefully be a little easier to debug.

Signed-off-by: Rupert Swarbrick <[email protected]>
  • Loading branch information
rswarbrick committed Sep 18, 2024
1 parent f245cc8 commit 03c90b7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions util/topgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,16 @@ def _process_top(
else:
ip_hjson = hjson_dir.parent / f"ip/{ip}/data/{ip}.hjson"

# In this situation, we are computing the path to the IP's hjson
# file by walking a relative path from hjson_dir. That hjson file
# should exist at this point, but things get confused if we started
# from a top file in an unexpected place. Check now to make sure
# this hasn't happened.
if not ip_hjson.is_file():
log.error(f'Cannot find a file at {ip_hjson}, which was '
f'computed as a relative path from {args.topcfg}')
sys.exit(1)

ips.append(ip_hjson)

# load Hjson and pass validate from reggen
Expand Down

0 comments on commit 03c90b7

Please sign in to comment.