Skip to content
Snippets Groups Projects
Commit 60206e72 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra Committed by Tomasz Wlostowski
Browse files

It is now possible to much more clearly state how async and sync differ.


Signed-off-by: default avatarTomasz Wlostowski <tomasz.wlostowski@cern.ch>
parent 8ec84d06
No related merge requests found
...@@ -71,11 +71,11 @@ architecture rtl of xwb_crossbar is ...@@ -71,11 +71,11 @@ architecture rtl of xwb_crossbar is
signal master_oe : t_wishbone_master_out_array(g_num_slaves downto 0); signal master_oe : t_wishbone_master_out_array(g_num_slaves downto 0);
signal virtual_ERR : std_logic; signal virtual_ERR : std_logic;
-- synchronous signals: signal matrix_old : matrix; -- Registered connection matrix
signal previous : matrix; -- Previously connected pairs signal matrix_new : matrix; -- The new values of the matrix
-- (a)synchronous signals (depending on generic): -- Either matrix_old or matrix_new, depending on g_registered
signal granted : matrix; -- The connections to form this cycle selected previous bus signal granted : matrix;
procedure main_logic( procedure main_logic(
signal granted : out matrix; signal granted : out matrix;
...@@ -228,24 +228,21 @@ begin ...@@ -228,24 +228,21 @@ begin
virtual_ERR <= master_oe(g_num_slaves).CYC and master_oe(g_num_slaves).STB; virtual_ERR <= master_oe(g_num_slaves).CYC and master_oe(g_num_slaves).STB;
end if; end if;
end process virtual_error_slave; end process virtual_error_slave;
-- If async determine granted devices -- Copy the matrix to a register:
granted_matrix : if not g_registered generate main : process(clk_sys_i)
main_logic(granted, slave_i, previous); begin
end generate; if rising_edge(clk_sys_i) then
if rst_n_i = '0' then
granted_driver : if g_registered generate matrix_old <= (others => (others => '0'));
process(clk_sys_i) else
begin matrix_old <= matrix_new;
if rising_edge(clk_sys_i) then
if rst_n_i = '0' then
granted <= (others => (others => '0'));
else
main_logic(granted, slave_i, granted);
end if;
end if; end if;
end process; end if;
end generate; end process main;
-- Is the crossbar combinatorial or registered
granted <= matrix_old when g_registered else matrix_new;
-- Make the slave connections -- Make the slave connections
slave_matrix : for slave in g_num_slaves downto 0 generate slave_matrix : for slave in g_num_slaves downto 0 generate
...@@ -257,16 +254,6 @@ begin ...@@ -257,16 +254,6 @@ begin
master_logic(slave_o(master), master_ie, granted, master); master_logic(slave_o(master), master_ie, granted, master);
end generate; end generate;
-- Store the current grant to the previous registers -- The main crossbar logic:
main : process(clk_sys_i) main_logic(matrix_new, slave_i, matrix_old);
begin
if rising_edge(clk_sys_i) then
if rst_n_i = '0' then
previous <= (others => (others => '0'));
else
previous <= granted;
end if;
end if;
end process main;
end rtl; end rtl;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment