From cbafca81451a452015ea365b3546c3bc0ac7bdbd Mon Sep 17 00:00:00 2001 From: Adam Megacz Date: Sun, 20 Sep 2009 12:38:38 -0700 Subject: [PATCH] lots of changes to Marina test code, mostly for scan chain counters --- .../vlsi/chips/marina/test/InstructionStopper.java | 4 +- src/com/sun/vlsi/chips/marina/test/Marina.java | 78 ++++++- src/com/sun/vlsi/chips/marina/test/MarinaTest.java | 214 ++++++++++++++++++-- .../sun/vlsi/chips/marina/test/MarinaUtils.java | 4 +- .../sun/vlsi/chips/marina/test/ProperStopper.java | 102 +++++++--- 5 files changed, 337 insertions(+), 65 deletions(-) diff --git a/src/com/sun/vlsi/chips/marina/test/InstructionStopper.java b/src/com/sun/vlsi/chips/marina/test/InstructionStopper.java index 5c18ef7..d8192f9 100644 --- a/src/com/sun/vlsi/chips/marina/test/InstructionStopper.java +++ b/src/com/sun/vlsi/chips/marina/test/InstructionStopper.java @@ -25,8 +25,8 @@ public class InstructionStopper extends ProperStopper { String reportChain, ChainControls cc, ChipModel model, boolean clockHack, - Indenter indenter) { - super(name, propInst, controlChain, dataChain, reportChain, cc, model, clockHack, indenter); + Indenter indenter, String counterPath) { + super(name, propInst, controlChain, dataChain, reportChain, cc, model, clockHack, indenter, counterPath); } /** put one Instruction into InstructionStopper */ diff --git a/src/com/sun/vlsi/chips/marina/test/Marina.java b/src/com/sun/vlsi/chips/marina/test/Marina.java index 759662d..5aa6dae 100644 --- a/src/com/sun/vlsi/chips/marina/test/Marina.java +++ b/src/com/sun/vlsi/chips/marina/test/Marina.java @@ -43,7 +43,7 @@ public class Marina { prefix+"outputDo@0.outM1Pre@0.outDockP@0.outDockC@0.olcWcont@0.scanEx3h@1"; // bits 2,4,6 private static final String OLC_PATH_ODD = prefix+"outputDo@0.outM1Pre@0.outDockP@0.outDockC@0.olcWcont@0.scanEx3h@2"; // bits 1,3,5 - private static final String OLC_PATH_KESSEL = + public static final String OLC_PATH_KESSEL = prefix+"outputDo@0.outM1Pre@0.outDockP@0.outDockC@0.counte@0.adamScan@1.scanEx6h@"; private static final String ILC_PATH_ODD = prefix+"outputDo@0.outM1Pre@0.outDockP@0.outDockC@0.ilcMoveO@0.scanEx4h@0"; // bits 1,3,5,7 @@ -110,7 +110,7 @@ public class Marina { // 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 + public final ChainControls cc; // specifies the scan chain private final ChipModel model; public final ProperStopper data; public final InstructionStopper instrIn; @@ -119,7 +119,7 @@ public class Marina { private void pr(String msg) {indenter.pr(msg);} /** Shift the report scan chain */ - private void shiftReport(boolean readEnable, boolean writeEnable) { + public void shiftReport(boolean readEnable, boolean writeEnable) { cc.shift(REPORT_CHAIN, readEnable, writeEnable); } @@ -142,14 +142,37 @@ public class Marina { CONTROL_CHAIN, DATA_CHAIN, REPORT_CHAIN, - cc, model, clockHack, indenter); + cc, model, clockHack, indenter, + prefix+"northFif@1.fillDrai@1.instruct@0.cntScnTh@1.cntScnOn@1"); instrIn = new InstructionStopper("south fifo", prefix+"southFif@1.tapPropS@1.properSt@1", CONTROL_CHAIN, DATA_CHAIN, REPORT_CHAIN, - cc, model, clockHack, indenter); + cc, model, clockHack, indenter, + prefix+"southFif@1.tapPropS@1.instruct@0.cntScnTh@1.cntScnOn@1"); } + + int northCount = 0; + int southCount = 0; + + public void stopAndResetCounters() { + instrIn.setCounterEnable(false); + data.setCounterEnable(false); + cc.shift(DATA_CHAIN, true, false); + northCount = data.getCounterValue(); + southCount = instrIn.getCounterValue(); + data.setCounterValue(0); + instrIn.setCounterValue(0); + } + public void startCounters() { + instrIn.setCounterEnable(true); + data.setCounterEnable(true); + } + public int getNorthCount() { return northCount; } + public int getSouthCount() { return southCount; } + + public void masterClear() { final double WIDTH = 10; // ns // Put a high going pulse on the internal chip master clear signal @@ -269,12 +292,14 @@ public class Marina { nModel.setNodeVoltage(MASTER_CLEAR,0.0); nModel.waitNS(1); } else { + mc0.setLogicState(true); mc1.setLogicState(true); model.waitNS(1000); mc0.setLogicState(false); mc1.setLogicState(false); model.waitNS(1000); + } resetAfterMasterClear(); } @@ -352,8 +377,34 @@ public class Marina { //System.out.println("kesselsCounter = " + bits); int first = 0; int second = 0; - for(int i=0; i<6; i++) first |= bits.get(4+i*3) ? (1<=olc ? 0 : 1; dataItems = marina.data.drainMany(2); fatal(dataItems.size()!=expected, "Expected "+expected+" item to emerge but got: "+dataItems.size()+" data items"); + expectOlc(Math.max(0,olc-decr_amount)); if (marina.kesselsCounter) { // master clear on each iteration; otherwise we'd need to "run down" the olc @@ -2271,17 +2353,54 @@ public class MarinaTest { - private void doOneTest(int testNum) { + private void doOneTest(int testNum) throws Exception { + try { + doOneTest_(testNum); + } catch (MarinaUtils.FailureException fe) { + System.out.println("******************************************************************************"); + System.out.println("******************************************************************************"); + System.out.println("******************************************************************************"); + System.out.println("******************************************************************************"); + fe.printStackTrace(); + } + } + + private void doOneTest_(int testNum) throws Exception { prln(""); prln("============================================================"); prln("MarinaTest: performing test: "+testNum); + if (testNum==999) { + //vdd = 0.5f; + vdd = 1.0f; + int[] tests = new int[] { 1002, 1003, 1005, 3002, 3004, 3005, 3006, 3008, 3009, 3025, 3026, 3029 }; + try { + PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream("test.out"))); + while(vdd <= 1.3f) { + vdd10.setVoltageWait(vdd); + System.out.println("vdd10 = " + vdd10.readVoltage()); + Thread.sleep(1000); + for(int i=0; i (2<<29)) + System.out.println("warning: count was greater than 2^29..."); + double gst = ((((double)count*2)) / (1000000. * wait /* * toks*/)); + System.out.println("south counter is: " + count + ", which is " + gst + "Ginst/sec with toks="+toks + " @vdd="+vdd); + total += gst; + + System.out.println(); + System.out.println(); + /* + System.out.println("counters are " + count + " and " + countNorth + "; ratio is "+ + (((double)countNorth)/((double)(count*2))) + " " + + (((double)countNorth)/((double)(count*2+1))) + " " + + ""); + */ + } + pw.println(vdd + " " + toks + " " + (((double)total) / MAX_ITER)); + pw.flush(); + } + } + break; + } case 9999: loadEveryValueOLC(marina); countOlc(marina); @@ -2411,13 +2592,6 @@ public class MarinaTest { prln("Test Result: Passed"); printTestTime(); //Infrastructure.exit(0); - } catch (MarinaUtils.FailureException fe) { - System.out.println("******************************************************************************"); - System.out.println("******************************************************************************"); - System.out.println("******************************************************************************"); - System.out.println("******************************************************************************"); - fe.printStackTrace(); - } } @@ -2428,7 +2602,7 @@ public class MarinaTest { * 2: test detected failure * 1: test crashed */ - public static void main(String[] args) { + public static void main(String[] args) throws Exception { startTime = System.currentTimeMillis(); new MarinaTest(args); } diff --git a/src/com/sun/vlsi/chips/marina/test/MarinaUtils.java b/src/com/sun/vlsi/chips/marina/test/MarinaUtils.java index 2ccc8c8..02b7fcc 100644 --- a/src/com/sun/vlsi/chips/marina/test/MarinaUtils.java +++ b/src/com/sun/vlsi/chips/marina/test/MarinaUtils.java @@ -15,13 +15,15 @@ public class MarinaUtils { public static enum StateWireState { FULL, EMPTY }; + + public static int testnum; public static void fatal(boolean pred, String msg) { if (pred) throw new FailureException(msg); } public static class FailureException extends RuntimeException { - public FailureException(String s) { super(s); } + public FailureException(String s) { super("test " + testnum + ": " + s); } } /** diff --git a/src/com/sun/vlsi/chips/marina/test/ProperStopper.java b/src/com/sun/vlsi/chips/marina/test/ProperStopper.java index 484ac8e..46151fa 100644 --- a/src/com/sun/vlsi/chips/marina/test/ProperStopper.java +++ b/src/com/sun/vlsi/chips/marina/test/ProperStopper.java @@ -2,12 +2,7 @@ package com.sun.vlsi.chips.marina.test; import java.util.ArrayList; import java.util.List; -import com.sun.async.test.BitVector; -import com.sun.async.test.ChainControl; -import com.sun.async.test.ChipModel; -import com.sun.async.test.Infrastructure; -import com.sun.async.test.NanosimModel; -import com.sun.async.test.VerilogModel; +import com.sun.async.test.*; import com.sun.vlsi.chips.marina.test.MarinaUtils.StateWireState; public class ProperStopper { @@ -48,6 +43,8 @@ public class ProperStopper { 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); } @@ -100,8 +97,35 @@ public class ProperStopper { private StateWireState boolToState(boolean b) { return b ? StateWireState.FULL : StateWireState.EMPTY; } + + private CommandCodes fdcstate = null; + + public void setCounterEnable(boolean enable) { + this.extra = enable; + setFillDrainControl(fdcstate); + } + + public void setCounterValue(int val) { + SubchainNode chainNode = (SubchainNode) cc.getChainControlFromPath(dataChain).findNode(pathToCounter); + int bitIndex = chainNode.getBitIndex(); + ChainNode root = chainNode.getParentChain(); + for(int i=0; i<31; i++) + root.getInBits().set(bitIndex+i, ((1<