@@ -259,7 +259,6 @@ class AXI4Bridge() extends Module with AXI4Config {
259259 }
260260 }
261261
262- // ------------------Number of transmission------------------
263262 protected val instTransLen = RegInit (0 .U (8 .W ))
264263 protected val instTransLenReset = WireDefault (this .reset.asBool() || (instRdTrans && rdStateIdle))
265264 protected val instAxiLen = Wire (UInt (8 .W ))
@@ -271,32 +270,12 @@ class AXI4Bridge() extends Module with AXI4Config {
271270 instTransLen := instTransLen + 1 .U
272271 }
273272
274- protected val memTransLen = RegInit (0 .U (8 .W ))
275- protected val memTransLenReset = WireDefault (this .reset.asBool() || (wtTrans && wtStateIdle) || (memRdTrans && rdStateIdle))
276- protected val memAxiLen = Wire (UInt (8 .W ))
277- protected val memTransLenIncrEna = WireDefault ((memTransLen =/= memAxiLen) && (wtHdShk || (rdHdShk && (io.axi.r.bits.id === memAxiId))))
278-
279- when(memTransLenReset) {
280- memTransLen := 0 .U
281- }.elsewhen(memTransLenIncrEna) {
282- memTransLen := memTransLen + 1 .U
283- }
284-
285- // ------------------Process Data------------------
286273 protected val ALIGNED_INST_WIDTH = log2Ceil(AxiInstDataWidth / 8 )
287274 protected val OFFSET_INST_WIDTH = log2Ceil(AxiInstDataWidth )
288275 protected val MASK_INST_WIDTH = AxiInstDataWidth * 2
289276 protected val AXI_INST_SIZE = if (SoCEna ) 2 .U else 3 .U // because the flash only support 4 bytes access
277+ protected val TRANS_LEN = 1
290278
291- protected val ALIGNED_MEM_WIDTH = log2Ceil(AxiDataWidth / 8 )
292- protected val OFFSET_MEM_WIDTH = log2Ceil(AxiDataWidth )
293- protected val MASK_MEM_WIDTH = AxiDataWidth * 2
294- protected val ALIGNED_PERIPH_MEM_WIDTH = log2Ceil(AxiPerifDataWidth / 8 )
295- protected val OFFSET_PERIPH_MEM_WIDTH = log2Ceil(AxiPerifDataWidth )
296- protected val MASK_PERIPH_MEM_WIDTH = AxiPerifDataWidth * 2
297- protected val TRANS_LEN = 1
298-
299- // ================================inst data=======================
300279 // no-aligned visit
301280 protected val instTransAligned = WireDefault (io.inst.addr(ALIGNED_INST_WIDTH - 1 , 0 ) === 0 .U )
302281 protected val instSizeByte = WireDefault (io.inst.size === AXI4Bridge .SIZE_B )
@@ -357,7 +336,25 @@ class AXI4Bridge() extends Module with AXI4Config {
357336 }
358337 io.inst.resp := instResp
359338
360- // ================================mem data=======================
339+ // ================================mem================================
340+ protected val memTransLen = RegInit (0 .U (8 .W ))
341+ protected val memTransLenReset = WireDefault (this .reset.asBool() || (wtTrans && wtStateIdle) || (memRdTrans && rdStateIdle))
342+ protected val memAxiLen = Wire (UInt (8 .W ))
343+ protected val memTransLenIncrEna = WireDefault ((memTransLen =/= memAxiLen) && (wtHdShk || (rdHdShk && (io.axi.r.bits.id === memAxiId))))
344+
345+ when(memTransLenReset) {
346+ memTransLen := 0 .U
347+ }.elsewhen(memTransLenIncrEna) {
348+ memTransLen := memTransLen + 1 .U
349+ }
350+
351+ protected val ALIGNED_MEM_WIDTH = log2Ceil(AxiDataWidth / 8 )
352+ protected val OFFSET_MEM_WIDTH = log2Ceil(AxiDataWidth )
353+ protected val MASK_MEM_WIDTH = AxiDataWidth * 2
354+ protected val ALIGNED_PERIPH_MEM_WIDTH = log2Ceil(AxiPerifDataWidth / 8 )
355+ protected val OFFSET_PERIPH_MEM_WIDTH = log2Ceil(AxiPerifDataWidth )
356+ protected val MASK_PERIPH_MEM_WIDTH = AxiPerifDataWidth * 2
357+
361358 protected val memTransAligned = Wire (Bool ())
362359 protected val memSizeByte = WireDefault (io.mem.size === AXI4Bridge .SIZE_B )
363360 protected val memSizeHalf = WireDefault (io.mem.size === AXI4Bridge .SIZE_H )
@@ -500,7 +497,6 @@ class AXI4Bridge() extends Module with AXI4Config {
500497 }
501498
502499 io.axi.b.ready := wtStateResp
503- // ------------------Read Transaction------------------
504500
505501 // Read address channel signals
506502 io.axi.ar.valid := rdIfARwithMemIDLE || rdIfIDLEwithMemAR || rdIfRDwithMemAR || rdIfARwithMemRD
0 commit comments