private final ChipModel model;
private final Indenter indenter;
- protected static void fatal(boolean pred, String msg) {
- if (pred) Infrastructure.fatal(msg);
- }
- private void prln(String msg) {indenter.prln(msg);}
- private void adjustIndent(int n) {indenter.adjustIndent(n);}
+ protected static void fatal(boolean pred, String msg) { if (pred) Infrastructure.fatal(msg); }
+ private void prln(String msg) { indenter.prln(msg); }
+ private void adjustIndent(int n) { indenter.adjustIndent(n); }
/** NanosimModel.setNodeState() requires special path names.
* Each instance name in the path must begin with the character 'x'.
public void stopSink() {
setFillDrainControl(CommandCodes.STOPSINK.bits());
}
+
/** Stop a running stopper in order to add items. Ensure that we don't
* lose the item in the fill stage.
* Exit state: block */
block(); // go = 1
// idle(); // go = 0
}
+
/** get value of the state wire preceding the fill stage */
public StateWireState getPrevStateWire() {
shiftReport(true, false);
fatal(n!=4, "Bad number of Stopper report bits: "+n);
return boolToState(cc.getOutBits(reportPath).get(PREV_STATE_IN_NDX));
}
+
/** get the value of drain stage fill wire.
* The fill wire will be interesting if we doubt that the
* scan chain works. */
shiftReport(true, false);
return cc.getOutBits(reportPath).get(FILL_STROBE_IN_NDX);
}
+
/** get value of state wire between the fill and drain stages */
public StateWireState getFillStateWire() {
shiftReport(true, false);
return boolToState(cc.getOutBits(reportPath).get(FILL_STATE_IN_NDX));
}
+
/** get value of drain stage stopped wire */
public boolean getStopped() {
shiftReport(true, false);
return cc.getOutBits(reportPath).get(STOPPED_IN_NDX);
}
+
public String getReportString() {
StringBuffer sb = new StringBuffer();
sb.append("Stopper's prev state: ");
sb.append(getStopped()+"\n");
return sb.toString();
}
+
/** construct a ProperStopper */
public ProperStopper(String propInst,
String controlChain, String dataChain,
this.clockHack = clockHack;
this.indenter = indenter;
}
+
/** Reset ProperStopper after the JTAG TRST has been pulsed */
public void resetAfterMasterClear() {
BitVector we = new BitVector(2, "write enable");
- BitVector data = new BitVector(37, "data");
- BitVector tag = new BitVector(1, "tag");
- BitVector addr = new BitVector(14, "addr");
+ BitVector packet = new BitVector(MarinaPacket.PACKET_WIDTH, "packet");
we.setFromLong(0);
- data.setFromLong(0);
- tag.setFromLong(0);
- addr.setFromLong(0);
- BitVector wdta = we.cat(data).cat(tag).cat(addr);
-
+ packet.setFromLong(0);
+ BitVector wdta = we.cat(packet);
cc.setInBits(dataPath, wdta);
}
// make sure fill stage is empty
StateWireState myState = getFillStateWire();
- fatal(myState!=StateWireState.EMPTY,
- "fill: fill stage already full");
+ fatal(myState!=StateWireState.EMPTY, "fill: fill stage already full");
if (traceFill) prln("writing data: "+new MarinaPacket(dta));
adjustIndent(-2);
prln("end fillMany");
}
+
/** Remove one item from fill stage. Return that item.
* An item must be available.
* drain() will stop cleanly.
return drainNoCheck();
}
+
/** Remove one item from fill stage. Return that item.
* Assume that an item is available.
* entry state: stop
if (traceDrain) prln("drain stopper="+name+" data="+new MarinaPacket(ans));
return ans;
}
+
/** Remove as many items as possible from the fill stage.
* drainStopperMany() will stop cleanly.
* exit state: stop */