1 ------------------------------------------------------------
2 -- Combinational Logic Design
3 -- (ESD book figure 2.4)
4 -- by Weijun Zhang, 04/2001
6 -- A simple example of VHDL Structure Modeling
7 -- we might define two components in two separate files,
8 -- in main file, we use port map statement to instantiate
9 -- the mapping relationship between each components
10 -- and the entire circuit.
11 ------------------------------------------------------------
13 library ieee; -- component #1
14 use ieee.std_logic_1164.all;
17 port( X: in std_logic;
23 architecture behv of OR_GATE is
27 F2 <= X or Y; -- behavior des.
31 -------------------------------------------------------------
33 library ieee; -- component #2
34 use ieee.std_logic_1164.all;
37 port( A: in std_logic;
43 architecture behv of AND_GATE is
47 F1 <= A and B; -- behavior des.
51 --------------------------------------------------------------
53 library ieee; -- top level circuit
54 use ieee.std_logic_1164.all;
58 port( input1: in std_logic;
65 architecture struct of comb_ckt is
67 component AND_GATE is -- as entity of AND_GATE
68 port( A: in std_logic;
74 component OR_GATE is -- as entity of OR_GATE
75 port( X: in std_logic;
81 signal wire: std_logic; -- signal just like wire
85 -- use sign "=>" to clarify the pin mapping
87 Gate1: AND_GATE port map (A=>input1, B=>input2, F1=>wire);
88 Gate2: OR_GATE port map (X=>wire, Y=>input3, F2=>output);
92 ----------------------------------------------------------------