// Test Program 3 -- tests addi and j instructions // // Correction was made. Specifically, the "j Loop" instruction // was not specified correctly in the original hw9Test3.V // file. The opcode was 3, which is incorrect. This has // been corrected so that the opcode is now 3. module ProgramMemory(addr,out); input [31:0] addr; output [31:0] out; reg [31:0] out; initial begin #40; $stop; end // // always @(addr) begin case (addr) // Loop: 0: out = {6'd8,5'd0,5'd16,16'd3}; // addi $16,$0,3 4: out = {6'd8,5'd0,5'd17,16'd8}; // addi $17,$0,0 // Loop: 8: out = {6'd0,5'd17,5'd16,5'd17,5'd0,6'd32}; // add $17,$17,$16 12: out = {6'd8,5'd16,5'd16,-16'd1}; // addi $16,$16,-1 // Loop2: 16: out = {6'd4,5'd0,5'd16,-16'd1}; // beq $0,$16,Loop2 20: out = {6'd2,26'd2}; // j Loop (2) default: $display("Illegal Access"); endcase end endmodule