- private void doSim() throws Exception {
- String netListName;
- switch (cmdArgs.mode) {
- case WHOLE_CHIP_SCHEMATIC_PARASITICS:
- netListName = NET_LIST;
- break;
- case WHOLE_CHIP_LAYOUT_PARASITICS:
- netListName = "marina_pads_guts.spi";
- break;
- default:
- fatal(true, "unrecognized CmdArgs.Mode");
- return;
- }
-
-
- Infrastructure.gpibControllers = new int[]{1};
- vdd18 = new Pst3202Channel("ch1", "tiPST3202", 1);
- vdd18 = new Pst3202Channel("ch3", "tiPST3202", 3);
- vdd10 = new PowerChannelResistorVoltageReadable(new Pst3202Channel("ch2", "tiPST3202", 2),
- 1000,
- new HP34401A("HP34970"),
- true);
-
- if (vdd10!=null) setVdd10(vdd);
- if (vdd18!=null) vdd18.setVoltageNoWait(1.8f);
-
- model = cmdArgs.useVerilog
- ? new VerilogModel()
- : cmdArgs.useHsim
- ? new HsimModel()
- : cmdArgs.silicon
- ? new SiliconChip()
- : new NanosimModel();
-
- 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
- : 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");
- //: new Netscan("10.0.0.200");
- //: new Signalyzer();
- //: new Netscan("jtag2");
- JtagLogicLevel mc0=null;
- JtagLogicLevel mc1=null;
- if (tester instanceof NetscanGeneric) {
- ((NetscanGeneric)tester).reset();
- // master clear
- // not sure if "GPIO1" means "index 0" or not
- mc0 = new JtagLogicLevel(tester, 0);
- mc1 = new JtagLogicLevel(tester, 1);
- mc1 = mc0;
- mc0.setLogicState(true);
- mc1.setLogicState(true);
- }
- /*
- Logger.setLogInits(true);
- tester.setLogSets(true);
- tester.setLogOthers(true);
- tester.setAllLogging(true);
- tester.printInfo = true;
- */
- tester.printInfo = false;
-
- PowerChannel pc = new ManualPowerChannel("pc", false);
- /*
- JtagTester testerD, testerR, testerC;
- testerD = ((SimulationModel)model).createJtagSubchainTester("sid[1:9]", null);
- testerR = ((SimulationModel)model).createJtagSubchainTester("sir[1:9]", null);
- testerC = ((SimulationModel)model).createJtagSubchainTester("sic[1:9]", null);
- testerD.printInfo = testerR.printInfo = testerC.printInfo = false;
-
- ccD = new ChainControl(SCAN_CHAIN_XML, testerD, 1.8f, khz);
- ccR = new ChainControl(SCAN_CHAIN_XML, testerR, 1.8f, khz);
- ccC = new ChainControl(SCAN_CHAIN_XML, testerC, 1.8f, khz);
- ccD.noTestSeverity = ccR.noTestSeverity = ccC.noTestSeverity = Infrastructure.SEVERITY_NOMESSAGE;
-
-
- ctD = new ChainTest(ccD, pc);
- ctR = new ChainTest(ccR, pc);
- ctC = new ChainTest(ccC, pc);
- */
- /*
- ccs.addChain(Marina.DATA_CHAIN, ccD);
- 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;
- ct = new ChainTest(cc, pc);
-
- marina = new Marina(cc, cc, cc, cc, 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 if (model instanceof NanosimModel)
- ((SimulationModel)model).start("nanosim -c cfg", netListName, 0, !cmdArgs.jtagShift);
- else
- {}
- prln("model started");
-
- model.waitNS(1000);
- prln("deasserting master clear");
- if (model instanceof SimulationModel)
- ((SimulationModel)model).setNodeState(Marina.MASTER_CLEAR, 0);
- else
- marina.masterClear();
- model.waitNS(1000);
-
- if (cmdArgs.testNum!=0 && cmdArgs.testNum!=1) {
- cc.resetInBits();
- cc.shift(Marina.CONTROL_CHAIN, false, true);
- }
-
- doOneTest(cmdArgs.testNum);
-
- if (model instanceof SimulationModel)
- ((SimulationModel)model).finish();
- }