+++ /dev/null
-package edu.berkeley.fleet.marina;
-
-import java.util.HashMap;
-import java.util.Map;
-import com.sun.electric.tool.simulation.test.*;
-
-/** One or more ChainControl. If we have a JTAG controller then one
- * ChainControl. If we don't have a JTAG controller then we need
- * one ChainControl per scan chain.
- *
- * ChainControls duplicates much of the ChainControl interface. It
- * allows the testing code to remain oblivious of whether or not the
- * JTAG controller exists.
- */
-public class ChainControls {
- private Map<String,ChainControl> chainToControl =
- new HashMap<String,ChainControl>();
-
- /** The path has the form:
- * chipName.chainName.instanceName1.instanceName2 ...
- */
- public ChainControl getChainControlFromPath(String path) {
- for (String chainName : chainToControl.keySet()) {
- if (path.startsWith(chainName)) return chainToControl.get(chainName);
- }
- MarinaTest.fatal(true, "Can't find chain for path: "+path);
- return null;
- }
- public void addChain(String chain, ChainControl control) {
- chainToControl.put(chain, control);
- }
-
- //--------------------------------------------------------------------------------
- // Replicate interface of ChainControl
- public BitVector getInBits(String path) {
- ChainControl cc = getChainControlFromPath(path);
- return cc.getInBits(path);
- }
- public BitVector getOutBits(String path) {
- ChainControl cc = getChainControlFromPath(path);
- return cc.getOutBits(path);
- }
- public void setInBits(String path, BitVector bits) {
- ChainControl cc = getChainControlFromPath(path);
- cc.setInBits(path, bits);
- }
- public void shift(String chainName, boolean readEnable, boolean writeEnable) {
- ChainControl cc = getChainControlFromPath(chainName);
- cc.shift(chainName, readEnable, writeEnable);
- }
- public void resetInBits() {
- for (String chainName : chainToControl.keySet()) {
- ChainControl cc = chainToControl.get(chainName);
- cc.resetInBits();
- }
- }
-}
public InstructionStopper(String name,
String propInst,
- ChainControls cc, ChipModel model,
+ ChainControl controlChain,
+ ChainControl dataChain,
+ ChainControl reportChain,
+ ChipModel model,
boolean clockHack,
Indenter indenter, String counterPath) {
- super(name, propInst, cc, model, clockHack, indenter, counterPath);
+ super(name, propInst, controlChain, dataChain, reportChain, model, clockHack, indenter, counterPath);
}
/** put one Instruction into InstructionStopper */
private int value;
private Ilc() {
shiftReport(true, false);
- BitVector odd = cc.getOutBits(REPORT_CHAIN+"."+ILC_PATH_ODD).bitReverse().not();
- BitVector even = cc.getOutBits(REPORT_CHAIN+"."+ILC_PATH_EVEN).bitReverse().not();
+ BitVector odd = reportChain.getOutBits(REPORT_CHAIN+"."+ILC_PATH_ODD).bitReverse().not();
+ BitVector even = reportChain.getOutBits(REPORT_CHAIN+"."+ILC_PATH_EVEN).bitReverse().not();
BitVector ret = new BitVector(8, "olc");
for(int i=0; i<4; i++) {
ret.set(i*2+1, odd.get(i));
// The name of the scan chain
// The instance path, from the top cell of the netlist, of the instance of infinityWithCover
- public final ChainControls cc; // specifies the scan chain
+ public final ChainControl controlChain;
+ public final ChainControl dataChain;
+ public final ChainControl dukeChain;
+ public final ChainControl reportChain;
+
private final ChipModel model;
public final ProperStopper data;
public final InstructionStopper instrIn;
/** Shift the report scan chain */
public void shiftReport(boolean readEnable, boolean writeEnable) {
- cc.shift(REPORT_CHAIN, readEnable, writeEnable);
+ reportChain.shift(REPORT_CHAIN, readEnable, writeEnable);
}
/** Shift the report scan chain */
private void shiftControl(boolean readEnable, boolean writeEnable) {
- cc.shift(CONTROL_CHAIN, readEnable, writeEnable);
+ controlChain.shift(CONTROL_CHAIN, readEnable, writeEnable);
}
/** Shift the data scan chain */
private void shiftData(boolean readEnable, boolean writeEnable) {
- cc.shift(DATA_CHAIN, readEnable, writeEnable);
+ dataChain.shift(DATA_CHAIN, readEnable, writeEnable);
}
/** Shift the data scan chain */
public void shiftDuke(boolean readEnable, boolean writeEnable) {
- cc.shift(DUKE_CHAIN, readEnable, writeEnable);
+ dukeChain.shift(DUKE_CHAIN, readEnable, writeEnable);
}
- public Marina(ChainControls cc, ChipModel model, boolean clockHack, Indenter indenter) {
- this.cc = cc;
+ public Marina(ChainControl controlChain,
+ ChainControl dataChain,
+ ChainControl dukeChain,
+ ChainControl reportChain,
+ ChipModel model, boolean clockHack, Indenter indenter) {
+ this.controlChain = controlChain;
+ this.dataChain = dataChain;
+ this.dukeChain = dukeChain;
+ this.reportChain = reportChain;
this.model = model;
this.indenter = indenter;
data = new ProperStopper("north fifo",
prefix+"northFif@1.fillDrai@1.properSt@1",
- cc, model, clockHack, indenter,
+ controlChain,
+ dataChain,
+ reportChain,
+ model, clockHack, indenter,
prefix+"northFif@1.fillDrai@1.instruct@0.cntScnTh@1.cntScnOn@1");
instrIn = new InstructionStopper("south fifo",
prefix+"southFif@1.tapPropS@1.properSt@1",
- cc, model, clockHack, indenter,
+ controlChain,
+ dataChain,
+ reportChain,
+ model, clockHack, indenter,
prefix+"southFif@1.tapPropS@1.instruct@0.cntScnTh@1.cntScnOn@1");
}
public void stopAndResetCounters() {
instrIn.setCounterEnable(false);
data.setCounterEnable(false);
- cc.shift(DATA_CHAIN, true, false);
+ dataChain.shift(DATA_CHAIN, true, false);
northCount = data.getCounterValue();
southCount = instrIn.getCounterValue();
data.setCounterValue(0);
// If you forget, then the inBits member initializes
// with random data. Then when you do your first write,
// some bits are written randomly.
- cc.resetInBits();
+ dataChain.resetInBits();
+ dukeChain.resetInBits();
+ reportChain.resetInBits();
+ controlChain.resetInBits();
// For reset, I want to clear all the stoppers simultaneously
data.clear();
if (omegaCounter) {
BitVector bits = null;
for(int i=0; i<4; i++) {
- BitVector x = cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH_KESSEL+i);
+ BitVector x = reportChain.getOutBits(REPORT_CHAIN+"."+OLC_PATH_KESSEL+i);
//System.out.println("bits are: " + x);
bits = bits==null ? x : bits.cat(x);
}
} else if (kesselsCounter) {
BitVector bits = null;
for(int i=0; i<4; i++) {
- BitVector x = cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH_KESSEL+i);
+ BitVector x = reportChain.getOutBits(REPORT_CHAIN+"."+OLC_PATH_KESSEL+i);
//System.out.println("bits are: " + x);
bits = bits==null ? x : bits.cat(x);
}
);
return (first+second);
} else {
- BitVector odd = cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH_ODD).bitReverse();
- BitVector even = cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH_EVEN).bitReverse();
+ BitVector odd = reportChain.getOutBits(REPORT_CHAIN+"."+OLC_PATH_ODD).bitReverse();
+ BitVector even = reportChain.getOutBits(REPORT_CHAIN+"."+OLC_PATH_EVEN).bitReverse();
odd = odd.not();
even = even.not();
BitVector bv = new BitVector(6, "olc");
/** Get the A flag */
public boolean getFlagA() {
shiftReport(true, false);
- return cc.getOutBits(REPORT_CHAIN+"."+FLAGS_PATH).get(A_FLAG_NDX);
+ return reportChain.getOutBits(REPORT_CHAIN+"."+FLAGS_PATH).get(A_FLAG_NDX);
}
/** Get the B flag */
public boolean getFlagB() {
shiftReport(true, false);
- return cc.getOutBits(REPORT_CHAIN+"."+FLAGS_PATH).get(B_FLAG_NDX);
+ return reportChain.getOutBits(REPORT_CHAIN+"."+FLAGS_PATH).get(B_FLAG_NDX);
}
/** return value of instruction counter. Instruction counter counts
* the instructions flowing through 1/2 of alternating FIFO.
* regardless of readEnable or writeEnable! */
public long getInstructionCounter() {
shiftData(true, false);
- BitVector count = cc.getOutBits(DATA_CHAIN+"."+INSTRUCTION_COUNTER_PATH);
+ BitVector count = dataChain.getOutBits(DATA_CHAIN+"."+INSTRUCTION_COUNTER_PATH);
int sz = count.getNumBits();
MarinaTest.fatal(sz!=COUNTER_LENGTH, "wrong number of counter bits: "+sz+
" expected: "+COUNTER_LENGTH);
* regardless of readEnable or writeEnable! */
public long getDataCounter() {
shiftData(true, false);
- BitVector count = cc.getOutBits(DATA_CHAIN+"."+DATA_COUNTER_PATH);
+ BitVector count = dataChain.getOutBits(DATA_CHAIN+"."+DATA_COUNTER_PATH);
int sz = count.getNumBits();
MarinaTest.fatal(sz!=COUNTER_LENGTH, "wrong number of counter bits: "+sz+
" expected: "+COUNTER_LENGTH);
/** Enable the transmission of instructions from the instruction
* ring test structure to the EPI FIFO. */
public void enableInstructionSend(boolean b) {
- BitVector bv = cc.getInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
+ BitVector bv = controlChain.getInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
bv.set(INSTRUCTION_SEND_NDX, b);
- cc.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv);
+ controlChain.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv);
shiftControl(false, true);
}
/** Enable the recirculation of instructions within the South FIFO */
public void enableInstructionRecirculate(boolean b) {
- BitVector bv = cc.getInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
+ BitVector bv = controlChain.getInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
bv.set(INSTRUCTION_RECIRCULATE_NDX, b);
- cc.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv);
+ controlChain.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv);
shiftControl(false, true);
}
/** get the number of tokens in the token FIFO.
public int getNumTokens() {
shiftReport(true, false);
// get the token successor and token FIFO wires
- BitVector bv = cc.getOutBits(REPORT_CHAIN+"."+TOK_FIFO_PATH);
+ BitVector bv = reportChain.getOutBits(REPORT_CHAIN+"."+TOK_FIFO_PATH);
int sz = bv.getNumBits();
MarinaTest.fatal(sz!=3, "wrong token FIFO size: "+sz+" expected: 3");
// get the token predecessor wire
- BitVector pred = cc.getOutBits(REPORT_CHAIN+"."+TOK_PRED_PATH);
+ BitVector pred = reportChain.getOutBits(REPORT_CHAIN+"."+TOK_PRED_PATH);
sz = pred.getNumBits();
MarinaTest.fatal(sz!=1, "wrong token predecessor size: "+sz+" expected: 1");
*/
tester.printInfo = false;
- ChainControls ccs = new ChainControls();
PowerChannel pc = new ManualPowerChannel("pc", false);
/*
JtagTester testerD, testerR, testerC;
cc = new ChainControl(SCAN_CHAIN_XML, tester, 1.8f, khz);
cc.noTestSeverity = Infrastructure.SEVERITY_NOMESSAGE;
ct = new ChainTest(cc, pc);
- ccs.addChain(Marina.DATA_CHAIN, cc);
- ccs.addChain(Marina.REPORT_CHAIN, cc);
- ccs.addChain(Marina.CONTROL_CHAIN, cc);
- ccs.addChain(Marina.DUKE_CHAIN, cc);
- marina = new Marina(ccs, model, !cmdArgs.jtagShift, indenter);
+ marina = new Marina(cc, cc, cc, cc, model, !cmdArgs.jtagShift, indenter);
marina.mc0=mc0;
marina.mc1=mc1;
case 3040: loadEveryValueOLC(marina); break;
case 6666: {
SubchainNode chainNode =
- (SubchainNode)marina.cc.getChainControlFromPath(Marina.DUKE_CHAIN)
+ (SubchainNode)marina.dukeChain
.findNode("marina.duke.marinaGu@0.dukeAll@1.dukePart@0.ring37sW@1.scanner@0.scanFx1@1.scanCell@3");
int bitIndex = chainNode.getBitIndex();
ChainNode root = chainNode.getParentChain();
ProperStopper bottomRing;
ProperStopper topRing;
- public MergeExperiment(ChainControls cc, ChipModel model, boolean clockHack, Indenter indenter) {
+ public MergeExperiment(ChipModel model, boolean clockHack, Indenter indenter) {
bottomRing =
new ProperStopper("bottom ring",
"marinaGu@0.outDockW@.compareW@1.marinaCo@0.bottomFI@0.tapPropS@1.properSt@1",
- cc,
+
model,
clockHack,
indenter,
topRing =
new ProperStopper("top ring",
"marinaGu@0.outDockW@.compareW@1.marinaCo@0.topFIFO0@.tapPropS@1.properSt@1",
- cc,
+
model,
clockHack,
indenter,
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