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

[BUG] December 2024 commits adding assertions broke SystemRDL builds #245

Closed
1 task done
paul-demo opened this issue Jan 6, 2025 · 5 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@paul-demo
Copy link

The changes from 1.27.3 -> 1.29.0 of systemrdl-compiler broke builds due to assertions failing in the commit here:
0e1dfac

Details like these can be helpful:

Traceback (most recent call last):
  File "/some/path/python/3.9.17/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/some/path/python/3.9.17/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File /some/other/path/lib/python3.9/site-packages/peakrdl/__main__.py", line 3, in <module>
    main()
  File /some/other/path/lib/python3.9/site-packages/peakrdl/main.py", line 183, in main
    options.subcommand.main(importers, options)
  File /some/other/path/lib/python3.9/site-packages/peakrdl/subcommand.py", line 154, in main
    self.do_export(top, options)
  File /some/other/path/lib/python3.9/site-packages/peakrdl_regblock/__peakrdl__.py", line 207, in do_export
    x.export(
  File /some/other/path/lib/python3.9/site-packages/peakrdl_regblock/exporter.py", line 157, in export
    DesignValidator(self).do_validate()
  File /some/other/path/lib/python3.9/site-packages/peakrdl_regblock/validate_design.py", line 32, in do_validate
    RDLWalker().walk(self.top_node, self)
  File /some/other/path/lib/python3.9/site-packages/systemrdl/walker.py", line 159, in walk
    self.walk(child, *listeners)
  File /some/other/path/lib/python3.9/site-packages/systemrdl/walker.py", line 159, in walk
    self.walk(child, *listeners)
  File /some/other/path/lib/python3.9/site-packages/systemrdl/walker.py", line 150, in walk
    self.current_action = self.do_enter(node, listener)
  File /some/other/path/lib/python3.9/site-packages/systemrdl/walker.py", line 176, in do_enter
    action = listener.enter_Component(node) or WalkerAction.Continue
  File /some/other/path/lib/python3.9/site-packages/peakrdl_regblock/validate_design.py", line 47, in enter_Component
    if not ref_is_internal(self.top_node, value):
  File /some/other/path/lib/python3.9/site-packages/peakrdl_regblock/utils.py", line 59, in ref_is_internal
    if current_node.external:
  File /some/other/path/lib/python3.9/site-packages/systemrdl/node.py", line 789, in external
    assert self.inst.external is not None
AssertionError
@paul-demo
Copy link
Author

Apparently this is not actually guaranteed after elaboration as the comment says:

image

@amykyta3
Copy link
Member

amykyta3 commented Jan 6, 2025 via email

@paul-demo paul-demo changed the title [BUG] December 2024 commits broke SystemRDL builds [BUG] December 2024 commits adding assertions broke SystemRDL builds Jan 6, 2025
@paul-demo
Copy link
Author

paul-demo commented Jan 6, 2025

EDITED: Looks like it's due to external signals (used for read double-buffering and hwclr):

Short example:

// Minimal example to demonstrate issue:
// https://github.com/SystemRDL/systemrdl-compiler/issues/245

default regwidth = 32;
default accesswidth = 32;
default addressing = compact;
default littleendian = true;
default reset = 0;
default sw = r;
default hw = w;

property buffer_reads {
    component = reg;
    type = boolean;
};

property rbuffer_trigger {
    component = reg;
    type = ref;
};

signal {
    sync;
    activehigh;
} latch_stats;

regfile foo {
    default hw = na;
    default counter;

    // Including these two lines causes the elaboration error:
    default buffer_reads = true;
    default rbuffer_trigger = latch_stats;

    // Including this line also causes the elaboration error:
    default hwclr = latch_stats;

    reg {
        field {} cnt[31:0];
    } num;
};

addrmap my_csr {
    foo bar[16] %= 0x100;
};

@amykyta3
Copy link
Member

amykyta3 commented Jan 6, 2025 via email

@amykyta3 amykyta3 added the bug Something isn't working label Jan 7, 2025
@amykyta3 amykyta3 closed this as completed Jan 7, 2025
@amykyta3
Copy link
Member

amykyta3 commented Jan 7, 2025

Turns out this was only a partial fix. Re-opening.
I yanked the problematic releases from Pypi in the meantime.

@amykyta3 amykyta3 reopened this Jan 7, 2025
@amykyta3 amykyta3 closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants