X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fcom%2Fsun%2Fvlsi%2Fchips%2Fmarina%2Ftest%2FProperStopper.java;fp=src%2Fcom%2Fsun%2Fvlsi%2Fchips%2Fmarina%2Ftest%2FProperStopper.java;h=0000000000000000000000000000000000000000;hb=79e5afa7283db57e1e6c63b879b0bf5f9fc39966;hp=7b089a954c2aef54a8c2f94447d62fee97a0b76c;hpb=c5a81b4b1730b55ae77947584b3eb75de194a13f;p=fleet.git diff --git a/src/com/sun/vlsi/chips/marina/test/ProperStopper.java b/src/com/sun/vlsi/chips/marina/test/ProperStopper.java deleted file mode 100644 index 7b089a9..0000000 --- a/src/com/sun/vlsi/chips/marina/test/ProperStopper.java +++ /dev/null @@ -1,461 +0,0 @@ -package com.sun.vlsi.chips.marina.test; -import com.sun.electric.tool.simulation.test.*; -import java.util.ArrayList; -import java.util.List; -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; - //private final String captureClockRelPath = "fillStag@1.gaspFill@0.fillScan@1"; - private final String captureClockRelPath = "fillStag@1"; - // test library direct write mode doesn't understand per register write - // enables. We get simulation to work by toggling write clock. - private final boolean clockHack; - private final String captureClockName = "sx[4]"; - - /* - private boolean traceFill = true; - private boolean traceDrain = true; - */ - private boolean traceFill = false; - private boolean traceDrain = false; - - private final String - controlChain = Marina.CONTROL_CHAIN, - controlPath, - dataChain = Marina.DATA_CHAIN, - dataPath, - reportChain = Marina.REPORT_CHAIN, - reportPath; - private final String captureClock; - private final ChainControls cc; - private final ChipModel model; - private final Indenter indenter; - - private final String pathToCounter; - - protected static void fatal(boolean pred, String msg) { MarinaUtils.fatal(pred, 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) { - if (model==null) throw new RuntimeException(); - if (!(model instanceof NanosimModel)) return 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"); - } - - /** 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"); - - 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); - - // strip the two write enable bits - BitVector ans = cc.getOutBits(dataPath).get(2, 52); - - idle(); // block = 1 - clear(); // clear = 1 - idle(); // clear = 0 - stop(); // block = 0 - - if (traceDrain) prln("drain stopper="+name+" data="+new MarinaPacket(ans)); - return ans; - } - - /** Remove as many items as possible from the fill stage. - * drainStopperMany() will stop cleanly. - * exit state: stop */ - public List drainMany() { - 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) { - adjustIndent(2); - - stop(); - - List ans = new ArrayList(); - - int cnt = 0; - while (true) { - StateWireState myState=getFillStateWire(); - - // debugging - if (traceDrain) prln(getReportString()); - - if (myState==StateWireState.EMPTY || cnt>=maxNbItems) break; - - cnt++; - indenter.pr(" drain"+(maxNbItems==0?"":"Many")+ - ": reading word"+(maxNbItems==0?":":" number "+cnt+ - "/"+(maxNbItems==Integer.MAX_VALUE - ?"unlimited":("at-most-"+maxNbItems))+": ")); - - BitVector d = drainNoCheck(); - if (maxNbItems>1) - prln(" got "+new MarinaPacket(d)); - - ans.add(d); - } - - prln("end drainMany, got "+ans.size()+" items"); - adjustIndent(-2); - - return ans; - } - - // proper stopper ring occupancy bits - //southFif@1.upDown8w@1.weakStag@18.scanEx1@0 REPORT chain - //18, 22, 19, 23, 20, 24, 21, 25 - //northFif@1.upDown8w@2... - // south fifo tap stage: - // southFif@1.tapPropS@1.tapStage@2.scanEx1@0 (also REPORT chain) - - /** - * (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 - */ - private static enum CommandCodes { - RUN ("000100","010100"), - IDLE ("100000","110000"), - FILL ("101000","111000"), - BLOCK ("100100","110100"), - STOP ("000000","010000"), - CLEAR ("100010","110010"), - SOURCE ("001100","011100"), - STOPSOURCE ("001000","011000"), - SINK ("000101","010101"), - STOPSINK ("000001","010001"); - private BitVector scanBits0; - private BitVector scanBits1; - CommandCodes(String bits0,String bits1) { - scanBits0 = new BitVector(bits0,"CommandCodes"); - scanBits1 = new BitVector(bits1,"CommandCodes"); - } - public BitVector bits(boolean extra) { - return extra ? scanBits1 : scanBits0; - } - } - -}