Advertisement
AlexanderAntonov

Untitled

Nov 2nd, 2022
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module ram_1rw
  2.   #(
  3.     parameter dat_width=32, adr_width=32, mem_size=1024
  4.   )
  5.   (
  6.     input [dat_width-1:0]      dat_i,
  7.     input [adr_width-1:0]      adr_i,
  8.     input          we_i,
  9.     output reg [dat_width-1:0] dat_o,
  10.     input          clk
  11.   );
  12.  
  13.    reg [dat_width-1:0] ram [0:mem_size - 1];
  14.    
  15.    always @ (posedge clk)
  16.      begin
  17.          dat_o <= ram[adr_i];
  18.          if (we_i)
  19.            ram[adr_i] <= dat_i;
  20.      end
  21.  
  22. endmodule // ram
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement