Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninferrable width on reg after using fromBits #726

Open
da-steve101 opened this issue Aug 31, 2016 · 0 comments
Open

Uninferrable width on reg after using fromBits #726

da-steve101 opened this issue Aug 31, 2016 · 0 comments

Comments

@da-steve101
Copy link
Contributor

da-steve101 commented Aug 31, 2016

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant