Commit 5ba77508 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

HDL: fd_spi_dac_arbiter.vhd: fixed missing readouts

parent 6b580f28
...@@ -111,6 +111,7 @@ begin -- behavioral ...@@ -111,6 +111,7 @@ begin -- behavioral
end if; end if;
end process; end process;
p_rq_host : process(clk_sys_i) p_rq_host : process(clk_sys_i)
begin begin
if rising_edge(clk_sys_i) then if rising_edge(clk_sys_i) then
...@@ -120,26 +121,22 @@ begin -- behavioral ...@@ -120,26 +121,22 @@ begin -- behavioral
rq_host.sel_dac <= '0'; rq_host.sel_dac <= '0';
rq_host.sel_pll <= '0'; rq_host.sel_pll <= '0';
rq_host.sel_gpio <= '0'; rq_host.sel_gpio <= '0';
regs_o.scr_ready_i <= '1'; regs_o.scr_ready_i <= '1';
regs_o.scr_data_i <= (others => '0');
else else
if(regs_i.scr_start_o = '1' and rq_host.pending = '0') then if(regs_i.scr_start_o = '1' and rq_host.pending = '0') then
rq_host.pending <= '1'; rq_host.pending <= '1';
rq_host.data <= scr_data_in; rq_host.data <= scr_data_in;
rq_host.sel_pll <= regs_i.scr_sel_pll_o; rq_host.sel_pll <= regs_i.scr_sel_pll_o;
rq_host.sel_dac <= regs_i.scr_sel_dac_o; rq_host.sel_dac <= regs_i.scr_sel_dac_o;
rq_host.sel_gpio <= regs_i.scr_sel_gpio_o; rq_host.sel_gpio <= regs_i.scr_sel_gpio_o;
regs_o.scr_ready_i <= '0'; regs_o.scr_ready_i <= '0';
regs_o.scr_data_i <= (others => '0'); elsif(rq_host.done = '1') then
regs_o.scr_ready_i <= '1';
elsif(rq_host.done = '1') then rq_host.pending <= '0';
regs_o.scr_ready_i <= '1'; end if;
regs_o.scr_data_i <= s_data_out; end if;
rq_host.pending <= '0'; end if;
end if;
end if;
end if;
end process; end process;
rq_pll.sel_gpio <= '0'; rq_pll.sel_gpio <= '0';
...@@ -148,88 +145,93 @@ begin -- behavioral ...@@ -148,88 +145,93 @@ begin -- behavioral
p_rq_pll : process(clk_sys_i) p_rq_pll : process(clk_sys_i)
begin begin
if rising_edge(clk_sys_i) then if rising_edge(clk_sys_i) then
if rst_n_i = '0' then if rst_n_i = '0' then
rq_pll.pending <= '0'; rq_pll.pending <= '0';
rq_pll.data <= (others => '0'); rq_pll.data <= (others => '0');
else else
if(tm_dac_wr_i = '1' and rq_pll.pending = '0') then if(tm_dac_wr_i = '1' and rq_pll.pending = '0') then
rq_pll.pending <= '1'; rq_pll.pending <= '1';
rq_pll.data <= tm_dac_value_i(23 downto 0); rq_pll.data <= tm_dac_value_i(23 downto 0);
elsif(rq_pll.done = '1') then elsif(rq_pll.done = '1') then
rq_pll.pending <= '0'; rq_pll.pending <= '0';
end if; end if;
end if; end if;
end if; end if;
end process; end process;
p_grant : process(prev_rq, rq_pll, rq_host) p_grant : process(prev_rq, rq_pll, rq_host)
begin begin
if(rq_pll.pending = '1' and rq_host.pending = '0') then if(rq_pll.pending = '1' and rq_host.pending = '0') then
rq_pll.grant <= '1' and not rq_pll.done; rq_pll.grant <= '1' and not rq_pll.done;
rq_host.grant <= '0'; rq_host.grant <= '0';
elsif (rq_pll.pending = '0' and rq_host.pending = '1') then elsif (rq_pll.pending = '0' and rq_host.pending = '1') then
rq_pll.grant <= '0'; rq_pll.grant <= '0';
rq_host.grant <= '1' and not rq_host.done; rq_host.grant <= '1' and not rq_host.done;
elsif (rq_pll.pending = '1' and rq_host.pending = '1') then elsif (rq_pll.pending = '1' and rq_host.pending = '1') then
rq_pll.grant <= prev_rq and not rq_pll.done; rq_pll.grant <= prev_rq and not rq_pll.done;
rq_host.grant <= not prev_rq and not rq_host.done; rq_host.grant <= not prev_rq and not rq_host.done;
else else
rq_pll.grant <= '0'; rq_pll.grant <= '0';
rq_host.grant <= '0'; rq_host.grant <= '0';
end if; end if;
end process; end process;
p_arbitrate : process(clk_sys_i) p_arbitrate : process(clk_sys_i)
begin begin
if rising_edge(clk_sys_i) then if rising_edge(clk_sys_i) then
if rst_n_i = '0' then if rst_n_i = '0' then
state <= WAIT_RQ; state <= WAIT_RQ;
s_start <= '0'; s_start <= '0';
s_data_in <= (others => '0'); s_data_in <= (others => '0');
s_sel_gpio <= '0'; s_sel_gpio <= '0';
s_sel_pll <= '0'; s_sel_pll <= '0';
s_sel_dac <= '0'; s_sel_dac <= '0';
else regs_o.scr_data_i <= (others => '0');
case state is
when WAIT_RQ => else
rq_pll.done <= '0'; case state is
rq_host.done <= '0'; when WAIT_RQ =>
rq_pll.done <= '0';
rq_pll.granted <= rq_pll.grant; rq_host.done <= '0';
rq_host.granted <= rq_host.grant;
rq_pll.granted <= rq_pll.grant;
rq_host.granted <= rq_host.grant;
if(rq_pll.grant = '1')then
prev_rq <= '0';
s_start <= '1'; if(rq_pll.grant = '1')then
s_data_in <= rq_pll.data; prev_rq <= '0';
s_sel_dac <= rq_pll.sel_dac; s_start <= '1';
s_sel_pll <= rq_pll.sel_pll; s_data_in <= rq_pll.data;
s_sel_gpio <= rq_pll.sel_gpio; s_sel_dac <= rq_pll.sel_dac;
state <= SERVE_RQ; s_sel_pll <= rq_pll.sel_pll;
elsif(rq_host.grant = '1') then s_sel_gpio <= rq_pll.sel_gpio;
prev_rq <= '1'; state <= SERVE_RQ;
s_start <= '1'; elsif(rq_host.grant = '1') then
s_data_in <= rq_host.data; prev_rq <= '1';
s_sel_dac <= rq_host.sel_dac; s_start <= '1';
s_sel_pll <= rq_host.sel_pll; s_data_in <= rq_host.data;
s_sel_gpio <= rq_host.sel_gpio; s_sel_dac <= rq_host.sel_dac;
state <= SERVE_RQ; s_sel_pll <= rq_host.sel_pll;
end if; s_sel_gpio <= rq_host.sel_gpio;
state <= SERVE_RQ;
when SERVE_RQ => end if;
if(s_ready = '1' and s_start = '0') then when SERVE_RQ =>
state <= WAIT_RQ;
rq_host.done <= rq_host.granted; if(s_ready = '1' and s_start = '0') then
rq_pll.done <= rq_pll.granted; state <= WAIT_RQ;
end if; rq_host.done <= rq_host.granted;
s_start <= '0'; rq_pll.done <= rq_pll.granted;
if(rq_host.granted = '1') then
end case; regs_o.scr_data_i <= s_data_out;
end if; end if;
end if;
s_start <= '0';
end case;
end if;
end if; end if;
end process; end process;
......
Markdown is supported
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