Contact us



PRBS checker 128 bits at a time


We will assume we have the generator driving our signal that we want to check.

module prbs_wide_check (
   // Outputs
   // Inputs
   prbs, clk, reset

  parameter       WIDTH = 128,
                  PN = 7,//not used but good to know
                  TAP1 = 30,
                  TAP2 = 27;

   output [8:0]       error;
   input [WIDTH-1:0]  prbs;
   input              clk, reset;

   reg [8:0]          error;
   reg [WIDTH-1:0]    prbs_state, check, d;//d is a temp variable
   reg                load;
   integer            i;

   always @ (posedge clk)
     if (reset)
       prbs_state <= 1; //anything but teh all 0s case is fine.
          d = prbs_state; //blocking assignment used on purpose here
          repeat (WIDTH) d = {d,d[TAP1]^d[TAP2]};//again blocking is intentional
          prbs_state <= d;
          check <= prbs ^ prbs_state;
          d = 0;
          for (i=0;i<= d;
          load <= error > 25; //error rate to reload
       end // else: !if(reset)
endmodule // prbs_wide_check

This checker has an automatic reload built in. If you want to have an external load you can 'or' in an additional external load. Or you can remove the automatic reload and only reload based on an external signal.

The reset block is only for mostly for simulations. With the auto load, the checker will automatically align to the incoming data. The calculations for the error signals and reload have a few pipe stages that are optional depending on the speed you are running at.