I have uart entity which have the following signals (I write only the relevant - for tx)

-- The output data: 8 bit - this is the UART receiver
-- Data is only valid during the time the STB is high
-- Acknowledge the data with a pulse on ACK, which is confirmed by
-- revoking STB.
-- When the following start bit is received the data becomes
-- invalid and the STB is revoked. So take care about fetching the
-- data early enough, or install your own FIFO buffer
DATA_STREAM_OUT     : out std_logic_vector(7 downto 0);
DATA_STREAM_OUT_STB : out std_logic;
DATA_STREAM_OUT_ACK : in  std_logic;
TX                  : out std_logic;

I have another block which its enable input should changed to high for only one clock when there is a change of the DATA_STREAM_OUT_ACK (high to low) plus delay of 50 clk cycles.

I guess I should derive DATA_STREAM_OUT_ACK, but I'm not sure hot to implement this, and also the delay (may be with counter).


1 Answer 1


This will do the function you asked about. You may have to adjust the '51' constant to get your precise timing.

  signal delayCtr       : natural range 0 to 51;

  Delayed : process(RST, CLK) is
    if (RST = '1') then
      delayCtr     <=   0 ;
      delayedEn    <=  '0';

    elsif rising_edge(clk) then

      if (data_stream_out_stb = '1') then
        delayCtr   <=  51;

      elsif (delayCtr > 0) then
        delayCtr   <=  delayCtr - 1;

      end if;

      if (delayCtr = 1) then
        delayedEn  <=  '1';
        delayedEn  <=  '0';
      end if;

    end if;
  end process Delayed;

You'll obviously have to wire it into the rest of your VHDL yourself, providing clock and reset. Otherwise we'll have an eternal comment exchange. But it shows the operating principle of the solution.

  • \$\begingroup\$ I wouldn't recommend an asynchronous reset. I would also not recommend aligning assignments like this: It is a lot of work to maintain. \$\endgroup\$
    – JHBonarius
    Commented Apr 4, 2017 at 14:31
  • 1
    \$\begingroup\$ @J.H.Bonarius, I don't understand the hard-to-maintain bit, and happen to disagree, but that would start a long discussion that we could do in Chat but not in comments :-) Feel free to contact me. But it's all beside the point here, as the answer was to show the principle, as stated in it. \$\endgroup\$
    – TonyM
    Commented Apr 4, 2017 at 14:46
  • \$\begingroup\$ Does this want to be retriggerable? (Do you want a digital delay line instead?) \$\endgroup\$
    – user8352
    Commented Apr 4, 2017 at 20:39
  • \$\begingroup\$ @user8352, me...don't mind, really...try asking the OP? \$\endgroup\$
    – TonyM
    Commented Apr 4, 2017 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.