Line 92... |
Line 92... |
output reg [1:0] o_byte_enable_sel = 'd0, // byte, halfword or word write
|
output reg [1:0] o_byte_enable_sel = 'd0, // byte, halfword or word write
|
output reg [2:0] o_status_bits_sel = 'd0,
|
output reg [2:0] o_status_bits_sel = 'd0,
|
output reg [2:0] o_reg_write_sel,
|
output reg [2:0] o_reg_write_sel,
|
output reg o_user_mode_regs_store_nxt,
|
output reg o_user_mode_regs_store_nxt,
|
output reg o_firq_not_user_mode,
|
output reg o_firq_not_user_mode,
|
|
output reg o_use_carry_in,
|
|
|
output reg o_write_data_wen = 'd0,
|
output reg o_write_data_wen = 'd0,
|
output reg o_base_address_wen = 'd0, // save ldm base address register
|
output reg o_base_address_wen = 'd0, // save ldm base address register
|
// in case of data abort
|
// in case of data abort
|
output reg o_pc_wen = 1'd1,
|
output reg o_pc_wen = 1'd1,
|
Line 218... |
Line 219... |
reg [2:0] pc_sel_nxt;
|
reg [2:0] pc_sel_nxt;
|
reg [1:0] byte_enable_sel_nxt;
|
reg [1:0] byte_enable_sel_nxt;
|
reg [2:0] status_bits_sel_nxt;
|
reg [2:0] status_bits_sel_nxt;
|
reg [2:0] reg_write_sel_nxt;
|
reg [2:0] reg_write_sel_nxt;
|
wire firq_not_user_mode_nxt;
|
wire firq_not_user_mode_nxt;
|
|
reg use_carry_in_nxt;
|
|
|
// ALU Function signals
|
// ALU Function signals
|
reg alu_swap_sel_nxt;
|
reg alu_swap_sel_nxt;
|
reg alu_not_sel_nxt;
|
reg alu_not_sel_nxt;
|
reg [1:0] alu_cin_sel_nxt;
|
reg [1:0] alu_cin_sel_nxt;
|
Line 743... |
Line 745... |
|
|
// default Mux Select values
|
// default Mux Select values
|
barrel_shift_amount_sel_nxt = 'd0; // don't shift the input
|
barrel_shift_amount_sel_nxt = 'd0; // don't shift the input
|
barrel_shift_data_sel_nxt = 'd0; // immediate value
|
barrel_shift_data_sel_nxt = 'd0; // immediate value
|
barrel_shift_function_nxt = 'd0;
|
barrel_shift_function_nxt = 'd0;
|
|
use_carry_in_nxt = 'd0;
|
multiply_function_nxt = 'd0;
|
multiply_function_nxt = 'd0;
|
iaddress_sel_nxt = 'd0;
|
iaddress_sel_nxt = 'd0;
|
daddress_sel_nxt = 'd0;
|
daddress_sel_nxt = 'd0;
|
pc_sel_nxt = 'd0;
|
pc_sel_nxt = 'd0;
|
load_pc_nxt = 'd0;
|
load_pc_nxt = 'd0;
|
Line 816... |
Line 819... |
|
|
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;
|
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 834... |
Line 838... |
if ( opcode == SBC ) // Subtract with Carry
|
if ( opcode == SBC ) // Subtract 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
|
alu_not_sel_nxt = 1'd1; // invert B
|
alu_not_sel_nxt = 1'd1; // invert B
|
|
use_carry_in_nxt = 1'd1;
|
end
|
end
|
|
|
if ( opcode == RSB ) // Reverse Subtract
|
if ( opcode == RSB ) // Reverse Subtract
|
begin
|
begin
|
alu_out_sel_nxt = 4'd1; // Add
|
alu_out_sel_nxt = 4'd1; // Add
|
alu_cin_sel_nxt = 2'd1; // cin = 1
|
alu_cin_sel_nxt = 2'd1; // cin = 1
|
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 == RSC ) // Reverse Subtract with carry
|
if ( opcode == RSC ) // Reverse Subtract with carry
|
begin
|
begin
|
alu_out_sel_nxt = 4'd1; // Add
|
alu_out_sel_nxt = 4'd1; // Add
|
Line 1604... |
Line 1610... |
o_rn_sel <= rn_sel_nxt;
|
o_rn_sel <= rn_sel_nxt;
|
o_barrel_shift_amount_sel <= barrel_shift_amount_sel_nxt;
|
o_barrel_shift_amount_sel <= barrel_shift_amount_sel_nxt;
|
o_barrel_shift_data_sel <= barrel_shift_data_sel_nxt;
|
o_barrel_shift_data_sel <= barrel_shift_data_sel_nxt;
|
o_barrel_shift_function <= barrel_shift_function_nxt;
|
o_barrel_shift_function <= barrel_shift_function_nxt;
|
o_alu_function <= alu_function_nxt;
|
o_alu_function <= alu_function_nxt;
|
|
o_use_carry_in <= use_carry_in_nxt;
|
o_multiply_function <= multiply_function_nxt;
|
o_multiply_function <= multiply_function_nxt;
|
o_interrupt_vector_sel <= next_interrupt;
|
o_interrupt_vector_sel <= next_interrupt;
|
o_iaddress_sel <= iaddress_sel_nxt;
|
o_iaddress_sel <= iaddress_sel_nxt;
|
o_daddress_sel <= daddress_sel_nxt;
|
o_daddress_sel <= daddress_sel_nxt;
|
o_pc_sel <= pc_sel_nxt;
|
o_pc_sel <= pc_sel_nxt;
|