Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 17th, 2011  |  syntax: None  |  size: 0.45 KB  |  views: 57  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. module tmu2_dpram #(
  2.         parameter depth = 11, /* < log2 of the capacity in words */
  3.         parameter width = 32
  4. ) (
  5.         input sys_clk,
  6.         input ce,
  7.  
  8.         input [depth-1:0] a,
  9.         output [width-1:0] do,
  10.  
  11.         input [depth-1:0] wa,
  12.         input we,
  13.         input [width-1:0] di,
  14. );
  15.  
  16. reg [width-1:0] ram[0:(1 << depth)-1];
  17.  
  18. reg [depth-1:0] ar;
  19.  
  20. always @(posedge sys_clk) begin
  21.         if(ce) begin
  22.                 if(we)
  23.                         ram[w] <= di;
  24.                 ar <= a;
  25.         end
  26. end
  27.  
  28. assign do = ram[ar];
  29.  
  30. endmodule