import edu.berkeley.fleet.marina.MarinaPath;
import com.sun.async.test.*;
+import java.io.*;
+
/**
* Tests for Marina
*/
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";
}
}
- 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();
}
- private void doSim() {
+ static PowerChannel vdd18;
+ static PowerChannel vdd10;
+
+ private void doSim() throws Exception {
String netListName;
switch (cmdArgs.mode) {
case WHOLE_CHIP_SCHEMATIC_PARASITICS:
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
JtagTester tester =
model instanceof SimulationModel
? ((SimulationModel)model).createJtagTester("TCK", "TMS", "TRSTb", "TDI", "TDO")
- : new Netscan4("jtag3", 2);
+ : new Netscan("jtag2"); // bad kessels counter
+ //: new Netscan4("jtag3", 4); // good kessels counter
JtagLogicLevel mc0=null;
JtagLogicLevel mc1=null;
- if (tester instanceof Netscan4) {
- ((Netscan4)tester).reset();
+ if (tester instanceof Netscan) {
+ ((Netscan)tester).reset();
// master clear
// not sure if "GPIO1" means "index 0" or not
mc0 = new JtagLogicLevel(tester, 0);
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;
if (model instanceof SimulationModel)
((SimulationModel)model).finish();
}
- private void doSilicon() {
+ private void doSilicon() throws Exception {
model = new SiliconChip();
String ip = cmdArgs.station.ipAddr;
JtagTester tester = new Netscan4(ip, cmdArgs.station.jtagChannel);
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...");
marina.enableInstructionSend(true);
}
+ expectTokensExactly(0);
+ marina.getOLC();
+
int inOlc = i==-1 ? 0 : (1<<i);
+ inOlc = i;
marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, inOlc));
+ marina.instrIn.fill(SEND_DATA_IF_D_SET);
+ marina.instrIn.fill(SEND_DATA_IF_D_NOT_SET);
+ marina.instrIn.fill(SEND_DATA);
model.waitNS(128 * CYCLE_TIME_NS);
expectOlc(inOlc);
prln("walkOneOLC: "+inOlc+" checks out");
+ expectNorthFifoExactly(0);
}
adjustIndent(-2);
prln("End walkOneOLC");
+ */
}
private void walkOneILC(Marina marina) {
prln("Begin walkOneILC");
}
private void loadEveryValueOLC(Marina marina) {
adjustIndent(2);
+ //while(true)
for (int i=0; i<(1<<6); i++) {
if (marina.kesselsCounter) {
true /* tokenOut */
);
+ private static final Instruction SEND_TOKEN_IF_D_NOT_SET =
+ new Instruction.Move(dock,
+ Predicate.Default, /* predicate */
+ false, /* torpedoable */
+ null_path, /* path */
+ false, /* tokenIn */
+ false, /* dataIn */
+ false, /* latchData */
+ false, /* latchPath */
+ false, /* dataOut */
+ true /* tokenOut */
+ );
+
private static final Instruction TORPEDOABLE_RECV_DATA =
new Instruction.Move(dock,
Predicate.IgnoreFlagD, /* predicate */
int expected = decr_amount>=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
- 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<tests.length; i++) {
+ try {
+ doOneTest_(tests[i]);
+ pw.println(vdd + " " + i + " " + "1");
+ } catch (MarinaUtils.FailureException fe) {
+ pw.println(vdd + " " + i + " " + "0");
+ }
+ pw.flush();
+ }
+ vdd -= 0.01f;
+ }
+ } catch (Exception e) { throw new RuntimeException(e); }
+ }
+
if (testNum!=0) {
marina.masterClear();
marina.enableInstructionSend(true);
}
-
- try {
+
+ MarinaUtils.testnum = testNum;
+
switch (testNum) {
case 0: {
doOneTest(3027); // passes extracted parasitics
doOneTest(3028); // passes extracted parasitics
doOneTest(3029); // passes extracted parasitics
- doOneTest(3030); // passes extracted parasitics
- doOneTest(3031); // passes extracted parasitics
+ //doOneTest(3030); // passes extracted parasitics (questionable)
+ //doOneTest(3031); // passes extracted parasitics should not pass!
// these tests take a while and usually pass
doOneTest(1002);
case 3031: testOverfillTokens(marina); break;
case 3040: loadEveryValueOLC(marina); break;
+ case 8888: {
+
+ //int wait = 1000;
+ int wait = 200;
+ //int toks = 1;
+
+ PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream("out.dat")));
+ for(double myvdd = 1.0; myvdd<2.0; myvdd += 0.05) {
+ vdd = (float)myvdd;
+ vdd18.setVoltageWait((float)Math.max(1.8,vdd));
+ vdd10.setVoltageWait(vdd);
+ Thread.sleep(1000);
+
+ for(int toks = 0; toks < 13; toks++) {
+ int MAX_ITER = 10;
+ double total = 0;
+ for(int iter = 0; iter < MAX_ITER; iter++) {
+
+ marina.masterClear();
+ marina.data.sink();
+ marina.stopAndResetCounters();
+
+ marina.enableInstructionSend(true);
+ marina.fillSouthProperStopper(setOlc(1));
+ marina.fillSouthProperStopper(new Instruction.Head(dock));
+ for(int i=0; i<toks; i++)
+ marina.fillSouthProperStopper(/*SEND_DATA*/NOP);
+ marina.fillSouthProperStopper(new Instruction[] {
+ new Instruction.Tail(dock),
+ }, false, true);
+ marina.startCounters();
+
+ marina.instrIn.run();
+ try { Thread.sleep(wait); } catch (Exception e) { }
+ //marina.instrIn.stop();
+
+ marina.stopAndResetCounters();
+ int countNorth = marina.getNorthCount();
+ int count = marina.getSouthCount();
+ System.out.println();
+ System.out.println();
+ if (count > (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);
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();
- }
}
* 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);
}