anchor.diff:      method Bit#(1)          ctrl_fifo_reset();
       method Bit#(3)          ctrl_reset_inc_ce();
       method Action           dackint(Bit#(1) v);
  +    method Action           endhandshake(Bit#(1) v);
  +    method Bit#(1)          starthandshake();
   endinterface: Iserdesbvi
   
   import "BVI" iserdes_datadeser = 
  
positive.code: endmodule: mkFIFO18
  
  typedef enum { DIdle, DValid, DLow} DState deriving (Bits,Eq);
  
  module mkIserdesDatadeser#(Clock serdes_clock, Reset serdes_reset, Clock serdest, Bit#(1) align_start,
      Bit#(1) autoalign, Bit#(10) training, Bit#(10) manual_tap, Bit#(1) rden)(IserdesDatadeser);
  
negative.code:         dfifo.wren(fifo_wren_sync.read());
      endrule
  
      rule handinit_rule if (bvi_resets_reg.read() == 0);
          hstate <= HIdle;
          hcounter <= 0;
          item_req_wire.send(0);
          serbvi.endhandshake(0);
      endrule
  
      rule hand_rule if (bvi_resets_reg.read() != 0);
          let hs = hstate;
          let hend = 0;
          let hc = hcounter;
          hc = hc + 1;
          if (hstate == HIdle && serbvi.starthandshake() == 1)
              begin
              hc = 0;
              hs = HHigh;
              end
          if (hstate == HHigh && dackint.read() == 1)
              begin
              hc = 0;
              hs = HLow;
              end
          if (hstate == HHigh && hcounter >= 'h20)
              begin
              hend = 1;
              hs = HIdle;
              end
          if (hstate == HLow && (dackint.read() == 0 || hcounter >= 'h20))
              begin
              hend = 1;
              hs = HIdle;
              end
          serbvi.endhandshake(hend);
          hstate <= hs;
          hcounter <= hc;
      endrule
      rule hstate1_rule if (bvi_resets_reg.read() != 0 && hstate == HIdle && serbvi.starthandshake() == 1);
          item_req_wire.send(1);
      endrule
      rule hstate2_rule if (bvi_resets_reg.read() != 0 && hstate == HHigh && dackint.read() == 1);
          item_req_wire.send(0);
      endrule
  
      rule serdesrule;
          serbvi.align_start(align_start);
          serbvi.autoalign(autoalign);
  