From: Adam Megacz Date: Thu, 28 May 2009 06:23:17 +0000 (+0000) Subject: updates for kessels counter X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=335a7396024a05728d2de3e382ce119e90231d00;p=fleet.git updates for kessels counter --- diff --git a/testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java b/testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java index 7c80022..0a58ba3 100644 --- a/testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java +++ b/testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java @@ -14,6 +14,7 @@ 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; @@ -97,7 +98,7 @@ public class MarinaTest { private static final int MORE_THAN_DATA_OUT_SATURATION_AMOUNT = 10; // Nominal cycle time assuming 4 GHz throughput - private static double CYCLE_TIME_NS; + public static double CYCLE_TIME_NS; //-------------------------------- types --------------------------------- @@ -212,8 +213,12 @@ public class MarinaTest { fatal(true, "unrecognized CmdArgs.Mode"); return; } - model = cmdArgs.useVerilog ? new VerilogModel() : new NanosimModel(); - + model = cmdArgs.useVerilog + ? new VerilogModel() + : cmdArgs.useHsim + ? new HsimModel() + : new NanosimModel(); + ((SimulationModel)model).setOptimizedDirectReadsWrites(true); CYCLE_TIME_NS = cmdArgs.useVerilog ? (100*20) : 0.250; @@ -247,6 +252,8 @@ public class MarinaTest { 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 ((SimulationModel)model).start("nanosim -c cfg", netListName, 0, !cmdArgs.jtagShift); @@ -543,6 +550,9 @@ public class MarinaTest { private Instruction setOlc(int olc) { return new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, olc); } + private Instruction setOlcIfZero(int olc) { + return new Instruction.Set(dock,Predicate.Default,SetDest.OuterLoopCounter, olc); + } private Instruction setIlc(int ilc) { return new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, ilc); } @@ -583,6 +593,10 @@ public class MarinaTest { ), }); expectNorthFifoExactly((predicate_olc_nonzero == (olc!=0)) ? 1 : 0); + + for(int i=0; i=0; i--) { + model.waitNS(128 * CYCLE_TIME_NS); prln("OLC should be: "+i); int olc = marina.getOLC(); fatal(olc!=i, "bad OLC: "+olc+" expected: "+i); @@ -777,6 +793,14 @@ public class MarinaTest { private static MarinaPath null_path = new MarinaPath((MarinaFleet)dock.getShip().getFleet(), MarinaUtils.sunToBerk(MarinaPacket.null_path)); + private static final Instruction DEC = + new Instruction.Set(dock,Predicate.Default,SetDest.OuterLoopCounter, SetSource.Decrement); + + private static final Instruction FLAG_NOP = + new Instruction.Set(dock, Predicate.IgnoreFlagD, + CLEAR_FLAG.add(Predicate.FlagA), + CLEAR_FLAG.add(Predicate.FlagB)); + private static final Instruction NOP = new Instruction.Move(dock, Predicate.IgnoreFlagD, /* predicate */ @@ -901,7 +925,6 @@ public class MarinaTest { marina.instrIn.fill(setIlc(1)); marina.fillSouthProperStopper(new Instruction[] { RECV_DATA, - new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,1), new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,0), SEND_DATA_IF_D_NOT_SET }); @@ -925,6 +948,7 @@ public class MarinaTest { }); marina.fillNorthProperStopper(); expectNorthFifoExactly(1); + marina.instrIn.fill(DEC); marina.fillSouthProperStopper(new Instruction[] { RECV_DATA, @@ -939,10 +963,10 @@ public class MarinaTest { private void testTailWaitsForHead(Marina marina) { marina.instrIn.fill(setIlc(1)); marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 63)); - + marina.enableInstructionSend(false); marina.enableInstructionRecirculate(true); - + marina.instrIn.fill(TORPEDOABLE_RECV_DATA); marina.instrIn.fill(new Instruction.Head(dock)); marina.instrIn.fill(SEND_DATA); @@ -951,11 +975,11 @@ public class MarinaTest { marina.instrIn.fill(TORPEDOABLE_RECV_DATA); marina.instrIn.fill(new Instruction.Tail(dock)); marina.instrIn.fillTorpedo(); - + marina.enableInstructionRecirculate(false); marina.enableInstructionSend(true); marina.instrIn.run(); - + expectNorthFifoNoMoreThan(0); prln("inserting into north proper stopper"); marina.fillNorthProperStopper(); @@ -964,6 +988,28 @@ public class MarinaTest { fatal(nbToks!=1, "Expected one token to emerge but got: "+nbToks+" tokens"); } + /* + marina.instrIn.fill(setIlc(1)); + marina.instrIn.fill(setOlc(1)); + + // this makes the head wait for the torpedo + marina.instrIn.fill(TORPEDOABLE_RECV_DATA); + + // the head should wait for the tail + marina.instrIn.fill(new Instruction.Head(dock)); + marina.instrIn.fill(NOP); + marina.instrIn.fill(SEND_DATA); + marina.instrIn.fill(RECV_DATA); + + expectNorthFifoNoMoreThan(0); + + marina.instrIn.fillTorpedo(); + expectNorthFifoNoMoreThan(0); + + marina.instrIn.fill(new Instruction.Tail(dock)); + expectNorthFifoExactly(1); + */ + private void testTailWithoutHead(Marina marina) { marina.instrIn.fill(setIlc(1)); marina.fillSouthProperStopper(new Instruction[] { @@ -1002,7 +1048,7 @@ public class MarinaTest { private void testNonTorpedoableMoveDoesNotResetDFlag(Marina marina) { marina.instrIn.fill(setIlc(1)); marina.fillSouthProperStopper(new Instruction[] { - new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,3), + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,63), new Instruction.Move(dock, Predicate.IgnoreFlagD, // predicate true, // torpedoable @@ -1045,7 +1091,7 @@ public class MarinaTest { } private void testAbort(Marina marina) { - + marina.instrIn.fill(setIlc(1)); marina.fillSouthProperStopper(new Instruction[] { new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.DataLatch,1), @@ -1058,28 +1104,28 @@ public class MarinaTest { new Instruction.Set(dock,Predicate.Default,SetDest.OuterLoopCounter,SetSource.Decrement), new Instruction.Tail(dock), }, true); - + for(int i=0; i<4; i++) { BitVector bv; - + model.waitNS(128 * CYCLE_TIME_NS); bv = new MarinaPacket(marina.data.drain()).data.bitReverse(); fatal(bv==null, "no data item found"); prln("got " + bv.toLong()); fatal(bv.toLong()!=1, "expected 1, got " + bv.toLong()); - + model.waitNS(128 * CYCLE_TIME_NS); bv = new MarinaPacket(marina.data.drain()).data.bitReverse(); fatal(bv==null, "no data item found"); prln("got " + bv.toLong()); fatal(bv.toLong()!=1, "expected 1, got " + bv.toLong()); - + model.waitNS(128 * CYCLE_TIME_NS); bv = new MarinaPacket(marina.data.drain()).data.bitReverse(); fatal(bv==null, "no data item found"); prln("got " + bv.toLong()); fatal(bv.toLong()!=2, "expected 2, got " + bv.toLong()); - + } } @@ -1127,7 +1173,7 @@ public class MarinaTest { marina.fillSouthProperStopper(new Instruction[] { RECV_DATA, inst, - setOlc(1), + NOP, }); model.waitNS(64 * CYCLE_TIME_NS); marina.fillNorthProperStopper(); @@ -1321,6 +1367,8 @@ public class MarinaTest { new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.DataLatch) }); + model.waitNS(CYCLE_TIME_NS * 64); + int olc = marina.getOLC(); fatal(olc != (1< dataItems = marina.data.drainMany(3); - fatal(dataItems.size()!=1, - "expected exactly one data item, got " + dataItems.size()); + expectNorthFifoExactly(1); adjustIndent(-2); prln("End testSendAndRecvToken"); @@ -1391,6 +1437,7 @@ public class MarinaTest { val), SEND_DATA, }); + model.waitNS(CYCLE_TIME_NS * 64); List dataItems = marina.data.drainMany(3); fatal(dataItems.size()!=1, "expected exactly one data item, got " + dataItems.size()); @@ -1444,6 +1491,7 @@ public class MarinaTest { SEND_DATA, }); + model.waitNS(CYCLE_TIME_NS * 64); List dataItems = marina.data.drainMany(3); fatal(dataItems.size()!=1, "expected exactly one data item, got " + dataItems.size()); @@ -1505,6 +1553,7 @@ public class MarinaTest { false, /* dataOut */ false /* tokenOut */ ), + FLAG_NOP, new Instruction.Set(dock,Predicate.IgnoreFlagD, Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagC), CLEAR_FLAG @@ -1661,10 +1710,12 @@ public class MarinaTest { prln("Begin sendTorpedo"); adjustIndent(2); marina.instrIn.fill(setIlc(1)); - marina.instrIn.fill(new - Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 1)); - int olc = marina.getOLC(); - fatal(olc!=1, "bad OLC: "+olc+" expected: 1"); + marina.instrIn.fill(setOlc(63)); + + int olc; + olc = marina.getOLC(); + fatal(olc!=63, "bad OLC: "+olc+" expected: 1"); + marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG)); fatal(marina.getFlagA(), "bad A flag: true"); @@ -1698,7 +1749,7 @@ public class MarinaTest { prln("send torpedo. This should clear the OLC"); marina.instrIn.fillTorpedo(); - model.waitNS(64 * CYCLE_TIME_NS); + model.waitNS(128 * CYCLE_TIME_NS); prln("A should remain false, B should be true"); fatal(marina.getFlagA(), "bad A flag: true"); @@ -1708,6 +1759,7 @@ public class MarinaTest { marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 63)); + // FIXME: find another way to test this olc = marina.getOLC(); fatal(olc!=63, "bad OLC: "+olc+" expected: 63"); @@ -1813,7 +1865,7 @@ public class MarinaTest { for(int i=0; i=olc ? 0 : 1; dataItems = marina.data.drainMany(2); fatal(dataItems.size()!=expected, "Expected "+expected+" item to emerge but got: "+dataItems.size()+" data items"); + for(int i=0; i