chisel icon indicating copy to clipboard operation
chisel copied to clipboard

Use firrtl.bitcast operator for DataView/asTypeOf conversions

Open sequencer opened this issue 5 months ago • 0 comments

Problem Statement

FIRRTL’s intermediate representation already defines a BitCastOp for bit-level reinterpreting between equal-width types (Bundles, Vecs, UInt, SInt, etc.), but this operator currently lacks parser/printer (ser/deser) support. As a result, Chisel and CIRCT cannot leverage BitCastOp in emitted FIRRTL IR, falling back to DSL-side recursive split-and-reconnect logic for asTypeOf, DataView, viewAs, and similar conversions.

Desired Behavior

Enable full FIRRTL parser and printer support for BitCastOp so that Chisel can lower all type reinterpret operations directly to a single BitCastOp, eliminating the recursive split-and-reconnect pattern. I provide a related implementation here, which I think it's really cool and reduced the eDSL maintaining burden: sequencer/zaozi#70

Proposed Solution

  • FIRRTL Parser/AST updates in both CIRCT and chisel;
  • Update implementation of DataView to use it;

sequencer avatar Jun 27 '25 07:06 sequencer