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

BlockRam Docs, arguments swapped in example? #171

Closed
drhodes opened this issue Aug 21, 2016 · 2 comments
Closed

BlockRam Docs, arguments swapped in example? #171

drhodes opened this issue Aug 21, 2016 · 2 comments

Comments

@drhodes
Copy link

drhodes commented Aug 21, 2016

From this page, in the first cpu example:

dataMem :: Signal MemAddr -- ^ Read address
        -> Signal MemAddr -- ^ Write address
        -> Signal Bool    -- ^ Write enable
        -> Signal Value   -- ^ data in
        -> Signal Value   -- ^ data out
dataMem wr rd en din = mealy dataMemT (replicate d32 0) (bundle (wr,rd,en,din))
  where
    dataMemT mem (wr,rd,en,din) = (mem',dout)
      where
        dout = mem !! rd
        mem' | en        = replace wr din mem
             | otherwise = mem

It seems to me that the first argument to dataMem should be rd instead of wr, is that right? My guess is that since, in the next section of code that calls dataMem, the call swaps those args too, so it works as expected.

    memOut = dataMem wrAddr rdAddr wrEn aluOut

Am I missing something?

@christiaanb
Copy link
Member

No... you're not missing anything... The haddock comments accompanying the function are swapped. The first argument is the write address, and the second argument is the read address.

I'll fix the docs tomorrow.

@drhodes
Copy link
Author

drhodes commented Aug 21, 2016

Aha, that explains it. Thanks for the quick clarification.

leonschoorl pushed a commit that referenced this issue Jul 31, 2023
For those thinking, "isn't it somewhat arrogant to write a Hedgehog test
for Euclid's third axiom?", rest assured I accidentally mixed up `c` and
`b` and only found out thanks to the test.
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