aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/rec01/rec01.vhdl
blob: e5eb86048e686b74be2a7d1b16a70a9a347e78bd (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;
use work.rec01_pkg.all;

entity rec01 is
  port (inp : myrec;
        rst : std_logic;
        clk : std_logic;
        o : out std_logic);
end rec01;

architecture behav of rec01 is
  signal s : myrec;
begin
  process (clk) is
  begin
    if rising_edge (clk) then
      if rst = '1' then
        s <= (a => "0000", b => '0');
      else
        if inp.b = '1' then
          s <= (a => inp.a, b => '1');
        else
          s <= inp;
        end if;
      end if;
    end if;
  end process;
  
  o <= '1' when s.a (1) = s.b else '0';
end behav;