anchor.diff:          //patternRegs[1] <= 32'h80ff80ff; // yuv422 white
           //patternRegs[2] <= 32'h2c961596; // yuv422 green
           //patternRegs[3] <= 32'hff1d6b1d; // yuv422 red
  -    endrule
  -
  -    rule data if (testPatternEnabled);
  -        LinePixelCount counts = newCounts(lineCount, pixelCount);
  -        lineCount <= counts.line;
  -        pixelCount <= counts.pixel;
           if (lineCount == 0 && pixelCount == 0)
  -        begin
  +            begin
               $display("testPatternEnabled %d", shadowTestPatternEnabled);
               testPatternEnabled <= shadowTestPatternEnabled;
  -        end
  -
  +            end
  +        if (pixelCount == numberOfPixels-1)
  +           begin
  +           pixelCount <= 0; 
  +           if (lineCount == numberOfLines-1)
  +               lineCount <= 0;
  +           else
  +               lineCount <= lineCount+1;
  +           end
  +        else
  +            pixelCount <= pixelCount + 1;
  +    endrule
  +
  +    rule data if (testPatternEnabled);
           Bit#(2) index = {pack(lineCount >= lineMidpoint), pack(pixelCount >= pixelMidpoint)};
  -        //if (pixelCount >= pixelMidpoint)
  -            //index[0] = 1;
  -        //if (lineCount >= lineMidpoint)
  -            //index[1] = 1;
  -        //Bit#(32) data = patternRegs[index];
  -
  +        bramOutStageFifo.enq(Rgb888Stage { vsync: vsync, hsync: hsync, de: dataEnable,
  +            pixel: unpack(truncate(patternRegs[index]))});
  +        lineBuffer.readAddr(0);
  +    endrule
  +
  +    rule fbRule if (!testPatternEnabled);
           if (hsync == 1)
               dataCount <= 0;
           else if (dataEnable)
               dataCount <= dataCount + 1;
  -        bramOutStageFifo.enq(Rgb888Stage { vsync: vsync, hsync: hsync, de: dataEnable, pixel: unpack(truncate(patternRegs[index]))});
  -        lineBuffer.readAddr(0);
  -    endrule
  -
  -    rule fbRule if (!testPatternEnabled);
  -        LinePixelCount counts = newCounts(lineCount, pixelCount);
  -        lineCount <= counts.line;
  -        pixelCount <= counts.pixel;
  -
  -        if (lineCount == 0 && pixelCount == 0)
  -        begin
  -            $display("testPatternEnabled %d", shadowTestPatternEnabled);
  -            testPatternEnabled <= shadowTestPatternEnabled;
  -        end
  -
  -        if (hsync == 1)
  -            dataCount <= 0;
  -        else if (dataEnable)
  -            dataCount <= dataCount + 1;
  -        bramOutStageFifo.enq(Rgb888Stage { vsync: vsync, hsync: hsync, de: dataEnable, pixel: Rgb888{r:0,g:0,b:0}});
  +        bramOutStageFifo.enq(Rgb888Stage { vsync: vsync, hsync: hsync, de: dataEnable,
  +            pixel: Rgb888{r:0,g:0,b:0}});
           lineBuffer.readAddr(dataCount);
       endrule
   
       rule bramOutStage;
  -        bramOutStageFifo.deq;
  -        let d <- lineBuffer.readData;
  +        bramOutStageFifo.deq();
  +        let d <- lineBuffer.readData();
           let stageData = bramOutStageFifo.first;
   
           if (!testPatternEnabled)
  
positive.code:     rule yuv444Stage;
          let previous = yuv444IntermediatesStageReg;
          yuv444StageReg <= Yuv444Stage {
              vsync: previous.vsync,
              hsync: previous.hsync,
              de: previous.de,
              data: (previous.de) ? yuvIntermediatesToYuv444(previous.data) : unpack(0)
          };
      endrule
  
negative.code:         let previous = rgb888StageReg;
          let pixel = previous.pixel;
          yuv444IntermediatesStageReg <= Yuv444IntermediatesStage {
              vsync: previous.vsync, hsync: previous.hsync, de: previous.de,
              data: (previous.de) ? rgbToYuvIntermediates(pixel) : unpack(0)
          };
      endrule
  