Made ROM binary file configurable via a parameter. Updated assignment2 and assignment3 to reflect this. Added bit slicing in assignment2 for ram/rom addresses.

This commit is contained in:
riley committed 2026-11-05 14:27:01 +11:00
1 parent 00b2087860
commit 74a15cf038
3 files changed
+13 -12

No files matched your search

+2 -6
View File
@@ -1,7 +1,7 @@
`ifndef ROM_H
`define ROM_H
module rom #(parameter m=7,p=4) (
module rom #(parameter string binary_path, parameter m=7,p=4) (
input logic [m-1:0] Ad,
output logic [2**p-1:0] Dout
);
@@ -12,11 +12,7 @@ module rom #(parameter m=7,p=4) (
//Load the program in memory
// The machine code stored in text file program.dat written in Hex format
initial begin
`ifdef QUARTUS_SYNTH
$readmemh("../../asm/bin/ELEC4720-2026s2-Ass-02-Demo.hex", mem, 0, 2**m-1); //$readmemb for binary
`else
$readmemh("./asm/bin/ELEC4720-2026s2-Ass-02-Demo.hex", mem, 0, 2**m-1); //$readmemb for binary
`endif
$readmemh(binary_path, mem, 0, 2**m-1); //$readmemb for binary
end
endmodule // end rom module