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

Implement missing CXXRTL features #531

Open
5 of 8 tasks
whitequark opened this issue Nov 6, 2020 · 4 comments
Open
5 of 8 tasks

Implement missing CXXRTL features #531

whitequark opened this issue Nov 6, 2020 · 4 comments

Comments

@whitequark
Copy link
Member

whitequark commented Nov 6, 2020

Integrating CXXSim requires a number of improvements to the Yosys CXXRTL backend that have to be done upstream.

Remaining tasks

See also #324 for nMigen-side view of these tasks.

Blockers (to be completed pre-merge)

  • CXXRTL designs should have a dedicated reset method. (cxxrtl: provide a way to perform unobtrusive power-on reset YosysHQ/yosys#2466) Although it is always possible to destroy and recreate the entire simulation, this has two downsides:
    • Memory addresses in debug items will get invalidated and will need to be reacquired. This may be quite costly to Python code.
    • The issue above can be partially solved by assigning a new default-initialized instance on C++ side using a new C API function. However, this would still destroy the state of every black box. Given that black boxes are explicitly intended to acquire heavyweight resources like GUI windows and OS network interfaces, this is undesirable.
  • CXXRTL generated code should have an option to disable assertions of RTL invariants without enabling -DNDEBUG, since -DNDEBUG would also disable assertions of CXXRTL API contracts, and most if not all CXXRTL embedders do not want the generated code to abort(). (cxxrtl: use CXXRTL_ASSERT for RTL contract violations instead of assert YosysHQ/yosys#2468)
  • CXXRTL API should allow placing modules at non-root hierarchy for VCD dumps. (cxxrtl: allow customizing the root module path in the C API YosysHQ/yosys#2470)
  • Investigate whether memory writes can be done using the C API without race conditions.

Non-blockers (may be completed post-merge)

  • Add support for Yosys enumerated signal attributes and/or arbitrary user-specified decoders to the CXXRTL VCD writer.
  • Add basic support for $print and $assert (& its related cells) that translate to console output and RTL assertions respectively.
  • Add advanced support for $print and $assert (& its related cells) that queue these events for consumption through the C API. (Add support for Print in simulation #432, Add support for Assert in simulation #427)
  • Investigate whether some kind of shared event manager/dispatcher would be a good solution to systematic issues with edge-triggered logic. (fsm_state changes mid cycle #439)
@whitequark
Copy link
Member Author

Most of the blockers are done. Only the memory write issue remains.

@whitequark
Copy link
Member Author

An IRC discussion with @awygle confirmed my suspicion that race-free concurrent operations on memories are not something that has a lot of value, and given the significant amount of effort and complexity required to support them, it makes sense to not provide them at all.

As a consequence, memory reads or writes from testbenches can only be, in general, safely done while the design is held in reset. In some specific cases, concurrent reads/writes from a testbench are possible while the design is running, but requires case-by-case evaluation for hazards.

@mithro
Copy link

mithro commented Dec 8, 2020

It would be nice if there was a way to detect if concurrent operations on memories are occurring and force an error (maybe a -Wconcurrent-memory -Werror style thing?).

@whitequark
Copy link
Member Author

The thought of a "RTL TSAN" crossed my mind, but I do not expect to have time to work on it in foreseeable future.

@whitequark whitequark modified the milestones: 0.3, 0.4 Dec 14, 2021
@whitequark whitequark removed this from the 0.4 milestone Feb 3, 2023
@whitequark whitequark unpinned this issue Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants