aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/fsm03/ent.vhdl
blob: 46adc93d8d248a68a9697fa471faacf48193a7f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
library ieee;
use ieee.std_logic_1164.all;

entity ent is
  port (
   clk : std_logic;
   req : std_logic;
   val : std_logic;
   ack : out std_logic);
end ent;

architecture behav of ent is
  signal cnt : natural range 0 to 5;
begin
  process (clk)
  begin
    if rising_edge(clk) then
      if cnt < 5 then
        cnt <= cnt + 1;
      else
        cnt <= 0;
      end if;
      if req = '1' and cnt = 0 then
        ack <= '1';
      else
        ack <= '0';
      end if;
    end if;
  end process;
end behav;