2018-01-28 04:02:51 +00:00
|
|
|
module rom_basic(
|
|
|
|
input clk,
|
2018-01-28 19:18:56 +00:00
|
|
|
input [11:0] address,
|
2018-01-28 04:02:51 +00:00
|
|
|
output reg [7:0] dout
|
|
|
|
);
|
|
|
|
|
2018-01-29 06:45:01 +00:00
|
|
|
`ifdef YOSYS
|
|
|
|
parameter BASIC_FILENAME = "../../roms/basic.hex";
|
|
|
|
`else
|
|
|
|
parameter BASIC_FILENAME = "../roms/basic.hex";
|
|
|
|
`endif
|
2018-01-28 04:02:51 +00:00
|
|
|
|
2018-01-29 06:45:01 +00:00
|
|
|
reg [7:0] rom_data[0:4095];
|
2018-01-28 04:02:51 +00:00
|
|
|
|
|
|
|
initial
|
2018-01-29 06:45:01 +00:00
|
|
|
$readmemh(BASIC_FILENAME, rom_data, 0, 4095);
|
2018-01-28 04:02:51 +00:00
|
|
|
|
|
|
|
always @(posedge clk)
|
2018-01-29 06:45:01 +00:00
|
|
|
dout <= rom_data[address];
|
2018-01-28 04:02:51 +00:00
|
|
|
|
|
|
|
endmodule
|