Line 1... |
Line 1... |
-- #################################################################################################
|
-- #################################################################################################
|
-- # << NEORV32 - CPU Compressed Instructions (RISC-V C-extension) Decoder >> #
|
-- # << NEORV32 - CPU: Compressed Instructions Decoder (RISC-V "C" Extension) >> #
|
-- # ********************************************************************************************* #
|
-- # ********************************************************************************************* #
|
-- # BSD 3-Clause License #
|
-- # BSD 3-Clause License #
|
-- # #
|
-- # #
|
-- # Copyright (c) 2020, Stephan Nolting. All rights reserved. #
|
-- # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
-- # #
|
-- # #
|
-- # Redistribution and use in source and binary forms, with or without modification, are #
|
-- # Redistribution and use in source and binary forms, with or without modification, are #
|
-- # permitted provided that the following conditions are met: #
|
-- # permitted provided that the following conditions are met: #
|
-- # #
|
-- # #
|
-- # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
-- # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
Line 164... |
Line 164... |
ci_instr32_o(instr_funct3_msb_c downto instr_funct3_lsb_c) <= funct3_sw_c;
|
ci_instr32_o(instr_funct3_msb_c downto instr_funct3_lsb_c) <= funct3_sw_c;
|
ci_instr32_o(instr_rs1_msb_c downto instr_rs1_lsb_c) <= "01" & ci_instr16_i(ci_rs1_3_msb_c downto ci_rs1_3_lsb_c); -- x8 - x15
|
ci_instr32_o(instr_rs1_msb_c downto instr_rs1_lsb_c) <= "01" & ci_instr16_i(ci_rs1_3_msb_c downto ci_rs1_3_lsb_c); -- x8 - x15
|
ci_instr32_o(instr_rs2_msb_c downto instr_rs2_lsb_c) <= "01" & ci_instr16_i(ci_rs2_3_msb_c downto ci_rs2_3_lsb_c); -- x8 - x15
|
ci_instr32_o(instr_rs2_msb_c downto instr_rs2_lsb_c) <= "01" & ci_instr16_i(ci_rs2_3_msb_c downto ci_rs2_3_lsb_c); -- x8 - x15
|
|
|
when others => -- undefined
|
when others => -- undefined
|
|
-- ----------------------------------------------------------------------------------------------------------
|
ci_illegal_o <= '1';
|
ci_illegal_o <= '1';
|
|
|
end case;
|
end case;
|
|
|
when "01" => -- C1: Control Transfer Instructions, Integer Constant-Generation Instructions
|
when "01" => -- C1: Control Transfer Instructions, Integer Constant-Generation Instructions
|
|
|
case ci_instr16_i(ci_funct3_msb_c downto ci_funct3_lsb_c) is
|
case ci_instr16_i(ci_funct3_msb_c downto ci_funct3_lsb_c) is
|
Line 336... |
Line 338... |
if (ci_instr16_i(12 downto 10) = "111") then -- reserved / undefined
|
if (ci_instr16_i(12 downto 10) = "111") then -- reserved / undefined
|
ci_illegal_o <= '1';
|
ci_illegal_o <= '1';
|
end if;
|
end if;
|
|
|
when others => -- undefined
|
when others => -- undefined
|
|
-- ----------------------------------------------------------------------------------------------------------
|
ci_illegal_o <= '1';
|
ci_illegal_o <= '1';
|
|
|
end case;
|
end case;
|
|
|
when "10" => -- C2: Stack-Pointer-Based Loads and Stores, Control Transfer Instructions
|
when "10" => -- C2: Stack-Pointer-Based Loads and Stores, Control Transfer Instructions
|
case ci_instr16_i(ci_funct3_msb_c downto ci_funct3_lsb_c) is
|
case ci_instr16_i(ci_funct3_msb_c downto ci_funct3_lsb_c) is
|
|
|
Line 420... |
Line 424... |
ci_instr32_o(instr_rs2_msb_c downto instr_rs2_lsb_c) <= ci_instr16_i(ci_rs2_5_msb_c downto ci_rs2_5_lsb_c);
|
ci_instr32_o(instr_rs2_msb_c downto instr_rs2_lsb_c) <= ci_instr16_i(ci_rs2_5_msb_c downto ci_rs2_5_lsb_c);
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
when others => -- undefined
|
when others => -- undefined
|
|
-- ----------------------------------------------------------------------------------------------------------
|
ci_illegal_o <= '1';
|
ci_illegal_o <= '1';
|
|
|
end case;
|
end case;
|
|
|
when others => -- not a compressed instruction
|
when others => -- not a compressed instruction
|
|
-- ----------------------------------------------------------------------------------------------------------
|
NULL;
|
NULL;
|
|
|
end case;
|
end case;
|
end process decompressor;
|
end process decompressor;
|
|
|