From 676a53670633729f35fb73af5effe1ada03f64aa Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Tue, 12 Jul 2016 13:47:42 -0700 Subject: [PATCH] fix bugs from adding ComparatorSource backpressure --- groundtest/src/main/scala/comparator.scala | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/groundtest/src/main/scala/comparator.scala b/groundtest/src/main/scala/comparator.scala index 2cec3780..5a97754f 100644 --- a/groundtest/src/main/scala/comparator.scala +++ b/groundtest/src/main/scala/comparator.scala @@ -69,13 +69,10 @@ class ComparatorSource(implicit val p: Parameters) extends Module } // Output exactly nOperations of Acquires - val counter = RegInit(UInt(nOperations)) val finished = RegInit(Bool(false)) val valid = RegInit(Bool(false)) valid := Bool(true) - counter := counter - (!finished && valid).asUInt - when (counter === UInt(1)) { finished := Bool(true) } io.finished := finished io.out.valid := !finished && valid @@ -148,15 +145,13 @@ class ComparatorSource(implicit val p: Parameters) extends Module UInt("b101") -> getPrefetch, UInt("b110") -> putPrefetch))) - when (!done_wipe && valid) { - wipe_addr_block := wipe_addr_block + UInt(1) - } - val idx = Reg(init = UInt(0, log2Up(nOperations))) when (io.out.fire()) { + when (idx === UInt(nOperations - 1)) { finished := Bool(true) } when (!done_wipe) { printf("[acq %d]: PutBlock(addr_block = %x, data = %x)\n", idx, wipe_addr_block, data) + wipe_addr_block := wipe_addr_block + UInt(1) } .otherwise { switch (a_type_sel) { is (UInt("b000")) { @@ -343,7 +338,6 @@ class ComparatorSink(implicit val p: Parameters) extends Module } } when (all_valid) { - // Skip the results generated by the block wiping when (base.hasData()) { printf("[gnt %d]: g_type = %x, addr_beat = %x, data = %x\n", idx, base.g_type, base.addr_beat, base.data)