* JTAG controller exists.
*/
public class ChainControls {
- private Map<String,ChainControl> chainToControl =
- new HashMap<String,ChainControl>();
-
- /** The path has the form:
- * chipName.chainName.instanceName1.instanceName2 ...
- */
- private 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();
- }
- }
+ private Map<String,ChainControl> chainToControl =
+ new HashMap<String,ChainControl>();
+
+ /** The path has the form:
+ * chipName.chainName.instanceName1.instanceName2 ...
+ */
+ private 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 class Counter {
- private final String dataChain, dataPath;
- private final ChainControl cc;
- public Counter(String cntrInst, String dataChain, ChainControl cc) {
- this.dataChain = dataChain;
- this.dataPath = dataChain+'.'+cntrInst;
- this.cc = cc;
- }
- /** Read a new value from the Counter */
- public long getCount() {
- cc.shift(dataChain, true, false);
- return 0;
- // do nothing because I counter schematics don't yet exist
- //long cnt = cc.getOutBits(dataPath).bitReverse().not().toLong();
- }
- /** Set counter value to zero */
- public void clearCount() {
-
- }
-
+ private final String dataChain, dataPath;
+ private final ChainControl cc;
+ public Counter(String cntrInst, String dataChain, ChainControl cc) {
+ this.dataChain = dataChain;
+ this.dataPath = dataChain+'.'+cntrInst;
+ this.cc = cc;
+ }
+ /** Read a new value from the Counter */
+ public long getCount() {
+ cc.shift(dataChain, true, false);
+ return 0;
+ // do nothing because I counter schematics don't yet exist
+ //long cnt = cc.getOutBits(dataPath).bitReverse().not().toLong();
+ }
+ /** Set counter value to zero */
+ public void clearCount() {
+
+ }
+
}
import com.sun.async.test.JtagTester;
public interface Design {
- public void masterClear(JtagTester tester);
+ public void masterClear(JtagTester tester);
}
package com.sun.vlsi.chips.marina.test;
public class Indenter {
- private static char NL = '\n';
- private int indent = 0;
- private boolean beginLine = true;
-
- private void spaces(int n) {
- StringBuffer sb = new StringBuffer();
- for (int i=0; i<n; i++) sb.append(" ");
- System.out.print(sb.toString());
- }
- private void indentIfNeeded() {
- if (beginLine) spaces(indent);
- beginLine = false;
- }
- private void printLines(String msg) {
- while (true) {
- int nl = msg.indexOf(NL);
- if (nl==-1) {
- indentIfNeeded();
- System.out.print(msg);
- return;
- } else {
- // found a new line.
- String line = msg.substring(0, nl);
- indentIfNeeded();
- System.out.println(line);
- beginLine = true;
- if (nl==msg.length()-1) {
- // nothing left after the newline
- return;
- }
- msg = msg.substring(nl+1);
- }
- }
- }
- public void prln(String msg) {printLines(msg+NL);}
- public void pr(String msg) {printLines(msg);}
- public void adjustIndent(int n) {
- indent += n;
- }
+ private static char NL = '\n';
+ private int indent = 0;
+ private boolean beginLine = true;
+
+ private void spaces(int n) {
+ StringBuffer sb = new StringBuffer();
+ for (int i=0; i<n; i++) sb.append(" ");
+ System.out.print(sb.toString());
+ }
+ private void indentIfNeeded() {
+ if (beginLine) spaces(indent);
+ beginLine = false;
+ }
+ private void printLines(String msg) {
+ while (true) {
+ int nl = msg.indexOf(NL);
+ if (nl==-1) {
+ indentIfNeeded();
+ System.out.print(msg);
+ return;
+ } else {
+ // found a new line.
+ String line = msg.substring(0, nl);
+ indentIfNeeded();
+ System.out.println(line);
+ beginLine = true;
+ if (nl==msg.length()-1) {
+ // nothing left after the newline
+ return;
+ }
+ msg = msg.substring(nl+1);
+ }
+ }
+ }
+ public void prln(String msg) {printLines(msg+NL);}
+ public void pr(String msg) {printLines(msg);}
+ public void adjustIndent(int n) {
+ indent += n;
+ }
}
/** InstructionStopper is a scaffold that lets us create a 36 bit propperStopper
* by using a 52 bit propperStopper and throwing away the unused bits. */
public class InstructionStopper extends ProperStopper {
- public static final BitVector TORPEDO;
- public static final int INSTR_SZ = 36;
+ public static final BitVector TORPEDO;
+ public static final int INSTR_SZ = 36;
public static final MarinaFleet MARINA = new MarinaFleet();
public static final Dock DOCK = MARINA.getOnlyInputDock();
static {
- BitVector d = new BitVector(37, "token"); d.setFromLong(0);
- BitVector t = new BitVector(1, "token"); t.setFromLong(0);
- BitVector a = new BitVector(14, "addr"); a.setFromLong(0);
+ BitVector d = new BitVector(37, "token"); d.setFromLong(0);
+ BitVector t = new BitVector(1, "token"); t.setFromLong(0);
+ BitVector a = new BitVector(14, "addr"); a.setFromLong(0);
TORPEDO = t.cat(a).cat(d);
}
- // Convert a Berkeley BitVector into a Sun BitVector
- private BitVector berkToSun(edu.berkeley.fleet.api.BitVector berkBits) {
+ // Convert a Berkeley BitVector into a Sun BitVector
+ private BitVector berkToSun(edu.berkeley.fleet.api.BitVector berkBits) {
BitVector sunBits = new BitVector(INSTR_SZ, "instr");
for(int i=0; i<INSTR_SZ; i++) sunBits.set(i, berkBits.get(i));
return sunBits;
- }
- private String formatDecodedInstr(BitVector dta) {
- BitVector instr = dta.get(0, INSTR_SZ).bitReverse();
- StringBuffer sb = new StringBuffer();
- String pred = instr.get(0, 6) .getState();
- String rq = instr.get(6, 1).getState();
- String unused2 = instr.get(7, 2).getState();
- String op = instr.get(9, 6).getState();
- String tail = instr.get(15, 1).getState();
- String rest = instr.get(16, 20).getState();
-
- return pred+" "+rq+" "+unused2+" "+op+" "+tail+" "+rest;
- }
- public InstructionStopper(String propInst,
- String controlChain, String dataChain,
- String reportChain,
- ChainControls cc, ChipModel model,
- boolean clockHack,
- Indenter indenter) {
- super(propInst, controlChain, dataChain, reportChain, cc, model, clockHack, indenter);
- }
- @Override
- public void fill(BitVector instr) {
- // allow user to pass in complete item: data + token + addr
- if (instr.getNumBits()==(37+1+14)) {super.fill(instr); return;}
-
- int n = instr.getNumBits();
- fatal(n!=INSTR_SZ, "InstructionStopper.fill: wrong num bits: "+n+", expect: "+INSTR_SZ);
- fatal(INSTR_SZ>37, "Instructions can't be more than 37 bits");
- if (INSTR_SZ<37) {
- BitVector pad = new BitVector(37-INSTR_SZ, "pad");
- pad.setFromLong(0);
- instr = instr.cat(pad);
- }
- BitVector t = new BitVector(1, "token"); t.setFromLong(1);
- BitVector a = new BitVector(14, "addr"); a.setFromLong(0);
- //super.fill(instr.cat(t).cat(a));
- super.fill(t.cat(a).cat(instr));
}
- @Override
- public BitVector drain() {
- BitVector dta = super.drain();
- return dta.get(0, INSTR_SZ);
- }
- @Override
- public String formatDataTokAddr(BitVector dta) {
- return formatDecodedInstr(dta);
- }
- /** put one Instruction into InstructionStopper */
- public void fill(Instruction instr) {
- fill(berkToSun(MARINA.encodeInstruction(DOCK, instr)));
- }
+ private String formatDecodedInstr(BitVector dta) {
+ BitVector instr = dta.get(0, INSTR_SZ).bitReverse();
+ StringBuffer sb = new StringBuffer();
+ String pred = instr.get(0, 6) .getState();
+ String rq = instr.get(6, 1).getState();
+ String unused2 = instr.get(7, 2).getState();
+ String op = instr.get(9, 6).getState();
+ String tail = instr.get(15, 1).getState();
+ String rest = instr.get(16, 20).getState();
+
+ return pred+" "+rq+" "+unused2+" "+op+" "+tail+" "+rest;
+ }
+ public InstructionStopper(String propInst,
+ String controlChain, String dataChain,
+ String reportChain,
+ ChainControls cc, ChipModel model,
+ boolean clockHack,
+ Indenter indenter) {
+ super(propInst, controlChain, dataChain, reportChain, cc, model, clockHack, indenter);
+ }
+ @Override
+ public void fill(BitVector instr) {
+ // allow user to pass in complete item: data + token + addr
+ if (instr.getNumBits()==(37+1+14)) {super.fill(instr); return;}
+
+ int n = instr.getNumBits();
+ fatal(n!=INSTR_SZ, "InstructionStopper.fill: wrong num bits: "+n+", expect: "+INSTR_SZ);
+ fatal(INSTR_SZ>37, "Instructions can't be more than 37 bits");
+ if (INSTR_SZ<37) {
+ BitVector pad = new BitVector(37-INSTR_SZ, "pad");
+ pad.setFromLong(0);
+ instr = instr.cat(pad);
+ }
+ BitVector t = new BitVector(1, "token"); t.setFromLong(1);
+ BitVector a = new BitVector(14, "addr"); a.setFromLong(0);
+ //super.fill(instr.cat(t).cat(a));
+ super.fill(t.cat(a).cat(instr));
+ }
+ @Override
+ public BitVector drain() {
+ BitVector dta = super.drain();
+ return dta.get(0, INSTR_SZ);
+ }
+ @Override
+ public String formatDataTokAddr(BitVector dta) {
+ return formatDecodedInstr(dta);
+ }
+ /** put one Instruction into InstructionStopper */
+ public void fill(Instruction instr) {
+ fill(berkToSun(MARINA.encodeInstruction(DOCK, instr)));
+ }
}
public static final String DATA_CHAIN = "marina.marina_data";
public static final String CONTROL_CHAIN = "marina.marina_control";
public static final String REPORT_CHAIN = "marina.marina_report";
-
+
private static final String OLC_PATH =
"dataPath@0.ringSkip@1.skipCoun@1.skipCoun@0.scanKx6@0";
private static final String ILC_PATH =
private static final int COUNTER_LENGTH = 34;
private static final int INSTRUCTION_SEND_NDX = 1;
private static final int INSTRUCTION_RECIRCULATE_NDX = 0;
-
- private static final int A_FLAG_NDX = 0;
- private static final int B_FLAG_NDX = 1;
-
- public static final int SOUTH_RING_CAPACITY = 11;
-
- // ILC appears in scan chain as "count[1:6], zLo, i, dLo"
- public class Ilc {
- // value is bit reversed and complemented
- private int value;
- private Ilc() {
- shiftReport(true, false);
- value = (int) cc.getOutBits(REPORT_CHAIN+"."+ILC_PATH).bitReverse().not().toLong();
- }
- /** Get the inner loop counter done bit. */
- public boolean getDone() {
- return (value & 0x100) != 0;
- }
- /** Get the inner loop counter infinity bit */
- public boolean getInfinity() {
- return (value & 0x80) == 0;
- }
- /** Get the inner loop counter zero bit. If the zero bit is true
- * then the hardware considers the inner loop counter to be zero
- * regardless of the state of the count bits */
- public boolean getZero() {
- return (value & 0x40) != 0;
- }
- /** Get the 6 bits of count of the inner loop counter */
- public int getCount() {
- return value & 0x3f;
- }
- }
-
- private final Indenter indenter;
+
+ private static final int A_FLAG_NDX = 0;
+ private static final int B_FLAG_NDX = 1;
+
+ public static final int SOUTH_RING_CAPACITY = 11;
+
+ // ILC appears in scan chain as "count[1:6], zLo, i, dLo"
+ public class Ilc {
+ // value is bit reversed and complemented
+ private int value;
+ private Ilc() {
+ shiftReport(true, false);
+ value = (int) cc.getOutBits(REPORT_CHAIN+"."+ILC_PATH).bitReverse().not().toLong();
+ }
+ /** Get the inner loop counter done bit. */
+ public boolean getDone() {
+ return (value & 0x100) != 0;
+ }
+ /** Get the inner loop counter infinity bit */
+ public boolean getInfinity() {
+ return (value & 0x80) == 0;
+ }
+ /** Get the inner loop counter zero bit. If the zero bit is true
+ * then the hardware considers the inner loop counter to be zero
+ * regardless of the state of the count bits */
+ public boolean getZero() {
+ return (value & 0x40) != 0;
+ }
+ /** Get the 6 bits of count of the inner loop counter */
+ public int getCount() {
+ return value & 0x3f;
+ }
+ }
+
+ private final Indenter indenter;
- // The name of the scan chain
- // The instance path, from the top cell of the netlist, of the instance of infinityWithCover
+ // The name of the scan chain
+ // The instance path, from the top cell of the netlist, of the instance of infinityWithCover
private final ChainControls cc; // specifies the scan chain
private final ChipModel model;
public final ProperStopper data;
public final InstructionStopper instrIn;
- private void prln(String msg) {indenter.prln(msg);}
- private void pr(String msg) {indenter.pr(msg);}
+ private void prln(String msg) {indenter.prln(msg);}
+ private void pr(String msg) {indenter.pr(msg);}
/** Shift the report scan chain */
- private void shiftReport(boolean readEnable, boolean writeEnable) {
- cc.shift(REPORT_CHAIN, readEnable, writeEnable);
- }
+ private void shiftReport(boolean readEnable, boolean writeEnable) {
+ cc.shift(REPORT_CHAIN, readEnable, writeEnable);
+ }
/** Shift the report scan chain */
- private void shiftControl(boolean readEnable, boolean writeEnable) {
- cc.shift(CONTROL_CHAIN, readEnable, writeEnable);
- }
-
- /** Shift the data scan chain */
- private void shiftData(boolean readEnable, boolean writeEnable) {
- cc.shift(DATA_CHAIN, readEnable, writeEnable);
- }
+ private void shiftControl(boolean readEnable, boolean writeEnable) {
+ cc.shift(CONTROL_CHAIN, readEnable, writeEnable);
+ }
+
+ /** Shift the data scan chain */
+ private void shiftData(boolean readEnable, boolean writeEnable) {
+ cc.shift(DATA_CHAIN, readEnable, writeEnable);
+ }
- public Marina(ChainControls cc, ChipModel model, boolean clockHack, Indenter indenter) {
+ public Marina(ChainControls cc, ChipModel model, boolean clockHack, Indenter indenter) {
this.cc = cc;
this.model = model;
this.indenter = indenter;
data = new ProperStopper("northFif@1.fillDrai@1.properSt@1",
- CONTROL_CHAIN,
- DATA_CHAIN,
- REPORT_CHAIN,
- cc, model, clockHack, indenter);
+ CONTROL_CHAIN,
+ DATA_CHAIN,
+ REPORT_CHAIN,
+ cc, model, clockHack, indenter);
instrIn = new InstructionStopper("southFif@1.tapPropS@1.properSt@1",
- CONTROL_CHAIN,
- DATA_CHAIN,
- REPORT_CHAIN,
- cc, model, clockHack, indenter);
+ CONTROL_CHAIN,
+ DATA_CHAIN,
+ REPORT_CHAIN,
+ cc, model, clockHack, indenter);
}
public void masterClear() {
- final double WIDTH = 10; // ns
- NanosimModel nModel = (NanosimModel) model;
- // Put a high going pulse on the internal chip master clear signal
+ final double WIDTH = 10; // ns
+ NanosimModel nModel = (NanosimModel) model;
+ // Put a high going pulse on the internal chip master clear signal
nModel.setNodeVoltage("sid[9]",1.0);
nModel.setNodeVoltage("sic[9]",1.0);
nModel.setNodeVoltage("sir[9]",1.0);
resetAfterMasterClear();
}
private void resetAfterMasterClear() {
- // The following call to ChainControl.resetInBits() is vital!
- // 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();
+ // The following call to ChainControl.resetInBits() is vital!
+ // 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();
- // For reset, I want to clear all the stoppers simultaneously
- data.clear();
- //tokOut.clear();
- instrIn.clear();
-
- data.stop();
- //tokOut.stop();
- instrIn.stop();
-
- data.resetAfterMasterClear();
- //tokOut.resetAfterMasterClear();
- instrIn.resetAfterMasterClear();
+ // For reset, I want to clear all the stoppers simultaneously
+ data.clear();
+ //tokOut.clear();
+ instrIn.clear();
+
+ data.stop();
+ //tokOut.stop();
+ instrIn.stop();
+
+ data.resetAfterMasterClear();
+ //tokOut.resetAfterMasterClear();
+ instrIn.resetAfterMasterClear();
}
/** Get the 6 bit outer loop counter. */
public int getOLC() {
- shiftReport(true, false);
- return (int) cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH).bitReverse().not().toLong();
+ shiftReport(true, false);
+ return (int) cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH).bitReverse().not().toLong();
}
/** Get the 7 bit inner loop counter. The MSB is the zero bit.
* The low order 6 bits are the count */
public Ilc getILC() {
- return new Ilc();
+ return new Ilc();
}
- /** Get the A flag */
+ /** Get the A flag */
public boolean getFlagA() {
- shiftReport(true, false);
- return cc.getOutBits(REPORT_CHAIN+"."+FLAGS_PATH).get(A_FLAG_NDX);
+ shiftReport(true, false);
+ return cc.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);
+ shiftReport(true, false);
+ return cc.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.
* Caution: instruction counter is written by all scans,
* regardless of readEnable or writeEnable! */
public long getInstructionCounter() {
- shiftData(true, false);
- BitVector count = cc.getOutBits(DATA_CHAIN+"."+INSTRUCTION_COUNTER_PATH);
- int sz = count.getNumBits();
- MarinaTest.fatal(sz!=COUNTER_LENGTH, "wrong number of counter bits: "+sz+
- " expected: "+COUNTER_LENGTH);
- return count.bitReverse().toLong();
+ shiftData(true, false);
+ BitVector count = cc.getOutBits(DATA_CHAIN+"."+INSTRUCTION_COUNTER_PATH);
+ int sz = count.getNumBits();
+ MarinaTest.fatal(sz!=COUNTER_LENGTH, "wrong number of counter bits: "+sz+
+ " expected: "+COUNTER_LENGTH);
+ return count.bitReverse().toLong();
}
/** return value of data counter. Data counter counts items flowing
* through drain stage of data proper stopper.
* Caution: data counter is written by all scans,
* regardless of readEnable or writeEnable! */
public long getDataCounter() {
- shiftData(true, false);
- BitVector count = cc.getOutBits(DATA_CHAIN+"."+DATA_COUNTER_PATH);
- int sz = count.getNumBits();
- MarinaTest.fatal(sz!=COUNTER_LENGTH, "wrong number of counter bits: "+sz+
- " expected: "+COUNTER_LENGTH);
- return count.bitReverse().toLong();
+ shiftData(true, false);
+ BitVector count = cc.getOutBits(DATA_CHAIN+"."+DATA_COUNTER_PATH);
+ int sz = count.getNumBits();
+ MarinaTest.fatal(sz!=COUNTER_LENGTH, "wrong number of counter bits: "+sz+
+ " expected: "+COUNTER_LENGTH);
+ return count.bitReverse().toLong();
}
/** Fill the "North" Fifo ring */
public void fillNorthProperStopper(MarinaPacket mp) {
/** 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);
- bv.set(INSTRUCTION_SEND_NDX, b);
- cc.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv);
- shiftControl(false, true);
+ BitVector bv = cc.getInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
+ bv.set(INSTRUCTION_SEND_NDX, b);
+ cc.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);
- bv.set(INSTRUCTION_RECIRCULATE_NDX, b);
- cc.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv);
- shiftControl(false, true);
+ BitVector bv = cc.getInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
+ bv.set(INSTRUCTION_RECIRCULATE_NDX, b);
+ cc.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv);
+ shiftControl(false, true);
}
/** get the number of tokens in the token FIFO.
* This includes the Token successor wire, the token FIFO wires,
* and Token predecessor wire.
* Master clear clears 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);
- 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);
- sz = pred.getNumBits();
- MarinaTest.fatal(sz!=1, "wrong token predecessor size: "+sz+" expected: 1");
+ shiftReport(true, false);
+ // get the token successor and token FIFO wires
+ BitVector bv = cc.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);
+ sz = pred.getNumBits();
+ MarinaTest.fatal(sz!=1, "wrong token predecessor size: "+sz+" expected: 1");
- // concatenate them
- bv = bv.cat(pred);
- sz = bv.getNumBits();
- prln("Token state wires: "+bv.getState());
-
- int nbTok = 0;
- for (int i=0; i<sz; i++) if (bv.get(i)) nbTok++;
- return nbTok;
+ // concatenate them
+ bv = bv.cat(pred);
+ sz = bv.getNumBits();
+ prln("Token state wires: "+bv.getState());
+
+ int nbTok = 0;
+ for (int i=0; i<sz; i++) if (bv.get(i)) nbTok++;
+ return nbTok;
}
/** Configure the test probe so it measures the throughput of
* the north data FIFO. The test probe frequency is 8192
* times slower than the FIFO throughput. This control has
* highest priority. */
public void probeDataCounter(Boolean b) {
- data.setGeneralPurposeOutput(b);
+ data.setGeneralPurposeOutput(b);
}
/** Configure the test probe so it measures the throughput of
* the alternating instruction FIFO. The test probe frequency is
* probeInstructionCounter(true)
*/
public void enableInstructionCounter(Boolean b) {
- instrIn.setGeneralPurposeOutput(b);
+ instrIn.setGeneralPurposeOutput(b);
}
}
* Tests for Marina
*/
public class MarinaTest {
- //-------------------------- constants -----------------------------------
- private static final String SCAN_CHAIN_XML = "marina.xml";
- private static final String NET_LIST = "marina.spi";
+ //-------------------------- constants -----------------------------------
+ private static final String SCAN_CHAIN_XML = "marina.xml";
+ private static final String NET_LIST = "marina.spi";
- public static final int INSTR_SZ = 36;
+ public static final int INSTR_SZ = 36;
public static final int INDEX_OF_ADDRESS_BIT_COPIED_TO_C_FLAG_WHEN_DC_EQUALS_ONE = 13;
public static final int INDEX_OF_ADDRESS_BIT_COPIED_TO_C_FLAG_WHEN_DC_EQUALS_ZERO = 0;
-
- public static final Dock DOCK = InstructionStopper.DOCK;
+
+ public static final Dock DOCK = InstructionStopper.DOCK;
public static final Instruction.Set.FlagFunction CLEAR_FLAG
- = Instruction.Set.FlagFunction.ZERO;
+ = Instruction.Set.FlagFunction.ZERO;
public static final Instruction.Set.FlagFunction SET_FLAG
= Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagA)
- .add(Predicate.NotFlagA);
+ .add(Predicate.NotFlagA);
public static final Instruction.Set.FlagFunction A_FLAG
= Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagA);
public static final Instruction.Set.FlagFunction B_FLAG
- = Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagB);
+ = Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagB);
- // COLUMN_LATENCY is a delay that is larger than the latency through an Infinity column
- private static final int COLUMN_LATENCY = 10; // nanoseconds
+ // COLUMN_LATENCY is a delay that is larger than the latency through an Infinity column
+ private static final int COLUMN_LATENCY = 10; // nanoseconds
// Officially, this should be the number of requeueing no-ops that
// INSTRUCTION_IN_SATURATION_AMOUNT. Increasing it may slow the tests down, but
// will never cause them to operate incorrectly.
private static final int MORE_THAN_INSTRUCTION_IN_SATURATION_AMOUNT = 25;
-
+
// This is the number of items which can be in the instruction
// fifo ring WITHOUT causing it to stop circulating.
private static final int INSTRUCTION_RING_CAPACITY = 13;
-
+
// Officially, this should be the number of data items which can
// be sent from the dock while the "data" proper stopper is in
// the "stopped" state
// proper stopper
/*
FIXME: what is the correct value here?
- private static final int DATA_OUT_SATURATION_AMOUNT = XXX;
+ private static final int DATA_OUT_SATURATION_AMOUNT = XXX;
*/
// This is some number which is greater than
// DATA_OUT_SATURATION_AMOUNT, but less than the capacity of the
// instruction fifo.
private static final int MORE_THAN_DATA_OUT_SATURATION_AMOUNT = 10;
-
- // Nominal cycle time assuming 4 GHz throughput
- private static final double CYCLE_TIME_NS = 0.250;
-
- //-------------------------------- types ---------------------------------
-
- //-------------------------- private data --------------------------------
- private static long startTime;
-
- private Indenter indenter = new Indenter();
- private Marina marina;
- private ChipModel model;
- //private ChainControl cc;
- //private JtagTester tester;
- private CmdArgs cmdArgs;
- private PowerChannel corePowerSupply, padsPowerSupply;
+
+ // Nominal cycle time assuming 4 GHz throughput
+ private static final double CYCLE_TIME_NS = 0.250;
+
+ //-------------------------------- types ---------------------------------
+
+ //-------------------------- private data --------------------------------
+ private static long startTime;
+
+ private Indenter indenter = new Indenter();
+ private Marina marina;
+ private ChipModel model;
+ //private ChainControl cc;
+ //private JtagTester tester;
+ private CmdArgs cmdArgs;
+ private PowerChannel corePowerSupply, padsPowerSupply;
private VoltageReadable coreVoltmeter, voltmeterForCurrent;
-
- //-------------------------- private methods -----------------------------
+
+ //-------------------------- private methods -----------------------------
/** @return true if simulation. Return false if we're testing silicon. */
- private boolean sim() {return model instanceof SimulationModel;}
-
- private void prln(String msg) {indenter.prln(msg);}
- private void pr(String msg) {indenter.pr(msg);}
- private void adjustIndent(int n) {indenter.adjustIndent(n);}
-
- public static void fatal(boolean pred, String msg) {
- if (pred) {
- Exception err = new Exception(msg);
- err.printStackTrace();
- System.out.println("Test Result: Test Failed");
-
- printTestTime();
- Infrastructure.exit(2);
- }
- }
+ private boolean sim() {return model instanceof SimulationModel;}
+
+ private void prln(String msg) {indenter.prln(msg);}
+ private void pr(String msg) {indenter.pr(msg);}
+ private void adjustIndent(int n) {indenter.adjustIndent(n);}
+
+ public static void fatal(boolean pred, String msg) {
+ if (pred) {
+ Exception err = new Exception(msg);
+ err.printStackTrace();
+ System.out.println("Test Result: Test Failed");
+
+ printTestTime();
+ Infrastructure.exit(2);
+ }
+ }
public static void fatalIfBitVectorsDoNotMatch(BitVector bv1, BitVector bv2) {
// FIXME: better error reporting needed here
fatal(mismatch, "bit vectors do not match on bits " + err + "\n "+bv1+"\n "+bv2);
}
- private static void printTestTime() {
- long endTime = System.currentTimeMillis();
- System.out.println("Test took: "+(endTime-startTime)/1000.0+" sec");
- }
+ private static void printTestTime() {
+ long endTime = System.currentTimeMillis();
+ System.out.println("Test took: "+(endTime-startTime)/1000.0+" sec");
+ }
- // Tell user what we're about to do
- private static void reportTask(CmdArgs args) {
- System.out.println("Begin testing Marina");
+ // Tell user what we're about to do
+ private static void reportTask(CmdArgs args) {
+ System.out.println("Begin testing Marina");
switch (args.mode) {
- case WHOLE_CHIP_SCHEMATIC_PARASITICS:
- System.out.println(" Simulate whole chip, schematic parasitics");
- break;
- case WHOLE_CHIP_LAYOUT_PARASITICS:
- System.out.println(" Simulate whole chip, layout parasitics");
- break;
- case TEST_SILICON:
- System.out.println(" Test silicon");
- break;
- default:
- fatal(true, "unrecognized CmdArgs.Mode");
- return;
+ case WHOLE_CHIP_SCHEMATIC_PARASITICS:
+ System.out.println(" Simulate whole chip, schematic parasitics");
+ break;
+ case WHOLE_CHIP_LAYOUT_PARASITICS:
+ System.out.println(" Simulate whole chip, layout parasitics");
+ break;
+ case TEST_SILICON:
+ System.out.println(" Test silicon");
+ break;
+ default:
+ fatal(true, "unrecognized CmdArgs.Mode");
+ return;
+ }
+ }
+ private void setUpSuppliesAndMeters(Station station) {
+ // set up power supplies and meters
+ if (!sim()) {
+ prln("Testing station: "+station);
+ Infrastructure.gpibControllers = new int[] {0};
+ switch (cmdArgs.station) {
+ case ONE:
+ corePowerSupply = new Pst3202Channel("ch1", "HPST3202", 1);
+ padsPowerSupply = new Pst3202Channel("ch2", "HPST3202", 2);
+ break;
+ case TWO:
+ corePowerSupply = new Pst3202Channel("ch1", "HPST3202B", 1);
+ padsPowerSupply = new Pst3202Channel("ch2", "HPST3202B", 2);
+ break;
+ default:
+ fatal(true, "Unrecognized station: "+cmdArgs.station);
+ }
+ corePowerSupply.setCurrent((float)1.7);
+ corePowerSupply.setVoltageWait((float)1.0);
+
+ padsPowerSupply.setCurrent((float)0.100);
+ padsPowerSupply.setVoltageWait((float)1.8);
+
+ coreVoltmeter = new HP34401A(station.coreVoltmeter);
+ voltmeterForCurrent = new HP34401A(station.currentVoltmenter);
}
- }
- private void setUpSuppliesAndMeters(Station station) {
- // set up power supplies and meters
- if (!sim()) {
- prln("Testing station: "+station);
- Infrastructure.gpibControllers = new int[] {0};
- switch (cmdArgs.station) {
- case ONE:
- corePowerSupply = new Pst3202Channel("ch1", "HPST3202", 1);
- padsPowerSupply = new Pst3202Channel("ch2", "HPST3202", 2);
- break;
- case TWO:
- corePowerSupply = new Pst3202Channel("ch1", "HPST3202B", 1);
- padsPowerSupply = new Pst3202Channel("ch2", "HPST3202B", 2);
- break;
- default:
- fatal(true, "Unrecognized station: "+cmdArgs.station);
- }
- corePowerSupply.setCurrent((float)1.7);
- corePowerSupply.setVoltageWait((float)1.0);
-
- padsPowerSupply.setCurrent((float)0.100);
- padsPowerSupply.setVoltageWait((float)1.8);
-
- coreVoltmeter = new HP34401A(station.coreVoltmeter);
- voltmeterForCurrent = new HP34401A(station.currentVoltmenter);
- }
- }
-
- private MarinaTest(String[] args) {
+ }
+
+ private MarinaTest(String[] args) {
cmdArgs = new MarinaUtils.CmdArgs(args);
reportTask(cmdArgs);
if (cmdArgs.mode==Mode.TEST_SILICON) doSilicon(); else doSim();
- }
-
- private void doSim() {
+ }
+
+ private void doSim() {
String netListName;
switch (cmdArgs.mode) {
- case WHOLE_CHIP_SCHEMATIC_PARASITICS:
- netListName = NET_LIST;
- break;
- case WHOLE_CHIP_LAYOUT_PARASITICS:
- netListName = "marina_pads_guts.spi";
- break;
- default:
- fatal(true, "unrecognized CmdArgs.Mode");
- return;
+ case WHOLE_CHIP_SCHEMATIC_PARASITICS:
+ netListName = NET_LIST;
+ break;
+ case WHOLE_CHIP_LAYOUT_PARASITICS:
+ netListName = "marina_pads_guts.spi";
+ break;
+ default:
+ fatal(true, "unrecognized CmdArgs.Mode");
+ return;
}
- model = new NanosimModel();
-
- //tester = ((SimulationModel)model).createJtagTester("TCK", "TMS", "TRSTb", "TDI", "TDO");
- ChainControls ccs = new ChainControls();
- JtagTester testerD, testerR, testerC;
- testerD = ((SimulationModel)model).createJtagSubchainTester("sid[1:9]", null);
- testerR = ((SimulationModel)model).createJtagSubchainTester("sir[1:9]", null);
- testerC = ((SimulationModel)model).createJtagSubchainTester("sic[1:9]", null);
+ model = new NanosimModel();
+
+ //tester = ((SimulationModel)model).createJtagTester("TCK", "TMS", "TRSTb", "TDI", "TDO");
+ ChainControls ccs = new ChainControls();
+ JtagTester testerD, testerR, testerC;
+ testerD = ((SimulationModel)model).createJtagSubchainTester("sid[1:9]", null);
+ testerR = ((SimulationModel)model).createJtagSubchainTester("sir[1:9]", null);
+ testerC = ((SimulationModel)model).createJtagSubchainTester("sic[1:9]", null);
testerD.printInfo = testerR.printInfo = testerC.printInfo = false;
int khz = 1000000;
((SimulationModel)model).start("nanosim -c cfg", netListName, 0, !cmdArgs.jtagShift);
/*
- ctD.testAllChains("marina", Infrastructure.SEVERITY_WARNING);
- ctR.testAllChains("marina", Infrastructure.SEVERITY_WARNING);
- ctC.testAllChains("marina", Infrastructure.SEVERITY_WARNING);
+ ctD.testAllChains("marina", Infrastructure.SEVERITY_WARNING);
+ ctR.testAllChains("marina", Infrastructure.SEVERITY_WARNING);
+ ctC.testAllChains("marina", Infrastructure.SEVERITY_WARNING);
*/
ccs.addChain(Marina.DATA_CHAIN, ccD);
ccs.addChain(Marina.REPORT_CHAIN, ccR);
ccs.addChain(Marina.CONTROL_CHAIN, ccC);
-
+
marina = new Marina(ccs, model, !cmdArgs.jtagShift, indenter);
//System.out.println("launching");
doOneTest(cmdArgs.testNum);
((SimulationModel)model).finish();
- }
- private void doSilicon() {
- model = new SiliconChip();
- String ip = cmdArgs.station.ipAddr;
- JtagTester tester = new Netscan4(ip, cmdArgs.station.jtagChannel);
+ }
+ private void doSilicon() {
+ model = new SiliconChip();
+ String ip = cmdArgs.station.ipAddr;
+ JtagTester tester = new Netscan4(ip, cmdArgs.station.jtagChannel);
tester.printInfo = false;
int khz = 1000;
ChainControl cc = new ChainControl("???", tester, 1.8f, khz);
doOneTest(cmdArgs.testNum);
setUpSuppliesAndMeters(cmdArgs.station);
-
- }
+
+ }
- /** In the absence of looping, the longest path through Infinity is 4 column delays */
- private void waitUntilQuiescent() {
- model.waitNS(4*COLUMN_LATENCY);
- }
+ /** In the absence of looping, the longest path through Infinity is 4 column delays */
+ private void waitUntilQuiescent() {
+ model.waitNS(4*COLUMN_LATENCY);
+ }
private double readCurrent() {
- return voltmeterForCurrent.readVoltage() / cmdArgs.station.ammeterShuntResistance;
+ return voltmeterForCurrent.readVoltage() / cmdArgs.station.ammeterShuntResistance;
}
/** Generate List of BitVectors where Token=true, high 25 data bits
* are alternating ones and zeros, low 12 data bits increment from
* zero, and address is given by addr. */
private List<BitVector> makeIncrDataConstAdr(int num, int addr) {
- List<BitVector> ans = new ArrayList<BitVector>();
- BitVector dHi = new BitVector(25, "dataHi");
- BitVector dLo = new BitVector(12, "dataLo");
- BitVector t = new BitVector("1", "token");
- BitVector a = new BitVector(14, "addr");
- dHi.setFromLong(0x00aaaaa);
- a.setFromLong(addr);
- for (int i=0; i<num; i++) {
- dLo.setFromLong(i);
- ans.add(dHi.cat(dLo).cat(t).cat(a));
- dHi = dHi.not();
- }
- return ans;
+ List<BitVector> ans = new ArrayList<BitVector>();
+ BitVector dHi = new BitVector(25, "dataHi");
+ BitVector dLo = new BitVector(12, "dataLo");
+ BitVector t = new BitVector("1", "token");
+ BitVector a = new BitVector(14, "addr");
+ dHi.setFromLong(0x00aaaaa);
+ a.setFromLong(addr);
+ for (int i=0; i<num; i++) {
+ dLo.setFromLong(i);
+ ans.add(dHi.cat(dLo).cat(t).cat(a));
+ dHi = dHi.not();
+ }
+ return ans;
}
private void stopToStop(ProperStopper s1, ProperStopper s2,
- Counter ctr,
- List<BitVector> din) {
- prln("Begin stopToStop");
- adjustIndent(2);
-
- s1.stop();
-
- long ctrStart = ctr==null ? 0 : ctr.getCount();
-
- s1.fillMany(din);
- waitUntilQuiescent();
+ Counter ctr,
+ List<BitVector> din) {
+ prln("Begin stopToStop");
+ adjustIndent(2);
+
+ s1.stop();
+
+ long ctrStart = ctr==null ? 0 : ctr.getCount();
+
+ s1.fillMany(din);
+ waitUntilQuiescent();
List<BitVector> dout = s2.drainMany();
MarinaUtils.compareItemsOrdered(din, dout);
if (ctr!=null) {
- long ctrEnd = ctr.getCount();
- long delta = ctrEnd - ctrStart;
+ long ctrEnd = ctr.getCount();
+ long delta = ctrEnd - ctrStart;
long expect = din.size();
fatal(delta!=expect,
- "counter delta wrong: expected delta: "+expect+
- " counter before:"+ctrStart+" counter after:"+ctrEnd);
+ "counter delta wrong: expected delta: "+expect+
+ " counter before:"+ctrStart+" counter after:"+ctrEnd);
}
adjustIndent(-2);
- prln("End stopToStop");
+ prln("End stopToStop");
}
/** Burst data from src to dst. gate is stopped while loading src. gate
* is then run to allow the burst to flow. */
private void stopToStopBurst(ProperStopper src, ProperStopper gate,
- ProperStopper dst,
- Counter ctr,
- List<BitVector> din) {
- prln("Begin stopToStopBurst test");
- adjustIndent(2);
-
- src.stop();
- gate.stop();
-
- long ctrStart = ctr==null ? 0 : ctr.getCount();
-
- src.fillMany(din);
- waitUntilQuiescent();
-
- // open the gate to start the burst
- gate.run();
- waitUntilQuiescent();
-
- List<BitVector> dout = dst.drainMany();
-
- MarinaUtils.compareItemsOrdered(din, dout);
-
- if (ctr!=null) {
- long ctrEnd = ctr.getCount();
- long delta = ctrEnd - ctrStart;
-
- long expectA = din.size();
- fatal(delta!=expectA,
- "counter delta wrong: expected delta: "+expectA+
- " counter before:"+ctrStart+" counter after:"+ctrEnd);
- }
-
- adjustIndent(-2);
- prln("End stopToStopBurst test");
-}
+ ProperStopper dst,
+ Counter ctr,
+ List<BitVector> din) {
+ prln("Begin stopToStopBurst test");
+ adjustIndent(2);
+
+ src.stop();
+ gate.stop();
+
+ long ctrStart = ctr==null ? 0 : ctr.getCount();
+
+ src.fillMany(din);
+ waitUntilQuiescent();
+
+ // open the gate to start the burst
+ gate.run();
+ waitUntilQuiescent();
+
+ List<BitVector> dout = dst.drainMany();
+
+ MarinaUtils.compareItemsOrdered(din, dout);
+
+ if (ctr!=null) {
+ long ctrEnd = ctr.getCount();
+ long delta = ctrEnd - ctrStart;
+
+ long expectA = din.size();
+ fatal(delta!=expectA,
+ "counter delta wrong: expected delta: "+expectA+
+ " counter before:"+ctrStart+" counter after:"+ctrEnd);
+ }
+
+ adjustIndent(-2);
+ prln("End stopToStopBurst test");
+ }
private void stopToStopOne(ProperStopper s1, ProperStopper s2,
- Counter ctr, int adr) {
- prln("Begin stopToStopOne");
- adjustIndent(2);
-
- List<BitVector> din = makeIncrDataConstAdr(1, adr);
- stopToStop(s1, s2, ctr, din);
-
- adjustIndent(-2);
- prln("End stopToStopOne");
+ Counter ctr, int adr) {
+ prln("Begin stopToStopOne");
+ adjustIndent(2);
+
+ List<BitVector> din = makeIncrDataConstAdr(1, adr);
+ stopToStop(s1, s2, ctr, din);
+
+ adjustIndent(-2);
+ prln("End stopToStopOne");
}
private void stopToStopThree(ProperStopper s1, ProperStopper s2,
- Counter ctr, int adr) {
- prln("Begin stopToStopOne");
- adjustIndent(2);
-
- List<BitVector> din = makeIncrDataConstAdr(3, adr);
- stopToStop(s1, s2, ctr, din);
-
- adjustIndent(-2);
- prln("End stopToStopOne");
+ Counter ctr, int adr) {
+ prln("Begin stopToStopOne");
+ adjustIndent(2);
+
+ List<BitVector> din = makeIncrDataConstAdr(3, adr);
+ stopToStop(s1, s2, ctr, din);
+
+ adjustIndent(-2);
+ prln("End stopToStopOne");
}
private int indexOf(BitVector o, List<BitVector> dIn) {
- for (int i=0; i<dIn.size(); i++) {
- if (o.equals(dIn.get(i))) return i;
- }
- return -1;
+ for (int i=0; i<dIn.size(); i++) {
+ if (o.equals(dIn.get(i))) return i;
+ }
+ return -1;
}
private String ringDump(List<BitVector> dIn, List<BitVector> dOut) {
- StringBuffer sb = new StringBuffer();
- sb.append(" ring dump: ");
- for (BitVector o : dOut) {
- sb.append(indexOf(o, dIn)+" ");
- }
- return sb.toString();
+ StringBuffer sb = new StringBuffer();
+ sb.append(" ring dump: ");
+ for (BitVector o : dOut) {
+ sb.append(indexOf(o, dIn)+" ");
+ }
+ return sb.toString();
}
private int[][] makeIntArray2D(int a, int b) {
- int[][] ans = new int[a][];
- for (int i=0; i<a; i++) ans[i] = new int[b];
- return ans;
+ int[][] ans = new int[a][];
+ for (int i=0; i<a; i++) ans[i] = new int[b];
+ return ans;
}
//=========================================================================
private void testProperStoppers(Marina marina) {
prln("Begin testProperStoppers");
- adjustIndent(2);
+ adjustIndent(2);
for(ProperStopper ps : new ProperStopper[] { marina.data, marina.instrIn }) {
prln("testing " + (ps == marina.data ? "data" : "instruction") + " stopper");
adjustIndent(-2);
}
- adjustIndent(-2);
+ adjustIndent(-2);
}
private void sendInstructions(Marina marina) {
- prln("Begin sendInstructions");
- adjustIndent(2);
-
- List<BitVector> din = new ArrayList<BitVector>();
-
- BitVector count = new BitVector(36,"count");
- BitVector one = new BitVector(36, "one");
- count.setFromLong(0);
- one.setFromLong(1);
- for (int i=0; i<3; i++) {
- din.add(count);
- count = count.add(one);
- }
-
- marina.instrIn.fillMany(din);
-
- adjustIndent(-2);
- prln("End sendInstructions");
+ prln("Begin sendInstructions");
+ adjustIndent(2);
+
+ List<BitVector> din = new ArrayList<BitVector>();
+
+ BitVector count = new BitVector(36,"count");
+ BitVector one = new BitVector(36, "one");
+ count.setFromLong(0);
+ one.setFromLong(1);
+ for (int i=0; i<3; i++) {
+ din.add(count);
+ count = count.add(one);
+ }
+
+ marina.instrIn.fillMany(din);
+
+ adjustIndent(-2);
+ prln("End sendInstructions");
}
private void sendToken(Marina marina) {
- prln("Begin sendToken");
- adjustIndent(2);
-
- //getCtrsFlags(marina);
-
- prln("send token");
+ prln("Begin sendToken");
+ adjustIndent(2);
+
+ //getCtrsFlags(marina);
+
+ prln("send token");
marina.instrIn.fill(
- new Instruction.Move(DOCK,
- false, /* requeueing */
- Predicate.IgnoreFlagD, /* predicate */
- false, /* torpedoable */
- null, /* path */
- false, /* tokenIn */
- false, /* dataIn */
- false, /* latchData */
- false, /* latchPath */
- false, /* dataOut */
- true /* tokenOut */
- ));
+ new Instruction.Move(DOCK,
+ false, /* requeueing */
+ Predicate.IgnoreFlagD, /* predicate */
+ false, /* torpedoable */
+ null, /* path */
+ false, /* tokenIn */
+ false, /* dataIn */
+ false, /* latchData */
+ false, /* latchPath */
+ false, /* dataOut */
+ true /* tokenOut */
+ ));
//getCtrsFlags(marina);
int nbToks = marina.getNumTokens();
fatal(nbToks!=1, "Expected one token to emerge but got: "+nbToks+" tokens");
- adjustIndent(-2);
- prln("End sendToken");
+ adjustIndent(-2);
+ prln("End sendToken");
}
private void sendData(Marina marina) {
- prln("Begin sendData");
- adjustIndent(2);
-
- prln("ILC=1");
- marina.instrIn.fill(
- new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
-
- getCtrsFlags(marina);
-
- prln("send data");
+ prln("Begin sendData");
+ adjustIndent(2);
+
+ prln("ILC=1");
marina.instrIn.fill(
- new Instruction.Move(DOCK,
- false, /* requeueing */
- Predicate.IgnoreFlagD, /* predicate */
- false, /* torpedoable */
- null, /* path */
- false, /* tokenIn */
- false, /* dataIn */
- false, /* latchData */
- false, /* latchPath */
- true, /* dataOut */
- false /* tokenOut */
- ));
+ new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
+
+ getCtrsFlags(marina);
+
+ prln("send data");
+ marina.instrIn.fill(
+ new Instruction.Move(DOCK,
+ false, /* requeueing */
+ Predicate.IgnoreFlagD, /* predicate */
+ false, /* torpedoable */
+ null, /* path */
+ false, /* tokenIn */
+ false, /* dataIn */
+ false, /* latchData */
+ false, /* latchPath */
+ true, /* dataOut */
+ false /* tokenOut */
+ ));
getCtrsFlags(marina);
prln("Datum="+MarinaUtils.formatDataTokAddr(dataItems.get(0)));
- adjustIndent(-2);
- prln("End sendData");
+ adjustIndent(-2);
+ prln("End sendData");
}
private void sendDataIlcInfinite(Marina marina) {
- prln("Begin sendDataIlcInfinite");
- adjustIndent(2);
-
- prln("ILC=\\infty");
- marina.instrIn.fill(
- new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.Infinity));
-
- getCtrsFlags(marina);
-
- prln("send data");
+ prln("Begin sendDataIlcInfinite");
+ adjustIndent(2);
+
+ prln("ILC=\\infty");
+ marina.instrIn.fill(
+ new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.Infinity));
+
+ getCtrsFlags(marina);
+
+ prln("send data");
marina.instrIn.fill(SEND_DATA);
getCtrsFlags(marina);
fatal(dataItems.size()!=howmany,
"Expected an unending supply of data items to emerge but only got got: "+dataItems.size());
- adjustIndent(-2);
- prln("End sendDataIlcInfinite");
+ adjustIndent(-2);
+ prln("End sendDataIlcInfinite");
}
private void setOLC(Marina marina, int olc) {
}
private void testFlagZ(Marina marina) {
- prln("Begin testFlagZ");
- adjustIndent(2);
-
+ prln("Begin testFlagZ");
+ adjustIndent(2);
+
List<BitVector> toks;
Predicate only_if_olc_zero = Predicate.FlagD;
adjustIndent(-2);
}
}
- adjustIndent(-2);
- prln("End testFlagZ");
+ adjustIndent(-2);
+ prln("End testFlagZ");
}
private void testPredicationOnAB(Marina marina) {
- prln("Begin testPredicationOnAB");
- adjustIndent(2);
-
+ prln("Begin testPredicationOnAB");
+ adjustIndent(2);
+
List<BitVector> dItems;
prln("Setting OLC=63");
? Instruction.Set.FlagFunction.ONE
: Instruction.Set.FlagFunction.ZERO
));
- getCtrsFlags(marina);
+ getCtrsFlags(marina);
adjustIndent(2);
for(Predicate predicate : new Predicate[] {
adjustIndent(-2);
}
}
- adjustIndent(-2);
- prln("End testPredicationOnAB");
+ adjustIndent(-2);
+ prln("End testPredicationOnAB");
}
private void getCtrsFlags(Marina marina) {
- prln("begin getCtrsFlags");
- adjustIndent(2);
-
+ prln("begin getCtrsFlags");
+ adjustIndent(2);
+
int olc = marina.getOLC();
prln("OLC=="+olc);
Ilc ilc = marina.getILC();
- prln("ILC.done=="+ilc.getDone()+
- " ILC.infinity=="+ilc.getInfinity()+
- " ILC.zero=="+ilc.getZero()+
- " ILC.count=="+ilc.getCount());
-
- boolean a = marina.getFlagA();
- prln("flagA=="+a);
-
- boolean b = marina.getFlagB();
- prln("flagB=="+b);
-
- adjustIndent(-2);
- prln("end getCtrsFlags");
+ prln("ILC.done=="+ilc.getDone()+
+ " ILC.infinity=="+ilc.getInfinity()+
+ " ILC.zero=="+ilc.getZero()+
+ " ILC.count=="+ilc.getCount());
+
+ boolean a = marina.getFlagA();
+ prln("flagA=="+a);
+
+ boolean b = marina.getFlagB();
+ prln("flagB=="+b);
+
+ adjustIndent(-2);
+ prln("end getCtrsFlags");
}
private void walkOneOLC(Marina marina) {
- prln("Begin walkOneOLC");
- adjustIndent(2);
- for (int i=0; i<7; i++) {
- int inOlc = 0x20 >> i;
- prln("Set inOlc="+inOlc);
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, inOlc));
- int outOlc = marina.getOLC();
- fatal(outOlc!=inOlc, "walkOneOLC: got="+outOlc+" expected="+inOlc);
- }
- adjustIndent(-2);
- prln("End walkOneOLC");
+ prln("Begin walkOneOLC");
+ adjustIndent(2);
+ for (int i=0; i<7; i++) {
+ int inOlc = 0x20 >> i;
+ prln("Set inOlc="+inOlc);
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, inOlc));
+ int outOlc = marina.getOLC();
+ fatal(outOlc!=inOlc, "walkOneOLC: got="+outOlc+" expected="+inOlc);
+ }
+ adjustIndent(-2);
+ prln("End walkOneOLC");
}
private void walkOneILC(Marina marina) {
- prln("Begin walkOneILC");
- adjustIndent(2);
- for (int i=0; i<7; i++) {
- // Mask off the "zero" bit position
- int inIlc = 0x20 >> i;
- prln("inIlc="+inIlc);
-
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, inIlc));
-
- Ilc ilc = marina.getILC();
- int outIlc = ilc.getCount();
- fatal(outIlc!=inIlc, "bad ILC count: "+outIlc+" expected: "+outIlc);
-
- boolean inZero = inIlc==0;
- boolean outZero = ilc.getZero();
- fatal(outZero!=inZero, "bad ILC zero: "+outZero);
- fatal(ilc.getInfinity(), "bad Infinity bit: true");
- }
- prln("Now test the infinity bit");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, SetSource.Infinity));
- Ilc ilc = marina.getILC();
- fatal(!ilc.getInfinity(), "bad Infinity bit: false");
- adjustIndent(-2);
- prln("End walkOneILC");
+ prln("Begin walkOneILC");
+ adjustIndent(2);
+ for (int i=0; i<7; i++) {
+ // Mask off the "zero" bit position
+ int inIlc = 0x20 >> i;
+ prln("inIlc="+inIlc);
+
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, inIlc));
+
+ Ilc ilc = marina.getILC();
+ int outIlc = ilc.getCount();
+ fatal(outIlc!=inIlc, "bad ILC count: "+outIlc+" expected: "+outIlc);
+
+ boolean inZero = inIlc==0;
+ boolean outZero = ilc.getZero();
+ fatal(outZero!=inZero, "bad ILC zero: "+outZero);
+ fatal(ilc.getInfinity(), "bad Infinity bit: true");
+ }
+ prln("Now test the infinity bit");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, SetSource.Infinity));
+ Ilc ilc = marina.getILC();
+ fatal(!ilc.getInfinity(), "bad Infinity bit: false");
+ adjustIndent(-2);
+ prln("End walkOneILC");
}
private void countIlc(Marina marina) {
- final int maxIlc = 63;
- prln("Begin countIlc");
- adjustIndent(2);
-
- prln("Set ILC=63");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, maxIlc));
-
- int ilc = marina.getILC().getCount();
- fatal(ilc!=maxIlc, "bad ILC count: "+ilc+" expected: "+maxIlc);
-
- prln("execute a move instruction that does nothing except decrement the ILC to zero");
+ final int maxIlc = 63;
+ prln("Begin countIlc");
+ adjustIndent(2);
+
+ prln("Set ILC=63");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, maxIlc));
+
+ int ilc = marina.getILC().getCount();
+ fatal(ilc!=maxIlc, "bad ILC count: "+ilc+" expected: "+maxIlc);
+
+ prln("execute a move instruction that does nothing except decrement the ILC to zero");
marina.instrIn.fill(
- new Instruction.Move(DOCK,
- false, /* requeueing */
- Predicate.IgnoreFlagD, /* predicate */
- false, /* torpedoable */
- null, /* path */
- false, /* tokenIn */
- false, /* dataIn */
- false, /* latchData */
- false, /* latchPath */
- false, /* dataOut */
- false /* tokenOut */
- ));
-
- // wait for ILC to count from 63 to 0
+ new Instruction.Move(DOCK,
+ false, /* requeueing */
+ Predicate.IgnoreFlagD, /* predicate */
+ false, /* torpedoable */
+ null, /* path */
+ false, /* tokenIn */
+ false, /* dataIn */
+ false, /* latchData */
+ false, /* latchPath */
+ false, /* dataOut */
+ false /* tokenOut */
+ ));
+
+ // wait for ILC to count from 63 to 0
model.waitNS(64 * CYCLE_TIME_NS);
prln("Check that ILC==0");
- ilc = marina.getILC().getCount();
- fatal(ilc!=0, "bad ILC count: "+ilc+" expected: "+0);
-
- adjustIndent(-2);
- prln("End countIlc");
+ ilc = marina.getILC().getCount();
+ fatal(ilc!=0, "bad ILC count: "+ilc+" expected: "+0);
+
+ adjustIndent(-2);
+ prln("End countIlc");
}
// Note: countOlc takes 44 minutes to run on nanosim
private void countOlc(Marina marina) {
- final int maxOlc = 63;
- prln("Begin countOlc");
- adjustIndent(2);
-
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, maxOlc));
- for (int i=maxOlc; i>=0; i--) {
- prln("OLC should be: "+i);
- int olc = marina.getOLC();
- fatal(olc!=i, "bad OLC: "+olc+" expected: "+i);
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, SetSource.Decrement));
- }
-
- adjustIndent(-2);
- prln("End countOlc");
+ final int maxOlc = 63;
+ prln("Begin countOlc");
+ adjustIndent(2);
+
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, maxOlc));
+ for (int i=maxOlc; i>=0; i--) {
+ prln("OLC should be: "+i);
+ int olc = marina.getOLC();
+ fatal(olc!=i, "bad OLC: "+olc+" expected: "+i);
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, SetSource.Decrement));
+ }
+
+ adjustIndent(-2);
+ prln("End countOlc");
}
private void saturateInstructionFifo(Marina marina, Instruction instruction, int quantity, boolean expect_it_to_jam_up) {
prln("Inserting "+quantity+" copies of \"" + instruction + "\"");
- adjustIndent(2);
+ adjustIndent(2);
int i=0;
for(i=0; i<quantity; i++) {
prln("Inserting instruction " + (i+1) +"/"+ quantity);
fatal(jammed, "Instruction stopper did not drain after inserting " + (i+1) + " instructions; not good!");
}
fatal(expect_it_to_jam_up, "Expected instruction stopper to jam up, but it did not");
- adjustIndent(-2);
+ adjustIndent(-2);
prln("Successfully inserted " + i + " instructions");
}
private void testRequeueStage0(Marina marina) {
prln("Begin testRequeueStage0");
- adjustIndent(2);
+ adjustIndent(2);
prln("Executing Set OLC=0");
setOLC(marina, 0);
saturateInstructionFifo(marina, REQUEUEING_NOP, MORE_THAN_INSTRUCTION_IN_SATURATION_AMOUNT, false);
- adjustIndent(-2);
+ adjustIndent(-2);
prln("End testRequeueStage0");
}
private void testRequeueStage0to1(Marina marina) {
prln("Begin testRequeueStage0to1");
- adjustIndent(2);
+ adjustIndent(2);
prln("Executing Set OLC=63");
setOLC(marina, 63);
saturateInstructionFifo(marina, REQUEUEING_NOP, MORE_THAN_INSTRUCTION_IN_SATURATION_AMOUNT, true);
- adjustIndent(-2);
+ adjustIndent(-2);
prln("End testRequeueStage0to1");
}
int olc_value = MORE_THAN_DATA_OUT_SATURATION_AMOUNT + extras;
prln("Begin testRequeueStage0to1to3to0");
- adjustIndent(2);
+ adjustIndent(2);
// State 0 //////////////////////////////////////////////////////////////////////////////
prln("Executing Set OLC="+olc_value);
setOLC(marina, olc_value);
- prln("Executing Set ILC=1");
- marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
+ prln("Executing Set ILC=1");
+ marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
// verify state0 "EPI->ring" and 0->1 transition
- prln("Executing Send Data (requeueable); this will cause 0->1 transition and be discarded");
+ prln("Executing Send Data (requeueable); this will cause 0->1 transition and be discarded");
marina.instrIn.fill(REQUEUEING_SEND_DATA);
// State 1 //////////////////////////////////////////////////////////////////////////////
// verify state1 "EPI->ring"
- prln("Executing Set ILC=1; this will be recirculated");
- marina.instrIn.fill(new Instruction.Set(DOCK,true,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
+ prln("Executing Set ILC=1; this will be recirculated");
+ marina.instrIn.fill(new Instruction.Set(DOCK,true,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
- prln("Executing Send Data; this will be recirculated");
+ prln("Executing Send Data; this will be recirculated");
marina.instrIn.fill(REQUEUEING_SEND_DATA);
- prln("Executing Set OLC--; this will be recirculated");
+ prln("Executing Set OLC--; this will be recirculated");
marina.instrIn.fill(new Instruction.Set(DOCK,true,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.Decrement));
// verify state1 "OD waits"
fatal(dataItems.size()!=1, "Expected exactly one data item to emerge but got: "+dataItems.size()+" data items");
// verify 1->3 transition
- prln("Executing Tail; this will cause the 2->3 transition and be discarded");
+ prln("Executing Tail; this will cause the 2->3 transition and be discarded");
marina.instrIn.fill(new Instruction.Tail(DOCK));
// State 3 //////////////////////////////////////////////////////////////////////////////
// verify that we are back in state0
saturateInstructionFifo(marina, REQUEUEING_NOP, MORE_THAN_INSTRUCTION_IN_SATURATION_AMOUNT, false);
- adjustIndent(-2);
+ adjustIndent(-2);
prln("End testRequeueStage0to1to3to0");
}
int number_of_non_requeueable_send_datas = INSTRUCTION_RING_CAPACITY;
prln("Begin testRequeueStage0to2to3to0");
- adjustIndent(2);
+ adjustIndent(2);
// State 0 //////////////////////////////////////////////////////////////////////////////
prln("Executing Set OLC="+olc_value);
setOLC(marina, olc_value);
- prln("Executing Set ILC=1");
- marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
+ prln("Executing Set ILC=1");
+ marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
// insert many non-requeueing "send data item" instructions;
// this will let us single-step the execution point by
}
// this will send us a token later
- prln("Inserting [Rq] Nop; this will be discarded");
+ prln("Inserting [Rq] Nop; this will be discarded");
marina.instrIn.fill(REQUEUEING_NOP);
// this will send us a token later
- prln("Inserting [Rq] Send Data; this will be recirculated");
+ prln("Inserting [Rq] Send Data; this will be recirculated");
marina.instrIn.fill(REQUEUEING_SEND_DATA);
- prln("Inserting [Rq] Set OLC--; this will be recirculated");
+ prln("Inserting [Rq] Set OLC--; this will be recirculated");
marina.instrIn.fill(new Instruction.Set(DOCK,true,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.Decrement));
// insert the tail, which will cause the 0->2 transition
- prln("Inserting Tail");
- marina.instrIn.fill(new Instruction.Tail(DOCK));
+ prln("Inserting Tail");
+ marina.instrIn.fill(new Instruction.Tail(DOCK));
// State 2 //////////////////////////////////////////////////////////////////////////////
// confirm state 2 "EPI waits"
- prln("Saturating the instruction input to confirm that EPI waits");
+ prln("Saturating the instruction input to confirm that EPI waits");
saturateInstructionFifo(marina, REQUEUEING_NOP, MORE_THAN_INSTRUCTION_IN_SATURATION_AMOUNT, true);
// confirm state 2 "OD->drain"
- prln("Draining data output to cause the 2->3 transition");
+ prln("Draining data output to cause the 2->3 transition");
dataItems = marina.data.drainMany(number_of_non_requeueable_send_datas);
fatal(dataItems.size()!=number_of_non_requeueable_send_datas,
"Expected at least " + number_of_non_requeueable_send_datas +
// State 3 //////////////////////////////////////////////////////////////////////////////
// verify state3 "EPI waits"
- prln("Verifying that EPI still waits in state3");
+ prln("Verifying that EPI still waits in state3");
fatal(marina.instrIn.getFillStateWire()!=MarinaUtils.StateWireState.FULL,
"state3 EPI waits not verified");
- prln(" ok");
- prln("");
+ prln(" ok");
+ prln("");
// verify state3 "OD->ring" and state3->state0
- prln("Removing data items to run down the OLC to zero and cause 3->0 transition");
+ prln("Removing data items to run down the OLC to zero and cause 3->0 transition");
dataItems = marina.data.drainMany(olc_value+10);
fatal(dataItems.size()!=(olc_value+1),
"Expected exactly " + (olc_value+1) + " items to emerge, but got: "+dataItems.size()+" of them");
// State 0 //////////////////////////////////////////////////////////////////////////////
// verify that we are back in state0
- prln("Confirming that we are back in state0");
+ prln("Confirming that we are back in state0");
saturateInstructionFifo(marina, REQUEUEING_NOP, MORE_THAN_INSTRUCTION_IN_SATURATION_AMOUNT, false);
- adjustIndent(-2);
+ adjustIndent(-2);
prln("End testRequeueStage0to2to3to0");
}
List<BitVector> dataItems;
prln("Begin testWaitForTail");
- adjustIndent(2);
+ adjustIndent(2);
prln("inserting instruction: Set OLC=63");
setOLC(marina, 63);
- prln("inserting instruction: [Rq] Nop; this will cause 0->1 transition and possibly be discarded");
+ prln("inserting instruction: [Rq] Nop; this will cause 0->1 transition and possibly be discarded");
marina.instrIn.fill(REQUEUEING_NOP);
// just in case there is some capacity between the execution
marina.instrIn.fill(REQUEUEING_NOP);
}
- prln("inserting instruction: [Rq] Set ILC=1");
- marina.instrIn.fill(new Instruction.Set(DOCK,true,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
+ prln("inserting instruction: [Rq] Set ILC=1");
+ marina.instrIn.fill(new Instruction.Set(DOCK,true,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
- prln("inserting instruction: [Rq] Send Data");
+ prln("inserting instruction: [Rq] Send Data");
marina.instrIn.fill(REQUEUEING_SEND_DATA);
dataItems = marina.data.drainMany(1);
fatal(dataItems.size()!=0, "Expected exactly no data items to emerge but got at least: "+dataItems.size());
- adjustIndent(-2);
+ adjustIndent(-2);
prln("End testWaitForTail");
}
List<BitVector> dataItems;
prln("Begin testRequeueStageDrop");
- adjustIndent(2);
+ adjustIndent(2);
// We have decided that this issue will not be fixed in
// Marina. Therefore, the test is commented out.
/*
- prln("inserting instruction: Set OLC=63");
- setOLC(marina, 63);
+ prln("inserting instruction: Set OLC=63");
+ setOLC(marina, 63);
- prln("inserting instruction: Set ILC=1");
- marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
+ prln("inserting instruction: Set ILC=1");
+ marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
- // if you uncomment this, then the NOP will be dropped and the test will pass
- //prln("inserting instruction: [Rq] Nop; this will cause 0->1 transition and possibly be discarded");
- //marina.instrIn.fill(REQUEUEING_NOP);
+ // if you uncomment this, then the NOP will be dropped and the test will pass
+ //prln("inserting instruction: [Rq] Nop; this will cause 0->1 transition and possibly be discarded");
+ //marina.instrIn.fill(REQUEUEING_NOP);
- prln("inserting instruction: [Rq] Send Data; this will cause 0->1 transition and be discarded");
- marina.instrIn.fill(REQUEUEING_SEND_DATA);
+ prln("inserting instruction: [Rq] Send Data; this will cause 0->1 transition and be discarded");
+ marina.instrIn.fill(REQUEUEING_SEND_DATA);
- prln("inserting instruction: [Rq] Set ILC=1");
- marina.instrIn.fill(new Instruction.Set(DOCK,true,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
+ prln("inserting instruction: [Rq] Set ILC=1");
+ marina.instrIn.fill(new Instruction.Set(DOCK,true,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
- prln("inserting instruction: Tail");
- marina.instrIn.fill(new Instruction.Tail(DOCK));
+ prln("inserting instruction: Tail");
+ marina.instrIn.fill(new Instruction.Tail(DOCK));
- dataItems = marina.data.drainMany(3);
- fatal(dataItems.size()<3, "Expected exactly unlimited data items to emerge but got only: "+dataItems.size());
+ dataItems = marina.data.drainMany(3);
+ fatal(dataItems.size()<3, "Expected exactly unlimited data items to emerge but got only: "+dataItems.size());
*/
- adjustIndent(-2);
+ adjustIndent(-2);
prln("End testRequeueStageDrop");
}
private void testFlagAB(Marina marina) {
- prln("Begin testFlagAB");
- adjustIndent(2);
+ prln("Begin testFlagAB");
+ adjustIndent(2);
Instruction.Set.FlagFunction zero = Instruction.Set.FlagFunction.ZERO;
Instruction.Set.FlagFunction one = zero;
fatal(marina.getFlagB()!=b, "after "+(b?"setting":"clearing")+" FlagB, it was still "+(b?"clear":"set"));
}
- adjustIndent(-2);
- prln("End testFlagAB");
+ adjustIndent(-2);
+ prln("End testFlagAB");
}
/**
* through 216 iterations.
*/
private void testFlagTruthTable(Marina marina) {
- prln("Begin testFlagTruthTable");
- adjustIndent(2);
+ prln("Begin testFlagTruthTable");
+ adjustIndent(2);
Instruction.Set.FlagFunction zero = Instruction.Set.FlagFunction.ZERO;
Instruction.Set.FlagFunction one = zero.add(Predicate.FlagA).add(Predicate.NotFlagA);
"expected B="+expected_b+", but got "+marina.getFlagB());
}
}
- adjustIndent(-2);
- prln("End testFlagTruthTable");
+ adjustIndent(-2);
+ prln("End testFlagTruthTable");
}
private void recvData(Marina marina) {
- prln("Begin recvData");
- adjustIndent(2);
+ prln("Begin recvData");
+ adjustIndent(2);
marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
marina.instrIn.fill(new Instruction.Move(DOCK,
- false, /* requeueing */
+ false, /* requeueing */
Predicate.IgnoreFlagD, /* predicate */
true, /* torpedoable */
null, /* path */
prln("checking to see if A flag got set");
fatal(!marina.getFlagA(), "bad A flag: "+marina.getFlagA());
- adjustIndent(-2);
- prln("End recvData");
+ adjustIndent(-2);
+ prln("End recvData");
}
private void testRecvAndSendWalkingOne(Marina marina) {
- prln("Begin testRecvAndSendWalkingOne");
- adjustIndent(2);
+ prln("Begin testRecvAndSendWalkingOne");
+ adjustIndent(2);
List<BitVector> dataItems;
for(int bit=0; bit<37; bit++) {
"found a data item waiting in the north proper stopper, but should not have");
marina.instrIn.fill(new Instruction.Move(DOCK,
- false, // requeueing
+ false, // requeueing
Predicate.IgnoreFlagD, // predicate
true, // torpedoable
null, // path
fatalIfBitVectorsDoNotMatch(mp.data, data);
}
- adjustIndent(-2);
- prln("End testRecvAndSendWalkingOne");
+ adjustIndent(-2);
+ prln("End testRecvAndSendWalkingOne");
}
private void setOlcFromDataLatch(Marina marina) {
- prln("Begin setOlcFromDataLatch");
- adjustIndent(2);
+ prln("Begin setOlcFromDataLatch");
+ adjustIndent(2);
// walk a bit from 0 to 5
for(int bit=0; bit<6; bit++) {
fatal(olc != (1<<bit), "expected olc to be " + (1<<bit) + ", but got " + olc);
}
- adjustIndent(-2);
- prln("End setOlcFromDataLatch");
+ adjustIndent(-2);
+ prln("End setOlcFromDataLatch");
}
private void setIlcFromDataLatch(Marina marina) {
- prln("Begin setIlcFromDataLatch");
- adjustIndent(2);
+ prln("Begin setIlcFromDataLatch");
+ adjustIndent(2);
// walk a bit from 0 to 5
for(int bit=0; bit<6; bit++) {
fatal(ilc != (1<<bit), "expected ilc to be " + (1<<bit) + ", but got " + ilc);
}
- adjustIndent(-2);
- prln("End setIlcFromDataLatch");
+ adjustIndent(-2);
+ prln("End setIlcFromDataLatch");
}
private void testSendAndRecvToken(Marina marina) {
- prln("Begin testSendAndRecvToken");
- adjustIndent(2);
+ prln("Begin testSendAndRecvToken");
+ adjustIndent(2);
prln("sending token");
marina.instrIn.fill(SEND_TOKEN);
fatal(dataItems.size()!=1,
"expected exactly one data item, got " + dataItems.size());
- adjustIndent(-2);
- prln("End testSendAndRecvToken");
+ adjustIndent(-2);
+ prln("End testSendAndRecvToken");
}
private void testSignExtendedLiteral(Marina marina) {
- prln("Begin testSignExtendedLiteral");
- adjustIndent(2);
+ prln("Begin testSignExtendedLiteral");
+ adjustIndent(2);
for(long val : new long[] { -1, 0, 1, (-1L << 14) }) {
prln("inserting Set Data Latch (sign-extended) 37'b" + Long.toString(val, 1));
fatal(mismatch, "data read back did not match inserted literal; mismatch on bits " + err);
}
- adjustIndent(-2);
- prln("End testSignExtendedLiteral");
+ adjustIndent(-2);
+ prln("End testSignExtendedLiteral");
}
private void testShiftedLiteral(Marina marina) {
- prln("Begin testShiftedLiteral");
- adjustIndent(2);
+ prln("Begin testShiftedLiteral");
+ adjustIndent(2);
prln("clearing the D register");
marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,
BitVector bv = MarinaUtils.extractData(dataItems.get(0));
fatal(!bv.equals(dreg), "data read back did not match inserted literal.\n" +
- "got: "+bv.bitReverse().getState()+"\n"+
- "expected:"+dreg.bitReverse().getState());
+ "got: "+bv.bitReverse().getState()+"\n"+
+ "expected:"+dreg.bitReverse().getState());
}
- adjustIndent(-2);
- prln("End testShiftedLiteral");
+ adjustIndent(-2);
+ prln("End testShiftedLiteral");
}
private void testFlagC(Marina marina) {
- prln("Begin testFlagC");
- adjustIndent(2);
+ prln("Begin testFlagC");
+ adjustIndent(2);
// Russell says:
// addr[14] == sigS
prln("executing recv data with Dc="+dc);
marina.instrIn.fill(new Instruction.Move(DOCK,
- false, /* requeueing */
+ false, /* requeueing */
Predicate.IgnoreFlagD, /* predicate */
true, /* torpedoable */
null, /* path */
fatal(marina.getFlagA()!=c_flag, "bad A flag: "+marina.getFlagA());
}
}
- adjustIndent(-2);
- prln("End testFlagC");
+ adjustIndent(-2);
+ prln("End testFlagC");
}
private void sendDataWithPath(Marina marina) {
}
private void sendTorpedo(Marina marina) {
- prln("Begin sendTorpedo");
- adjustIndent(2);
-
- prln("Set OLC = 1");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 1));
-
- int olc = marina.getOLC();
- fatal(olc!=1, "bad OLC: "+olc+" expected: 1");
-
- prln("Set A=0, B=0");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
-
- fatal(marina.getFlagA(), "bad A flag: true");
- fatal(marina.getFlagB(), "bad B flag: true");
-
- prln("Set ILC = Infinity");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, SetSource.Infinity));
-
- prln("execute a move instruction that does nothing but loops until torpedo arrives");
+ prln("Begin sendTorpedo");
+ adjustIndent(2);
+
+ prln("Set OLC = 1");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 1));
+
+ int olc = marina.getOLC();
+ fatal(olc!=1, "bad OLC: "+olc+" expected: 1");
+
+ prln("Set A=0, B=0");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
+
+ fatal(marina.getFlagA(), "bad A flag: true");
+ fatal(marina.getFlagB(), "bad B flag: true");
+
+ prln("Set ILC = Infinity");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, SetSource.Infinity));
+
+ prln("execute a move instruction that does nothing but loops until torpedo arrives");
marina.instrIn.fill(
- new Instruction.Move(DOCK,
- false, /* requeueing */
- Predicate.IgnoreFlagD, /* predicate */
- true, /* torpedoable */
- null, /* path */
- false, /* tokenIn */
- false, /* dataIn */
- false, /* latchData */
- false, /* latchPath */
- false, /* dataOut */
- false /* tokenOut */
- ));
-
- prln("A=1, B=1 This instruction should get torpedoed along with the Move");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.Default, SET_FLAG, SET_FLAG));
-
- prln("send torpedo. This should clear the OLC");
- marina.instrIn.fill(InstructionStopper.TORPEDO);
-
- getCtrsFlags(marina);
-
- // Note: It's tempting to test that OLC==0 here. However, hardware doesn't
- // actually set counter bits to zero; it just sets the OLCZERO bit
-
- prln("A and B should remain false");
- fatal(marina.getFlagA(), "bad A flag: true");
- fatal(marina.getFlagB(), "bad B flag: true");
-
- prln("OLC = 63. Reload OLC after torpedo");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 63));
-
- olc = marina.getOLC();
- fatal(olc!=63, "bad OLC: "+olc+" expected: 63");
-
- prln("Set A=1, B=1 This instruction should execute because OLC!=0");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.Default, SET_FLAG, SET_FLAG));
-
- prln("A and B should be true");
- fatal(!marina.getFlagA(), "bad A flag: false");
- fatal(!marina.getFlagB(), "bad B flag: false");
-
- adjustIndent(-2);
- prln("End sendTorpedo");
+ new Instruction.Move(DOCK,
+ false, /* requeueing */
+ Predicate.IgnoreFlagD, /* predicate */
+ true, /* torpedoable */
+ null, /* path */
+ false, /* tokenIn */
+ false, /* dataIn */
+ false, /* latchData */
+ false, /* latchPath */
+ false, /* dataOut */
+ false /* tokenOut */
+ ));
+
+ prln("A=1, B=1 This instruction should get torpedoed along with the Move");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.Default, SET_FLAG, SET_FLAG));
+
+ prln("send torpedo. This should clear the OLC");
+ marina.instrIn.fill(InstructionStopper.TORPEDO);
+
+ getCtrsFlags(marina);
+
+ // Note: It's tempting to test that OLC==0 here. However, hardware doesn't
+ // actually set counter bits to zero; it just sets the OLCZERO bit
+
+ prln("A and B should remain false");
+ fatal(marina.getFlagA(), "bad A flag: true");
+ fatal(marina.getFlagB(), "bad B flag: true");
+
+ prln("OLC = 63. Reload OLC after torpedo");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 63));
+
+ olc = marina.getOLC();
+ fatal(olc!=63, "bad OLC: "+olc+" expected: 63");
+
+ prln("Set A=1, B=1 This instruction should execute because OLC!=0");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.Default, SET_FLAG, SET_FLAG));
+
+ prln("A and B should be true");
+ fatal(!marina.getFlagA(), "bad A flag: false");
+ fatal(!marina.getFlagB(), "bad B flag: false");
+
+ adjustIndent(-2);
+ prln("End sendTorpedo");
}
private void testTorpedoOnAnInfiniteNop(Marina marina) {
prln("calling marina.instrIn.run()");
marina.instrIn.run();
- model.waitNS(5);
+ model.waitNS(5);
int expected = decr_amount>=olc ? 0 : 1;
dataItems = marina.data.drainMany(2);
}
private void flipIlcBit(Marina marina) {
- prln("Begin flipIlcBit");
- adjustIndent(2);
- prln("Using the set ILC instruction, toggle a single bit between zero and one. \n" +
- "Check correct setting of the ILC zero bit");
-
- for (int i=0; i<6; i++) {
- int notZero = 32 >> i;
- prln("Set ILC=0");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 0));
-
- prln("Then immediately set ILC="+notZero);
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, notZero));
-
- prln("Verify ILC using scan chain");
- Ilc ilc = marina.getILC();
- int ilcCount = ilc.getCount();
- fatal(ilcCount!=notZero, "bad ILC count: "+ilcCount+" expected: "+notZero);
-
- fatal(ilc.getZero(), "bad ILC zero bit: true");
- fatal(ilc.getInfinity(), "bad ILC Infinity bit: true");
-
- prln("Set ILC="+notZero);
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, notZero));
-
- prln("Then immediately set ILC=0");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 0));
-
- prln("Verify ILC using scan chain");
- ilc = marina.getILC();
- ilcCount = ilc.getCount();
- fatal(ilcCount!=0, "bad ILC count: "+ilcCount+" expected: 0");
-
- fatal(!ilc.getZero(), "bad ILC zero bit: false");
- fatal(ilc.getInfinity(), "bad ILC Infinity bit: true");
- }
-
- adjustIndent(-2);
- prln("End flipIlcBit");
+ prln("Begin flipIlcBit");
+ adjustIndent(2);
+ prln("Using the set ILC instruction, toggle a single bit between zero and one. \n" +
+ "Check correct setting of the ILC zero bit");
+
+ for (int i=0; i<6; i++) {
+ int notZero = 32 >> i;
+ prln("Set ILC=0");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 0));
+
+ prln("Then immediately set ILC="+notZero);
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, notZero));
+
+ prln("Verify ILC using scan chain");
+ Ilc ilc = marina.getILC();
+ int ilcCount = ilc.getCount();
+ fatal(ilcCount!=notZero, "bad ILC count: "+ilcCount+" expected: "+notZero);
+
+ fatal(ilc.getZero(), "bad ILC zero bit: true");
+ fatal(ilc.getInfinity(), "bad ILC Infinity bit: true");
+
+ prln("Set ILC="+notZero);
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, notZero));
+
+ prln("Then immediately set ILC=0");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 0));
+
+ prln("Verify ILC using scan chain");
+ ilc = marina.getILC();
+ ilcCount = ilc.getCount();
+ fatal(ilcCount!=0, "bad ILC count: "+ilcCount+" expected: 0");
+
+ fatal(!ilc.getZero(), "bad ILC zero bit: false");
+ fatal(ilc.getInfinity(), "bad ILC Infinity bit: true");
+ }
+
+ adjustIndent(-2);
+ prln("End flipIlcBit");
}
private void flipOlcBit(Marina marina) {
- prln("Begin flipOlcBit");
- adjustIndent(2);
- prln("Using the set OLC instruction, toggle a single bit between zero and one. \n" +
- "Check correct setting of the OLC zero bit");
-
- prln("Set A=0, B=0");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
-
- for (int i=0; i<6; i++) {
- int notZero = 32 >> i;
- prln("Set OLC=0");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0));
-
- prln("Then immediately set OLC="+notZero);
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero));
-
- prln("Verify OLC count using scan chain");
- int outOlc = marina.getOLC();
- fatal(outOlc!=notZero, "bad OLC count: "+outOlc+" expected: "+notZero);
-
- prln("Verify OLC zero bit using predication");
- prln("if (OLC==0) {A=1; B=1;} // should not get executed");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.FlagD, SET_FLAG, SET_FLAG));
- fatal(marina.getFlagA(), "bad A flag. expected: false");
-
- prln("Set OLC="+notZero);
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero));
-
- prln("Then immediately set OLC=0");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0));
-
- prln("Verify OLC count using scan chain");
- outOlc = marina.getOLC();
- fatal(outOlc!=0, "bad OLC count: "+outOlc+" expected: 0");
-
- prln("Verify OLC zero bit using predication");
- prln("if (OLC!=0) {A=1; B=1;} // should not get executed");
- marina.instrIn.fill(new
- Instruction.Set(DOCK,false,Predicate.Default, SET_FLAG, SET_FLAG));
- fatal(marina.getFlagA(), "bad A flag. expected: false");
- }
-
- adjustIndent(-2);
- prln("End flipOlcBit");
+ prln("Begin flipOlcBit");
+ adjustIndent(2);
+ prln("Using the set OLC instruction, toggle a single bit between zero and one. \n" +
+ "Check correct setting of the OLC zero bit");
+
+ prln("Set A=0, B=0");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
+
+ for (int i=0; i<6; i++) {
+ int notZero = 32 >> i;
+ prln("Set OLC=0");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0));
+
+ prln("Then immediately set OLC="+notZero);
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero));
+
+ prln("Verify OLC count using scan chain");
+ int outOlc = marina.getOLC();
+ fatal(outOlc!=notZero, "bad OLC count: "+outOlc+" expected: "+notZero);
+
+ prln("Verify OLC zero bit using predication");
+ prln("if (OLC==0) {A=1; B=1;} // should not get executed");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.FlagD, SET_FLAG, SET_FLAG));
+ fatal(marina.getFlagA(), "bad A flag. expected: false");
+
+ prln("Set OLC="+notZero);
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero));
+
+ prln("Then immediately set OLC=0");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0));
+
+ prln("Verify OLC count using scan chain");
+ outOlc = marina.getOLC();
+ fatal(outOlc!=0, "bad OLC count: "+outOlc+" expected: 0");
+
+ prln("Verify OLC zero bit using predication");
+ prln("if (OLC!=0) {A=1; B=1;} // should not get executed");
+ marina.instrIn.fill(new
+ Instruction.Set(DOCK,false,Predicate.Default, SET_FLAG, SET_FLAG));
+ fatal(marina.getFlagA(), "bad A flag. expected: false");
+ }
+
+ adjustIndent(-2);
+ prln("End flipOlcBit");
}
private void testSouthRecirculate (Marina marina) {
- prln("Begin testSouthRecirculate");
- adjustIndent(2);
-
- marina.enableInstructionSend(false);
- marina.enableInstructionRecirculate(true);
-
- prln("Completely fill south ring");
- for (int i=0; i<Marina.SOUTH_RING_CAPACITY; i++) {
- BitVector instr = new BitVector(36, "Instr"+i);
- instr.setFromLong(i);
- marina.instrIn.fill(instr);
- }
- prln("Drain south ring and check contents");
- List<BitVector> out = marina.instrIn.drainMany();
- for (int i=0; i<Marina.SOUTH_RING_CAPACITY; i++) {
- int expect = (i+Marina.SOUTH_RING_CAPACITY-1) % Marina.SOUTH_RING_CAPACITY;
- long got = out.get(i).toLong();
- fatal(got!=expect, "bad instruction: "+got+" expected: "+expect);
- }
-
- for (int i=0; i<5; i++) {}
-
- adjustIndent(-2);
- prln("End testSouthRecirculate");
+ prln("Begin testSouthRecirculate");
+ adjustIndent(2);
+
+ marina.enableInstructionSend(false);
+ marina.enableInstructionRecirculate(true);
+
+ prln("Completely fill south ring");
+ for (int i=0; i<Marina.SOUTH_RING_CAPACITY; i++) {
+ BitVector instr = new BitVector(36, "Instr"+i);
+ instr.setFromLong(i);
+ marina.instrIn.fill(instr);
+ }
+ prln("Drain south ring and check contents");
+ List<BitVector> out = marina.instrIn.drainMany();
+ for (int i=0; i<Marina.SOUTH_RING_CAPACITY; i++) {
+ int expect = (i+Marina.SOUTH_RING_CAPACITY-1) % Marina.SOUTH_RING_CAPACITY;
+ long got = out.get(i).toLong();
+ fatal(got!=expect, "bad instruction: "+got+" expected: "+expect);
+ }
+
+ for (int i=0; i<5; i++) {}
+
+ adjustIndent(-2);
+ prln("End testSouthRecirculate");
}
- private void doOneTest(int testNum) {
+ private void doOneTest(int testNum) {
prln("MarinaTest: performing test: "+testNum);
marina.masterClear();
marina.enableInstructionSend(true);
- switch (testNum) {
- case 1: testProperStoppers(marina); break;
- case 2: sendInstructions(marina); break;
- case 3: sendToken(marina); break;
- case 4: getCtrsFlags(marina); break;
- case 5: walkOneOLC(marina); break;
-
- // Russell's tests begin with 1000
- case 1000: walkOneILC(marina); break;
- case 1001: countIlc(marina); break;
- case 1002: countOlc(marina); break;
- case 1003: sendTorpedo(marina); break;
- case 1004: flipIlcBit(marina); break;
- case 1005: flipOlcBit(marina); break;
- case 1006: testSouthRecirculate(marina); break;
-
- // Bill's tests begin with 2000
- case 2000: break;
+ switch (testNum) {
+ case 1: testProperStoppers(marina); break;
+ case 2: sendInstructions(marina); break;
+ case 3: sendToken(marina); break;
+ case 4: getCtrsFlags(marina); break;
+ case 5: walkOneOLC(marina); break;
+
+ // Russell's tests begin with 1000
+ case 1000: walkOneILC(marina); break;
+ case 1001: countIlc(marina); break;
+ case 1002: countOlc(marina); break;
+ case 1003: sendTorpedo(marina); break;
+ case 1004: flipIlcBit(marina); break;
+ case 1005: flipOlcBit(marina); break;
+ case 1006: testSouthRecirculate(marina); break;
+
+ // Bill's tests begin with 2000
+ case 2000: break;
// Adam's tests begin with 3000
- case 3000: sendToken(marina); break;
- case 3001: testFlagAB(marina); break;
- case 3002: testRequeueStage0(marina); break;
- case 3003: testRequeueStage0to1(marina); break;
- case 3004: testFlagZ(marina); break;
- case 3005: testPredicationOnAB(marina); break;
- case 3006: sendData(marina); break;
- case 3007: testRequeueStage0to1to3to0(marina); break;
- case 3008: testWaitForTail(marina); break;
- case 3009: testRequeueStageDrop(marina); break;
- case 3010: testRequeueStage0to2to3to0(marina); break;
- case 3011: recvData(marina); break;
- case 3012: testFlagC(marina); break;
- case 3013: testSignExtendedLiteral(marina); break;
- case 3014: testShiftedLiteral(marina); break;
- case 3015: testSendAndRecvToken(marina); break;
- case 3016: sendDataIlcInfinite(marina); break;
- case 3017: testFlagTruthTable(marina); break;
- case 3018: sendDataWithPath(marina); break;
- case 3019: setOlcFromDataLatch(marina); break;
- case 3020: setIlcFromDataLatch(marina); break;
- case 3021: recvPath(marina); break;
- case 3022: testILC(marina); break;
- case 3023: testTorpedoOnAnInfiniteNop(marina); break;
- case 3024: testRecvAndSendWalkingOne(marina); break;
- case 3025: testOlcDecrementAtHighSpeed(marina); break;
-
- default:
- fatal(true, "Test number: "+testNum+" doesn't exist.");
- break;
- }
- // If we get here then test passed
- prln("Test Result: Passed");
- printTestTime();
- Infrastructure.exit(0);
- }
+ case 3000: sendToken(marina); break;
+ case 3001: testFlagAB(marina); break;
+ case 3002: testRequeueStage0(marina); break;
+ case 3003: testRequeueStage0to1(marina); break;
+ case 3004: testFlagZ(marina); break;
+ case 3005: testPredicationOnAB(marina); break;
+ case 3006: sendData(marina); break;
+ case 3007: testRequeueStage0to1to3to0(marina); break;
+ case 3008: testWaitForTail(marina); break;
+ case 3009: testRequeueStageDrop(marina); break;
+ case 3010: testRequeueStage0to2to3to0(marina); break;
+ case 3011: recvData(marina); break;
+ case 3012: testFlagC(marina); break;
+ case 3013: testSignExtendedLiteral(marina); break;
+ case 3014: testShiftedLiteral(marina); break;
+ case 3015: testSendAndRecvToken(marina); break;
+ case 3016: sendDataIlcInfinite(marina); break;
+ case 3017: testFlagTruthTable(marina); break;
+ case 3018: sendDataWithPath(marina); break;
+ case 3019: setOlcFromDataLatch(marina); break;
+ case 3020: setIlcFromDataLatch(marina); break;
+ case 3021: recvPath(marina); break;
+ case 3022: testILC(marina); break;
+ case 3023: testTorpedoOnAnInfiniteNop(marina); break;
+ case 3024: testRecvAndSendWalkingOne(marina); break;
+ case 3025: testOlcDecrementAtHighSpeed(marina); break;
+
+ default:
+ fatal(true, "Test number: "+testNum+" doesn't exist.");
+ break;
+ }
+ // If we get here then test passed
+ prln("Test Result: Passed");
+ printTestTime();
+ Infrastructure.exit(0);
+ }
//============================ for public use =============================
- /** Exit codes:
- * 0: test detected success
- * 2: test detected failure
- * 1: test crashed
- */
+ /** Exit codes:
+ * 0: test detected success
+ * 2: test detected failure
+ * 1: test crashed
+ */
public static void main(String[] args) {
- startTime = System.currentTimeMillis();
- new MarinaTest(args);
+ startTime = System.currentTimeMillis();
+ new MarinaTest(args);
}
}
import java.util.ArrayList;
public class MarinaUtils {
- /**
- * (Note by Bill and Adam: Ivan has struck again!)
- * As of 05 March 2009 the new bits are:
- * Block Extra Fill Go Clear Silent
- * => Note: "Extra" gets fed to the mux in the counter
- * that selects the frequency output that goes off-chip
- *
- * Caution: Ivan changes the order of the ProperStopper control bits
- * from chip to chip. Here is the current order for Marina
- * as of 14 Aug 2008:
- * Block, Fill, Go, Silent, Clear
- *
- * The old bit order for Infinity was: Fill, Block, Clear, Silent, Go
- */
+ /**
+ * (Note by Bill and Adam: Ivan has struck again!)
+ * As of 05 March 2009 the new bits are:
+ * Block Extra Fill Go Clear Silent
+ * => Note: "Extra" gets fed to the mux in the counter
+ * that selects the frequency output that goes off-chip
+ *
+ * Caution: Ivan changes the order of the ProperStopper control bits
+ * from chip to chip. Here is the current order for Marina
+ * as of 14 Aug 2008:
+ * Block, Fill, Go, Silent, Clear
+ *
+ * The old bit order for Infinity was: Fill, Block, Clear, Silent, Go
+ */
public static enum RingIfc {
RUN ("000100"),
- IDLE ("100000"),
- FILL ("101000"),
- BLOCK ("100100"),
- STOP ("000000"),
- CLEAR ("100010"),
- SOURCE ("001100"),
- STOPSOURCE ("001000"),
- SINK ("000101"),
- STOPSINK ("000001");
+ IDLE ("100000"),
+ FILL ("101000"),
+ BLOCK ("100100"),
+ STOP ("000000"),
+ CLEAR ("100010"),
+ SOURCE ("001100"),
+ STOPSOURCE ("001000"),
+ SINK ("000101"),
+ STOPSINK ("000001");
private BitVector scanBits;
RingIfc(String bits) {scanBits = new BitVector(bits,"RingIfc");}
public BitVector bits() {return scanBits;}
public static enum StateWireState {FULL, EMPTY};
public static class CmdArgs {
- public enum Mode {//ISOLATED_IN_DOCK,
- //ISOLATED_OUT_DOCK,
- WHOLE_CHIP_SCHEMATIC_PARASITICS,
- WHOLE_CHIP_LAYOUT_PARASITICS,
- TEST_SILICON};
- public Mode mode = Mode.WHOLE_CHIP_SCHEMATIC_PARASITICS;
- public int testNum, ringNum, numTokensOther, chipNum=-1;
- public boolean jtagShift = false;
- public Station station=Station.ONE;
+ public enum Mode {//ISOLATED_IN_DOCK,
+ //ISOLATED_OUT_DOCK,
+ WHOLE_CHIP_SCHEMATIC_PARASITICS,
+ WHOLE_CHIP_LAYOUT_PARASITICS,
+ TEST_SILICON};
+ public Mode mode = Mode.WHOLE_CHIP_SCHEMATIC_PARASITICS;
+ public int testNum, ringNum, numTokensOther, chipNum=-1;
+ public boolean jtagShift = false;
+ public Station station=Station.ONE;
public float vdd, temp;
public boolean init;
public boolean wholeChipNetlist() {return mode==Mode.WHOLE_CHIP_SCHEMATIC_PARASITICS ||
- mode==Mode.WHOLE_CHIP_LAYOUT_PARASITICS ||
- mode==Mode.TEST_SILICON;}
- private static void usage() {
- System.out.println("Options: -testNum <int> select which test to run");
+ mode==Mode.WHOLE_CHIP_LAYOUT_PARASITICS ||
+ mode==Mode.TEST_SILICON;}
+ private static void usage() {
+ System.out.println("Options: -testNum <int> select which test to run");
System.out.println(" -vdd <float>");
System.out.println(" -temp <float>");
- System.out.println(" -chipSch simulate netlist of entire chip, parasitics from schematic");
- System.out.println(" -chipLay simulate netlist of entire chip, parasitics from layout");
- System.out.println(" -jtagShift simulate shifting of JTAG chains");
- System.out.println(" -silicon test the silicon");
- System.out.println(" -chipNum <int> store test results according to chip number");
- System.out.println(" -station <int> select test station");
- System.exit(-1);
- }
+ System.out.println(" -chipSch simulate netlist of entire chip, parasitics from schematic");
+ System.out.println(" -chipLay simulate netlist of entire chip, parasitics from layout");
+ System.out.println(" -jtagShift simulate shifting of JTAG chains");
+ System.out.println(" -silicon test the silicon");
+ System.out.println(" -chipNum <int> store test results according to chip number");
+ System.out.println(" -station <int> select test station");
+ System.exit(-1);
+ }
- public CmdArgs(String[] args) {
- int nbArgs = args.length;
- for (int i=0; i<nbArgs; i++) {
- if (args[i].equals("-testNum")) {
- i++;
- if (i>=nbArgs) usage();
- testNum = Integer.parseInt(args[i]);
- } else if (args[i].equals("-vdd")) {
- i++;
- if (i>=nbArgs) usage();
- vdd = Float.parseFloat(args[i]);
- } else if (args[i].equals("-init")) {
- i++;
- if (i>=nbArgs) usage();
- init = Boolean.parseBoolean(args[i]);
- } else if (args[i].equals("-temp")) {
- i++;
- if (i>=nbArgs) usage();
- temp = Float.parseFloat(args[i]);
- } else if (args[i].equals("-chipNum")) {
- i++;
- if (i>=nbArgs) usage();
- chipNum = Integer.parseInt(args[i]);
- } else if (args[i].equals("-station")) {
- i++;
- if (i>=nbArgs) usage();
- switch (Integer.parseInt(args[i])) {
- case 1: station = Station.ONE; break;
- case 2: station = Station.TWO; break;
- default: System.out.println("Bad station: "+args[i]); usage();
- }
- } else if (args[i].equals("-chipSch")) {
- mode = CmdArgs.Mode.WHOLE_CHIP_SCHEMATIC_PARASITICS;
- } else if (args[i].equals("-chipLay")) {
- mode = CmdArgs.Mode.WHOLE_CHIP_LAYOUT_PARASITICS;
- } else if (args[i].equals("-silicon")) {
- mode = CmdArgs.Mode.TEST_SILICON;
- } else if (args[i].equals("-jtagShift")) {
- jtagShift = true;
- } else {
- System.out.println("Bad argument: "+args[i]);
- usage();
- }
- }
- }
- }
+ public CmdArgs(String[] args) {
+ int nbArgs = args.length;
+ for (int i=0; i<nbArgs; i++) {
+ if (args[i].equals("-testNum")) {
+ i++;
+ if (i>=nbArgs) usage();
+ testNum = Integer.parseInt(args[i]);
+ } else if (args[i].equals("-vdd")) {
+ i++;
+ if (i>=nbArgs) usage();
+ vdd = Float.parseFloat(args[i]);
+ } else if (args[i].equals("-init")) {
+ i++;
+ if (i>=nbArgs) usage();
+ init = Boolean.parseBoolean(args[i]);
+ } else if (args[i].equals("-temp")) {
+ i++;
+ if (i>=nbArgs) usage();
+ temp = Float.parseFloat(args[i]);
+ } else if (args[i].equals("-chipNum")) {
+ i++;
+ if (i>=nbArgs) usage();
+ chipNum = Integer.parseInt(args[i]);
+ } else if (args[i].equals("-station")) {
+ i++;
+ if (i>=nbArgs) usage();
+ switch (Integer.parseInt(args[i])) {
+ case 1: station = Station.ONE; break;
+ case 2: station = Station.TWO; break;
+ default: System.out.println("Bad station: "+args[i]); usage();
+ }
+ } else if (args[i].equals("-chipSch")) {
+ mode = CmdArgs.Mode.WHOLE_CHIP_SCHEMATIC_PARASITICS;
+ } else if (args[i].equals("-chipLay")) {
+ mode = CmdArgs.Mode.WHOLE_CHIP_LAYOUT_PARASITICS;
+ } else if (args[i].equals("-silicon")) {
+ mode = CmdArgs.Mode.TEST_SILICON;
+ } else if (args[i].equals("-jtagShift")) {
+ jtagShift = true;
+ } else {
+ System.out.println("Bad argument: "+args[i]);
+ usage();
+ }
+ }
+ }
+ }
public static enum Station {
- ONE("152.70.25.42", 1, "H34401C", "H34401A", 24.98e-3),
- TWO("152.70.25.27", 2, "H34401B", "H34401D", 26.47e-3);
- public final String ipAddr, coreVoltmeter, currentVoltmenter;
- public final int jtagChannel;
- public final double ammeterShuntResistance;
- private Station(String ip, int jtagChannel, String coreVoltmeter,
- String currentVoltmeter, double ammeterShuntResistance) {
- this.ipAddr = ip;
- this.jtagChannel = jtagChannel;
- this.coreVoltmeter = coreVoltmeter;
- this.currentVoltmenter = currentVoltmeter;
- this.ammeterShuntResistance = ammeterShuntResistance;
- }
+ ONE("152.70.25.42", 1, "H34401C", "H34401A", 24.98e-3),
+ TWO("152.70.25.27", 2, "H34401B", "H34401D", 26.47e-3);
+ public final String ipAddr, coreVoltmeter, currentVoltmenter;
+ public final int jtagChannel;
+ public final double ammeterShuntResistance;
+ private Station(String ip, int jtagChannel, String coreVoltmeter,
+ String currentVoltmeter, double ammeterShuntResistance) {
+ this.ipAddr = ip;
+ this.jtagChannel = jtagChannel;
+ this.coreVoltmeter = coreVoltmeter;
+ this.currentVoltmenter = currentVoltmeter;
+ this.ammeterShuntResistance = ammeterShuntResistance;
+ }
};
public static void fatal(boolean pred, String msg) {
- if (pred) Infrastructure.fatal(msg);
- }
-
+ if (pred) Infrastructure.fatal(msg);
+ }
+
public static BitVector generateBits (int start, boolean alternate, int n){
int temp = start;
String bits = Integer.toString(start);
return inputContent.get(38, 14).getState().equals(exitContent.get(38, 14).getState()); //bits 38:38+14 are the data bits
}
- public static boolean insertedVsRemoved(BitVector [] insertedTokenContent, BitVector [] removedTokenContent, int numTokens){
+ public static boolean insertedVsRemoved(BitVector [] insertedTokenContent, BitVector [] removedTokenContent, int numTokens){
for (int i = 0; i < numTokens; i++) {
if (insertedTokenContent[i].get(37)){ //tag = 1 meaning data is valid
}
public static void checkRingData(String ringNm, List<BitVector> dIn,
- List<BitVector> dOut) {
- int sz = dIn.size();
+ List<BitVector> dOut) {
+ int sz = dIn.size();
- fatal(dOut.size()!=sz, ringNm+
- " wrong number of items. Expected:"+sz+", got:"+dOut.size());
+ fatal(dOut.size()!=sz, ringNm+
+ " wrong number of items. Expected:"+sz+", got:"+dOut.size());
- // find offset
- BitVector first = dIn.get(0);
- int offset=0;
- for (; offset<sz; offset++) {
- if (dOut.get(offset).equals(first)) break;
- }
- fatal(offset==sz, "first input item not found in output: "+first.getState());
- //prln("Output item offset: "+offset);
+ // find offset
+ BitVector first = dIn.get(0);
+ int offset=0;
+ for (; offset<sz; offset++) {
+ if (dOut.get(offset).equals(first)) break;
+ }
+ fatal(offset==sz, "first input item not found in output: "+first.getState());
+ //prln("Output item offset: "+offset);
System.out.println("Output item offset: "+offset);
// compare all items
- for (int i=0; i<sz; i++) {
- int outNdx = (i + offset + sz) % sz;
- BitVector out = dOut.get(outNdx);
- BitVector in = dIn.get(i);
+ for (int i=0; i<sz; i++) {
+ int outNdx = (i + offset + sz) % sz;
+ BitVector out = dOut.get(outNdx);
+ BitVector in = dIn.get(i);
- fatal(!in.equals(out), i+"th input item:"+in.getState()+"\n"+
- "doesn't match "+outNdx+"th output item: "+out.getState());
- }
+ fatal(!in.equals(out), i+"th input item:"+in.getState()+"\n"+
+ "doesn't match "+outNdx+"th output item: "+out.getState());
+ }
}
/** Generate List of BitVectors where Token=true, high 25 data bits
* are alternating ones and zeros, low 12 data bits increment from
* zero, and address is given by random number generator. */
public static List<BitVector> makeIncrDataRandAdr(int num, Random rand) {
- List<BitVector> ans = new ArrayList<BitVector>();
- BitVector dHi = new BitVector(25, "dataHi");
- BitVector dLo = new BitVector(12, "dataLo");
- BitVector t = new BitVector("1", "token");
- BitVector a = new BitVector(14, "addr");
- dHi.setFromLong(0x00aaaaa);
- for (int i=0; i<num; i++) {
- dLo.setFromLong(i);
- a.setFromLong((long)rand.nextInt());
- ans.add(dHi.cat(dLo).cat(t).cat(a));
- dHi = dHi.not();
- }
- return ans;
+ List<BitVector> ans = new ArrayList<BitVector>();
+ BitVector dHi = new BitVector(25, "dataHi");
+ BitVector dLo = new BitVector(12, "dataLo");
+ BitVector t = new BitVector("1", "token");
+ BitVector a = new BitVector(14, "addr");
+ dHi.setFromLong(0x00aaaaa);
+ for (int i=0; i<num; i++) {
+ dLo.setFromLong(i);
+ a.setFromLong((long)rand.nextInt());
+ ans.add(dHi.cat(dLo).cat(t).cat(a));
+ dHi = dHi.not();
+ }
+ return ans;
}
- /** Generate List of BitVectors where Token=true, high 25 data bits
+ /** Generate List of BitVectors where Token=true, high 25 data bits
* are alternating ones and zeros, low 12 data bits increment from
* zero, and address is given by addr. */
public static List<BitVector> makeIncrDataConstAdr(int num, int addr) {
- List<BitVector> ans = new ArrayList<BitVector>();
- BitVector dHi = new BitVector(25, "dataHi");
- BitVector dLo = new BitVector(12, "dataLo");
- BitVector t = new BitVector("1", "token");
- BitVector a = new BitVector(14, "addr");
- dHi.setFromLong(0x00aaaaa);
- a.setFromLong(addr);
- for (int i=0; i<num; i++) {
- dLo.setFromLong(i);
- ans.add(dHi.cat(dLo).cat(t).cat(a));
- dHi = dHi.not();
- }
- return ans;
+ List<BitVector> ans = new ArrayList<BitVector>();
+ BitVector dHi = new BitVector(25, "dataHi");
+ BitVector dLo = new BitVector(12, "dataLo");
+ BitVector t = new BitVector("1", "token");
+ BitVector a = new BitVector(14, "addr");
+ dHi.setFromLong(0x00aaaaa);
+ a.setFromLong(addr);
+ for (int i=0; i<num; i++) {
+ dLo.setFromLong(i);
+ ans.add(dHi.cat(dLo).cat(t).cat(a));
+ dHi = dHi.not();
+ }
+ return ans;
}
public static List<BitVector> makeIncrDataConstAdr(int num, String addr) {
- List<BitVector> ans = new ArrayList<BitVector>();
- BitVector dHi = new BitVector(25, "dataHi");
- BitVector dLo = new BitVector(12, "dataLo");
- BitVector t = new BitVector("1", "token");
- BitVector a = new BitVector(addr, "addr");
- dHi.setFromLong(0x00aaaaa);
- //a.setFromLong(addr);
- for (int i=0; i<num; i++) {
- dLo.setFromLong(i);
- ans.add(dHi.cat(dLo).cat(t).cat(a));
- dHi = dHi.not();
- }
- return ans;
+ List<BitVector> ans = new ArrayList<BitVector>();
+ BitVector dHi = new BitVector(25, "dataHi");
+ BitVector dLo = new BitVector(12, "dataLo");
+ BitVector t = new BitVector("1", "token");
+ BitVector a = new BitVector(addr, "addr");
+ dHi.setFromLong(0x00aaaaa);
+ //a.setFromLong(addr);
+ for (int i=0; i<num; i++) {
+ dLo.setFromLong(i);
+ ans.add(dHi.cat(dLo).cat(t).cat(a));
+ dHi = dHi.not();
+ }
+ return ans;
}
public static List<BitVector> makeConstDataConstAdr(int num, boolean dataValue, String addr) {
- List<BitVector> ans = new ArrayList<BitVector>();
- BitVector d = new BitVector(37, "dataHi");
- BitVector t = new BitVector("1", "token");
- BitVector a = new BitVector(addr, "addr");
- Long dat = dataValue ? -1L : 0L;
- d.setFromLong(dat);
- for (int i=0; i<num; i++) {
- ans.add(d.cat(t).cat(a));
- }
- return ans;
+ List<BitVector> ans = new ArrayList<BitVector>();
+ BitVector d = new BitVector(37, "dataHi");
+ BitVector t = new BitVector("1", "token");
+ BitVector a = new BitVector(addr, "addr");
+ Long dat = dataValue ? -1L : 0L;
+ d.setFromLong(dat);
+ for (int i=0; i<num; i++) {
+ ans.add(d.cat(t).cat(a));
+ }
+ return ans;
}
public static List<BitVector> make0TokenAdd(int num, int addrMsb, int addrLsb) {
- List<BitVector> ans = new ArrayList<BitVector>();
- BitVector d = new BitVector(37, "data");
- BitVector t = new BitVector("0", "token");
- BitVector aHi = new BitVector(1, "addrHi");
+ List<BitVector> ans = new ArrayList<BitVector>();
+ BitVector d = new BitVector(37, "data");
+ BitVector t = new BitVector("0", "token");
+ BitVector aHi = new BitVector(1, "addrHi");
BitVector aLo = new BitVector(1, "addrLo");
BitVector aMid = new BitVector(12, "addrMid");
- d.setFromLong(0x0000000000L);
+ d.setFromLong(0x0000000000L);
aHi.setFromLong(addrMsb);
aLo.setFromLong(addrLsb);
aMid.setFromLong(0x000);
- for (int i=0; i<num; i++) {
- ans.add(d.cat(t).cat(aHi).cat(aMid).cat(aLo));
- }
- return ans;
+ for (int i=0; i<num; i++) {
+ ans.add(d.cat(t).cat(aHi).cat(aMid).cat(aLo));
+ }
+ return ans;
}
/** Generate List of BitVectors where Token=true, the address MSB
* is given by addrMsb, the address LSB is set by addrLSB,
* data bits alternate between 0xaaaa and 0x5555.
* 12 insignificant address bits to crosser alternate between 0xaaa and 0x555 */
public static List<BitVector> makeAltDataAdd(int num, Long longValue, int addrMsb, int addrLsb, boolean crosser) {
- List<BitVector> ans = new ArrayList<BitVector>();
- BitVector d = new BitVector(37, "data");
- BitVector t = new BitVector("1", "token");
- BitVector aHi = new BitVector(1, "addrHi");
+ List<BitVector> ans = new ArrayList<BitVector>();
+ BitVector d = new BitVector(37, "data");
+ BitVector t = new BitVector("1", "token");
+ BitVector aHi = new BitVector(1, "addrHi");
BitVector aLo = new BitVector(1, "addrLo");
BitVector aMid = new BitVector(12, "addrMid");
BitVector aRing = new BitVector(14, "addrRing"); //address bits for ring, bit 0 and 13 do not need to be anything specific b/c there isn't a cross element in the ring
ans.add(d.cat(t).cat(aRing));
}
d = d.not();
- aMid = aMid.not();
+ aMid = aMid.not();
aRing = aRing.not();
}
- return ans;
+ return ans;
}
public static void compareItemsOrdered(List<BitVector> din, List<BitVector> dout) {
fatal(din.size()!=dout.size(),
- "in count="+din.size()+" out count="+dout.size());
- for (int i=0; i<din.size(); i++) {
- BitVector dI = din.get(i);
- BitVector dO = dout.get(i);
- fatal(!dI.equals(dO),
- "item mismatch! in:"+dI.getState()+" out:"+dO.getState());
- }
+ "in count="+din.size()+" out count="+dout.size());
+ for (int i=0; i<din.size(); i++) {
+ BitVector dI = din.get(i);
+ BitVector dO = dout.get(i);
+ fatal(!dI.equals(dO),
+ "item mismatch! in:"+dI.getState()+" out:"+dO.getState());
+ }
}
public static void compareJUSTDataTag(List<BitVector> din, List<BitVector> dout) {
fatal(din.size()!=dout.size(),
- "in count="+din.size()+" out count="+dout.size());
- for (int i=0; i<din.size(); i++) {
- BitVector dI = din.get(i);
- BitVector dO = dout.get(i);
+ "in count="+din.size()+" out count="+dout.size());
+ for (int i=0; i<din.size(); i++) {
+ BitVector dI = din.get(i);
+ BitVector dO = dout.get(i);
//prln("Count = " + i + ", dI = " + dI + ", dO = " + dO);
- fatal(!dI.get(0,37).equals(dO.get(0,37)),
- "data mismatch! in data + tag:"+dI.get(0,37).getState()+" out data + tag:"+dO.get(0,37).getState());
- }
+ fatal(!dI.get(0,37).equals(dO.get(0,37)),
+ "data mismatch! in data + tag:"+dI.get(0,37).getState()+" out data + tag:"+dO.get(0,37).getState());
+ }
}
public static void checkUnorderedData(List<BitVector> din, List<BitVector> dout) {
- int sz = din.size();
- fatal(dout.size()!=sz, "found "+dout.size()+" items, Expected: "+sz);
- for (BitVector in : din) {
- boolean found = false;
- for (BitVector out : dout) {
- if (in.equals(out)) {
- found = true;
- break;
- }
- }
- fatal(!found, "Can't find vector in output: "+in.getState());
- }
+ int sz = din.size();
+ fatal(dout.size()!=sz, "found "+dout.size()+" items, Expected: "+sz);
+ for (BitVector in : din) {
+ boolean found = false;
+ for (BitVector out : dout) {
+ if (in.equals(out)) {
+ found = true;
+ break;
+ }
+ }
+ fatal(!found, "Can't find vector in output: "+in.getState());
+ }
}
public static void checkUnorderedJUSTDataTag(List<BitVector> din, List<BitVector> dout) {
- int sz = din.size();
- fatal(dout.size()!=sz, "found "+dout.size()+" items, Expected: "+sz);
- for (BitVector in : din) {
- boolean found = false;
- for (BitVector out : dout) {
- if (in.get(0,37).equals(out.get(0,37))) {
- found = true;
- break;
- }
- }
- fatal(!found, "Can't find vector in output: "+in.getState());
- }
+ int sz = din.size();
+ fatal(dout.size()!=sz, "found "+dout.size()+" items, Expected: "+sz);
+ for (BitVector in : din) {
+ boolean found = false;
+ for (BitVector out : dout) {
+ if (in.get(0,37).equals(out.get(0,37))) {
+ found = true;
+ break;
+ }
+ }
+ fatal(!found, "Can't find vector in output: "+in.getState());
+ }
}
public static void checkToken0Add(List<BitVector> din, List<BitVector> dout) {
- int sz = din.size();
- fatal(dout.size()!=sz, "found "+dout.size()+" items, Expected: "+sz);
- for (BitVector in : din) {
- boolean found = false;
- for (BitVector out : dout) {
- if (in.get(38,14).equals(out.get(38,14))) {
- found = true;
- break;
- }
- }
- fatal(!found, "Can't find vector in output: "+in.getState());
- }
+ int sz = din.size();
+ fatal(dout.size()!=sz, "found "+dout.size()+" items, Expected: "+sz);
+ for (BitVector in : din) {
+ boolean found = false;
+ for (BitVector out : dout) {
+ if (in.get(38,14).equals(out.get(38,14))) {
+ found = true;
+ break;
+ }
+ }
+ fatal(!found, "Can't find vector in output: "+in.getState());
+ }
}
public static int findBitVectorIndex(List<BitVector> din, BitVector findThis) {
- int sz = din.size();
+ int sz = din.size();
boolean found=false;
int i=0;
for (BitVector in : din) {
- if (in.equals(findThis)) {
+ if (in.equals(findThis)) {
found = true;
break;
} else {i++;}
}
fatal(!found, "Can't find vector in output: "+findThis.getState());
- return i;
+ return i;
}
public static String formatDataTokAddr(BitVector dta) {
- if (dta.getNumBits()!=(37+1+14)) {
- Infrastructure.fatal("wrong number of bits");
- }
- return dta.get(0,37).getState() + " " +
- dta.get(37,1).getState() + " " +
- dta.get(38,14).getState();
+ if (dta.getNumBits()!=(37+1+14)) {
+ Infrastructure.fatal("wrong number of bits");
+ }
+ return dta.get(0,37).getState() + " " +
+ dta.get(37,1).getState() + " " +
+ dta.get(38,14).getState();
}
public static BitVector extractAddr(BitVector dataTokAddr) {
- fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
- return dataTokAddr.get((37+1), 14);
+ fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
+ return dataTokAddr.get((37+1), 14);
}
public static BitVector extractToken(BitVector dataTokAddr) {
- fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
- return dataTokAddr.get(37, 1);
+ fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
+ return dataTokAddr.get(37, 1);
}
public static BitVector extractData(BitVector dataTokAddr) {
- fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
- return dataTokAddr.get(0, 37);
+ fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
+ return dataTokAddr.get(0, 37);
}
public static BitVector berkToSun(edu.berkeley.fleet.api.BitVector berkBits) {
import com.sun.vlsi.chips.marina.test.MarinaUtils.StateWireState;
public class ProperStopper {
- // position of strobes in the control chain
- private static final int BLOCK_STROBE_NDX = 0;
- private static final int FILL_STROBE_NDX = 1;
- private static final int GO_STROBE_NDX = 2;
- private static final int SILENT_STROBE_NDX = 3;
- private static final int CLEAR_STROBE_NDX = 4;
- private static final int GENERAL_PURPOSE_STROBE_NDX = 5;
-
- // position of inputs in report chain
- private static final int PREV_STATE_IN_NDX = 0;
- private static final int FILL_STROBE_IN_NDX = 1;
- private static final int FILL_STATE_IN_NDX = 2;
- private static final int STOPPED_IN_NDX = 3;
-
- private final String name;
+ // position of strobes in the control chain
+ private static final int BLOCK_STROBE_NDX = 0;
+ private static final int FILL_STROBE_NDX = 1;
+ private static final int GO_STROBE_NDX = 2;
+ private static final int SILENT_STROBE_NDX = 3;
+ private static final int CLEAR_STROBE_NDX = 4;
+ private static final int GENERAL_PURPOSE_STROBE_NDX = 5;
+
+ // position of inputs in report chain
+ private static final int PREV_STATE_IN_NDX = 0;
+ private static final int FILL_STROBE_IN_NDX = 1;
+ private static final int FILL_STATE_IN_NDX = 2;
+ private static final int STOPPED_IN_NDX = 3;
+
+ private final String name;
private final String captureClockRelPath = "fillStag@1.gaspFill@0.fillScan@1";
// test library direct write mode doesn't understand per register write
// enables. We get simulation to work by toggling write clock.
private final String captureClockName = "si[4]";
private boolean traceFill = true;
- private boolean traceDrain = true;
-
+ private boolean traceDrain = true;
+
private final String controlChain, controlPath,
- dataChain, dataPath,
- reportChain, reportPath;
+ dataChain, dataPath,
+ reportChain, reportPath;
private final String captureClock;
private final ChainControls cc;
private final ChipModel model;
- private final Indenter indenter;
+ 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);}
-
- /** NanosimModel.setNodeState() requires special path names.
- * Each instance name in the path must begin with the character 'x'.
- * Return a path with the added X's. */
- private String prefixInstNamesInPathWithX(String path) {
- StringBuffer sb = new StringBuffer();
- sb.append('x');
- for (int i=0; i<path.length(); i++) {
- char c = path.charAt(i);
- sb.append(c);
- if (c=='.') sb.append('x');
- }
- return sb.toString();
- }
+ 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'.
+ * Return a path with the added X's. */
+ private String prefixInstNamesInPathWithX(String path) {
+ StringBuffer sb = new StringBuffer();
+ sb.append('x');
+ for (int i=0; i<path.length(); i++) {
+ char c = path.charAt(i);
+ sb.append(c);
+ if (c=='.') sb.append('x');
+ }
+ return sb.toString();
+ }
private BitVector getDatTokAdr() {
- // strip the two write enable bits
- return cc.getOutBits(dataPath).get(2, 52);
+ // strip the two write enable bits
+ return cc.getOutBits(dataPath).get(2, 52);
}
private void shiftControl(boolean readEnable, boolean writeEnable) {
- cc.shift(controlChain, readEnable, writeEnable);
+ cc.shift(controlChain, readEnable, writeEnable);
}
private void shiftData(boolean readEnable, boolean writeEnable) {
- cc.shift(dataChain, readEnable, writeEnable);
- if (writeEnable) {
- if (clockHack && model instanceof NanosimModel) {
- NanosimModel nanoModel = (NanosimModel) model;
- nanoModel.setNodeState(captureClock, 1);
- nanoModel.waitNS(1);
- nanoModel.setNodeState(captureClock, 0);
- }
- }
+ cc.shift(dataChain, readEnable, writeEnable);
+ if (writeEnable) {
+ if (clockHack && model instanceof NanosimModel) {
+ NanosimModel nanoModel = (NanosimModel) model;
+ nanoModel.setNodeState(captureClock, 1);
+ nanoModel.waitNS(1);
+ nanoModel.setNodeState(captureClock, 0);
+ }
+ }
}
private void shiftReport(boolean readEnable, boolean writeEnable) {
- cc.shift(reportChain, readEnable, writeEnable);
+ cc.shift(reportChain, readEnable, writeEnable);
}
private StateWireState boolToState(boolean b) {
- return b ? StateWireState.FULL : StateWireState.EMPTY;
+ return b ? StateWireState.FULL : StateWireState.EMPTY;
}
// The first 5 bits of the control chain control the fill and drain stages
private void setFillDrainControl(BitVector fdCtl) {
- fatal(fdCtl.getNumBits()!=6, "expect 6 proper stopper control bits");
- BitVector val = cc.getInBits(controlPath);
- for (int i=0; i<fdCtl.getNumBits(); i++) {
- val.set(i, fdCtl.get(i));
- }
- cc.setInBits(controlPath, val);
- shiftControl(false, true);
+ fatal(fdCtl.getNumBits()!=6, "expect 6 proper stopper control bits");
+ BitVector val = cc.getInBits(controlPath);
+ for (int i=0; i<fdCtl.getNumBits(); i++) {
+ val.set(i, fdCtl.get(i));
+ }
+ cc.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);
- val.set(GENERAL_PURPOSE_STROBE_NDX,b);
- shiftControl(false, true);
+ BitVector val = cc.getInBits(controlPath);
+ val.set(GENERAL_PURPOSE_STROBE_NDX,b);
+ shiftControl(false, true);
}
//-------------------------- public methods ----------------------------
* the Instruction stopper only uses the 37 bits of data so it only
* wants to print the 37 instruction bits */
public String formatDataTokAddr(BitVector dta) {
- return MarinaUtils.formatDataTokAddr(dta);
+ return MarinaUtils.formatDataTokAddr(dta);
}
/** Put stopper in RUN state */
public void run() {
- setFillDrainControl(MarinaUtils.RingIfc.RUN.bits());
+ setFillDrainControl(MarinaUtils.RingIfc.RUN.bits());
}
/** Put stopper in IDLE state */
public void idle() {
- setFillDrainControl(MarinaUtils.RingIfc.IDLE.bits());
+ setFillDrainControl(MarinaUtils.RingIfc.IDLE.bits());
}
/** Put stopper in FILL state */
public void fill() {
- setFillDrainControl(MarinaUtils.RingIfc.FILL.bits());
+ setFillDrainControl(MarinaUtils.RingIfc.FILL.bits());
}
/** Put stopper in BLOCK state */
public void block() {
- setFillDrainControl(MarinaUtils.RingIfc.BLOCK.bits());
+ setFillDrainControl(MarinaUtils.RingIfc.BLOCK.bits());
}
/** Put stopper in STOP state */
public void stop() {
- setFillDrainControl(MarinaUtils.RingIfc.STOP.bits());
+ setFillDrainControl(MarinaUtils.RingIfc.STOP.bits());
}
/** Put stopper in CLEAR state */
public void clear() {
- setFillDrainControl(MarinaUtils.RingIfc.CLEAR.bits());
+ setFillDrainControl(MarinaUtils.RingIfc.CLEAR.bits());
}
/** Put stopper in SOURCE state */
public void source() {
- setFillDrainControl(MarinaUtils.RingIfc.SOURCE.bits());
+ setFillDrainControl(MarinaUtils.RingIfc.SOURCE.bits());
}
/** Put stopper in STOPSOURCE state */
public void stopSource() {
- setFillDrainControl(MarinaUtils.RingIfc.STOPSOURCE.bits());
+ setFillDrainControl(MarinaUtils.RingIfc.STOPSOURCE.bits());
}
/** Put stopper in SINK state */
public void sink() {
- setFillDrainControl(MarinaUtils.RingIfc.SINK.bits());
+ setFillDrainControl(MarinaUtils.RingIfc.SINK.bits());
}
/** Put stopper in STOPSINK state */
public void stopSink() {
- setFillDrainControl(MarinaUtils.RingIfc.STOPSINK.bits());
+ setFillDrainControl(MarinaUtils.RingIfc.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 */
public void stopToFill() {
- stop(); // go = 0
- idle(); // block = 1
- block(); // go = 1
-// idle(); // go = 0
+ stop(); // go = 0
+ idle(); // block = 1
+ block(); // go = 1
+ // idle(); // go = 0
}
/** get value of the state wire preceding the fill stage */
public StateWireState getPrevStateWire() {
- shiftReport(true, false);
- BitVector b = cc.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));
+ shiftReport(true, false);
+ BitVector b = cc.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));
}
/** get the value of drain stage fill wire.
* The fill wire will be interesting if we doubt that the
* scan chain works. */
public boolean getFillStrobe() {
- shiftReport(true, false);
- return cc.getOutBits(reportPath).get(FILL_STROBE_IN_NDX);
+ 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));
+ 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);
+ 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(getPrevStateWire()+"\n");
- sb.append("Stopper's fill stage: ");
- sb.append(getFillStateWire()+"\n");
- sb.append("Stopper's stopped: ");
- sb.append(getStopped()+"\n");
- return sb.toString();
+ StringBuffer sb = new StringBuffer();
+ sb.append("Stopper's prev state: ");
+ sb.append(getPrevStateWire()+"\n");
+ sb.append("Stopper's fill stage: ");
+ sb.append(getFillStateWire()+"\n");
+ sb.append("Stopper's stopped: ");
+ sb.append(getStopped()+"\n");
+ return sb.toString();
}
/** construct a ProperStopper */
public ProperStopper(String propInst,
- String controlChain, String dataChain,
- String reportChain,
- ChainControls cc, ChipModel model,
- boolean clockHack,
- Indenter indenter) {
- this.name = propInst;
- this.controlChain = controlChain;
- this.controlPath = controlChain+'.'+propInst;
- this.dataChain = dataChain;
- this.dataPath = dataChain+'.'+propInst;
- this.reportChain = reportChain;
- this.reportPath = reportChain+'.'+propInst;
- this.captureClock =
- prefixInstNamesInPathWithX(propInst+'.'+captureClockRelPath)
- +'.'+captureClockName;
- this.cc = cc;
- this.model = model;
- this.clockHack = clockHack;
- this.indenter = indenter;
+ String controlChain, String dataChain,
+ String reportChain,
+ ChainControls cc, ChipModel model,
+ boolean clockHack,
+ Indenter indenter) {
+ this.name = propInst;
+ this.controlChain = controlChain;
+ this.controlPath = controlChain+'.'+propInst;
+ this.dataChain = dataChain;
+ this.dataPath = dataChain+'.'+propInst;
+ this.reportChain = reportChain;
+ this.reportPath = reportChain+'.'+propInst;
+ this.captureClock =
+ prefixInstNamesInPathWithX(propInst+'.'+captureClockRelPath)
+ +'.'+captureClockName;
+ this.cc = cc;
+ this.model = model;
+ 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");
- we.setFromLong(0);
- data.setFromLong(0);
- tag.setFromLong(0);
- addr.setFromLong(0);
- BitVector wdta = we.cat(data).cat(tag).cat(addr);
-
+ 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");
+ we.setFromLong(0);
+ data.setFromLong(0);
+ tag.setFromLong(0);
+ addr.setFromLong(0);
+ BitVector wdta = we.cat(data).cat(tag).cat(addr);
+
cc.setInBits(dataPath, wdta);
}
* You must stop stopper before calling fill.
* exit state: block */
public void fill(BitVector dta) {
- if (traceFill) prln("Begin fill. stopper="+name);
- adjustIndent(2);
-
- int n = dta.getNumBits();
- fatal(n!=(37+1+14), "fill: wrong num bits: "+n);
-
- // make sure fill stage is empty
- StateWireState myState = getFillStateWire();
- fatal(myState!=StateWireState.EMPTY,
- "fill: fill stage already full");
-
- if (traceFill) prln("writing data: "+formatDataTokAddr(dta));
-
- idle(); // block = 1, go = 0
+ if (traceFill) prln("Begin fill. stopper="+name);
+ adjustIndent(2);
+
+ int n = dta.getNumBits();
+ fatal(n!=(37+1+14), "fill: wrong num bits: "+n);
+
+ // make sure fill stage is empty
+ StateWireState myState = getFillStateWire();
+ fatal(myState!=StateWireState.EMPTY,
+ "fill: fill stage already full");
+
+ if (traceFill) prln("writing data: "+formatDataTokAddr(dta));
+
+ idle(); // block = 1, go = 0
- BitVector wrEn = new BitVector(2, "write enable");
- wrEn.setFromLong(3);
+ BitVector wrEn = new BitVector(2, "write enable");
+ wrEn.setFromLong(3);
cc.setInBits(dataPath, wrEn.cat(dta));
- shiftData(false, true);
-
- fill(); // fill = 1
- idle(); // fill = 0
- block(); // go = 1
-// idle();
-
- model.waitNS(5);
+ shiftData(false, true);
+
+ fill(); // fill = 1
+ idle(); // fill = 0
+ block(); // go = 1
+ // idle();
+
+ model.waitNS(5);
- // debugging
- if (traceFill) prln(getReportString());
-
- // if data chain is shifted in the future, don't write!
- wrEn.setFromLong(0);
- cc.setInBits(dataPath, wrEn.cat(dta));
-
- adjustIndent(-2);
- if (traceFill) prln("End fill");
+ // debugging
+ if (traceFill) prln(getReportString());
+
+ // if data chain is shifted in the future, don't write!
+ wrEn.setFromLong(0);
+ cc.setInBits(dataPath, wrEn.cat(dta));
+
+ adjustIndent(-2);
+ if (traceFill) prln("End fill");
}
/** Insert items from a list, one by one.
* You must stop stopper before calling fillMany()
* exit state: block */
public void fillMany(List<BitVector> data) {
- prln("Begin fillMany. stopper="+name+" numWords="+data.size());
- adjustIndent(2);
- int cnt = 0;
- for (BitVector bv : data) {
- if (traceFill) prln("fillStopperMany: writing word number: "+cnt++);
- fill(bv);
- }
- adjustIndent(-2);
- prln("end fillMany");
+ prln("Begin fillMany. stopper="+name+" numWords="+data.size());
+ adjustIndent(2);
+ int cnt = 0;
+ for (BitVector bv : data) {
+ if (traceFill) prln("fillStopperMany: writing word number: "+cnt++);
+ fill(bv);
+ }
+ adjustIndent(-2);
+ prln("end fillMany");
}
/** Remove one item from fill stage. Return that item.
* An item must be available.
* drain() will stop cleanly.
* exit state: stop */
public BitVector drain() {
- stop(); // all zero, block = 0, go = 0
-
- // make sure an item is available
- StateWireState myState=getFillStateWire();
- fatal(myState==StateWireState.EMPTY, "drain: fill stage empty");
+ stop(); // all zero, block = 0, go = 0
+
+ // make sure an item is available
+ StateWireState myState=getFillStateWire();
+ fatal(myState==StateWireState.EMPTY, "drain: fill stage empty");
- return drainNoCheck();
+ return drainNoCheck();
}
/** Remove one item from fill stage. Return that item.
* Assume that an item is available.
* entry state: stop
* exit state: stop */
private BitVector drainNoCheck() {
- shiftData(true, false);
- BitVector ans = getDatTokAdr();
+ shiftData(true, false);
+ BitVector ans = getDatTokAdr();
- idle(); // block = 1
- clear(); // clear = 1
- idle(); // clear = 0
- stop(); // block = 0
+ idle(); // block = 1
+ clear(); // clear = 1
+ idle(); // clear = 0
+ stop(); // block = 0
- if (traceDrain) prln("drain stopper="+name+" data="+formatDataTokAddr(ans));
- return ans;
+ if (traceDrain) prln("drain stopper="+name+" data="+formatDataTokAddr(ans));
+ return ans;
}
/** Remove as many items as possible from the fill stage.
* drainStopperMany() will stop cleanly.
* exit state: stop */
public List<BitVector> drainMany() {
- return drainMany(Integer.MAX_VALUE);
+ return drainMany(Integer.MAX_VALUE);
}
/** Remove up to maxNbItems items from the fill stage.
* drainStopperMany() will stop cleanly.
* exit state: stop */
public List<BitVector> drainMany(int maxNbItems) {
- prln("begin drainMany. stopper="+name);
- adjustIndent(2);
-
- stop();
-
- List<BitVector> ans = new ArrayList<BitVector>();
-
- int cnt = 0;
- while (true) {
- StateWireState myState=getFillStateWire();
+ prln("begin drainMany. stopper="+name);
+ adjustIndent(2);
+
+ stop();
+
+ List<BitVector> ans = new ArrayList<BitVector>();
+
+ int cnt = 0;
+ while (true) {
+ StateWireState myState=getFillStateWire();
- // debugging
- if (traceDrain) prln(getReportString());
+ // debugging
+ if (traceDrain) prln(getReportString());
- if (myState==StateWireState.EMPTY || cnt>=maxNbItems) break;
-
- if (traceDrain) prln("drainMany: reading word number: "+cnt++);
-
- BitVector d = drainNoCheck();
+ if (myState==StateWireState.EMPTY || cnt>=maxNbItems) break;
+
+ if (traceDrain) prln("drainMany: reading word number: "+cnt++);
+
+ BitVector d = drainNoCheck();
- ans.add(d);
- }
-
- adjustIndent(-2);
- prln("end drainMany, got "+ans.size()+" items");
-
- return ans;
+ ans.add(d);
+ }
+
+ adjustIndent(-2);
+ prln("end drainMany, got "+ans.size()+" items");
+
+ return ans;
}