chisel2-deprecated icon indicating copy to clipboard operation
chisel2-deprecated copied to clipboard

Uninferrable width on reg after using fromBits

Open da-steve101 opened this issue 9 years ago • 0 comments

class UserMod( bw : Int ) extends Module {
     val io = new Bundle {
       val in = UInt( INPUT, bw )
       val out = UInt( OUTPUT )
     }
     val r = RegNext( UInt( width = io.in.getWidth() ).fromBits(io.in) )
     println( r.getWidth() )
     io.out := r
}

This gives: Chisel.GetWidthException: getWidth was called on a Register or on an object connected in some way to a Register that has a statically uninferrable width This is fine however:

class UserMod( bw : Int ) extends Module {
     val io = new Bundle {
       val in = UInt( INPUT, bw )
       val out = UInt( OUTPUT )
     }
     val r = RegNext( io.in )
     println( r.getWidth() )
     io.out := r
}

da-steve101 avatar Aug 31 '16 01:08 da-steve101