This repository has been archived on 2023-12-21. You can view files and clone it, but cannot push or open issues or pull requests.
cse141L-project/RTL/InstROM.sv

20 lines
554 B
Systemverilog
Raw Normal View History

2022-08-14 23:05:44 +00:00
// Module Name: InstFetch
// Project Name: CSE141L
// Description: instruction ROM module for use with InstFetch
module InstROM #(parameter A=10, W=9, machine_code_file = "machine_code.txt") (
2022-08-14 23:05:44 +00:00
input logic [A-1:0] InstAddress,
output logic[W-1:0] InstOut
);
// declare 2-dimensional array, W bits wide, 2**A words deep
logic[W-1:0] inst_rom[2**A];
assign InstOut = inst_rom[InstAddress];
2022-08-14 01:54:10 +00:00
2022-08-14 23:05:44 +00:00
// use readmemb to read ascii 0 and 1 representation of binary values from text file
2022-08-14 23:05:44 +00:00
initial begin
$readmemb(machine_code_file,inst_rom);
2022-08-14 23:05:44 +00:00
end
2022-08-14 01:54:10 +00:00
2022-08-12 05:01:28 +00:00
endmodule