File tree 3 files changed +20
-0
lines changed
core/src/main/scala/chisel3/experimental/hierarchy/core
src/test/scala/chiselTests/experimental/hierarchy
3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -543,4 +543,5 @@ object Lookupable {
543
543
implicit val lookupString : SimpleLookupable [String ] = new SimpleLookupable [String ]()
544
544
implicit val lookupBoolean : SimpleLookupable [Boolean ] = new SimpleLookupable [Boolean ]()
545
545
implicit val lookupBigInt : SimpleLookupable [BigInt ] = new SimpleLookupable [BigInt ]()
546
+ implicit val lookupUnit : SimpleLookupable [Unit ] = new SimpleLookupable [Unit ]()
546
547
}
Original file line number Diff line number Diff line change @@ -369,4 +369,11 @@ object Examples {
369
369
out := copy.out
370
370
371
371
}
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
+ }
372
379
}
Original file line number Diff line number Diff line change @@ -449,6 +449,18 @@ class InstanceSpec extends ChiselFunSpec with Utils {
449
449
MarkAnnotation (" ~Top|Top/i:HasHasTarget>sram_mem" .rt, " x" )
450
450
)
451
451
}
452
+ it(" (3.s): should work on Unit" ) {
453
+ class Top extends Module {
454
+ val i = Instance (Definition (new HasPublicUnit ))
455
+ i.x should be(())
456
+ mark(i.y._1, " y_1" )
457
+ i.y._2 should be(())
458
+ }
459
+ val (_, annos) = getFirrtlAndAnnos(new Top )
460
+ annos.collect { case c : MarkAnnotation => c } should contain(
461
+ MarkAnnotation (" ~Top|Top/i:HasPublicUnit>y_1" .rt, " y_1" )
462
+ )
463
+ }
452
464
}
453
465
describe(" (4) toInstance" ) {
454
466
it(" (4.a): should work on modules" ) {
You can’t perform that action at this time.
0 commit comments