-- Internal memory signals
signal imem_en_s : std_logic;
+ signal imem_en_r : std_logic;
signal dmem_en_s : std_logic;
+ signal dmem_en_r : std_logic;
signal imem_we_s : std_logic_vector(3 downto 0);
signal dmem_we_s : std_logic_vector(3 downto 0);
signal imem_data_o_s : std_logic_vector(31 downto 0);
signal dmem_data_o_s : std_logic_vector(31 downto 0);
+ -- Control registers read access
+ signal tumbl_reg_en_control_r : std_logic;
+ signal tumbl_reg_en_pc_r : std_logic;
+ signal tumbl_reg_en_halt_code_r : std_logic;
+
-- Internal bus structure
-- 12 address bits: 2 bits for selection, 10 bits for address
--
-- Wiring
wiring:
process(ce_i, bls_i, address_i, imem_en_s, imem_data_o_s, dmem_en_s,
- dmem_data_o_s, tumbl_reset_s, tumbl_input_s, tumbl_state_s)
+ dmem_data_o_s, tumbl_reset_s, tumbl_input_s, tumbl_state_s,
+ imem_en_r, dmem_en_r, tumbl_reg_en_control_r, tumbl_reg_en_pc_r,
+ tumbl_reg_en_halt_code_r)
begin
if imem_en_s = '1' then
dmem_we_s <= "0000";
end if;
- if imem_en_s = '1' then
+ if imem_en_r = '1' then
data_o <= imem_data_o_s;
- elsif dmem_en_s = '1' then
+ elsif dmem_en_r = '1' then
data_o <= dmem_data_o_s;
- elsif ce_i = '1' and address_i(11 downto 10) = "11" then
- if address_i(9 downto 0) = "0000000000" then
- data_o(0) <= tumbl_reset_s;
- data_o(1) <= tumbl_input_s.int;
- data_o(2) <= tumbl_input_s.halt;
- data_o(3) <= tumbl_input_s.trace;
- data_o(4) <= tumbl_state_s.halted;
- data_o(31 downto 5) <= (others => '0');
- elsif address_i(9 downto 0) = "0000000010" then
- data_o <= tumbl_state_s.pc;
- elsif address_i(9 downto 0) = "0000000011" then
- data_o(4 downto 0) <= tumbl_state_s.halt_code;
- data_o(31 downto 5) <= (others => '0');
- else
- data_o <= (others => 'X');
- end if;
+ elsif tumbl_reg_en_control_r = '1' then
+ data_o(0) <= tumbl_reset_s;
+ data_o(1) <= tumbl_input_s.int;
+ data_o(2) <= tumbl_input_s.halt;
+ data_o(3) <= tumbl_input_s.trace;
+ data_o(4) <= tumbl_state_s.halted;
+ data_o(31 downto 5) <= (others => '0');
+ elsif tumbl_reg_en_pc_r = '1' then
+ data_o <= tumbl_state_s.pc;
+ elsif tumbl_reg_en_halt_code_r = '1' then
+ data_o(4 downto 0) <= tumbl_state_s.halt_code;
+ data_o(31 downto 5) <= (others => '0');
else
data_o <= (others => 'X');
end if;
-- Update
wait until clk_i'event and clk_i = '1';
+ imem_en_r <= imem_en_s;
+ dmem_en_r <= dmem_en_s;
+
+ tumbl_reg_en_control_r <= '0';
+ tumbl_reg_en_pc_r <= '0';
+ tumbl_reg_en_halt_code_r <= '0';
+
tumbl_input_s.trace_kick <= '0';
if reset_i = '1' then
end if;
end if;
end if;
+
+
+ if address_i(9 downto 0) = "0000000000" then
+ tumbl_reg_en_control_r <= '1';
+ elsif address_i(9 downto 0) = "0000000010" then
+ tumbl_reg_en_pc_r <= '1';
+ elsif address_i(9 downto 0) = "0000000011" then
+ tumbl_reg_en_halt_code_r <= '1';
+ end if;
end if;
end if;