Line 198... |
Line 198... |
wire shift_imm_zero_nxt;
|
wire shift_imm_zero_nxt;
|
wire [3:0] condition_nxt;
|
wire [3:0] condition_nxt;
|
reg decode_exclusive_nxt;
|
reg decode_exclusive_nxt;
|
reg decode_iaccess_nxt;
|
reg decode_iaccess_nxt;
|
reg decode_daccess_nxt;
|
reg decode_daccess_nxt;
|
|
wire shift_extend;
|
|
|
reg [1:0] barrel_shift_function_nxt;
|
reg [1:0] barrel_shift_function_nxt;
|
wire [8:0] alu_function_nxt;
|
wire [8:0] alu_function_nxt;
|
reg [1:0] multiply_function_nxt;
|
reg [1:0] multiply_function_nxt;
|
reg [1:0] status_bits_mode_nxt;
|
reg [1:0] status_bits_mode_nxt;
|
Line 445... |
Line 446... |
assign ldm_flags = type == MTRANS && rs_sel_nxt == 4'd15 && instruction[20] && instruction[22];
|
assign ldm_flags = type == MTRANS && rs_sel_nxt == 4'd15 && instruction[20] && instruction[22];
|
assign ldm_status_bits = type == MTRANS && rs_sel_nxt == 4'd15 && instruction[20] && instruction[22] && i_execute_status_bits[1:0] != USR;
|
assign ldm_status_bits = type == MTRANS && rs_sel_nxt == 4'd15 && instruction[20] && instruction[22] && i_execute_status_bits[1:0] != USR;
|
assign load_rd_byte = (type == TRANS || type == SWAP) && instruction[22];
|
assign load_rd_byte = (type == TRANS || type == SWAP) && instruction[22];
|
assign load_rd_nxt = {ldm_flags, ldm_status_bits, ldm_user_mode, load_rd_byte, rs_sel_nxt};
|
assign load_rd_nxt = {ldm_flags, ldm_status_bits, ldm_user_mode, load_rd_byte, rs_sel_nxt};
|
|
|
|
// this is used for RRX
|
|
assign shift_extend = !instruction[25] && !instruction[4] && !(|instruction[11:7]) && instruction[6:5] == 2'b11;
|
|
|
// MSB indicates valid dirty target register
|
// MSB indicates valid dirty target register
|
assign load_rd_d1_nxt = {o_decode_daccess && !o_write_data_wen, o_load_rd[3:0]};
|
assign load_rd_d1_nxt = {o_decode_daccess && !o_write_data_wen, o_load_rd[3:0]};
|
assign shift_imm = instruction[11:7];
|
assign shift_imm = instruction[11:7];
|
assign offset12 = { 20'h0, instruction[11:0]};
|
assign offset12 = { 20'h0, instruction[11:0]};
|
Line 813... |
Line 816... |
status_bits_sel_nxt = 3'd5;
|
status_bits_sel_nxt = 3'd5;
|
|
|
if ( opcode == ADD || opcode == CMN ) // CMN is just like an ADD
|
if ( opcode == ADD || opcode == CMN ) // CMN is just like an ADD
|
begin
|
begin
|
alu_out_sel_nxt = 4'd1; // Add
|
alu_out_sel_nxt = 4'd1; // Add
|
|
use_carry_in_nxt = shift_extend;
|
end
|
end
|
|
|
if ( opcode == ADC ) // Add with Carry
|
if ( opcode == ADC ) // Add with Carry
|
begin
|
begin
|
alu_out_sel_nxt = 4'd1; // Add
|
alu_out_sel_nxt = 4'd1; // Add
|
alu_cin_sel_nxt = 2'd2; // carry in from status_bits
|
alu_cin_sel_nxt = 2'd2; // carry in from status_bits
|
use_carry_in_nxt = 1'd1;
|
use_carry_in_nxt = shift_extend;
|
end
|
end
|
|
|
if ( opcode == SUB || opcode == CMP ) // Subtract
|
if ( opcode == SUB || opcode == CMP ) // Subtract
|
begin
|
begin
|
alu_out_sel_nxt = 4'd1; // Add
|
alu_out_sel_nxt = 4'd1; // Add
|
Line 856... |
Line 860... |
begin
|
begin
|
alu_out_sel_nxt = 4'd1; // Add
|
alu_out_sel_nxt = 4'd1; // Add
|
alu_cin_sel_nxt = 2'd2; // carry in from status_bits
|
alu_cin_sel_nxt = 2'd2; // carry in from status_bits
|
alu_not_sel_nxt = 1'd1; // invert B
|
alu_not_sel_nxt = 1'd1; // invert B
|
alu_swap_sel_nxt = 1'd1; // swap A and B
|
alu_swap_sel_nxt = 1'd1; // swap A and B
|
|
use_carry_in_nxt = 1'd1;
|
end
|
end
|
|
|
if ( opcode == AND || opcode == TST ) // Logical AND, Test (using AND operator)
|
if ( opcode == AND || opcode == TST ) // Logical AND, Test (using AND operator)
|
begin
|
begin
|
alu_out_sel_nxt = 4'd8; // AND
|
alu_out_sel_nxt = 4'd8; // AND
|
Line 868... |
Line 873... |
|
|
if ( opcode == EOR || opcode == TEQ ) // Logical Exclusive OR, Test Equivalence (using EOR operator)
|
if ( opcode == EOR || opcode == TEQ ) // Logical Exclusive OR, Test Equivalence (using EOR operator)
|
begin
|
begin
|
alu_out_sel_nxt = 4'd6; // XOR
|
alu_out_sel_nxt = 4'd6; // XOR
|
alu_cout_sel_nxt = 1'd1; // i_barrel_shift_carry
|
alu_cout_sel_nxt = 1'd1; // i_barrel_shift_carry
|
|
use_carry_in_nxt = 1'd1;
|
end
|
end
|
|
|
if ( opcode == ORR )
|
if ( opcode == ORR )
|
begin
|
begin
|
alu_out_sel_nxt = 4'd7; // OR
|
alu_out_sel_nxt = 4'd7; // OR
|
alu_cout_sel_nxt = 1'd1; // i_barrel_shift_carry
|
alu_cout_sel_nxt = 1'd1; // i_barrel_shift_carry
|
|
use_carry_in_nxt = 1'd1;
|
end
|
end
|
|
|
if ( opcode == BIC ) // Bit Clear (using AND & NOT operators)
|
if ( opcode == BIC ) // Bit Clear (using AND & NOT operators)
|
begin
|
begin
|
alu_out_sel_nxt = 4'd8; // AND
|
alu_out_sel_nxt = 4'd8; // AND
|
alu_not_sel_nxt = 1'd1; // invert B
|
alu_not_sel_nxt = 1'd1; // invert B
|
alu_cout_sel_nxt = 1'd1; // i_barrel_shift_carry
|
alu_cout_sel_nxt = 1'd1; // i_barrel_shift_carry
|
|
use_carry_in_nxt = 1'd1;
|
end
|
end
|
|
|
if ( opcode == MOV ) // Move
|
if ( opcode == MOV ) // Move
|
begin
|
begin
|
alu_cout_sel_nxt = 1'd1; // i_barrel_shift_carry
|
alu_cout_sel_nxt = 1'd1; // i_barrel_shift_carry
|
|
use_carry_in_nxt = 1'd1;
|
end
|
end
|
|
|
if ( opcode == MVN ) // Move NOT
|
if ( opcode == MVN ) // Move NOT
|
begin
|
begin
|
alu_not_sel_nxt = 1'd1; // invert B
|
alu_not_sel_nxt = 1'd1; // invert B
|
alu_cout_sel_nxt = 1'd1; // i_barrel_shift_carry
|
alu_cout_sel_nxt = 1'd1; // i_barrel_shift_carry
|
|
use_carry_in_nxt = 1'd1;
|
end
|
end
|
end
|
end
|
|
|
// Load & Store instructions
|
// Load & Store instructions
|
if ( mem_op )
|
if ( mem_op )
|