Skip to content

Commit

Permalink
Generate more remarkably useful signals
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-g committed Aug 27, 2015
1 parent 373503d commit a50178b
Showing 1 changed file with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ public class ParallelCsrReadControl extends ManagerStateMachine {

private final DFEsmPullInput iLength;
private final DFEsmStateValue iLengthReady;
private final DFEsmPushOutput oReadMask, oReadEnable, oRowFinished, oRowLength, oNnzCounter;
private final DFEsmPushOutput oReadMask, oReadEnable, oRowFinished, oRowLength, oNnzCounter, oFirstReadPosition;
private final DFEsmStateValue readEnableOutValid, readMaskOutValid;
private final DFEsmStateValue readEnableData, readMaskData, rowFinishedData, rowLengthData;
private final DFEsmStateValue nnzCounter;
private final DFEsmStateValue cycleCounter;
private final DFEsmStateValue firstReadPosition;

private final DFEsmStateValue crtPos, toread, iLengthRead;
private final int inputWidth;
Expand All @@ -28,10 +29,12 @@ public ParallelCsrReadControl(DFEManager owner, int inputWidth, boolean dbg) {
oReadEnable = io.pushOutput("readenable", dfeBool(), 1);
oRowFinished = io.pushOutput("rowFinished", dfeBool(), 1);
oRowLength = io.pushOutput("rowLength", dfeUInt(32), 1);
oNnzCounter = io.pushOutput("nnzCounter", dfeUInt(32), 1);
oNnzCounter = io.pushOutput("cycleCounter", dfeUInt(32), 1);
oFirstReadPosition = io.pushOutput("firstReadPosition", dfeUInt(32), 1);

nnzCounter = state.value(dfeUInt(32), 0);
cycleCounter = state.value(dfeUInt(32), 0);
crtPos = state.value(dfeUInt(32), 0);
firstReadPosition = state.value(dfeUInt(32), 0);
toread = state.value(dfeUInt(32), 0);
iLengthRead = state.value(dfeBool(), true);
readEnableOutValid = state.value(dfeBool(), false);
Expand All @@ -57,7 +60,7 @@ protected void nextState() {
DFEsmAssignableValue toreadCrt = assignable.value(dfeUInt(32));
IF (iLengthReady === true) {
toreadCrt <== iLength;
nnzCounter.next <== 0;
firstReadPosition.next <== crtPos;
IF (iLength !== 0) {
iLengthRead.next <== false;
rowLengthData.next <== iLength;
Expand All @@ -67,6 +70,7 @@ protected void nextState() {
readMaskData.next <== 0;
rowLengthData.next <== 0;
readEnableData.next <== 0;
cycleCounter.next <== 0;
readMaskOutValid.next <== true;
readEnableOutValid.next <== true;
}
Expand All @@ -86,7 +90,10 @@ protected void nextState() {
}

readEnableData.next <== crtPos === 0;
nnzCounter.next <== nnzCounter + canread;
IF (iLengthReady === true)
cycleCounter.next <== 0;
ELSE
cycleCounter.next <== cycleCounter + 1;

DFEsmAssignableValue pattern = assignable.value(dfeUInt(64));
pattern <== 0;
Expand Down Expand Up @@ -125,17 +132,19 @@ protected void outputFunction() {
oRowLength.valid <== readMaskOutValid;
oRowFinished.valid <== readMaskOutValid;
oNnzCounter.valid <== readMaskOutValid;
oFirstReadPosition.valid <== readEnableOutValid;

oReadEnable <==readEnableData;
oReadMask <== readMaskData;
oRowLength <== rowLengthData;
oRowFinished <== rowFinishedData;
oNnzCounter <== nnzCounter;
oNnzCounter <== cycleCounter;
oFirstReadPosition <== firstReadPosition;

if (dbg)
IF (readEnableOutValid)
debug.simPrintf(
"ReadControl SM -- readmask: %d, readeenable: %d toread: %d, crtPos: %d, rowLength %d, rowFinished %d\n",
readMaskData, readEnableData, toread, crtPos, rowLengthData, rowFinishedData);
"ReadControl SM -- readmask: %d, readeenable: %d toread: %d, crtPos: %d, rowLength %d, rowFinished %d cycleCounter %d\n",
readMaskData, readEnableData, toread, crtPos, rowLengthData, rowFinishedData, cycleCounter);
}
}

0 comments on commit a50178b

Please sign in to comment.