Line 14... |
Line 14... |
// ALU
|
// ALU
|
output[31:0] alu_a_o, // ALU Operand A
|
output[31:0] alu_a_o, // ALU Operand A
|
output[31:0] alu_b_o, // ALU Operand B
|
output[31:0] alu_b_o, // ALU Operand B
|
output[4:0] alu_func_o, // ALU Function
|
output[4:0] alu_func_o, // ALU Function
|
output alu_signed_o, // ALU operation is Signed
|
output alu_signed_o, // ALU operation is Signed
|
input[31:0] alu_result_i, // ALU Result
|
input[32:0] alu_result_i, // ALU Result with Carry
|
input alu_carry_i, // ALU Carry
|
|
|
|
// Multiplier
|
// Multiplier
|
output reg mul_req_o, // Multiplier Request
|
output reg mul_req_o, // Multiplier Request
|
output[31:0] mul_a_o, // Multiplier Operand A
|
output[31:0] mul_a_o, // Multiplier Operand A
|
output[31:0] mul_b_o, // Multiplier Operand B
|
output[31:0] mul_b_o, // Multiplier Operand B
|
Line 90... |
Line 89... |
// Latch 3: EX/MEM
|
// Latch 3: EX/MEM
|
reg[31:0] ex_mem_opcode;
|
reg[31:0] ex_mem_opcode;
|
reg[31:0] ex_mem_addr, ex_mem_addrnext;
|
reg[31:0] ex_mem_addr, ex_mem_addrnext;
|
reg[31:0] ex_mem_addrbranch, ex_mem_addrjump, ex_mem_addrjr;
|
reg[31:0] ex_mem_addrbranch, ex_mem_addrjump, ex_mem_addrjr;
|
reg[63:0] ex_mem_aluout; // ALU result
|
reg[63:0] ex_mem_aluout; // ALU result
|
|
reg ex_mem_carry; // ALU carry
|
reg ex_mem_branch, ex_mem_jump, ex_mem_jr, ex_mem_linked;
|
reg ex_mem_branch, ex_mem_jump, ex_mem_jr, ex_mem_linked;
|
reg ex_mem_mult, ex_mem_div;
|
reg ex_mem_mult, ex_mem_div;
|
reg ex_mem_load,ex_mem_store;
|
reg ex_mem_load,ex_mem_store;
|
reg[31:0] ex_mem_store_value;
|
reg[31:0] ex_mem_store_value;
|
reg[3:0] ex_mem_store_sel; // Byte Selector on Stores
|
reg[3:0] ex_mem_store_sel; // Byte Selector on Stores
|
Line 1764... |
Line 1764... |
ex_mem_destlo <= id_ex_destlo;
|
ex_mem_destlo <= id_ex_destlo;
|
|
|
// Choose the output from ALU, Multiplier or Divider
|
// Choose the output from ALU, Multiplier or Divider
|
if(id_ex_mult) ex_mem_aluout <= mul_product_i;
|
if(id_ex_mult) ex_mem_aluout <= mul_product_i;
|
else if(id_ex_div) ex_mem_aluout <= { div_remainder_i, div_quotient_i };
|
else if(id_ex_div) ex_mem_aluout <= { div_remainder_i, div_quotient_i };
|
else ex_mem_aluout <= alu_result_i;
|
else begin
|
|
ex_mem_aluout <= {32'b0, alu_result_i[31:0]};
|
|
ex_mem_carry <= alu_result_i[32];
|
|
end
|
|
|
if(id_ex_store) begin
|
if(id_ex_store) begin
|
|
|
$display("INFO: CPU(%m)-EX: Execution of Store instruction @ADDR=%X w/OPCODE=%X started to STORE_ADDR=%X w/STORE_DATA=%X", id_ex_addr, id_ex_opcode, alu_result_i, id_ex_store_value);
|
$display("INFO: CPU(%m)-EX: Execution of Store instruction @ADDR=%X w/OPCODE=%X started to STORE_ADDR=%X w/STORE_DATA=%X", id_ex_addr, id_ex_opcode, alu_result_i, id_ex_store_value);
|
case(id_ex_size)
|
case(id_ex_size)
|