key_reg_cg.v 568 Bytes
Newer Older
lwc-tester committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
module key_reg_cg (/*AUTOARG*/
   // Outputs
   so,
   // Inputs
   si, skinnys, sld, clk, rst, enc, se
   ) ;
   parameter initial_value = 0;
   parameter width = 32;   
   
   output reg [width-1:0] so;

   input [width-1:0]      si, skinnys, sld;
   input 	     clk, rst, enc, se;

   wire 	     clki, enci;
   wire [width-1:0]  sr;
   
   assign enci = (clk == 0) ? enc : enci;   
   assign clki = enci & clk;
   assign sr = rst ? sld : si;   

   always @ (posedge clki) begin
      if (se) so <= sr;
      else so <= skinnys;
   end
   
endmodule // key_reg_cg