Skip to content

Commit

Permalink
Merge branch 'isa_calypte_tx_ver_stop_seq' into 'devel'
Browse files Browse the repository at this point in the history
fix(RX DMA Calypte-VER): remove copy sw pointer from hw pointer when driver is shuttingdown channel

See merge request ndk/ndk-fpga!130
  • Loading branch information
radek-isa committed Jan 31, 2025
2 parents 201a169 + 903299e commit 6db623c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ port (

STOP_REQ_CHAN : out std_logic_vector(log2(CHANNELS)-1 downto 0);
STOP_REQ_VLD : out std_logic;
STOP_REQ_ACK : in std_logic;
STOP_REQ_ACK : in std_logic; --logic request one CLK delay between VLD request and ACK reponse

-- general vector of all channels with their activity
ENABLED_CHAN : out std_logic_vector(CHANNELS-1 downto 0);
Expand Down Expand Up @@ -594,7 +594,7 @@ architecture FULL of TX_DMA_SW_MANAGER is
-- =====================================================================
-- Stop request logic
-- =====================================================================
type stop_fsm_type is (IDLE, WAIT_FOR_REQ_ACK, WAIT_FOR_POINTERS);
type stop_fsm_type is (IDLE, WAIT_FOR_REQ_ACK, DELAY_FOR_DSP_1, DELAY_FOR_DSP_2, WAIT_FOR_POINTERS, WAIT_FOR_STATUS_UPDATE);
signal stop_fsm_pst : stop_fsm_type;
signal stop_fsm_nst : stop_fsm_type;

Expand Down Expand Up @@ -1115,23 +1115,37 @@ begin
when IDLE =>

if (reg_dob_opt(R_CONTROL)(1)(0) = '0' and reg_dob_opt(R_STATUS)(1)(0) = '1') then
stop_fsm_nst <= WAIT_FOR_REQ_ACK;
stop_fsm_nst <= DELAY_FOR_DSP_1;
stop_fsm_channel <= active_chan_reg;
STOP_REQ_CHAN <= active_chan_reg;
end if;


when DELAY_FOR_DSP_1 =>

stop_fsm_nst <= DELAY_FOR_DSP_2;

when DELAY_FOR_DSP_2 =>

stop_fsm_nst <= WAIT_FOR_POINTERS;

when WAIT_FOR_POINTERS =>

if (stop_chan_ok = '1' and stop_ptr_ok = '1') then
stop_fsm_nst <= WAIT_FOR_REQ_ACK;
STOP_REQ_VLD <= '1';
end if;

-- wait till Channel core acknowledges the stopping of the channel
when WAIT_FOR_REQ_ACK =>

if (STOP_REQ_ACK = '1') then
stop_fsm_nst <= WAIT_FOR_POINTERS;
stop_fsm_nst <= WAIT_FOR_STATUS_UPDATE;
end if;

when WAIT_FOR_POINTERS =>
when WAIT_FOR_STATUS_UPDATE =>

if (stop_chan_ok = '1' and stop_ptr_ok = '1') then
stop_fsm_nst <= IDLE;
if (stop_chan_ok = '1') then
stop_fsm_nst <= IDLE;
stop_acked <= '1';
enabled_chan_rst(to_integer(unsigned(stop_fsm_channel_reg))) <= '1';
end if;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ class stop_channel_seq extends uvm_sequence;
m_regmodel_channel.control_reg.write(status, 32'h0, .parent(this));

do begin
m_regmodel_channel.hw_data_pointer_reg.read (status, data, .parent(this));
m_regmodel_channel.sw_data_pointer_reg.write(status, data, .parent(this));
m_regmodel_channel.hw_hdr_pointer_reg .read (status, data, .parent(this));
m_regmodel_channel.sw_hdr_pointer_reg .write(status, data, .parent(this));

#(500ns);

m_regmodel_channel.sw_data_pointer_reg.read(status, data, .parent(this));
Expand All @@ -85,7 +80,7 @@ class stop_channel_seq extends uvm_sequence;
stop_attempts++;

assert (stop_attempts < 500) else
`uvm_warning(this.get_type_name(), "\n\nThe stop of a channel takes suspiciously long time!\n")
`uvm_warning(m_regmodel_channel.get_full_name(), $sformatf("\nThe stop of a channel takes suspiciously long time!\n\tDATA SW(%0d) HW(%0d)\n\tHDR SW(%0d) HW(%0d)\n\tSTATUS %0d\n-----------------------\n", sw_data, hw_data, sw_hdr, hw_hdr, (data & 32'h1)));

end while (sw_data != hw_data || sw_hdr != hw_hdr || (data & 32'h1) != 0);
endtask
Expand Down

0 comments on commit 6db623c

Please sign in to comment.