OTWO-1213 Works around lost encoding in Ruby/C binding layer
[ohcount] / test / expected_dir / vhdl1.vhd
1 vhdl    comment ------------------------------------------------------------
2 vhdl    comment -- Combinational Logic Design
3 vhdl    comment -- (ESD book figure 2.4)
4 vhdl    comment -- by Weijun Zhang, 04/2001
5 vhdl    comment --
6 vhdl    comment -- A simple example of VHDL Structure Modeling
7 vhdl    comment -- we might define two components in two separate files,
8 vhdl    comment -- in main file, we use port map statement to instantiate
9 vhdl    comment -- the mapping relationship between each components
10 vhdl    comment -- and the entire circuit.
11 vhdl    comment ------------------------------------------------------------
12 vhdl    blank   
13 vhdl    code    library ieee;                           -- component #1
14 vhdl    code    use ieee.std_logic_1164.all;
15 vhdl    blank   
16 vhdl    code    entity OR_GATE is
17 vhdl    code    port(   X:      in std_logic;
18 vhdl    code            Y:      in std_logic;
19 vhdl    code            F2:     out std_logic
20 vhdl    code    );
21 vhdl    code    end OR_GATE;
22 vhdl    blank   
23 vhdl    code    architecture behv of OR_GATE is
24 vhdl    code    begin
25 vhdl    code    process(X,Y)
26 vhdl    code    begin
27 vhdl    code            F2 <= X or Y;                   -- behavior des.
28 vhdl    code    end process;
29 vhdl    code    end behv;
30 vhdl    blank   
31 vhdl    comment -------------------------------------------------------------
32 vhdl    blank   
33 vhdl    code    library ieee;                           -- component #2
34 vhdl    code    use ieee.std_logic_1164.all;
35 vhdl    blank   
36 vhdl    code    entity AND_GATE is
37 vhdl    code    port(   A:      in std_logic;
38 vhdl    code            B:      in std_logic;
39 vhdl    code            F1:     out std_logic
40 vhdl    code    );
41 vhdl    code    end AND_GATE;
42 vhdl    blank   
43 vhdl    code    architecture behv of AND_GATE is
44 vhdl    code    begin
45 vhdl    code    process(A,B)
46 vhdl    code    begin
47 vhdl    code            F1 <= A and B;                  -- behavior des.
48 vhdl    code    end process;
49 vhdl    code    end behv;
50 vhdl    blank   
51 vhdl    comment --------------------------------------------------------------
52 vhdl    blank   
53 vhdl    code    library ieee;                           -- top level circuit
54 vhdl    code    use ieee.std_logic_1164.all;
55 vhdl    code    use work.all;
56 vhdl    blank   
57 vhdl    code    entity comb_ckt is
58 vhdl    code    port(   input1: in std_logic;
59 vhdl    code            input2: in std_logic;
60 vhdl    code            input3: in std_logic;
61 vhdl    code            output: out std_logic
62 vhdl    code    );
63 vhdl    code    end comb_ckt;
64 vhdl    blank   
65 vhdl    code    architecture struct of comb_ckt is
66 vhdl    blank   
67 vhdl    code        component AND_GATE is               -- as entity of AND_GATE
68 vhdl    code        port(   A:  in std_logic;
69 vhdl    code                B:  in std_logic;
70 vhdl    code                F1: out std_logic
71 vhdl    code        );
72 vhdl    code        end component;
73 vhdl    blank   
74 vhdl    code        component OR_GATE is                -- as entity of OR_GATE
75 vhdl    code        port(   X:  in std_logic;
76 vhdl    code                Y:  in std_logic;
77 vhdl    code                F2: out std_logic
78 vhdl    code        );
79 vhdl    code        end component;
80 vhdl    blank   
81 vhdl    code        signal wire: std_logic;             -- signal just like wire
82 vhdl    blank   
83 vhdl    code    begin
84 vhdl    blank   
85 vhdl    comment     -- use sign "=>" to clarify the pin mapping
86 vhdl    blank   
87 vhdl    code        Gate1: AND_GATE port map (A=>input1, B=>input2, F1=>wire);
88 vhdl    code        Gate2: OR_GATE port map (X=>wire, Y=>input3, F2=>output);
89 vhdl    blank   
90 vhdl    code    end struct;
91 vhdl    blank   
92 vhdl    comment ----------------------------------------------------------------