Line 125... |
Line 125... |
when "00" => opa <= rs1_i;
|
when "00" => opa <= rs1_i;
|
when "01" => opa <= pc2_i;
|
when "01" => opa <= pc2_i;
|
when others => opa <= csr_i;
|
when others => opa <= csr_i;
|
end case;
|
end case;
|
-- opb (second ALU input operand) --
|
-- opb (second ALU input operand) --
|
case ctrl_i(ctrl_alu_opb_mux_msb_c downto ctrl_alu_opb_mux_lsb_c) is
|
if (ctrl_i(ctrl_alu_opb_mux_c) = '0') then
|
when "00" => opb <= rs2_i;
|
opb <= rs2_i;
|
when "01" => opb <= imm_i;
|
else
|
when others => opb <= rs1_i;
|
opb <= imm_i;
|
end case;
|
end if;
|
-- opc (second operand for comparison and SUB) --
|
-- opc (second operand for comparison and SUB) --
|
if (ctrl_i(ctrl_alu_opc_mux_c) = '0') then
|
if (ctrl_i(ctrl_alu_opc_mux_c) = '0') then
|
opc <= imm_i;
|
opc <= imm_i;
|
else
|
else
|
opc <= rs2_i;
|
opc <= rs2_i;
|
Line 249... |
Line 249... |
cp_res <= cp0_data_i or cp1_data_i; -- only the selcted cp may output data != 0
|
cp_res <= cp0_data_i or cp1_data_i; -- only the selcted cp may output data != 0
|
|
|
|
|
-- ALU Function Select --------------------------------------------------------------------
|
-- ALU Function Select --------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
alu_function_mux: process(ctrl_i, opa, opb, add_res, sub_res, cmp_less, shifter)
|
alu_function_mux: process(ctrl_i, opa, opb, add_res, sub_res, cmp_less, shifter.sreg)
|
begin
|
begin
|
case ctrl_i(ctrl_alu_cmd2_c downto ctrl_alu_cmd0_c) is
|
case ctrl_i(ctrl_alu_cmd2_c downto ctrl_alu_cmd0_c) is
|
when alu_cmd_xor_c => alu_res <= opa xor opb;
|
when alu_cmd_xor_c => alu_res <= opa xor opb;
|
when alu_cmd_or_c => alu_res <= opa or opb;
|
when alu_cmd_or_c => alu_res <= opa or opb;
|
when alu_cmd_and_c => alu_res <= opa and opb;
|
when alu_cmd_and_c => alu_res <= opa and opb;
|