File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
core/src/main/scala/chisel3/experimental/hierarchy/core
src/test/scala/chiselTests/experimental/hierarchy Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -552,4 +552,5 @@ object Lookupable {
552552 implicit val lookupString : SimpleLookupable [String ] = new SimpleLookupable [String ]()
553553 implicit val lookupBoolean : SimpleLookupable [Boolean ] = new SimpleLookupable [Boolean ]()
554554 implicit val lookupBigInt : SimpleLookupable [BigInt ] = new SimpleLookupable [BigInt ]()
555+ implicit val lookupUnit : SimpleLookupable [Unit ] = new SimpleLookupable [Unit ]()
555556}
Original file line number Diff line number Diff line change @@ -369,4 +369,11 @@ object Examples {
369369 out := copy.out
370370
371371 }
372+
373+ @ instantiable
374+ class HasPublicUnit extends Module {
375+ @ public val x : Unit = ()
376+ // Should also work in type-parameterized lookupable things
377+ @ public val y : (Data , Unit ) = (Wire (UInt (3 .W )), ())
378+ }
372379}
Original file line number Diff line number Diff line change @@ -474,6 +474,18 @@ class InstanceSpec extends ChiselFunSpec with Utils {
474474 MarkAnnotation (" ~Top|Top/i:HasHasTarget>sram_sram" .rt, " x" )
475475 )
476476 }
477+ it(" (3.s): should work on Unit" ) {
478+ class Top extends Module {
479+ val i = Instance (Definition (new HasPublicUnit ))
480+ i.x should be(())
481+ mark(i.y._1, " y_1" )
482+ i.y._2 should be(())
483+ }
484+ val (_, annos) = getFirrtlAndAnnos(new Top )
485+ annos.collect { case c : MarkAnnotation => c } should contain(
486+ MarkAnnotation (" ~Top|Top/i:HasPublicUnit>y_1" .rt, " y_1" )
487+ )
488+ }
477489 }
478490 describe(" (4) toInstance" ) {
479491 it(" (4.a): should work on modules" ) {
You can’t perform that action at this time.
0 commit comments