File tree Expand file tree Collapse file tree 4 files changed +17
-11
lines changed
Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ object MyBundle {
3535 */
3636 def setYTo5 (): MyBundle = {
3737 val wire = Wire (new MyBundle )
38+ // Initialize all elements. We don't want firrtl complaining about "not fully initialized" connections.
39+ wire.x := 0 .U
3840 wire.y := 5 .U
3941 wire
4042 }
Original file line number Diff line number Diff line change @@ -26,9 +26,11 @@ class SlowDecoupledAdder extends Module {
2626 val in = Flipped (Decoupled (new SlowDecoupledAdderIn ))
2727 val out = Decoupled (new SlowDecoupledAdderOut )
2828 })
29+ // Initialize all elements. We don't want firrtl complaining about "not fully initialized" connections.
2930 val busy = RegInit (false .B )
3031 val a_reg = RegInit (0 .U (16 .W ))
3132 val b_reg = RegInit (0 .U (16 .W ))
33+ val o_reg = RegInit (0 .U (16 .W ))
3234 val wait_counter = RegInit (0 .U (16 .W ))
3335
3436 io.in.ready := ! busy
@@ -45,11 +47,12 @@ class SlowDecoupledAdder extends Module {
4547 }
4648 when(busy) {
4749 when(wait_counter > delay_value.asUInt) {
48- io.out.bits.c := a_reg + b_reg
50+ o_reg := a_reg + b_reg
4951 }.otherwise {
5052 wait_counter := wait_counter + 1 .U
5153 }
5254 }
55+ io.out.bits.c := o_reg
5356
5457 io.out.valid := (io.out.bits.c === a_reg + b_reg ) && busy
5558
Original file line number Diff line number Diff line change 22
33package examples
44
5- import chisel3 ._
6- import chisel3 .util ._
75import chisel3 ._
86import chisel3 .util ._
97import chisel3 .iotesters ._
10- import org .scalatest .{Matchers , FlatSpec }
118
129class ExampleModule extends Module {
1310 val io = IO (new Bundle {
@@ -39,6 +36,8 @@ class ExampleModule extends Module {
3936 io.out.bits := 0 .U
4037 wait_counter := wait_counter + 1 .U
4138 }
39+ }.otherwise {
40+ io.out.bits := 0 .U
4241 }
4342
4443 io.out.valid := (io.out.bits === in_reg) && (wait_counter === delay_value) && busy
Original file line number Diff line number Diff line change 33package examples
44
55import chisel3 ._
6- import chisel3 .util .{EnqIO , DeqIO , log2Ceil }
6+ import chisel3 .util .{DeqIO , EnqIO , log2Ceil }
77import chisel3 .iotesters .{ChiselFlatSpec , OrderedDecoupledHWIOTester }
88
99object Router {
@@ -53,12 +53,14 @@ class Router extends Module {
5353 val io = IO (new RouterIO (n))
5454 val tbl = Mem (depth, UInt (BigInt (n).bitLength.W ))
5555
56- when(reset.toBool) {
57- io.read_routing_table_request.nodeq()
58- io.load_routing_table_request.nodeq()
59- io.read_routing_table_response.noenq()
60- io.in.nodeq()
61- io.outs.foreach { out => out.noenq() }
56+ io.read_routing_table_request.nodeq()
57+ io.load_routing_table_request.nodeq()
58+ io.read_routing_table_response.noenq()
59+ io.read_routing_table_response.bits := 0 .U
60+ io.in.nodeq()
61+ io.outs.foreach { out =>
62+ out.bits := 0 .U .asTypeOf(out.bits)
63+ out.noenq()
6264 }
6365
6466 when(io.read_routing_table_request.valid && io.read_routing_table_response.ready) {
You can’t perform that action at this time.
0 commit comments