aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue382/demo.vhd
blob: b52712777c8a55a203ad1f57f188f274017b7b2e (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
32
33
34
35
36
37
38
39
40
41
42
43
44
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;

entity demo is
        port (
                clk,reset: in std_logic;
                load:   in std_logic;
                load_val: in unsigned(7 downto 0);
                qout: out unsigned(7 downto 0);
                is5: out std_logic
                );
end entity;

architecture v1 of demo is
        signal q: unsigned(7 downto 0); 
begin
        qout<=q;

--        is5<='1' when q=x"05" else '0';
        
        process(clk, reset)
        begin
                if reset='1' then
                        q<=(others=>'0');
                        is5<='0';
                elsif rising_edge(clk) then
                        is5<='0';
                        
                        if q=x"04" then
                                is5<='1';
                        end if;

                        if load='1' then
                                q<=load_val;
                                if load_val=x"05" then
                                        is5<='1';
                                end if;
                        else
                                q<=q+1;
                        end if;
                end if;
        end process;
end v1;