Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[topgen] Fail more understandably if we start in an unexpected place #24598

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rswarbrick
Copy link
Contributor

This should fix issue #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.

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]>
@rswarbrick rswarbrick added the Component:Tooling Issues related to tooling, e.g. tools/scripts for doc, code generation (docgen, reggen), CSR label Sep 18, 2024
@pamaury
Copy link
Contributor

pamaury commented Sep 18, 2024

I believe topgen has a option to point to places where to look for hjson files (--hjson-path), the doc says:

If defined, topgen uses supplied path to search for ip hjson. This applies only to ip's with the reggen_only attribute. If an hjson is located both in the conventional path and the alternate path, the
alternate path has priority.

@rswarbrick
Copy link
Contributor Author

Yep, you're right. The issue that prompted the change is triggered by a block that isn't marked reggen_only. The code (before this change) is:

        if reggen_only and args.hjson_path:
            ip_hjson = Path(args.hjson_path) / f"{ip}.hjson"
        else:
            ip_hjson = hjson_dir.parent / f"ip/{ip}/data/{ip}.hjson"

where hjson_dir is derived from the -t argument.

This change is basically just adding a somewhat helpful error message earlier if the derived directory is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:Tooling Issues related to tooling, e.g. tools/scripts for doc, code generation (docgen, reggen), CSR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[topgen.py]FileNotFoundError: ‘hw/top_earlgrey/data/ip/ast/data/ast.hjson’
2 participants