firrtl-spec icon indicating copy to clipboard operation
firrtl-spec copied to clipboard

[Proposal] Remove implicit truncations.

Open darthscsi opened this issue 1 year ago • 2 comments

Update the connect algorithm to eliminate type equivalence between smaller to larger conversions.

The type equivalence sections sometimes talks about types being equivalent and sometimes talks about them being connectable. Since the types are not equivalent, they are convertable, update all wording to only talk about connectability.

darthscsi avatar Jan 23 '24 19:01 darthscsi

While we're at it, would it be worthwhile to forbid implicit extensions as well?

It's more principled and would let us (almost) remove this section entirely.

mmaloney-sf avatar Jan 23 '24 21:01 mmaloney-sf

While we're at it, would it be worthwhile to forbid implicit extensions as well?

No. How would you connect a number with a known width to a number with an unknown width that may end up with a larger width due to a later conditional connection? I think this would require explicit width parameters and operations for manipulating them (a good idea, but not something FIRRTL has yet).

It's also just not a good design point for arithmetic types, but I will grant if we had parameters and sufficient operations defined on them then maybe frontend languages like Chisel can just emit the appropriate manipulations.

I think it would be good to add a new "Bits" type that does not have implicit extension, but it too would be hard to use without the mentioned width manipulation operations.

jackkoenig avatar Jan 23 '24 21:01 jackkoenig