You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
620 B

3 years ago
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// 指令存储<E5AD98>?
module Insn_mem #(
parameter ADDR_WIDTH = 9,
parameter INSN_WIDTH = 32
)(
input logic [ADDR_WIDTH - 1 : 0] read_address,
output logic [INSN_WIDTH - 1 : 0] insn
);
logic [INSN_WIDTH-1 :0] insn_array [(2**(ADDR_WIDTH - 2))-1:0];
initial begin
$display("reading from insn.txt...");
$readmemh("insn.txt", insn_array);
$display("finished reading from insn.txt...");
end
assign insn = insn_array[read_address[ADDR_WIDTH - 1 : 2]];
endmodule