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

Option to drive channel signals back to 0 when valid is low #92

Open
darsor opened this issue Sep 26, 2024 · 2 comments
Open

Option to drive channel signals back to 0 when valid is low #92

darsor opened this issue Sep 26, 2024 · 2 comments

Comments

@darsor
Copy link

darsor commented Sep 26, 2024

First of all, incredible library. Well designed and well engineered. Thanks for your hard work!

I'm testing a custom AXI module whose upstream master likes to drive all channel signals back to 0 when *VALID is low. Because this python library doesn't change the signal values when *VALID goes low, there was an uncaught bug where my module depended on this library's behavior.

Would it be possible to add an option to drive channel signals back to some default value when not active?

@ollie-etl
Copy link

x would be a better choice. Its equally possible to introduce bugs that incorrectly rely on zeros when valid is low

@darsor
Copy link
Author

darsor commented Oct 16, 2024

Great point. Then any reliance on signal values when *VALID is low can be caught in simulation.

I was able to hack this functionality in by adding

for sig_name, sig_handle in self.bus._signals.items():
    if not sig_name.endswith(("valid", "ready")):
        sig_handle.value = BinaryValue("x"*sig_handle.value.n_bits)

to the StreamSource _run() coroutine here. Then every time it sets *valid low it sets all the other signals to X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants