[Basic VHDL] Wait Statements

Wait statement is one of the useful statements in VHDL. we can use it for either synthesizable or non-synthesizable code. Below are 3 main syntax for wait statement:

+ wait until condition
 For example: wait until i_clk_sl'event and i_clk_sl = '1';


+ wait on sensitivity list
 For example: wait on i_clk_sl;

+ wait for time expression 
For example: wait for 10 ns


 One thing we need to keep in mind is that: Process cannot have both a wait statement and a sensitivity list.

In the third wait statement, if we don't have a specific time, then the process will wait there forever. And, this wait statement cannot be synthesizable.

Example Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity wait_cmd_test is
 port(
  i_input_sl: in std_logic;
  i_clk_sl: in std_logic;
  o_output_sl: out std_logic
 );
end wait_cmd_test;

architecture Behavioral of wait_cmd_test is

begin
 PRO_WAIT_TEST: process is
 begin
  wait until i_clk_sl'event and i_clk_sl = '1';
   
  o_output_sl <= i_clk_sl;

 end process PRO_WAIT_TEST;
end Behavioral;

1 comment:

  1. Wait trong VHDL.

    Có 3 câu lệnh wait chính trong VHDL.

    Wait until condition: chờ cho đến khi condition được thỏa mãn

    Wait on sensitive list: chờ cho đến khi một trong các signal trong danh sách thay đổi

    wait for time: chờ trong 1 khoảng thời gian xác định

    nếu không xác định thời gian, thì sẽ chờ mãi mãi( syntax: wait )

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...