// COLUMN_LATENCY is a delay that is larger than the latency through an Infinity column
private static final int COLUMN_LATENCY = 10; // nanoseconds
+
+ // maximum number of instructions that fit in the instruction
+ // ring; note that in order for the ring to circulate, you
+ // must insert no more than INSTRUCTION_FIFO_CAPACITY-1
+ // instructions
+ private static final int INSTRUCTION_FIFO_CAPACITY = 13;
// Nominal cycle time assuming 4 GHz throughput
private static final double CYCLE_TIME_NS = 0.250;
adjustIndent(-2);
prln("End sendInstructions");
}
+
private void sendToken(IsolatedInDock inDock) {
prln("Begin sendToken");
adjustIndent(2);
inDock.instrIn.fill(
new Instruction.Move(DOCK,
- false, /* requeueing */
+ false, /* requeueing */
Predicate.IgnoreOLC, /* predicate */
false, /* torpedoable */
null, /* path */
adjustIndent(-2);
prln("End sendToken");
}
+
+ private void testFlagZ(IsolatedInDock inDock) {
+ prln("Begin testFlagZ");
+ adjustIndent(2);
+
+ List<BitVector> toks;
+
+ Predicate only_if_olc_zero = Predicate.OLCZero;
+ Predicate only_if_olc_nonzero = Predicate.Default;
+
+ for(int olc : new int[] { 1, 0 }) {
+ for(boolean predicate_olc_nonzero : new boolean[] { true, false }) {
+ prln("Attempting send token with "+
+ "olc=="+olc+" and "+
+ "predicate olc"+(predicate_olc_nonzero?"!=0":"==0"));
+ adjustIndent(2);
+ inDock.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter, 1));
+ if (olc==0)
+ inDock.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC, SetDest.OuterLoopCounter, SetSource.Decrement));
+ inDock.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.InnerLoopCounter, 1));
+ inDock.instrIn.fill(new Instruction.Move(DOCK,
+ false, /* requeueing */
+ predicate_olc_nonzero /* predicate */
+ ? only_if_olc_nonzero
+ : only_if_olc_zero
+ ,
+ false, /* torpedoable */
+ null, /* path */
+ false, /* tokenIn */
+ false, /* dataIn */
+ false, /* latchData */
+ false, /* latchPath */
+ false, /* dataOut */
+ true /* tokenOut */
+ ));
+ toks = inDock.tokOut.drainMany();
+ int expected = (predicate_olc_nonzero == (olc!=0)) ? 1 : 0;
+ fatal(toks.size()!=expected, "Expected one token to emerge but got: "+toks.size()+" token(s)");
+ adjustIndent(-2);
+ }
+ }
+ adjustIndent(-2);
+ prln("End testFlagZ");
+ }
+
private void getCtrsFlags(IsolatedInDock inDock) {
int olc = inDock.getOLC();
prln("OLC="+olc);
adjustIndent(-2);
prln("End countOlc");
}
+
+ private void saturateInstructionFifo(IsolatedInDock inDock, Instruction instruction) {
+ prln("Inserting "+(INSTRUCTION_FIFO_CAPACITY+1)+" copies of \"" + instruction + "\"");
+ adjustIndent(2);
+ for(int i=0; i<(INSTRUCTION_FIFO_CAPACITY+1); i++) {
+ prln("Inserting instruction " + (i+1) +"/"+ (INSTRUCTION_FIFO_CAPACITY+1));
+ inDock.instrIn.fill(instruction);
+ }
+ adjustIndent(-2);
+ prln("Successfully inserted " + (INSTRUCTION_FIFO_CAPACITY+1) + " instructions");
+ }
+
+ private static final Instruction REQUEUEING_NOP =
+ new Instruction.Move(DOCK,
+ true, /* requeueing */
+ Predicate.IgnoreOLC, /* predicate */
+ false, /* torpedoable */
+ null, /* path */
+ false, /* tokenIn */
+ false, /* dataIn */
+ false, /* latchData */
+ false, /* latchPath */
+ false, /* dataOut */
+ false /* tokenOut */
+ );
+
+ private void testRequeueStage0(IsolatedInDock inDock) {
+ prln("Begin testRequeueStage0");
+ adjustIndent(2);
+
+ prln("Executing Set OLC=1");
+ inDock.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,1));
+ prln("Executing Set OLC--");
+ inDock.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,SetSource.Decrement));
+ saturateInstructionFifo(inDock, REQUEUEING_NOP);
+ adjustIndent(-2);
+ prln("End testRequeueStage0");
+ }
+
+ private void testRequeueStage0to1(IsolatedInDock inDock) {
+ prln("Begin testRequeueStage0to1");
+ adjustIndent(2);
+
+ prln("Executing Set OLC=1");
+ inDock.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,1));
+ saturateInstructionFifo(inDock, REQUEUEING_NOP); /** FIXME: expect it to jam up */
+ adjustIndent(-2);
+ prln("End testRequeueStage0to1");
+ }
+
private void testFlagAB(IsolatedInDock inDock) {
prln("Begin testFlagAB");
adjustIndent(2);
// Adam's tests begin with 3000
case 3000: sendToken((IsolatedInDock)design); break;
case 3001: testFlagAB((IsolatedInDock)design); break;
+ case 3002: testRequeueStage0((IsolatedInDock)design); break;
+ case 3003: testRequeueStage0to1((IsolatedInDock)design); break;
+ case 3004: testFlagZ((IsolatedInDock)design); break;
default:
fatal(true, "Test number: "+testNum+" doesn't exist.");