Line 23... |
Line 23... |
rd_write : out std_logic;
|
rd_write : out std_logic;
|
branch : out branch_type;
|
branch : out branch_type;
|
|
|
-- Exception signals:
|
-- Exception signals:
|
decode_exception : out std_logic;
|
decode_exception : out std_logic;
|
decode_exception_cause : out std_logic_vector(4 downto 0);
|
decode_exception_cause : out csr_exception_cause;
|
|
|
-- Control register signals:
|
-- Control register signals:
|
csr_write : out csr_write_mode;
|
csr_write : out csr_write_mode;
|
csr_imm : out std_logic; --! Indicating an immediate variant of the csrr* instructions.
|
csr_imm : out std_logic; --! Indicating an immediate variant of the csrr* instructions.
|
|
|
Line 43... |
Line 43... |
);
|
);
|
end entity pp_control_unit;
|
end entity pp_control_unit;
|
|
|
architecture behaviour of pp_control_unit is
|
architecture behaviour of pp_control_unit is
|
signal exception : std_logic;
|
signal exception : std_logic;
|
signal exception_cause : std_logic_vector(4 downto 0);
|
signal exception_cause : csr_exception_cause;
|
signal alu_op_temp : alu_operation;
|
signal alu_op_temp : alu_operation;
|
begin
|
begin
|
|
|
csr_imm <= funct3(2);
|
csr_imm <= funct3(2);
|
alu_op <= alu_op_temp;
|
alu_op <= alu_op_temp;
|
Line 123... |
Line 123... |
if funct3 = b"000" then
|
if funct3 = b"000" then
|
rd_write <= '0';
|
rd_write <= '0';
|
|
|
if funct12 = x"000" then
|
if funct12 = x"000" then
|
exception <= '1';
|
exception <= '1';
|
exception_cause <= CSR_CAUSE_SYSCALL;
|
exception_cause <= CSR_CAUSE_ECALL;
|
branch <= BRANCH_NONE;
|
branch <= BRANCH_NONE;
|
elsif funct12 = x"001" then
|
elsif funct12 = x"001" then
|
exception <= '1';
|
exception <= '1';
|
exception_cause <= CSR_CAUSE_BREAKPOINT;
|
exception_cause <= CSR_CAUSE_BREAKPOINT;
|
branch <= BRANCH_NONE;
|
branch <= BRANCH_NONE;
|
elsif funct12 = x"800" then
|
elsif funct12 = CSR_EPC_ERET then
|
exception <= '0';
|
exception <= '0';
|
exception_cause <= CSR_CAUSE_NONE;
|
exception_cause <= CSR_CAUSE_NONE;
|
branch <= BRANCH_SRET;
|
branch <= BRANCH_SRET;
|
else
|
else
|
exception <= '1';
|
exception <= '1';
|