signal cs0_xc_f_s : std_logic;
signal rd_f_s : std_logic; -- Filtered RD
signal i_rd_s : std_logic; -- Internal bus RD (active 1)
- -- signal next_i_rd_s : std_logic;
- signal last_i_rd_s : std_logic; -- Delayed RD bus, used for latching
signal next_last_i_rd_s : std_logic;
- signal i_rd_cycle2_s : std_logic; -- Some internal subsystems provide
- signal next_i_rd_cycle2_s : std_logic; -- data only after 2 cycles
+ signal last_i_rd_s : std_logic; -- Delayed RD bus, used for latching
--
signal address_f_s : std_logic_vector(15 downto 0); -- Filtered address
--
-- Bus update
memory_bus_logic:
- process(cs0_xc_f_s, rd_f_s, last_rd_s, i_rd_cycle2_s, last_i_rd_s,
+ process(cs0_xc_f_s, rd_f_s, last_rd_s, last_i_rd_s,
bls_f_s, last_bls_s, data_f_s, data_write_s,
data_o_s, data_read_s, last_address_s, address_f_s)
begin
-- Defaults
- next_i_rd_cycle2_s <= '0';
next_address_hold_s <= '0';
-- Check if we have chip select
-- Internal read
if last_rd_s = '0' or (last_address_s /= address_f_s) then
i_rd_s <= '1';
- next_i_rd_cycle2_s <= '1';
- next_last_i_rd_s <= '1';
- elsif i_rd_cycle2_s = '1' then -- FIXME it seems that some internal
- i_rd_s <= '1'; -- peripherals demands 2 cycles to read
next_last_i_rd_s <= '1';
else
- i_rd_s <= '0';
+ i_rd_s <= '0';
next_last_i_rd_s <= '0';
end if;
last_bls_s <= next_last_bls_s;
last_rd_s <= next_last_rd_s;
i_bls_s <= next_i_bls_s;
- -- i_rd_s <= next_i_rd_s;
- i_rd_cycle2_s <= next_i_rd_cycle2_s;
last_i_rd_s <= next_last_i_rd_s;
data_write_s <= next_data_write_s;
last_address_s <= next_last_address_s;
-- Do the actual wiring here
memory_bus_wiring:
- process(cs0_xc_f_s, i_bls_s, address_f_s, example_out_s, meas_out_s)
+ process(cs0_xc_f_s, i_bls_s, address_f_s, example_out_s, meas_out_s, i_rd_s, last_i_rd_s)
begin
-- Inactive by default
meas_ce_s <= '0';
data_o_s <= (others => '0');
- if cs0_xc_f_s = '1' or i_bls_s /= "0000" then
+ if i_rd_s = '1' or i_bls_s /= "0000" then
-- Memory Map (16-bit address @ 32-bit each)
if address_f_s < "0001000000000000" then -- Tumbl
example_ce_s <= '1';
- data_o_s <= example_out_s;
elsif address_f_s(15 downto 2) = "00011111111111" then -- Measurement
meas_ce_s <= '1';
- data_o_s <= meas_out_s;
end if;
end if;
+ if last_i_rd_s = '1' then
+ if address_f_s < "0001000000000000" then -- Tumbl
+ data_o_s <= example_out_s;
+ elsif address_f_s(15 downto 2) = "00011111111111" then -- Measurement
+ data_o_s <= meas_out_s;
+ end if;
+ end if;
+
end process;
-- If RD and BLS is not high, we must keep DATA at high impedance