Added Changes to ModelSim from Modules folder (and small fix for ../hexfile path)

This commit is contained in:
TroubleElectrical committed 2026-10-16 12:59:50 +11:00
1 parent 2f652705cc
commit 91a5090528
21 files changed
+389 -1323

No files matched your search

+5 -5
View File
@@ -3,19 +3,19 @@
module rom #(parameter m=7,p=4) (
input logic [m-1:0] Ad,
output logic [p-1:0] Dout
output logic [2**p-1:0] Dout
);
logic [p-1:0] mem[2**m-1:0];
assign Dout = mem[Ad];
logic [2**p-1:0] mem[2**m];
assign Dout = mem[Ad>>2]; // Because word-size versus byte size hack
//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.txt",mem); //$readmemb for binary
$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.txt",mem); //$readmemb for binary
$readmemh("../asm/bin/ELEC4720-2026s2-Ass-02-Demo.hex", mem, 0, 2**m-1); //$readmemb for binary
`endif
end
endmodule // end rom module