24 lines
1.0 KiB
Verilog
24 lines
1.0 KiB
Verilog
`timescale 1ns / 1ps
|
|
|
|
module InstructionMemory (
|
|
input [31:0] address,
|
|
output reg [31:0] instruction
|
|
);
|
|
|
|
always @(*) begin
|
|
case (address[31:2])
|
|
20'd0: instruction <= 32'h20110001; // addi $s1, $zero, 1
|
|
20'd6: instruction <= 32'h16320009; // bne $s1, $s2, bne_target
|
|
20'd11: instruction <= 32'h20130001; // addi $s3, $zero, 1
|
|
// bne_target:
|
|
20'd16: instruction <= 32'h20120001; // addi $s2, $zero, 1
|
|
20'd21: instruction <= 32'h16320009; // bne $s1, $s2, bne_target2
|
|
20'd26: instruction <= 32'h20130002; // addi $s3, $zero, 2
|
|
// bne_target2:
|
|
20'd31: instruction <= 32'h0810001e; // j bne_target2
|
|
default: instruction <= 32'h00000000;
|
|
endcase
|
|
end
|
|
|
|
endmodule
|