@@ -126,8 +126,6 @@ class GemminiModule[T <: Data: Arithmetic, U <: Data, V <: Data]
126126 implicit val edge = outer.node.edges.out.head
127127 val tlb = Module (new FrontendTLB (2 , tlb_size, dma_maxbytes))
128128 (tlb.io.clients zip outer.spad.module.io.tlb).foreach(t => t._1 <> t._2)
129- tlb.io.exp.flush_skip := false .B
130- tlb.io.exp.flush_retry := false .B
131129
132130 io.ptw.head <> tlb.io.ptw
133131 /* io.ptw.head.req <> tlb.io.ptw.req
@@ -137,7 +135,7 @@ class GemminiModule[T <: Data: Arithmetic, U <: Data, V <: Data]
137135 tlb.io.ptw.pmp := io.ptw.head.pmp
138136 tlb.io.ptw.customCSRs := io.ptw.head.customCSRs*/
139137
140- spad.module.io.flush := tlb.io.exp.flush()
138+ spad.module.io.flush := tlb.io.exp.flush
141139
142140 /*
143141 //=========================================================================
@@ -181,7 +179,30 @@ class GemminiModule[T <: Data: Arithmetic, U <: Data, V <: Data]
181179 // Incoming commands and ROB
182180 val rob = Module (new ROB (new RoCCCommand , rob_entries, local_addr_t, meshRows* tileRows, meshColumns* tileColumns))
183181
184- val raw_cmd = Queue (io.cmd)
182+ val raw_cmd_q = Module (new Queue (new RoCCCommand , 2 ))
183+ val fence_stall = io.cmd.bits.inst.funct === FENCE_CMD && io.busy
184+ raw_cmd_q.io.enq.valid := io.cmd.valid && io.resp.ready && ! fence_stall
185+ raw_cmd_q.io.enq.bits := io.cmd.bits
186+
187+ io.resp.valid := io.cmd.valid && raw_cmd_q.io.enq.ready && ! fence_stall
188+ io.resp.bits.rd := io.cmd.bits.inst.rd
189+ io.resp.bits.data := 0 .U
190+
191+ io.cmd.ready := io.resp.ready && raw_cmd_q.io.enq.ready && ! fence_stall
192+
193+ // When TLB is busy with exception, don't enqueue new instructions, instead use RD to pass back exception info
194+ when (tlb.io.exp.interrupt) {
195+ io.cmd.ready := true .B
196+ raw_cmd_q.io.enq.valid := false .B
197+ io.resp.valid := io.cmd.valid
198+ io.resp.bits.data := tlb.io.exp.vaddr
199+ }
200+
201+ tlb.io.exp.flush := io.cmd.fire() && io.cmd.bits.inst.funct === FLUSH_CMD
202+
203+
204+
205+ val raw_cmd = raw_cmd_q.io.deq
185206
186207 // val (compressed_cmd, compressor_busy) = InstCompressor(unrolled_cmd)
187208 // compressed_cmd.ready := false.B
@@ -361,8 +382,8 @@ class GemminiModule[T <: Data: Arithmetic, U <: Data, V <: Data]
361382 rob_completed_arb.io.out.ready := true .B
362383
363384 // Wire up global RoCC signals
364- io.busy := raw_cmd.valid || loop_unroller_busy || rob.io.busy || spad.module.io.busy
365- io.interrupt := tlb.io.exp.interrupt
385+ io.busy := ( raw_cmd.valid || loop_unroller_busy || rob.io.busy || spad.module.io.busy) && ! tlb.io.exp.interrupt
386+ io.interrupt := false . B
366387
367388 rob.io.solitary_preload := ex_controller.io.solitary_preload
368389
@@ -415,32 +436,15 @@ class GemminiModule[T <: Data: Arithmetic, U <: Data, V <: Data]
415436 val risc_funct = unrolled_cmd.bits.inst.funct
416437
417438 val is_flush = risc_funct === FLUSH_CMD
439+ val is_fence = risc_funct === FENCE_CMD
418440 /*
419441 val is_load = (funct === LOAD_CMD) || (funct === CONFIG_CMD && config_cmd_type === CONFIG_LOAD)
420442 val is_store = (funct === STORE_CMD) || (funct === CONFIG_CMD && config_cmd_type === CONFIG_STORE)
421443 val is_ex = (funct === COMPUTE_AND_FLIP_CMD || funct === COMPUTE_AND_STAY_CMD || funct === PRELOAD_CMD) ||
422444 (funct === CONFIG_CMD && config_cmd_type === CONFIG_EX)
423445 */
424-
425- when (is_flush) {
426- // val skip = compressed_cmd.bits.rs1(0)
427- val skip = unrolled_cmd.bits.rs1(0 )
428- tlb.io.exp.flush_skip := skip
429- tlb.io.exp.flush_retry := ! skip
430-
431- // compressed_cmd.ready := true.B // TODO should we wait for an acknowledgement from the TLB?
432- unrolled_cmd.ready := true .B // TODO should we wait for an acknowledgement from the TLB?
433- }
434-
435- .otherwise {
436- rob.io.alloc.valid := true .B
437-
438- when(rob.io.alloc.fire()) {
439- // compressed_cmd.ready := true.B
440- unrolled_cmd.ready := true .B
441- }
442- }
443-
446+ unrolled_cmd.ready := is_fence || is_flush || rob.io.alloc.ready
447+ rob.io.alloc.valid := ! is_flush && ! is_fence
444448 }
445449
446450 /*
0 commit comments