Skip to content

Commit 92f2527

Browse files
Amanda ShiAmanda Shi
authored andcommitted
change scale mem write addr width
1 parent 7ea2330 commit 92f2527

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/main/scala/gemmini/ExecuteController.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ExecuteController[T <: Data, U <: Data, V <: Data](xLen: Int, tagWidth: In
5252
val counter = new CounterEventIO()
5353
val b_fire = Output(Bool())
5454
val a_fire = Output(Bool())
55-
val scale_mem_mvout_base_addr_act = Output(UInt(32.W))
55+
val scale_mem_mvout_base_addr_act = Output(UInt(scale_mem.get.ScaleMemWriteAddrWidth.W))
5656
val scaleMemCntl = Output(new ScalingFactorCntl(meshRows*tileRows))
5757
})
5858

@@ -124,13 +124,13 @@ class ExecuteController[T <: Data, U <: Data, V <: Data](xLen: Int, tagWidth: In
124124

125125
val scale_mem_mvin_base_addr_act = RegInit(0.U(32.W))
126126
val scale_mem_mvin_base_addr_w = RegInit(0.U(32.W))
127-
val scale_mem_mvout_base_addr_act = RegInit(0.U(32.W))
127+
val scale_mem_mvout_base_addr_act = RegInit(0.U(scale_mem.get.ScaleMemWriteAddrWidth.W))
128128

129129
when(functs(0) === CONFIG_SCALE_MEM) {
130130
val direction = rs2s(0)(63)
131131
when(direction === 1.U) { // mvin
132132
scale_mem_mvin_base_addr_act := rs1s(0)
133-
scale_mem_mvin_base_addr_w := rs1s(0) + (config.scale_mem.get.sizeInBytes >> 1).U
133+
scale_mem_mvin_base_addr_w := rs1s(0) + (scale_mem.get.sizeInBytes >> 1).U
134134
}.elsewhen(direction === 0.U) { // mvout
135135
scale_mem_mvout_base_addr_act := rs1s(0)
136136
}

src/main/scala/gemmini/GemminiISA.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ object GemminiISA {
6666
//==========================================================================
6767
val GARBAGE_ADDR = "hffffffff".U(32.W)
6868

69-
val CONFIG_SCALE_MEM_RS1_ADDR_WIDTH = 32
69+
val CONFIG_SCALE_MEM_RS1_ADDR_WIDTH = 33
7070
val CONFIG_SCALE_MEM_SPACER_WIDTH = 64 - 1 - CONFIG_SCALE_MEM_RS1_ADDR_WIDTH
7171

7272
class ConfigScaleMemRs1 extends Bundle {

src/main/scala/gemmini/MxConfigFragments.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ case class GemminiScalingFactorMemConfig(
1111
gpuInputWidthBytes: Int = 8,
1212
numBanks: Int = 8,
1313
ScaleMemWriteDataWidth: Int = 256,
14-
ScaleMemWriteAddrWidth: Int = 32,
14+
ScaleMemWriteAddrWidth: Int = 33,
1515
) {
1616
def depth: Int = (sizeInBytes / (subbankLineSizeInBytes) / numBanks).toInt
1717
def bankWidthBytes = subbankLineSizeInBytes * subbanksPerBank

src/main/scala/gemmini/MxRequantizer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class MxRequantizerIO(
6767
val fp8_mode = Input(Bool()) // true for 64-lane mode, false for 16-lane mode
6868
val a_fire = Input(Bool()) // from execute controller
6969
val b_fire = Input(Bool()) // from execute controller
70-
val scale_mem_mvout_base_addr_act = Input(UInt(32.W)) // from execute controller
70+
val scale_mem_mvout_base_addr_act = Input(UInt(scaleMem_addr_width.W)) // from execute controller
7171
val counter_i = Input(UInt(iterator_bitwidth.W)) // from controller
7272
val counter_j = Input(UInt(iterator_bitwidth.W)) // from controller
7373
val counter_k = Input(UInt(iterator_bitwidth.W)) // from controller
@@ -346,7 +346,7 @@ class MxRequantizer[T <: Data: Arithmetic](
346346

347347
when(scale_buffer_full) {
348348
io.scaleMem_write.valid := true.B
349-
io.scaleMem_write.bits.addr := scale_mem_mvout_base_addr_act + (scale_write_addr_counter << 5) //byte address, scale 32B per write
349+
io.scaleMem_write.bits.addr := scale_mem_mvout_base_addr_act + (scale_write_addr_counter << (log2Ceil(scaleMem_data_width/8))) //byte address, scale 32B per write
350350
io.scaleMem_write.bits.data := Cat(scale_buffer.reverse)
351351
}
352352
}

0 commit comments

Comments
 (0)