Line 17... |
Line 17... |
--! instructions for manipulation of control and status registers from the
|
--! instructions for manipulation of control and status registers from the
|
--! currently unpublished supervisor extension.
|
--! currently unpublished supervisor extension.
|
entity pp_core is
|
entity pp_core is
|
generic(
|
generic(
|
PROCESSOR_ID : std_logic_vector(31 downto 0) := x"00000000"; --! Processor ID.
|
PROCESSOR_ID : std_logic_vector(31 downto 0) := x"00000000"; --! Processor ID.
|
RESET_ADDRESS : std_logic_vector(31 downto 0) := x"00000000" --! Address of the first instruction to execute.
|
RESET_ADDRESS : std_logic_vector(31 downto 0) := x"00000200" --! Address of the first instruction to execute.
|
);
|
);
|
port(
|
port(
|
-- Control inputs:
|
-- Control inputs:
|
clk : in std_logic; --! Processor clock
|
clk : in std_logic; --! Processor clock
|
reset : in std_logic; --! Reset signal
|
reset : in std_logic; --! Reset signal
|
Line 73... |
Line 73... |
signal csr_read_data : std_logic_vector(31 downto 0);
|
signal csr_read_data : std_logic_vector(31 downto 0);
|
signal csr_read_writeable : boolean;
|
signal csr_read_writeable : boolean;
|
signal csr_read_address, csr_read_address_p : csr_address;
|
signal csr_read_address, csr_read_address_p : csr_address;
|
|
|
-- Status register outputs:
|
-- Status register outputs:
|
signal status : csr_status_register;
|
signal mtvec : std_logic_vector(31 downto 0);
|
signal evec : std_logic_vector(31 downto 0);
|
signal mie : std_logic_vector(31 downto 0);
|
|
signal ie, ie1 : std_logic;
|
|
|
|
-- Internal interrupt signals:
|
|
signal software_interrupt, timer_interrupt : std_logic;
|
|
|
-- Load hazard detected in the execute stage:
|
-- Load hazard detected in the execute stage:
|
signal load_hazard_detected : std_logic;
|
signal load_hazard_detected : std_logic;
|
|
|
-- Branch targets:
|
-- Branch targets:
|
Line 180... |
Line 184... |
PROCESSOR_ID => PROCESSOR_ID
|
PROCESSOR_ID => PROCESSOR_ID
|
) port map(
|
) port map(
|
clk => clk,
|
clk => clk,
|
reset => reset,
|
reset => reset,
|
timer_clk => timer_clk,
|
timer_clk => timer_clk,
|
|
irq => irq,
|
count_instruction => wb_count_instruction,
|
count_instruction => wb_count_instruction,
|
fromhost_data => fromhost_data,
|
fromhost_data => fromhost_data,
|
fromhost_updated => fromhost_write_en,
|
fromhost_updated => fromhost_write_en,
|
tohost_data => tohost_data,
|
tohost_data => tohost_data,
|
tohost_updated => tohost_write_en,
|
tohost_updated => tohost_write_en,
|
Line 193... |
Line 198... |
write_address => wb_csr_address,
|
write_address => wb_csr_address,
|
write_data_in => wb_csr_data,
|
write_data_in => wb_csr_data,
|
write_mode => wb_csr_write,
|
write_mode => wb_csr_write,
|
exception_context => wb_exception_context,
|
exception_context => wb_exception_context,
|
exception_context_write => wb_exception,
|
exception_context_write => wb_exception,
|
status_out => status,
|
mie_out => mie,
|
evec_out => evec
|
mtvec_out => mtvec,
|
|
ie_out => ie,
|
|
ie1_out => ie1,
|
|
software_interrupt_out => software_interrupt,
|
|
timer_interrupt_out => timer_interrupt
|
);
|
);
|
|
|
csr_read_address <= id_csr_address when stall_ex = '0' else csr_read_address_p;
|
csr_read_address <= id_csr_address when stall_ex = '0' else csr_read_address_p;
|
|
|
store_previous_csr_addr: process(clk, stall_ex)
|
store_previous_csr_addr: process(clk, stall_ex)
|
begin
|
begin
|
if rising_edge(clk) and stall_ex = '0' then
|
if rising_edge(clk) and stall_ex = '0' then
|
csr_read_address_p <= id_csr_address;
|
csr_read_address_p <= id_csr_address;
|
end if;
|
end if;
|
Line 297... |
Line 305... |
clk => clk,
|
clk => clk,
|
reset => reset,
|
reset => reset,
|
stall => stall_ex,
|
stall => stall_ex,
|
flush => flush_ex,
|
flush => flush_ex,
|
irq => irq,
|
irq => irq,
|
|
software_interrupt => software_interrupt,
|
|
timer_interrupt => timer_interrupt,
|
dmem_address => ex_dmem_address,
|
dmem_address => ex_dmem_address,
|
dmem_data_size => ex_dmem_data_size,
|
dmem_data_size => ex_dmem_data_size,
|
dmem_data_out => ex_dmem_data_out,
|
dmem_data_out => ex_dmem_data_out,
|
dmem_read_req => ex_dmem_read_req,
|
dmem_read_req => ex_dmem_read_req,
|
dmem_write_req => ex_dmem_write_req,
|
dmem_write_req => ex_dmem_write_req,
|
Line 335... |
Line 345... |
mem_op_out => ex_mem_op,
|
mem_op_out => ex_mem_op,
|
mem_size_in => id_mem_size,
|
mem_size_in => id_mem_size,
|
mem_size_out => ex_mem_size,
|
mem_size_out => ex_mem_size,
|
count_instruction_in => id_count_instruction,
|
count_instruction_in => id_count_instruction,
|
count_instruction_out => ex_count_instruction,
|
count_instruction_out => ex_count_instruction,
|
status_in => status,
|
ie_in => ie,
|
evec_in => evec,
|
ie1_in => ie1,
|
evec_out => exception_target,
|
mie_in => mie,
|
|
mtvec_in => mtvec,
|
|
mtvec_out => exception_target,
|
decode_exception_in => id_exception,
|
decode_exception_in => id_exception,
|
decode_exception_cause_in => id_exception_cause,
|
decode_exception_cause_in => id_exception_cause,
|
exception_out => exception_taken,
|
exception_out => exception_taken,
|
exception_context_out => ex_exception_context,
|
exception_context_out => ex_exception_context,
|
jump_out => branch_taken,
|
jump_out => branch_taken,
|