diff options
| author | Jack Koenig | 2017-12-19 17:33:07 -0800 |
|---|---|---|
| committer | GitHub | 2017-12-19 17:33:07 -0800 |
| commit | d95cb262aefc06458652b227980a3cdc5471d3ba (patch) | |
| tree | 01c543cb66ae221f648e57909a1c29ea6e9456b8 /chiselFrontend/src | |
| parent | d67914ffd4b983903f777c5c033ce84fbdb561f1 (diff) | |
Add WireInit.apply that accepts DontCare (#731)
Prevents DontCare from affecting type inference
Fixes #728
Diffstat (limited to 'chiselFrontend/src')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Data.scala | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Data.scala b/chiselFrontend/src/main/scala/chisel3/core/Data.scala index db99d6b3..19adf01b 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Data.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Data.scala @@ -451,13 +451,20 @@ object WireInit { apply(model, init) } - def apply[T <: Data](t: T, init: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = { + private def applyImpl[T <: Data](t: T, init: Data)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = { implicit val noSourceInfo = UnlocatableSourceInfo val x = Wire(t) requireIsHardware(init, "wire initializer") x := init x } + + def apply[T <: Data](t: T, init: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = { + applyImpl(t, init) + } + def apply[T <: Data](t: T, init: DontCare.type)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = { + applyImpl(t, init) + } } /** RHS (source) for Invalidate API. |
