@@ -161,7 +161,10 @@ class ProcessingElementPad(debug: Boolean) extends Module with MCRENFConfig with
161
161
protected val mightWeightIdxIncWire : Bool = Wire (Bool ())
162
162
protected val mightInActReadFinish : Bool = Wire (Bool ())
163
163
mightInActReadFinish.suggestName(" mightInActReadFinish" )
164
+ /** true while weightMatrixData = 0*/
164
165
protected val mightWeightReadFinish : Bool = Wire (Bool ())
166
+ /** true while weightAdr = 0, then it should turn to read new inActAdr */
167
+ protected val mightWeightMatrixFinish : Bool = Wire (Bool ())
165
168
protected val psDataSPadIdxWire : UInt = Wire (UInt (log2Ceil(pSumDataSPadSize).W ))
166
169
// InActSPad
167
170
protected val inActAdrIndexWire : UInt = Wire (UInt (inActAdrIdxWidth.W ))
@@ -321,6 +324,7 @@ class ProcessingElementPad(debug: Boolean) extends Module with MCRENFConfig with
321
324
mightWeightIdxIncWire := weightAdrDataWire === (weightDataIndexWire + 1 .U ) || mightWeightReadFinish // or meet finish signal
322
325
mightInActReadFinish := inActMatrixDataWire === 0 .U && ! inActDataSPadFirstReadReg
323
326
mightWeightReadFinish := weightMatrixDataReg === 0 .U && ! weightDataSPadFirstRead
327
+ mightWeightMatrixFinish := weightAdrDataWire === 0 .U
324
328
inActAdrSPadIdxIncWire := (padEqIA && mightInActZeroColumnWire) || (((padEqWA && mightWeightZeroColumnWire) ||
325
329
(padEqWB && mightWeightIdxIncWire)) && mightInActIdxIncWire) || (mightInActReadFinish && sPad =/= 0 .U )
326
330
weightAdrSPadIdxIncWire := (padEqMpy || sPad === padWeightData1) && mightWeightZeroColumnWire // FIXME: should add a state
@@ -397,8 +401,8 @@ class ProcessingElementPad(debug: Boolean) extends Module with MCRENFConfig with
397
401
when (mightInActReadFinish) {
398
402
readFinish()
399
403
} .otherwise { // then haven't done all the MAC operations
400
- when (mightWeightIdxIncWire) { // finished read current weight data Matrix column
401
- when (mightInActIdxIncWire) { // finished read current inAct data Matrix column
404
+ when (mightWeightIdxIncWire || mightWeightMatrixFinish ) { // finished read current weight data Matrix column
405
+ when (mightInActIdxIncWire || mightWeightMatrixFinish ) { // finished read current inAct data Matrix column
402
406
nextSPadInActAdr()
403
407
when (inActSPadZeroColumnReg) {
404
408
inActSPadZeroColumnReg := false .B
0 commit comments