import com.sun.async.test.JtagTester;
import com.sun.async.test.NanosimModel;
+import edu.berkeley.fleet.api.Instruction;
+
/** The Marina object will eventually represent the Marina test chip.
* Right now, it doesn't do much of anything. It just helps me exercise
* my test infrastructure. */
public void fillNorthProperStopper(MarinaPacket mp) {
this.data.fill(mp.toSingleBitVector());
}
+ /** Fill the "South" Fifo ring with instructions */
+ public void fillSouthProperStopper(Instruction[] instructions) {
+ enableInstructionSend(false);
+ enableInstructionRecirculate(false);
+ for(Instruction i : instructions)
+ instrIn.fill(i);
+ enableInstructionSend(true);
+ }
/** Enable the transmission of instructions from the instruction
* ring test structure to the EPI FIFO. */
public void enableInstructionSend(boolean b) {
boolean mismatch = false;
String err = "";
for(int i=0; i<37; i++) {
- if (bv.get(37-i) != ( (val & (1L << i)) != 0 )) {
+ if (bv.get(i) != ( (val & (1L << i)) != 0 )) {
mismatch = true;
err += ""+i+", ";
}
boolean mismatch = false;
String err = "";
for(int i=0; i<37; i++) {
- if (bv.get(37-i) != ( (val & (1L << i)) != 0 )) {
+ if (bv.get(i) != ( (val & (1L << i)) != 0 )) {
mismatch = true;
err += ""+i+", ";
}
adjustIndent(-2);
prln("End sendTorpedo");
}
+
+ private void testTorpedoOnAnInfiniteNop(Marina marina) {
+ prln("Begin testTorpedoOnAnInfiniteNop");
+ adjustIndent(2);
+
+ List<BitVector> dataItems;
+
+ for(boolean torpedoable : new boolean[] { true, false }) {
+ prln("set ilc=\\infty");
+ marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.InnerLoopCounter,SetSource.Infinity));
+
+ prln("nop");
+ marina.instrIn.fill(new Instruction.Move(DOCK,
+ false, /* requeueing */
+ Predicate.IgnoreOLC, /* predicate */
+ torpedoable, /* torpedoable */
+ null, /* path */
+ false, /* tokenIn */
+ false, /* dataIn */
+ false, /* latchData */
+ false, /* latchPath */
+ false, /* dataOut */
+ false /* tokenOut */
+ ));
+ prln("send data");
+ marina.instrIn.fill(SEND_DATA);
+
+ // expect nothing to come out, because the NOP is executing
+ dataItems = marina.data.drainMany(10);
+ fatal(dataItems.size()!=0, "Expected no data item(s) to emerge but got at least: "+dataItems.size()+" data items");
+
+ prln("send torpedo");
+ marina.instrIn.fill(InstructionStopper.TORPEDO);
+
+ int expected = torpedoable?1:0;
+ dataItems = marina.data.drainMany(2);
+ fatal(dataItems.size()!=expected, "Expected "+expected+" item to emerge but got: "+dataItems.size()+" data items");
+ }
+
+ adjustIndent(-2);
+ prln("End testTorpedoOnAnInfiniteNop");
+ }
+
+ private void testOlcDecrementAtHighSpeed(Marina marina) {
+ prln("Begin testOlcDecrementAtHighSpeed");
+ adjustIndent(2);
+
+ List<BitVector> dataItems;
+
+ int olc = 3;
+ prln("set olc="+olc);
+ marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,olc));
+
+ prln("nop");
+ marina.instrIn.fill(new Instruction.Move(DOCK,
+ false, /* requeueing */
+ Predicate.IgnoreOLC, /* predicate */
+ torpedoable, /* torpedoable */
+ null, /* path */
+ false, /* tokenIn */
+ false, /* dataIn */
+ false, /* latchData */
+ false, /* latchPath */
+ false, /* dataOut */
+ false /* tokenOut */
+ ));
+ prln("send data");
+ marina.instrIn.fill(SEND_DATA);
+
+ // expect nothing to come out, because the NOP is executing
+ dataItems = marina.data.drainMany(10);
+ fatal(dataItems.size()!=0, "Expected no data item(s) to emerge but got at least: "+dataItems.size()+" data items");
+
+ prln("send torpedo");
+ marina.instrIn.fill(InstructionStopper.TORPEDO);
+
+ int expected = torpedoable?1:0;
+ dataItems = marina.data.drainMany(2);
+ fatal(dataItems.size()!=expected, "Expected "+expected+" item to emerge but got: "+dataItems.size()+" data items");
+ }
+
+ adjustIndent(-2);
+ prln("End testTorpedoOnAnInfiniteNop");
+ }
+
private void flipIlcBit(Marina marina) {
prln("Begin flipIlcBit");
adjustIndent(2);
case 3020: setIlcFromDataLatch(marina); break;
case 3021: recvPath(marina); break;
case 3022: testILC(marina); break;
+ case 3023: testTorpedoOnAnInfiniteNop(marina); break;
default:
fatal(true, "Test number: "+testNum+" doesn't exist.");