blarney-lang / blarney

Haskell library for hardware description
Other
98 stars 11 forks source link

Add selector width to `Mux` primitive #96

Closed mn416 closed 3 years ago

mn416 commented 3 years ago

I noticed that Bit 0 elimination was not working for a mux with a 0-bit selector. To fix this, I added the selector width as an argument to the Mux prim. Previously the width was being inferred from the number of inputs, but this was not consistent with (enforced against) the actual width of the input selector signal.

mn416 commented 3 years ago

@gameboo suggests it would be nice to get rid of the n argument to the Mux primitive (the number of inputs), as it can be determined just by taking the length of the input list. However, I wasn't able to do this due to https://github.com/blarney-lang/blarney/blob/master/Haskell/Blarney/Core/Prim.hs#L764. Maybe we will revisit this later.