Advertisement
aidanozohor1810

Untitled

Dec 6th, 2023
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module register(
  2.         clk,
  3.         rst,
  4.         oe,
  5.         we,
  6.         in,
  7.         out,
  8.         disp_out
  9.     );
  10.  
  11. parameter width = 16;
  12.  
  13. input               clk;
  14. input               rst;
  15. input               oe;
  16. input               we;
  17. input [width-1 : 0] in;
  18. output[width-1 : 0] out;
  19. output[width-1 : 0] disp_out;
  20.  
  21. reg [width-1 : 0]   data;
  22.  
  23. always @(posedge clk) begin
  24.     if(rst)
  25.         data <= 0;
  26.     else if(we)
  27.         data <= in;
  28. end
  29.  
  30. assign out = oe ? data : 0;
  31. assign disp_out = data;
  32.  
  33. endmodule
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement