Line 114... |
Line 114... |
when "00" => -- C0: Register-Based Loads and Stores
|
when "00" => -- C0: Register-Based Loads and Stores
|
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
|
|
|
when "000" => -- Illegal_instruction, C.ADDI4SPN
|
when "000" => -- Illegal_instruction, C.ADDI4SPN
|
-- ----------------------------------------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------------------------------------
|
if (ci_instr16_i(12 downto 2) = "00000000000") then -- "official illegal instruction"
|
|
ci_illegal_o <= '1';
|
|
else
|
|
-- C.ADDI4SPN
|
-- C.ADDI4SPN
|
ci_instr32_o(instr_opcode_msb_c downto instr_opcode_lsb_c) <= opcode_alui_c;
|
ci_instr32_o(instr_opcode_msb_c downto instr_opcode_lsb_c) <= opcode_alui_c;
|
ci_instr32_o(instr_rs1_msb_c downto instr_rs1_lsb_c) <= "00010"; -- stack pointer
|
ci_instr32_o(instr_rs1_msb_c downto instr_rs1_lsb_c) <= "00010"; -- stack pointer
|
ci_instr32_o(instr_rd_msb_c downto instr_rd_lsb_c) <= "01" & ci_instr16_i(ci_rd_3_msb_c downto ci_rd_3_lsb_c);
|
ci_instr32_o(instr_rd_msb_c downto instr_rd_lsb_c) <= "01" & ci_instr16_i(ci_rd_3_msb_c downto ci_rd_3_lsb_c);
|
ci_instr32_o(instr_funct3_msb_c downto instr_funct3_lsb_c) <= funct3_subadd_c;
|
ci_instr32_o(instr_funct3_msb_c downto instr_funct3_lsb_c) <= funct3_subadd_c;
|
Line 133... |
Line 130... |
ci_instr32_o(instr_imm12_lsb_c + 5) <= ci_instr16_i(12);
|
ci_instr32_o(instr_imm12_lsb_c + 5) <= ci_instr16_i(12);
|
ci_instr32_o(instr_imm12_lsb_c + 6) <= ci_instr16_i(7);
|
ci_instr32_o(instr_imm12_lsb_c + 6) <= ci_instr16_i(7);
|
ci_instr32_o(instr_imm12_lsb_c + 7) <= ci_instr16_i(8);
|
ci_instr32_o(instr_imm12_lsb_c + 7) <= ci_instr16_i(8);
|
ci_instr32_o(instr_imm12_lsb_c + 8) <= ci_instr16_i(9);
|
ci_instr32_o(instr_imm12_lsb_c + 8) <= ci_instr16_i(9);
|
ci_instr32_o(instr_imm12_lsb_c + 9) <= ci_instr16_i(10);
|
ci_instr32_o(instr_imm12_lsb_c + 9) <= ci_instr16_i(10);
|
end if;
|
--
|
|
ci_illegal_o <= not or_reduce_f(ci_instr16_i(12 downto 2)); -- 12:2 = "00000000000" is official illegal instruction
|
|
|
when "010" | "011" => -- C.LW / C.FLW
|
when "010" | "011" => -- C.LW / C.FLW
|
-- ----------------------------------------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------------------------------------
|
ci_instr32_o(instr_opcode_msb_c downto instr_opcode_lsb_c) <= opcode_load_c;
|
ci_instr32_o(instr_opcode_msb_c downto instr_opcode_lsb_c) <= opcode_load_c;
|
ci_instr32_o(21 downto 20) <= "00";
|
ci_instr32_o(21 downto 20) <= "00";
|
Line 171... |
Line 169... |
ci_illegal_o <= '1';
|
ci_illegal_o <= '1';
|
end if;
|
end if;
|
|
|
when others => -- undefined
|
when others => -- undefined
|
-- ----------------------------------------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------------------------------------
|
|
ci_instr32_o <= (others => '-');
|
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
|
Line 231... |
Line 230... |
ci_instr32_o(instr_imm12_lsb_c + 1) <= ci_instr16_i(3);
|
ci_instr32_o(instr_imm12_lsb_c + 1) <= ci_instr16_i(3);
|
ci_instr32_o(instr_imm12_lsb_c + 2) <= ci_instr16_i(4);
|
ci_instr32_o(instr_imm12_lsb_c + 2) <= ci_instr16_i(4);
|
ci_instr32_o(instr_imm12_lsb_c + 3) <= ci_instr16_i(5);
|
ci_instr32_o(instr_imm12_lsb_c + 3) <= ci_instr16_i(5);
|
ci_instr32_o(instr_imm12_lsb_c + 4) <= ci_instr16_i(6);
|
ci_instr32_o(instr_imm12_lsb_c + 4) <= ci_instr16_i(6);
|
ci_instr32_o(instr_imm12_lsb_c + 5) <= ci_instr16_i(12);
|
ci_instr32_o(instr_imm12_lsb_c + 5) <= ci_instr16_i(12);
|
if (ci_instr16_i(ci_rd_5_msb_c downto ci_rd_5_lsb_c) = "00000") then -- HINT
|
|
ci_illegal_o <= '1';
|
|
end if;
|
|
|
|
when "011" => -- C.LUI / C.ADDI16SP
|
when "011" => -- C.LUI / C.ADDI16SP
|
-- ----------------------------------------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------------------------------------
|
if (ci_instr16_i(ci_rd_5_msb_c downto ci_rd_5_lsb_c) = "00010") then -- C.ADDI16SP
|
if (ci_instr16_i(ci_rd_5_msb_c downto ci_rd_5_lsb_c) = "00010") then -- C.ADDI16SP
|
ci_instr32_o(instr_opcode_msb_c downto instr_opcode_lsb_c) <= opcode_alui_c;
|
ci_instr32_o(instr_opcode_msb_c downto instr_opcode_lsb_c) <= opcode_alui_c;
|
Line 345... |
Line 341... |
ci_illegal_o <= '1';
|
ci_illegal_o <= '1';
|
end if;
|
end if;
|
|
|
when others => -- undefined
|
when others => -- undefined
|
-- ----------------------------------------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------------------------------------
|
|
ci_instr32_o <= (others => '-');
|
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
|
Line 437... |
Line 434... |
end if;
|
end if;
|
end if;
|
end if;
|
|
|
when others => -- undefined
|
when others => -- undefined
|
-- ----------------------------------------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------------------------------------
|
|
ci_instr32_o <= (others => '-');
|
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;
|
ci_instr32_o <= (others => '-');
|
|
ci_illegal_o <= '0';
|
|
|
end case;
|
end case;
|
end process decompressor;
|
end process decompressor;
|
|
|
|
|