From 897e6ccf8a4057df2e5262c9768e05d0e5eede63 Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Fri, 15 Jul 2016 15:39:00 -0700 Subject: [PATCH] fix Hasti and Smi converters --- junctions/src/main/scala/hasti.scala | 8 ++++++-- junctions/src/main/scala/smi.scala | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/junctions/src/main/scala/hasti.scala b/junctions/src/main/scala/hasti.scala index 12873eff..fe177500 100644 --- a/junctions/src/main/scala/hasti.scala +++ b/junctions/src/main/scala/hasti.scala @@ -403,7 +403,11 @@ class HastiMasterIONastiIOConverter(implicit p: Parameters) extends HastiModule( last = (len === UInt(0))) assert(!r_queue.io.enq.valid || r_queue.io.enq.ready, - "HASTI -> NASTI converter queue overflow") + "NASTI -> HASTI converter queue overflow") + + val next_count = r_queue.io.count + + r_queue.io.enq.valid - + r_queue.io.deq.ready io.hasti.haddr := addr io.hasti.hsize := size @@ -418,7 +422,7 @@ class HastiMasterIONastiIOConverter(implicit p: Parameters) extends HastiModule( Mux(first, HTRANS_IDLE, HTRANS_BUSY)), s_read -> MuxCase(HTRANS_BUSY, Seq( first -> HTRANS_NONSEQ, - (r_queue.io.count <= UInt(1)) -> HTRANS_SEQ)))) + (next_count <= UInt(1)) -> HTRANS_SEQ)))) when (io.nasti.aw.fire()) { first := Bool(true) diff --git a/junctions/src/main/scala/smi.scala b/junctions/src/main/scala/smi.scala index ce1fbe70..777dd075 100644 --- a/junctions/src/main/scala/smi.scala +++ b/junctions/src/main/scala/smi.scala @@ -240,16 +240,18 @@ class SmiIONastiWriteIOConverter(val dataWidth: Int, val addrWidth: Int) } when (state === s_send) { - when (strb === UInt(0)) { - state := Mux(last, s_ack, s_data) - } .elsewhen (io.smi.req.ready || !strb(0)) { + when (io.smi.req.ready || !strb(0)) { strb := strb >> jump data := data >> Cat(jump, UInt(0, log2Up(dataWidth))) addr := addr + jump + when (strb(0)) { state := s_ack } } } - when (io.smi.resp.fire()) { state := s_resp } + when (io.smi.resp.fire()) { + state := Mux(strb === UInt(0), + Mux(last, s_resp, s_data), s_send) + } when (io.nasti.b.fire()) { state := s_idle } }