From 8e9aba3e5e40968efebc2c001517ed6d91d7debe Mon Sep 17 00:00:00 2001 From: Adam Megacz Date: Wed, 13 May 2009 00:05:53 +0000 Subject: [PATCH] update tests --- .../com/sun/vlsi/chips/marina/test/MarinaTest.java | 393 ++++++++++---------- 1 file changed, 189 insertions(+), 204 deletions(-) diff --git a/testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java b/testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java index 28119b2..7458cf3 100644 --- a/testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java +++ b/testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java @@ -499,21 +499,7 @@ public class MarinaTest { int nbToks = marina.getNumTokens(); fatal(nbToks!=0, "Expected no tokens on initialization but got: "+nbToks+" tokens"); - marina.instrIn.fill( - new Instruction.Move(dock, - Predicate.IgnoreFlagD, /* predicate */ - false, /* torpedoable */ - null, /* path */ - false, /* tokenIn */ - false, /* dataIn */ - false, /* latchData */ - false, /* latchPath */ - false, /* dataOut */ - true /* tokenOut */ - )); - - //getCtrsFlags(marina); - + marina.instrIn.fill(SEND_TOKEN); nbToks = marina.getNumTokens(); fatal(nbToks!=1, "Expected one token to emerge but got: "+nbToks+" tokens"); @@ -525,25 +511,11 @@ public class MarinaTest { prln("Begin sendData"); adjustIndent(2); - //getCtrsFlags(marina); - edu.berkeley.fleet.api.BitVector bv = new edu.berkeley.fleet.api.BitVector(13); for(int i=0; i dataItems = marina.data.drainMany(); fatal(dataItems.size()!=1, "Expected one data item to emerge but got: "+dataItems.size()+" data items"); @@ -559,8 +531,10 @@ public class MarinaTest { prln("Begin sendDataIlcInfinite"); adjustIndent(2); - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.Infinity)); - marina.instrIn.fill(SEND_DATA); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.Infinity), + SEND_DATA, + }); // more than MAX_ILC int howmany = 70; @@ -572,8 +546,8 @@ public class MarinaTest { prln("End sendDataIlcInfinite"); } - private void setOLC(Marina marina, int olc) { - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, olc)); + private Instruction setOlc(int olc) { + return new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, olc); } private void testFlagD(Marina marina) { @@ -592,21 +566,23 @@ public class MarinaTest { "predicate olc"+(predicate_olc_nonzero?"!=0":"==0")); adjustIndent(2); - setOLC(marina, olc); - marina.instrIn.fill(new Instruction.Move(dock, - predicate_olc_nonzero // predicate - ? only_if_olc_nonzero - : only_if_olc_zero - , - false, // torpedoable - null, // path - false, // tokenIn - false, // dataIn - false, // latchData - false, // latchPath - true, // dataOut - false // tokenOut - )); + marina.fillSouthProperStopper(new Instruction[] { + setOlc(olc), + new Instruction.Move(dock, + predicate_olc_nonzero // predicate + ? only_if_olc_nonzero + : only_if_olc_zero + , + false, // torpedoable + null, // path + false, // tokenIn + false, // dataIn + false, // latchData + false, // latchPath + true, // dataOut + false // tokenOut + ), + }); toks = marina.data.drainMany(); int expected = (predicate_olc_nonzero == (olc!=0)) ? 1 : 0; fatal(toks.size()!=expected, "Expected "+expected+" token to emerge but got: "+toks.size()+" token(s)"); @@ -817,8 +793,6 @@ public class MarinaTest { false /* tokenOut */ ); - private static final Instruction REQUEUEING_NOP = NOP; - private static final Instruction SEND_DATA = new Instruction.Move(dock, Predicate.IgnoreFlagD, /* predicate */ @@ -897,7 +871,6 @@ public class MarinaTest { false /* tokenOut */ ); - private static final Instruction REQUEUEING_SEND_DATA = SEND_DATA; private void expectNorthFifoNoMoreThan(int num) { List dataItems = marina.data.drainMany(num+1); @@ -964,7 +937,7 @@ public class MarinaTest { } private void testTailWaitsForHead(Marina marina) { - setOLC(marina, 63); + marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 63)); marina.enableInstructionSend(false); marina.enableInstructionRecirculate(true); @@ -991,9 +964,11 @@ public class MarinaTest { } private void testTailWithoutHead(Marina marina) { - setOLC(marina, 63); - marina.instrIn.fill(new Instruction.Tail(dock)); - marina.instrIn.fill(SEND_DATA); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 63), + new Instruction.Tail(dock), + SEND_DATA, + }); List dataItems = marina.data.drainMany(1); fatal(dataItems.size()!=0, "Expected exactly no data items to emerge but got at least: "+dataItems.size()); } @@ -1004,10 +979,12 @@ public class MarinaTest { prln("Begin testHeadWaitsForTail"); adjustIndent(2); - setOLC(marina, 63); - marina.instrIn.fill(new Instruction.Head(dock)); - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1)); - marina.instrIn.fill(SEND_DATA); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 63), + new Instruction.Head(dock), + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1), + SEND_DATA, + }); dataItems = marina.data.drainMany(1); fatal(dataItems.size()!=0, "Expected exactly no data items to emerge but got at least: "+dataItems.size()); marina.instrIn.fill(new Instruction.Tail(dock)); @@ -1066,10 +1043,6 @@ public class MarinaTest { private void testAbort(Marina marina) { marina.fillSouthProperStopper(new Instruction[] { - - // ensure that an abort doesn't cause problems if no loop is in progress - //new Instruction.Abort(dock, Predicate.IgnoreFlagD), - new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.DataLatch,1), new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,2), SEND_DATA_IF_D_NOT_SET, @@ -1102,6 +1075,15 @@ public class MarinaTest { } } + private void testAbortOutsideOfLoop(Marina marina) { + marina.fillSouthProperStopper(new Instruction[] { + // ensure that an abort doesn't cause problems if no loop is in progress + new Instruction.Abort(dock, Predicate.IgnoreFlagD), + SEND_DATA, + }); + expectNorthFifoExactly(1); + } + private void testFlagAB(Marina marina) { prln("Begin testFlagAB"); adjustIndent(2); @@ -1204,19 +1186,21 @@ public class MarinaTest { prln("Begin recvData"); adjustIndent(2); - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG)); - marina.instrIn.fill(new Instruction.Move(dock, - Predicate.IgnoreFlagD, // predicate - false, // torpedoable - null, // path - false, // tokenIn - true, // dataIn - false, // latchData - false, // latchPath - false, // dataOut - false // tokenOut - )); - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD, SET_FLAG, SET_FLAG)); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Set(dock,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG), + new Instruction.Move(dock, + Predicate.IgnoreFlagD, // predicate + false, // torpedoable + null, // path + false, // tokenIn + true, // dataIn + false, // latchData + false, // latchPath + false, // dataOut + false // tokenOut + ), + new Instruction.Set(dock,Predicate.IgnoreFlagD, SET_FLAG, SET_FLAG), + }); model.waitNS(64 * CYCLE_TIME_NS); prln("checking to confirm that A flag is cleared"); @@ -1301,8 +1285,10 @@ public class MarinaTest { data.set(bit, true); marina.fillNorthProperStopper(new MarinaPacket(data, false, addr)); - marina.instrIn.fill(RECV_DATA); - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.DataLatch)); + marina.fillSouthProperStopper(new Instruction[] { + RECV_DATA, + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.DataLatch) + }); int olc = marina.getOLC(); fatal(olc != (1< dataItems = marina.data.drainMany(3); fatal(dataItems.size()!=1, "expected exactly one data item, got " + dataItems.size()); @@ -1360,21 +1350,12 @@ public class MarinaTest { for(long val : new long[] { (-1L << 14), -1, 0, 1 }) { - /* marina.fillSouthProperStopper(new Instruction[] { new Instruction.Set(dock,Predicate.IgnoreFlagD, Instruction.Set.SetDest.DataLatch, val), SEND_DATA, }); - */ - marina.fillSouthProperStopper(new Instruction[] { - new Instruction.Set(dock,Predicate.IgnoreFlagD, - Instruction.Set.SetDest.DataLatch, - val) }); - marina.fillSouthProperStopper(new Instruction[] { - SEND_DATA, - }); List dataItems = marina.data.drainMany(3); fatal(dataItems.size()!=1, "expected exactly one data item, got " + dataItems.size()); @@ -1415,7 +1396,6 @@ public class MarinaTest { new edu.berkeley.fleet.api.BitVector(19); for(int i=0; i dataItems = marina.data.drainMany(3); fatal(dataItems.size()!=1, "expected exactly one data item, got " + dataItems.size()); @@ -1470,26 +1453,26 @@ public class MarinaTest { marina.fillNorthProperStopper(new MarinaPacket(data, false, addr)); prln("clearing flags"); - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG)); - prln("executing recv data with Dc="+dc); - marina.instrIn.fill(new Instruction.Move(dock, - Predicate.IgnoreFlagD, /* predicate */ - true, /* torpedoable */ - null, /* path */ - false, /* tokenIn */ - true, /* dataIn */ - dc, /* latchData */ - false, /* latchPath */ - false, /* dataOut */ - false /* tokenOut */ - )); - prln("copying c-flag to a-flag"); - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD, - Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagC), - CLEAR_FLAG - )); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Set(dock,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG), + new Instruction.Move(dock, + Predicate.IgnoreFlagD, /* predicate */ + true, /* torpedoable */ + null, /* path */ + false, /* tokenIn */ + true, /* dataIn */ + dc, /* latchData */ + false, /* latchPath */ + false, /* dataOut */ + false /* tokenOut */ + ), + new Instruction.Set(dock,Predicate.IgnoreFlagD, + Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagC), + CLEAR_FLAG + ), + }); model.waitNS(CYCLE_TIME_NS * 64); @@ -1505,8 +1488,6 @@ public class MarinaTest { prln("Begin sendDataWithPath"); adjustIndent(2); - //getCtrsFlags(marina); - edu.berkeley.fleet.api.BitVector bv = new edu.berkeley.fleet.api.BitVector(13); // alternating ones and zeroes @@ -1518,18 +1499,21 @@ public class MarinaTest { MarinaPath path = new MarinaPath((MarinaFleet)dock.getShip().getFleet(), bv); - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1)); - marina.instrIn.fill(new Instruction.Move(dock, - Predicate.IgnoreFlagD, /* predicate */ - false, /* torpedoable */ - path, /* path */ - false, /* tokenIn */ - false, /* dataIn */ - false, /* latchData */ - false, /* latchPath */ - true, /* dataOut */ - false /* tokenOut */ - )); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1), + new Instruction.Move(dock, + Predicate.IgnoreFlagD, /* predicate */ + false, /* torpedoable */ + path, /* path */ + false, /* tokenIn */ + false, /* dataIn */ + false, /* latchData */ + false, /* latchPath */ + true, /* dataOut */ + false /* tokenOut */ + ), + }); + List dataItems; MarinaPacket mp; @@ -1610,8 +1594,10 @@ public class MarinaTest { for(int bit=0; bit<6; bit++) { int ilc = bit<0 ? 0 : (1< dataItems = marina.data.drainMany(); fatal(dataItems.size()!=ilc, "Expected "+ilc+" data item(s) to emerge but got: "+dataItems.size()+" data items"); } @@ -1643,37 +1629,32 @@ public class MarinaTest { Instruction.Set(dock,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG)); fatal(marina.getFlagA(), "bad A flag: true"); fatal(marina.getFlagB(), "bad B flag: true"); - marina.instrIn.fill(new - Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, SetSource.Infinity)); prln("execute a move instruction that does nothing but loops until torpedo arrives"); - marina.instrIn.fill( - new Instruction.Move(dock, - Predicate.IgnoreFlagD, // predicate - true, // torpedoable - null, // path - false, // tokenIn - true, // dataIn - false, // latchData - false, // latchPath - false, // dataOut - false // tokenOut - )); - - prln("A=1, B=B This instruction should not execute because D-flag is set"); - marina.instrIn.fill(new - Instruction.Set(dock,Predicate.Default, - SET_FLAG, - Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagB) - )); - prln("Set A=A, B=1 This instruction should execute because D-flag is set"); - marina.instrIn.fill(new - Instruction.Set(dock, Predicate.FlagD, - Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagA), - SET_FLAG - )); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, SetSource.Infinity), + new Instruction.Move(dock, + Predicate.IgnoreFlagD, // predicate + true, // torpedoable + null, // path + false, // tokenIn + true, // dataIn + false, // latchData + false, // latchPath + false, // dataOut + false // tokenOut + ), + new Instruction.Set(dock,Predicate.Default, + SET_FLAG, + Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagB) + ), + new Instruction.Set(dock, Predicate.FlagD, + Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagA), + SET_FLAG + ), + }); prln("send torpedo. This should clear the OLC"); marina.instrIn.fillTorpedo(); @@ -1710,36 +1691,35 @@ public class MarinaTest { for(boolean torpedoable : new boolean[] { true, false }) { - marina.instrIn.fill(new Instruction.Move(dock, - Predicate.IgnoreFlagD, // predicate - false, // torpedoable - null, // path - false, // tokenIn - false, // dataIn - false, // latchData - false, // latchPath - false, // dataOut - true // tokenOut - )); - - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.Infinity)); - - marina.instrIn.fill(new Instruction.Move(dock, - Predicate.IgnoreFlagD, // predicate - torpedoable, // torpedoable - null, // path - true, // tokenIn - false, // dataIn - false, // latchData - false, // latchPath - false, // dataOut - true // tokenOut - )); - - // FIXME: this probably should be removed, unless Ivan doesn't want to change the behavior - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1)); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Move(dock, + Predicate.IgnoreFlagD, // predicate + false, // torpedoable + null, // path + false, // tokenIn + false, // dataIn + false, // latchData + false, // latchPath + false, // dataOut + true // tokenOut + ), + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.Infinity), + new Instruction.Move(dock, + Predicate.IgnoreFlagD, // predicate + torpedoable, // torpedoable + null, // path + true, // tokenIn + false, // dataIn + false, // latchData + false, // latchPath + false, // dataOut + true // tokenOut + ), + // FIXME: this probably should be removed, unless Ivan doesn't want to change the behavior + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1), - marina.instrIn.fill(SEND_DATA); + SEND_DATA, + }); // expect nothing to come out, because the NOP is executing dataItems = marina.data.drainMany(2); @@ -1778,9 +1758,11 @@ public class MarinaTest { int decr_amount = decr_amounts[which]; prln("inserting set olc="+olc); - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,olc)); prln("inserting set ilc=1"); - marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1)); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1), + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,olc), + }); // commenting the following four lines causes this test to pass @@ -1826,19 +1808,22 @@ public class MarinaTest { for (int i=0; i<6; i++) { int notZero = 1<> i; prln("Set OLC=0"); - marina.instrIn.fill(new - Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0)); - prln("Then immediately set OLC="+notZero); - marina.instrIn.fill(new - Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero)); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0), + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero), + }); prln("Verify OLC count using scan chain"); int outOlc = marina.getOLC(); fatal(outOlc!=notZero, "bad OLC count: "+outOlc+" expected: "+notZero); prln("Set OLC="+notZero); - marina.instrIn.fill(new - Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero)); - prln("Then immediately set OLC=0"); - marina.instrIn.fill(new - Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0)); + marina.fillSouthProperStopper(new Instruction[] { + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero), + new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0), + }); prln("Verify OLC count using scan chain"); outOlc = marina.getOLC(); @@ -1974,6 +1957,7 @@ public class MarinaTest { doOneTest(3023); doOneTest(3026); doOneTest(3027); + doOneTest(3028); // these tests take a while and usually pass doOneTest(1002); @@ -2044,6 +2028,7 @@ public class MarinaTest { case 3026: testNonTorpedoableMoveDoesNotResetDFlag(marina); break; // 23-Apr (+verilog) case 3027: testILCZero(marina); break; + case 3028: testAbortOutsideOfLoop(marina); break; default: fatal(true, "Test number: "+testNum+" doesn't exist."); -- 1.7.10.4