tsuckow

InferableROM

Mar 13th, 2011
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module InferableROM
  2. #(
  3.     parameter data_width = 8,
  4.     parameter addr_width = 8
  5. )
  6. (
  7.    input [(addr_width-1):0] addr_a,
  8.    input clk,
  9.    output reg [(data_width-1):0] q_a
  10. );
  11.    reg [data_width-1:0] rom[0:2**addr_width-1];
  12.    
  13.    initial //Init ROM from file
  14.    begin
  15.       $readmemh("boot.dat", rom); // It would be great if this could be a parameter
  16.    end
  17.    
  18.    always @ (posedge clk)
  19.    begin
  20.       q_a <= rom[addr_a];
  21.    end
  22.    
  23. endmodule
RAW Paste Data