From 2e6285bf83b43c59476abca11753fe72263319dc Mon Sep 17 00:00:00 2001 From: Adam Megacz Date: Tue, 10 Mar 2009 19:49:39 +0000 Subject: [PATCH] remove tab characters from source code files --- .../sun/vlsi/chips/marina/test/ChainControls.java | 82 +- .../com/sun/vlsi/chips/marina/test/Counter.java | 38 +- .../com/sun/vlsi/chips/marina/test/Design.java | 2 +- .../com/sun/vlsi/chips/marina/test/Indenter.java | 78 +- .../vlsi/chips/marina/test/InstructionStopper.java | 116 +- .../com/sun/vlsi/chips/marina/test/Marina.java | 256 ++-- .../com/sun/vlsi/chips/marina/test/MarinaTest.java | 1526 ++++++++++---------- .../sun/vlsi/chips/marina/test/MarinaUtils.java | 512 +++---- .../sun/vlsi/chips/marina/test/ProperStopper.java | 412 +++--- 9 files changed, 1511 insertions(+), 1511 deletions(-) diff --git a/testCode/com/sun/vlsi/chips/marina/test/ChainControls.java b/testCode/com/sun/vlsi/chips/marina/test/ChainControls.java index cb366d3..5e93a1c 100644 --- a/testCode/com/sun/vlsi/chips/marina/test/ChainControls.java +++ b/testCode/com/sun/vlsi/chips/marina/test/ChainControls.java @@ -15,45 +15,45 @@ import com.sun.async.test.ChainControl; * JTAG controller exists. */ public class ChainControls { - private Map chainToControl = - new HashMap(); - - /** 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 chainToControl = + new HashMap(); + + /** 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(); + } + } } diff --git a/testCode/com/sun/vlsi/chips/marina/test/Counter.java b/testCode/com/sun/vlsi/chips/marina/test/Counter.java index ebba300..e3f73c0 100644 --- a/testCode/com/sun/vlsi/chips/marina/test/Counter.java +++ b/testCode/com/sun/vlsi/chips/marina/test/Counter.java @@ -3,23 +3,23 @@ import com.sun.async.test.ChainControl; 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() { + + } + } diff --git a/testCode/com/sun/vlsi/chips/marina/test/Design.java b/testCode/com/sun/vlsi/chips/marina/test/Design.java index 6216863..218d1d4 100644 --- a/testCode/com/sun/vlsi/chips/marina/test/Design.java +++ b/testCode/com/sun/vlsi/chips/marina/test/Design.java @@ -3,5 +3,5 @@ package com.sun.vlsi.chips.marina.test; import com.sun.async.test.JtagTester; public interface Design { - public void masterClear(JtagTester tester); + public void masterClear(JtagTester tester); } diff --git a/testCode/com/sun/vlsi/chips/marina/test/Indenter.java b/testCode/com/sun/vlsi/chips/marina/test/Indenter.java index e7f9679..eea831e 100644 --- a/testCode/com/sun/vlsi/chips/marina/test/Indenter.java +++ b/testCode/com/sun/vlsi/chips/marina/test/Indenter.java @@ -1,45 +1,45 @@ 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; i37, "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))); + } } diff --git a/testCode/com/sun/vlsi/chips/marina/test/Marina.java b/testCode/com/sun/vlsi/chips/marina/test/Marina.java index ee48a9c..94b0d3b 100644 --- a/testCode/com/sun/vlsi/chips/marina/test/Marina.java +++ b/testCode/com/sun/vlsi/chips/marina/test/Marina.java @@ -15,7 +15,7 @@ public class Marina { 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 = @@ -38,86 +38,86 @@ public class Marina { 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); @@ -129,68 +129,68 @@ public class Marina { 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) { @@ -207,49 +207,49 @@ public class Marina { /** 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 makeIncrDataConstAdr(int num, int addr) { - List ans = new ArrayList(); - 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 ans = new ArrayList(); + 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 din) { - prln("Begin stopToStop"); - adjustIndent(2); - - s1.stop(); - - long ctrStart = ctr==null ? 0 : ctr.getCount(); - - s1.fillMany(din); - waitUntilQuiescent(); + Counter ctr, + List din) { + prln("Begin stopToStop"); + adjustIndent(2); + + s1.stop(); + + long ctrStart = ctr==null ? 0 : ctr.getCount(); + + s1.fillMany(din); + waitUntilQuiescent(); List 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 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 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 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 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 din = makeIncrDataConstAdr(1, adr); - stopToStop(s1, s2, ctr, din); - - adjustIndent(-2); - prln("End stopToStopOne"); + Counter ctr, int adr) { + prln("Begin stopToStopOne"); + adjustIndent(2); + + List 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 din = makeIncrDataConstAdr(3, adr); - stopToStop(s1, s2, ctr, din); - - adjustIndent(-2); - prln("End stopToStopOne"); + Counter ctr, int adr) { + prln("Begin stopToStopOne"); + adjustIndent(2); + + List din = makeIncrDataConstAdr(3, adr); + stopToStop(s1, s2, ctr, din); + + adjustIndent(-2); + prln("End stopToStopOne"); } private int indexOf(BitVector o, List dIn) { - for (int i=0; i dIn, List 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 din = new ArrayList(); - - 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 din = new ArrayList(); + + 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); @@ -535,21 +535,21 @@ public class MarinaTest { 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); @@ -560,8 +560,8 @@ public class MarinaTest { 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) { @@ -572,9 +572,9 @@ public class MarinaTest { } private void testFlagZ(Marina marina) { - prln("Begin testFlagZ"); - adjustIndent(2); - + prln("Begin testFlagZ"); + adjustIndent(2); + List toks; Predicate only_if_olc_zero = Predicate.FlagD; @@ -612,14 +612,14 @@ public class MarinaTest { 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 dItems; prln("Setting OLC=63"); @@ -636,7 +636,7 @@ public class MarinaTest { ? Instruction.Set.FlagFunction.ONE : Instruction.Set.FlagFunction.ZERO )); - getCtrsFlags(marina); + getCtrsFlags(marina); adjustIndent(2); for(Predicate predicate : new Predicate[] { @@ -671,136 +671,136 @@ public class MarinaTest { 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; iring" 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" @@ -986,7 +986,7 @@ public class MarinaTest { 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 ////////////////////////////////////////////////////////////////////////////// @@ -1010,7 +1010,7 @@ public class MarinaTest { // 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"); } @@ -1031,15 +1031,15 @@ public class MarinaTest { 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 @@ -1050,28 +1050,28 @@ public class MarinaTest { } // 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 + @@ -1080,14 +1080,14 @@ public class MarinaTest { // 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"); @@ -1095,10 +1095,10 @@ public class MarinaTest { // 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"); } @@ -1106,12 +1106,12 @@ public class MarinaTest { List 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 @@ -1122,16 +1122,16 @@ public class MarinaTest { 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"); } @@ -1143,43 +1143,43 @@ public class MarinaTest { List 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; @@ -1209,8 +1209,8 @@ public class MarinaTest { 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"); } /** @@ -1218,8 +1218,8 @@ public class MarinaTest { * 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); @@ -1272,17 +1272,17 @@ public class MarinaTest { "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 */ @@ -1308,14 +1308,14 @@ public class MarinaTest { 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 dataItems; for(int bit=0; bit<37; bit++) { @@ -1338,7 +1338,7 @@ public class MarinaTest { "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 @@ -1357,15 +1357,15 @@ public class MarinaTest { 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++) { @@ -1384,13 +1384,13 @@ public class MarinaTest { fatal(olc != (1<=olc ? 0 : 1; dataItems = marina.data.drainMany(2); @@ -1884,201 +1884,201 @@ public class MarinaTest { } 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 out = marina.instrIn.drainMany(); - for (int i=0; i out = marina.instrIn.drainMany(); + for (int i=0; i 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;} @@ -41,101 +41,101 @@ public class MarinaUtils { 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 select which test to run"); + mode==Mode.WHOLE_CHIP_LAYOUT_PARASITICS || + mode==Mode.TEST_SILICON;} + private static void usage() { + System.out.println("Options: -testNum select which test to run"); System.out.println(" -vdd "); System.out.println(" -temp "); - 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 store test results according to chip number"); - System.out.println(" -station 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 store test results according to chip number"); + System.out.println(" -station select test station"); + System.exit(-1); + } - public CmdArgs(String[] args) { - int nbArgs = args.length; - for (int i=0; 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) 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); @@ -194,7 +194,7 @@ public class MarinaUtils { 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 @@ -218,120 +218,120 @@ public class MarinaUtils { } public static void checkRingData(String ringNm, List dIn, - List dOut) { - int sz = dIn.size(); + List 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 makeIncrDataRandAdr(int num, Random rand) { - List ans = new ArrayList(); - 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 ans = new ArrayList(); + 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 makeIncrDataConstAdr(int num, int addr) { - List ans = new ArrayList(); - 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 ans = new ArrayList(); + 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 makeIncrDataConstAdr(int num, String addr) { - List ans = new ArrayList(); - 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 ans = new ArrayList(); + 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 makeConstDataConstAdr(int num, boolean dataValue, String addr) { - List ans = new ArrayList(); - 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 ans = new ArrayList(); + 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 make0TokenAdd(int num, int addrMsb, int addrLsb) { - List ans = new ArrayList(); - BitVector d = new BitVector(37, "data"); - BitVector t = new BitVector("0", "token"); - BitVector aHi = new BitVector(1, "addrHi"); + List ans = new ArrayList(); + 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 makeAltDataAdd(int num, Long longValue, int addrMsb, int addrLsb, boolean crosser) { - List ans = new ArrayList(); - BitVector d = new BitVector(37, "data"); - BitVector t = new BitVector("1", "token"); - BitVector aHi = new BitVector(1, "addrHi"); + List ans = new ArrayList(); + 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 @@ -348,111 +348,111 @@ public class MarinaUtils { 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 din, List dout) { fatal(din.size()!=dout.size(), - "in count="+din.size()+" out count="+dout.size()); - for (int i=0; i din, List dout) { fatal(din.size()!=dout.size(), - "in count="+din.size()+" out count="+dout.size()); - for (int i=0; i din, List 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 din, List 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 din, List 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 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) { diff --git a/testCode/com/sun/vlsi/chips/marina/test/ProperStopper.java b/testCode/com/sun/vlsi/chips/marina/test/ProperStopper.java index 70ba519..cd5a182 100644 --- a/testCode/com/sun/vlsi/chips/marina/test/ProperStopper.java +++ b/testCode/com/sun/vlsi/chips/marina/test/ProperStopper.java @@ -10,21 +10,21 @@ import com.sun.async.test.NanosimModel; 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. @@ -32,78 +32,78 @@ public class ProperStopper { 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 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 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 drainMany(int maxNbItems) { - prln("begin drainMany. stopper="+name); - adjustIndent(2); - - stop(); - - List ans = new ArrayList(); - - int cnt = 0; - while (true) { - StateWireState myState=getFillStateWire(); + prln("begin drainMany. stopper="+name); + adjustIndent(2); + + stop(); + + List ans = new ArrayList(); + + 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; } -- 1.7.10.4