private boolean traceFill = false;
private boolean traceDrain = false;
- private final String
- controlChain = Marina.CONTROL_CHAIN,
- controlPath,
- dataChain = Marina.DATA_CHAIN,
- dataPath,
- reportChain = Marina.REPORT_CHAIN,
- reportPath;
+ private final String controlPath, dataPath, reportPath;
+ private final ChainControl controlChain;
+ private final ChainControl dataChain;
+ private final ChainControl reportChain;
private final String captureClock;
- private final ChainControls cc;
private final ChipModel model;
private final Indenter indenter;
}
private void shiftControl(boolean readEnable, boolean writeEnable) {
- //System.out.println("start shiftcontrol");
- cc.shift(controlChain, readEnable, writeEnable);
- //System.out.println(" end shiftcontrol");
+ controlChain.shift(Marina.CONTROL_CHAIN, readEnable, writeEnable);
}
private void shiftData(boolean readEnable, boolean writeEnable) {
- //System.out.println("start shiftdata");
- cc.shift(dataChain, readEnable, writeEnable);
+ dataChain.shift(Marina.DATA_CHAIN, readEnable, writeEnable);
if (writeEnable) {
if (clockHack && model instanceof NanosimModel) {
NanosimModel nanoModel = (NanosimModel) model;
nanoModel.setNodeState(captureClock, 0);
}
}
- //System.out.println(" end shiftdata");
}
private void shiftReport(boolean readEnable, boolean writeEnable) {
- //System.out.println("start shiftreport");
- cc.shift(reportChain, readEnable, writeEnable);
- //System.out.println(" end shiftreport");
+ reportChain.shift(Marina.REPORT_CHAIN, readEnable, writeEnable);
}
private StateWireState boolToState(boolean b) {
}
public void setCounterValue(int val) {
- SubchainNode chainNode = (SubchainNode) cc.getChainControlFromPath(dataChain).findNode(pathToCounter);
+ SubchainNode chainNode = (SubchainNode) dataChain.findNode(pathToCounter);
int bitIndex = chainNode.getBitIndex();
ChainNode root = chainNode.getParentChain();
for(int i=0; i<31; i++)
// DOES NOT SHIFT THE CHAIN!!!!
public int getCounterValue() {
- SubchainNode chainNode = (SubchainNode) cc.getChainControlFromPath(dataChain).findNode(pathToCounter);
+ SubchainNode chainNode = (SubchainNode) dataChain.findNode(pathToCounter);
int bitIndex = chainNode.getBitIndex();
ChainNode root = chainNode.getParentChain();
return (int)root.getOutBits().get(bitIndex, 30).bitReverse().toLong();
BitVector fdCtl = ccc.bits(extra);
fdcstate = ccc;
fatal(fdCtl.getNumBits()!=6, "expect 6 proper stopper control bits");
- BitVector val = cc.getInBits(controlPath);
+ BitVector val = controlChain.getInBits(controlPath);
for (int i=0; i<fdCtl.getNumBits(); i++) {
val.set(i, fdCtl.get(i));
}
- cc.setInBits(controlPath, val);
+ controlChain.setInBits(controlPath, val);
shiftControl(false, true);
}
// The last bit of the control chain controls the general purpose
// output
public void setGeneralPurposeOutput(Boolean b) {
- BitVector val = cc.getInBits(controlPath);
+ BitVector val = controlChain.getInBits(controlPath);
val.set(GENERAL_PURPOSE_STROBE_NDX,b);
shiftControl(false, true);
}
/** get value of the state wire preceding the fill stage */
public StateWireState getPrevStateWire() {
shiftReport(true, false);
- BitVector b = cc.getOutBits(reportPath);
+ BitVector b = reportChain.getOutBits(reportPath);
int n = b.getNumBits();
fatal(n!=4, "Bad number of Stopper report bits: "+n);
- return boolToState(cc.getOutBits(reportPath).get(PREV_STATE_IN_NDX));
+ return boolToState(reportChain.getOutBits(reportPath).get(PREV_STATE_IN_NDX));
}
/** get the value of drain stage fill wire.
* scan chain works. */
public boolean getFillStrobe() {
shiftReport(true, false);
- return cc.getOutBits(reportPath).get(FILL_STROBE_IN_NDX);
+ return reportChain.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));
+ return boolToState(reportChain.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);
+ return reportChain.getOutBits(reportPath).get(STOPPED_IN_NDX);
}
public String getReportString() {
/** construct a ProperStopper */
public ProperStopper(String name,
String propInst,
- ChainControls cc, ChipModel model,
+ ChainControl controlChain,
+ ChainControl dataChain,
+ ChainControl reportChain,
+ ChipModel model,
boolean clockHack,
Indenter indenter,
String pathToCounter) {
this.name = name;
- this.controlPath = controlChain+'.'+propInst;
- this.dataPath = dataChain+'.'+propInst;
- this.reportPath = reportChain+'.'+propInst;
+ this.controlPath = Marina.CONTROL_CHAIN+'.'+propInst;
+ this.dataPath = Marina.DATA_CHAIN+'.'+propInst;
+ this.reportPath = Marina.REPORT_CHAIN+'.'+propInst;
this.model = model;
this.captureClock =
prefixInstNamesInPathWithX(propInst+'.'+captureClockRelPath)
+'.'+captureClockName;
- this.cc = cc;
this.clockHack = clockHack;
this.indenter = indenter;
- this.pathToCounter = dataChain+'.'+pathToCounter;
+ this.pathToCounter = Marina.DATA_CHAIN+'.'+pathToCounter;
+ this.controlChain = controlChain;
+ this.dataChain = dataChain;
+ this.reportChain = reportChain;
}
/** Reset ProperStopper after the JTAG TRST has been pulsed */
we.setFromLong(0);
packet.setFromLong(0);
BitVector wdta = we.cat(packet);
- cc.setInBits(dataPath, wdta);
+ dataChain.setInBits(dataPath, wdta);
}
/** Insert one item into the fill stage.
BitVector wrEn = new BitVector(2, "write enable");
wrEn.setFromLong(3);
- cc.setInBits(dataPath, wrEn.cat(dta));
+ dataChain.setInBits(dataPath, wrEn.cat(dta));
shiftData(false, true);
fill(); // fill = 1
// if data chain is shifted in the future, don't write!
wrEn.setFromLong(0);
- cc.setInBits(dataPath, wrEn.cat(dta));
+ dataChain.setInBits(dataPath, wrEn.cat(dta));
adjustIndent(-2);
if (traceFill) prln("End fill");
shiftData(true, false);
// strip the two write enable bits
- BitVector ans = cc.getOutBits(dataPath).get(2, 52);
+ BitVector ans = dataChain.getOutBits(dataPath).get(2, 52);
idle(); // block = 1
clear(); // clear = 1