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

Add a bitcast primitive to match CIRCT's `firrtl.bitcast` ?

Open smarter opened this issue 2 years ago • 2 comments
trafficstars

https://github.com/llvm/circt/blob/main/docs/Dialects/FIRRTL/RationaleFIRRTL.md#firrtlbitcast seems like a generally useful thing, but there doesn't appear to be a corresponding primitive operation that could be called from a .fir file, would it make sense to add it to the spec (and FIRParser) ?

smarter avatar Oct 18 '23 20:10 smarter

@darthscsi or @dtzSiFive, WDYT?

seldridge avatar Oct 20 '23 18:10 seldridge

I was working with a user who was converting vectors around and realized that there was no bitcast available. It is probably useful. It requires positions on bit and field orderings. It also has to be extremely clear it is not making some aliasing reinterpretation of it's arguments (e.g. can't be used on the lhs of a connect).

darthscsi avatar Oct 20 '23 22:10 darthscsi