20 lines
591 B
Systemverilog
20 lines
591 B
Systemverilog
|
|
module rom #(parameter m=7,p=4) (
|
|
input logic [m-1:0] Ad,
|
|
output logic [p-1:0] Dout
|
|
);
|
|
|
|
logic [p-1:0] mem[2**m-1:0];
|
|
assign Dout = mem[Ad];
|
|
|
|
//Load the program in memory
|
|
// The machine code stored in text file program.dat written in Hex format
|
|
initial begin
|
|
`ifdef QUARTUS_BUILD
|
|
$readmemh("../../asm/bin/ELEC4720-2026s2-Ass-02-Demo.txt",mem); //$readmemb for binary
|
|
`else
|
|
$readmemh("./asm/bin/ELEC4720-2026s2-Ass-02-Demo.txt",mem); //$readmemb for binary
|
|
`endif
|
|
end
|
|
endmodule // end rom module
|