From 6acfb6a7007cc2be81ebb8e4a69eadb3cc1cdafe Mon Sep 17 00:00:00 2001 From: Rey Tucker Date: Fri, 12 Jan 2018 17:32:11 -0500 Subject: [PATCH] hdl: fifo_reader: add flow control for FIFO reads Adds a fifo_holdoff port that, when asserted, will pause the flow of fifo_reads until de-asserted. --- hdl/fpga/ip/nuand/synthesis/fifo_reader.vhd | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/hdl/fpga/ip/nuand/synthesis/fifo_reader.vhd b/hdl/fpga/ip/nuand/synthesis/fifo_reader.vhd index a60796a3..59ab5ec9 100644 --- a/hdl/fpga/ip/nuand/synthesis/fifo_reader.vhd +++ b/hdl/fpga/ip/nuand/synthesis/fifo_reader.vhd @@ -47,6 +47,7 @@ entity fifo_reader is fifo_read : buffer std_logic := '0'; fifo_empty : in std_logic; fifo_data : in std_logic_vector(FIFO_DATA_WIDTH-1 downto 0); + fifo_holdoff : in std_logic := '0'; meta_fifo_usedw : in std_logic_vector(META_FIFO_USEDW_WIDTH-1 downto 0); meta_fifo_read : buffer std_logic := '0'; @@ -99,7 +100,8 @@ architecture simple of fifo_reader is COMPUTE_ENABLED_CHANNELS, COMPUTE_OFFSETS, READ_SAMPLES, - READ_THROTTLE + READ_THROTTLE, + READ_HOLDOFF ); type ch_offsets_t is array( natural range <> ) of natural range fifo_data'low to fifo_data'high; @@ -370,8 +372,12 @@ begin fifo_future.downcount <= FIFO_FSM_RESET_VALUE.downcount; - if( fifo_empty = '0' and - (meta_en = '0' or (meta_en = '1' and meta_current.meta_time_go = '1')) ) then + if( fifo_holdoff = '1' ) then + -- Pause for a spell + fifo_future.state <= READ_HOLDOFF; + + elsif( fifo_empty = '0' and + (meta_en = '0' or (meta_en = '1' and meta_current.meta_time_go = '1')) ) then -- Check for valid data request read_req := '0'; @@ -411,6 +417,12 @@ begin fifo_future.downcount <= fifo_current.downcount - 1; end if; + when READ_HOLDOFF => + + if( fifo_holdoff = '0' ) then + fifo_future.state <= READ_SAMPLES; + end if; + when others => fifo_future.state <= FIFO_FSM_RESET_VALUE.state;