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

Adding custom Eq instance for Axi4StreamM2S #66

Closed
wants to merge 1 commit into from

Conversation

lmbollen
Copy link
Member

The derived Eq instance always checks the contents of each _tdata entry , even if the corresponding _tkeep entry is False.

According to the spec, bytes with a low keep signal, do not carry any information.
The current derived implementation leads to undesired failing comparisions:

              ┃   │ ━━━ Failed (- lhs) (+ rhs) ━━━
              ┃   │   Just
              ┃   │     Axi4StreamM2S {
              ┃   │         _tdata =
              ┃   │ -         0 :> 0 :> 0 :> 1 :> Nil
              ┃   │ +         0 :> 0 :> 0 :> 0 :> Nil
              ┃   │       , _tkeep =
              ┃   │           False :> False :> False :> False :> Nil
              ┃   │       , _tstrb =
              ┃   │           False :> False :> False :> False :> Nil
              ┃   │       , _tlast =
              ┃   │           True
              ┃   │       , _tid =
              ┃   │           0
              ┃   │       , _tdest =
              ┃   │           0
              ┃   │       , _tuser =
              ┃   │           ()
              ┃   │       }

I imagine this is also the case for some other protocols.

The derived `Eq` instance always checks the contents of each `_tdata` entry
, even if the corresponding `_tkeep` entry is `False`.
Copy link
Member

@martijnbastiaan martijnbastiaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll have to implement Hashable manually too.

@martijnbastiaan
Copy link
Member

If you want to write a Hedgehog test for it: a == b |-> hash(a) == hash(b).

@lmbollen
Copy link
Member Author

^ After some more thought, I'd like to change the implementation of these protocols to use ADTs. Let's discuss IRL and maybe open a discussion.

@lmbollen lmbollen closed this Feb 28, 2024
@martijnbastiaan martijnbastiaan deleted the axi4m2s-eq-instance branch February 28, 2024 12:41
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

Successfully merging this pull request may close these issues.

2 participants