TA147

Ejecicios y trabajos prácticos de la materia Taller de Sistemas Digitales (TA147)
Index Commits Files Refs
vhdl/basics/wait/wait_tb.vhd (958B)
   1 entity wait_tb is
   2 end entity;
   3 
   4 architecture wait_arq of wait_tb is
   5 
   6     signal count_up:   integer := 0;
   7     signal count_down: integer := 10;
   8 
   9 begin
  10 
  11     process is
  12     begin
  13 
  14         count_up <= count_up + 1;
  15         count_down <= count_down - 1;
  16 
  17         wait for 10 ms;
  18 
  19         if count_down <= 0 then
  20             -- wait forever
  21             wait;
  22         end if;
  23 
  24     end process;
  25 
  26     process is
  27     begin
  28 
  29         -- waits until either `count_up` or `count_down` updates its value
  30         wait on count_up, count_down;
  31 
  32         report "[1] count_up: " & integer'image(count_up);
  33         report "[1] count_down: " & integer'image(count_down);
  34 
  35     end process;
  36 
  37     process is
  38     begin
  39 
  40         -- waits until `count_up` and `count_down` are equal
  41         wait until count_up = count_down;
  42 
  43         report "[2] count_up: " & integer'image(count_up);
  44         report "[2] count_down: " & integer'image(count_down);
  45 
  46     end process;
  47 
  48 end architecture;