clash-lang / clash-compiler

Haskell to VHDL/Verilog/SystemVerilog compiler
https://clash-lang.org/
Other
1.42k stars 150 forks source link

Tutorial: some MAC's alternative specifications don't fit in its topEntity type signature #2533

Closed pasqu4le closed 1 year ago

pasqu4le commented 1 year ago

In the "Your first circuit" section of the tutorial, the multiply-and-accumulate (MAC) circuit is introduced with the topEntity:

topEntity
  :: Clock System
  -> Reset System
  -> Enable System
  -> Signal System (Signed 9, Signed 9)
  -> Signal System (Signed 9)
topEntity = exposeClockResetEnable mac

and later in the "Alternative specifications" sub-section the macN, macA and macS are given as examples of alternatives to mac.

However, while macS can be used as a drop-in replacement, both the macN and macA require a topEntity with a different signature:

topEntity
  :: Clock System
  -> Reset System
  -> Enable System
  -> (Signal System (Signed 9), Signal System (Signed 9))
  -> Signal System (Signed 9)

If this is intentional, it would be nice to have it mentioned in the tutorial, as it can be confusing to newcomers.

christiaanb commented 1 year ago

Thanks for reporting this! In the next release the variants will have the same type.