aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/bug0104/alt.vhdl
blob: bbdee9bb16d5218b039547781248a9bca89882ee (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
library ieee;
use ieee.std_logic_1164.all;

entity delay is
    port (
        clk : in std_logic;
        reset: in std_logic;
        start: in std_logic;
        done: out std_logic
    );
end entity delay;

architecture fast of delay is   -- The reader is unenlightened as to fast/slow
begin
end architecture fast;

architecture slow of delay is
begin
end architecture slow;

library ieee;
use ieee.std_logic_1164.all;

entity dut is
    generic (
         SPEED : string := "fast"
     );
    port(
        clk : in std_logic;
        reset: in std_logic;
        start: in std_logic;
        done:  out std_logic);
    end entity dut;

architecture dutarch of dut is

    -- component delay is   -- component declaration not needed or used here.
    --     port (
    --         clk : in std_logic;
    --         reset: in std_logic;
    --         start: in std_logic;
    --         done: out std_logic
    --     );
    -- end component delay;
    begin
d1g: 
    if SPEED = "fast" generate
d1: -- The alternative labels, if any, within an if generate statement or a 
    -- case generate statement shall all be distinct. 11.8 Generate statements
        entity work.delay(fast)
           port map (
                clk     => clk,
                reset   => reset,
                start   => start,
                done => done
            );
    else generate
d1: -- This isn't a distinct label in the else alternative
            entity work.delay(slow)
            port map (
                clk     => clk,
                reset   => reset,
                start   => start,
                done => done
            );
    end generate;
end architecture dutarch;