X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fcom%2Fsun%2Fvlsi%2Fchips%2Fmarina%2Ftest%2FMarinaTest.java;h=01b394dd4a472c3749cc919488babb6f76c4c452;hb=880b4654b1774ff8bdbc331bdff19bbbc6200a61;hp=82dc07436fc7e94672bb3e86c417e985c078f6b2;hpb=5cb4399be56118a33eca8e72463074640388e157;p=fleet.git diff --git a/src/com/sun/vlsi/chips/marina/test/MarinaTest.java b/src/com/sun/vlsi/chips/marina/test/MarinaTest.java index 82dc074..01b394d 100644 --- a/src/com/sun/vlsi/chips/marina/test/MarinaTest.java +++ b/src/com/sun/vlsi/chips/marina/test/MarinaTest.java @@ -3,25 +3,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.ChainG; -import com.sun.async.test.ChainTest; -import com.sun.async.test.ChipModel; -import com.sun.async.test.HP34401A; -import com.sun.async.test.Infrastructure; -import com.sun.async.test.JtagSubchainTesterModel; -import com.sun.async.test.JtagTester; -import com.sun.async.test.ManualPowerChannel; -import com.sun.async.test.NanosimModel; -import com.sun.async.test.HsimModel; -import com.sun.async.test.VerilogModel; -import com.sun.async.test.Netscan4; -import com.sun.async.test.PowerChannel; -import com.sun.async.test.Pst3202Channel; -import com.sun.async.test.SiliconChip; -import com.sun.async.test.SimulationModel; -import com.sun.async.test.VoltageReadable; +import com.sun.electric.tool.simulation.test.*; import com.sun.vlsi.chips.marina.test.Marina.Ilc; import com.sun.vlsi.chips.marina.test.CmdArgs; import com.sun.vlsi.chips.marina.test.CmdArgs.Mode; @@ -34,6 +16,8 @@ import edu.berkeley.fleet.api.Instruction.Set.SetSource; import edu.berkeley.fleet.marina.MarinaFleet; import edu.berkeley.fleet.marina.MarinaPath; +import java.io.*; + /** * Tests for Marina */ @@ -41,6 +25,8 @@ public class MarinaTest { public static final MarinaFleet marinaFleet = new MarinaFleet(); public static final Dock dock = marinaFleet.getOnlyInputDock(); + public static float vdd = 1.0f; + //-------------------------- constants ----------------------------------- private static final String SCAN_CHAIN_XML = "marina.xml"; private static final String NET_LIST = "marina.spi"; @@ -114,6 +100,8 @@ public class MarinaTest { private PowerChannel corePowerSupply, padsPowerSupply; private VoltageReadable coreVoltmeter, voltmeterForCurrent; + + private ChainTest ctD, ctR, ctC, ct; private ChainControl ccD, ccR, ccC, cc; @@ -166,41 +154,17 @@ public class MarinaTest { return; } } - private void setUpSuppliesAndMeters(Station station) { - // set up power supplies and meters - if (!sim()) { - prln("Testing station: "+station); - Infrastructure.gpibControllers = new int[] {0}; - switch (cmdArgs.station) { - case ONE: - corePowerSupply = new Pst3202Channel("ch1", "HPST3202", 1); - padsPowerSupply = new Pst3202Channel("ch2", "HPST3202", 2); - break; - case TWO: - corePowerSupply = new Pst3202Channel("ch1", "HPST3202B", 1); - padsPowerSupply = new Pst3202Channel("ch2", "HPST3202B", 2); - break; - default: - fatal(true, "Unrecognized station: "+cmdArgs.station); - } - corePowerSupply.setCurrent((float)1.7); - corePowerSupply.setVoltageWait((float)1.0); - - padsPowerSupply.setCurrent((float)0.100); - padsPowerSupply.setVoltageWait((float)1.8); - - coreVoltmeter = new HP34401A(station.coreVoltmeter); - voltmeterForCurrent = new HP34401A(station.currentVoltmenter); - } - } - - private MarinaTest(String[] args) { + + private MarinaTest(String[] args) throws Exception { cmdArgs = new CmdArgs(args); reportTask(cmdArgs); - if (cmdArgs.mode==Mode.TEST_SILICON) doSilicon(); else doSim(); + doSim(); } - private void doSim() { + static PowerChannel vdd18; + static PowerChannel vdd10; + + private void doSim() throws Exception { String netListName; switch (cmdArgs.mode) { case WHOLE_CHIP_SCHEMATIC_PARASITICS: @@ -213,19 +177,58 @@ public class MarinaTest { fatal(true, "unrecognized CmdArgs.Mode"); return; } + + Infrastructure.gpibControllers = new int[]{1}; + vdd18 = new Pst3202Channel("ch2", "tiPST3202", 2); + vdd10 = new Pst3202Channel("ch3", "tiPST3202", 3); + vdd10.setVoltageNoWait(vdd); + vdd18.setVoltageNoWait(1.8f); + model = cmdArgs.useVerilog ? new VerilogModel() : cmdArgs.useHsim ? new HsimModel() + : cmdArgs.silicon + ? new SiliconChip() : new NanosimModel(); - ((SimulationModel)model).setOptimizedDirectReadsWrites(true); + if (model instanceof SimulationModel) + ((SimulationModel)model).setOptimizedDirectReadsWrites(true); CYCLE_TIME_NS = cmdArgs.useVerilog ? (100*20) : 0.250; - int khz = model instanceof VerilogModel ? 100000 : cmdArgs.jtagShift ? 20000 : 1000000; - - prln("constructing jtag controller"); - JtagTester tester = ((SimulationModel)model).createJtagTester("TCK", "TMS", "TRSTb", "TDI", "TDO"); + int khz = + model instanceof VerilogModel + ? 100000 + : cmdArgs.jtagShift + ? 20000 + : model instanceof ChipModel + ? 1000 + : 1000000; + + System.err.println("constructing jtag controller"); + JtagTester tester = + model instanceof SimulationModel + ? ((SimulationModel)model).createJtagTester("TCK", "TMS", "TRSTb", "TDI", "TDO") + : new Netscan("jtag2"); // bad kessels counter + //: new Netscan4("jtag3", 4); // good kessels counter + JtagLogicLevel mc0=null; + JtagLogicLevel mc1=null; + if (tester instanceof Netscan) { + ((Netscan)tester).reset(); + // master clear + // not sure if "GPIO1" means "index 0" or not + mc0 = new JtagLogicLevel(tester, 0); + mc1 = new JtagLogicLevel(tester, 1); + mc0.setLogicState(true); + mc1.setLogicState(true); + } + /* + Logger.setLogInits(true); + tester.setLogSets(true); + tester.setLogOthers(true); + tester.setAllLogging(true); + tester.printInfo = true; + */ tester.printInfo = false; ChainControls ccs = new ChainControls(); @@ -252,6 +255,14 @@ public class MarinaTest { ccs.addChain(Marina.REPORT_CHAIN, ccR); ccs.addChain(Marina.CONTROL_CHAIN, ccC); */ + /* + PowerChannel ch2 = new Pst3202Channel("ch2", "tiPST3202", 2); + PowerChannel ch3 = new Pst3202Channel("ch3", "tiPST3202", 3); + Infrastructure.gpibControllers = new int[]{1}; + ch2.setVoltageNoWait(1f); + ch3.setVoltageNoWait(1.8f); + */ + cc = new ChainControl(SCAN_CHAIN_XML, tester, 1.8f, khz); cc.noTestSeverity = Infrastructure.SEVERITY_NOMESSAGE; @@ -259,46 +270,46 @@ public class MarinaTest { ccs.addChain(Marina.DATA_CHAIN, cc); ccs.addChain(Marina.REPORT_CHAIN, cc); ccs.addChain(Marina.CONTROL_CHAIN, cc); + ccs.addChain(Marina.DUKE_CHAIN, cc); marina = new Marina(ccs, model, !cmdArgs.jtagShift, indenter); + marina.mc0=mc0; + marina.mc1=mc1; + if (model instanceof NanosimModel) { + NanosimLogicSettable mc = (NanosimLogicSettable) + ((SimulationModel)model).createLogicSettable(Marina.MASTER_CLEAR); + mc.setInitState(true); + } + + prln("starting model"); if (model instanceof VerilogModel) ((SimulationModel)model).start("verilog", "marina.v", VerilogModel.DUMPVARS, !cmdArgs.jtagShift); else if (model instanceof HsimModel) ((SimulationModel)model).start("hsim64", netListName, 0, !cmdArgs.jtagShift); - else + else if (model instanceof NanosimModel) ((SimulationModel)model).start("nanosim -c cfg", netListName, 0, !cmdArgs.jtagShift); + else + {} + prln("model started"); - /* - ccC.resetInBits(); - ccC.shift(Marina.CONTROL_CHAIN, false, true); - */ + model.waitNS(1000); + prln("deasserting master clear"); + if (model instanceof SimulationModel) + ((SimulationModel)model).setNodeState(Marina.MASTER_CLEAR, 0); + else + marina.masterClear(); + model.waitNS(1000); - cc.resetInBits(); - cc.shift(Marina.CONTROL_CHAIN, false, true); - - doOneTest(cmdArgs.testNum); + if (cmdArgs.testNum!=0 && cmdArgs.testNum!=1) { + cc.resetInBits(); + cc.shift(Marina.CONTROL_CHAIN, false, true); + } - ((SimulationModel)model).finish(); - } - private void doSilicon() { - model = new SiliconChip(); - String ip = cmdArgs.station.ipAddr; - JtagTester tester = new Netscan4(ip, cmdArgs.station.jtagChannel); - tester.printInfo = false; - int khz = 1000; - ChainControl cc = new ChainControl("???", tester, 1.8f, khz); - cc.noTestSeverity = Infrastructure.SEVERITY_NOMESSAGE; - ChainControls ccs = new ChainControls(); - ccs.addChain(Marina.DATA_CHAIN, cc); - ccs.addChain(Marina.REPORT_CHAIN, cc); - ccs.addChain(Marina.CONTROL_CHAIN, cc); - marina = new Marina(ccs, model, false, indenter); - PowerChannel pc = new ManualPowerChannel("pc", false); - ChainTest ct = new ChainTest(cc, pc); - ct.testAllChains("marina", Infrastructure.SEVERITY_WARNING); doOneTest(cmdArgs.testNum); - setUpSuppliesAndMeters(cmdArgs.station); + + if (model instanceof SimulationModel) + ((SimulationModel)model).finish(); } /** In the absence of looping, the longest path through Infinity is 4 column delays */ @@ -722,7 +733,43 @@ public class MarinaTest { private void walkOneOLC(Marina marina) { prln("Begin walkOneOLC"); adjustIndent(2); - for (int i=0; i<6; i++) { + /* + //for (int i=-1; i<6; i++) { + marina.fillSouthProperStopper(new Instruction[] { + + new Instruction.Head(dock), + + // new Instruction.Set(dock,Predicate.IgnoreFlagD, SetDest.OuterLoopCounter, 1), + FLAG_NOP, + FLAG_NOP, + FLAG_NOP, + TORPEDOABLE_RECV_DATA, + FLAG_NOP, + FLAG_NOP, + FLAG_NOP, + + + //new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, SetSource.Decrement), + + new Instruction.Tail(dock), + }); + marina.fillSouthProperStopper(new Instruction[] { + null, + }, + true); + while(true) { + BitVector bits = null; + marina.shiftReport(true, false); + for(int i=0; i<4; i++) { + BitVector x = marina.cc.getOutBits(marina.REPORT_CHAIN+"."+marina.OLC_PATH_KESSEL+i); + //System.out.println("bits are: " + x); + bits = bits==null ? x : bits.cat(x); + } + System.out.println("dec="+bits.get(0)); + if (bits.get(1)) throw new RuntimeException(); + } + */ + /* for (int i=0; i<64; i++) { if (marina.kesselsCounter) { System.out.println("master-clearing..."); @@ -731,16 +778,25 @@ public class MarinaTest { marina.enableInstructionSend(true); } + expectTokensExactly(0); + marina.getOLC(); + int inOlc = i==-1 ? 0 : (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 @@ -2198,17 +2308,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); + break; default: fatal(true, "Test number: "+testNum+" doesn't exist."); @@ -2334,13 +2547,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(); - } } @@ -2351,7 +2557,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); }