Skip to content

Commit be89284

Browse files
author
Oron Port
committed
fix: prevent missing domain location of internal designs inside top device design
1 parent ff876fa commit be89284

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

compiler/ir/src/main/scala/dfhdl/compiler/ir/DB.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ final case class DB(
10911091
// Collect all location constraints to check for collisions
10921092
val locationMap = mutable.Map.empty[String, String] // loc -> portName(idx)
10931093
(design :: members).foreach {
1094+
case designInstance: DFDesignBlock if designInstance != design => // no need to check for location constraints in nested designs
10941095
case domainOwner: DFDomainOwner =>
10951096
domainOwner.domainType match
10961097
case DomainType.RT(_) =>

lib/src/test/scala/ElaborationChecksSpec.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,4 +435,28 @@ class ElaborationChecksSpec extends DesignSpec:
435435
|RHS: y.resize(8)
436436
|Message: Unexpected write access to the immutable value y.resize(8).""".stripMargin
437437
)
438+
test("no need for clock location constraint check in internal designs"):
439+
object Test:
440+
import hw.constraints.*
441+
class Internal extends RTDesign:
442+
val x = Bit <> IN
443+
val y = Bit <> OUT
444+
y <> x.reg(1, init = 0)
445+
end Internal
446+
@deviceID(deviceID.Vendor.XilinxAMD, "test", "test", "")
447+
@timing.clock(rate = 20.MHz)
448+
@io(loc = "locClk")
449+
@top(false) class Top extends RTDesign:
450+
@io(loc = "locx")
451+
val x = Bit <> IN
452+
@io(loc = "locy")
453+
val y = Bit <> OUT
454+
val internal = Internal()
455+
internal.x <> x
456+
internal.y <> y
457+
end Test
458+
import Test.*
459+
assertElaborationErrors(Top())(
460+
"No error found"
461+
)
438462
end ElaborationChecksSpec

0 commit comments

Comments
 (0)