Skip to content

Uninferrable width on reg after using fromBits #726

Description

@da-steve101
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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions