tmoreau89 commented on a change in pull request #32:
URL: https://github.com/apache/tvm-vta/pull/32#discussion_r701572274



##########
File path: hardware/chisel/src/main/scala/core/LoadUop.scala
##########
@@ -67,160 +64,43 @@ class LoadUop(debug: Boolean = false)(implicit p: 
Parameters) extends Module {
     val vme_rd = new VMEReadMaster
     val uop = new UopClient
   })
-  val numUop = 2 // store two uops per sram word
-  val uopBits = p(CoreKey).uopBits
-  val uopBytes = uopBits / 8
-  val uopDepth = p(CoreKey).uopMemDepth / numUop
 
-  val dec = io.inst.asTypeOf(new MemDecode)
-  val raddr = Reg(chiselTypeOf(io.vme_rd.cmd.bits.addr))
-  val xcnt = Reg(chiselTypeOf(io.vme_rd.cmd.bits.len))
-  val xlen = Reg(chiselTypeOf(io.vme_rd.cmd.bits.len))
-  val xrem = Reg(chiselTypeOf(dec.xsize))
-  val xsize = (dec.xsize >> log2Ceil(numUop)) + dec.xsize(0) + 
(dec.sram_offset % 2.U) - 1.U
-  val xmax = (1 << mp.lenBits).U
-  val xmax_bytes = ((1 << mp.lenBits) * mp.dataBits / 8).U
+  // force simple load uop implementation be careful if
+  // define simple tensor load
+  val forceSimpleLoadUop = false;
 
-  val dram_even = (dec.dram_offset % 2.U) === 0.U
-  val sram_even = (dec.sram_offset % 2.U) === 0.U
-  val sizeIsEven = (dec.xsize % 2.U) === 0.U
+  if (forceSimpleLoadUop) {
+    require(mp.dataBits == 64, "-F- Original LoadUop supports only 64 bit 
memory data transfer")
 
-  val sIdle :: sReadCmd :: sReadData :: Nil = Enum(3)
-  val state = RegInit(sIdle)
+    val loadUop = Module(new LoadUopSimple(debug))
 
-  // control
-  switch(state) {
-    is(sIdle) {
-      when(io.start) {
-        state := sReadCmd
-        when(xsize < xmax) {
-          xlen := xsize
-          xrem := 0.U
-        }.otherwise {
-          xlen := xmax - 1.U
-          xrem := xsize - xmax
-        }
-      }
-    }
-    is(sReadCmd) {
-      when(io.vme_rd.cmd.ready) {
-        state := sReadData
-      }
-    }
-    is(sReadData) {
-      when(io.vme_rd.data.valid) {
-        when(xcnt === xlen) {
-          when(xrem === 0.U) {
-            state := sIdle
-          }.otherwise {
-            raddr := raddr + xmax_bytes
-            when(xrem < xmax) {
-              state := sReadCmd
-              xlen := xrem
-              xrem := 0.U
-            }
-            .otherwise {
-              state := sReadCmd
-              xlen := xmax - 1.U
-              xrem := xrem - xmax
-            }
-          }
-        }
-      }
-    }
-  }
+    loadUop.io.start := io.start
+    io.done := loadUop.io.done
+    loadUop.io.baddr := io.baddr
+    loadUop.io.vme_rd <> io.vme_rd
 
-  // read-from-dram
-  val maskOffset = VecInit(Seq.fill(M_DRAM_OFFSET_BITS)(true.B)).asUInt
-  when(state === sIdle) {
-    when(dram_even) {
-      raddr := io.baddr | (maskOffset & (dec.dram_offset << 
log2Ceil(uopBytes)))
-    }.otherwise {
-      raddr := (io.baddr | (maskOffset & (dec.dram_offset << 
log2Ceil(uopBytes)))) - uopBytes.U
-    }
-  }
+    loadUop.io.dec := io.inst.asTypeOf(new MemDecode)
+    loadUop.io.uop.idx <> io.uop.idx
+    io.uop <> loadUop.io.uop
 
-  io.vme_rd.cmd.valid := state === sReadCmd
-  io.vme_rd.cmd.bits.addr := raddr
-  io.vme_rd.cmd.bits.len := xlen
+  } else {
+    //println(

Review comment:
       clean up comments




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to