Skip to content

Commit

Permalink
Emit FIRRTL bulk connects even for "input" wires (#4219) (#4235)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0a3d157)

Co-authored-by: Jack Koenig <koenig@sifive.com>
  • Loading branch information
mergify[bot] and jackkoenig authored Jul 1, 2024
1 parent e3f8e0b commit 0938828
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/scala/chisel3/internal/MonoConnect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private[chisel3] object MonoConnect {

// CASE: Context is same module that both sink node and source node are in
if ((context_mod == sink_mod) && (context_mod == source_mod)) {
sink.direction != Input
!sink_is_port || sink.direction != Input
}

// CASE: Context is same module as sink node and source node is in a child module
Expand Down
11 changes: 11 additions & 0 deletions src/test/scala/chiselTests/BulkConnectSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,15 @@ class BulkConnectSpec extends ChiselPropSpec {
chirrtl should include("connect out1[0], in1[1]")
chirrtl should include("connect out1[1], in1[0]")
}

property("Chisel should emit FIRRTL bulk connect for \"input\" wires") {
class MyBundle extends Bundle {
val foo = Input(UInt(8.W))
}
val chirrtl = ChiselStage.emitCHIRRTL(new Module {
val w1, w2 = Wire(new MyBundle)
w2 <> w1
})
chirrtl should include("connect w2, w1")
}
}

0 comments on commit 0938828

Please sign in to comment.