Line 99... |
Line 99... |
signal int_dmem_acc, int_dmem_acc_real : std_ulogic;
|
signal int_dmem_acc, int_dmem_acc_real : std_ulogic;
|
signal int_boot_acc : std_ulogic;
|
signal int_boot_acc : std_ulogic;
|
signal wb_access : std_ulogic;
|
signal wb_access : std_ulogic;
|
|
|
-- bus arbiter
|
-- bus arbiter
|
type ctrl_state_t is (IDLE, BUSY, CANCELED);
|
type ctrl_state_t is (IDLE, BUSY, CANCELED, RESYNC);
|
type ctrl_t is record
|
type ctrl_t is record
|
state : ctrl_state_t;
|
state : ctrl_state_t;
|
state_prev : ctrl_state_t;
|
state_prev : ctrl_state_t;
|
we : std_ulogic;
|
we : std_ulogic;
|
rd_req : std_ulogic;
|
rd_req : std_ulogic;
|
Line 202... |
Line 202... |
elsif (wb_ack_i = '1') then -- normal bus termination
|
elsif (wb_ack_i = '1') then -- normal bus termination
|
ctrl.ack <= '1';
|
ctrl.ack <= '1';
|
ctrl.state <= IDLE;
|
ctrl.state <= IDLE;
|
end if;
|
end if;
|
|
|
when CANCELED => --
|
when CANCELED => -- wait for cycle to be completed either by peripheral or by timeout (ignore result of transfer)
|
-- ------------------------------------------------------------
|
-- ------------------------------------------------------------
|
ctrl.wr_req <= ctrl.wr_req or wren_i; -- buffer new request
|
ctrl.wr_req <= ctrl.wr_req or wren_i; -- buffer new request
|
ctrl.rd_req <= ctrl.rd_req or rden_i; -- buffer new request
|
ctrl.rd_req <= ctrl.rd_req or rden_i; -- buffer new request
|
-- wait for bus.peripheral to ACK transfer (as "aborted" but still somehow "completed")
|
-- wait for bus.peripheral to ACK transfer (as "aborted" but still somehow "completed")
|
-- or wait for a timeout and force termination
|
-- or wait for a timeout and force termination
|
ctrl.timeout <= std_ulogic_vector(unsigned(ctrl.timeout) - 1); -- timeout counter
|
ctrl.timeout <= std_ulogic_vector(unsigned(ctrl.timeout) - 1); -- timeout counter
|
if (wb_ack_i = '1') or (or_all_f(ctrl.timeout) = '0') then
|
if (wb_ack_i = '1') or (or_all_f(ctrl.timeout) = '0') then
|
|
ctrl.state <= RESYNC;
|
|
end if;
|
|
|
|
when RESYNC => -- make sure transfer is done!
|
|
-- ------------------------------------------------------------
|
|
if (wb_ack_i = '0') then
|
ctrl.state <= IDLE;
|
ctrl.state <= IDLE;
|
end if;
|
end if;
|
|
|
when others => -- undefined
|
when others => -- undefined
|
-- ------------------------------------------------------------
|
-- ------------------------------------------------------------
|
Line 239... |
Line 245... |
wb_sel_o <= ctrl.sel;
|
wb_sel_o <= ctrl.sel;
|
wb_stb_o <= stb_int when (WB_PIPELINED_MODE = true) else cyc_int;
|
wb_stb_o <= stb_int when (WB_PIPELINED_MODE = true) else cyc_int;
|
wb_cyc_o <= cyc_int;
|
wb_cyc_o <= cyc_int;
|
|
|
stb_int <= '1' when ((ctrl.state = BUSY) and (ctrl.state_prev = IDLE)) else '0';
|
stb_int <= '1' when ((ctrl.state = BUSY) and (ctrl.state_prev = IDLE)) else '0';
|
cyc_int <= '0' when (ctrl.state = IDLE) else '1';
|
cyc_int <= '0' when ((ctrl.state = IDLE) or (ctrl.state = RESYNC)) else '1';
|
|
|
|
|
end neorv32_wishbone_rtl;
|
end neorv32_wishbone_rtl;
|
|
|
No newline at end of file
|
No newline at end of file
|