The definition of a design in GM VHDL requires two parts, an entity and an architecture. The entity declaration describes the inputs and outputs of the design. The description of the inputs and outputs is called the interface and is analogous to a pin list you might find in a data book. The architecture declaration actually describes the operation of the design.
We begin the design of the half adder with the entity declaration that defines the interface to the half adder. The entity declaration is
entity half_adder is
port (a,b : in bit;
s,c : out bit);
end half_adder;
Now we need to declare an architecture that describes the operation of the half adder. The declaration for the half adder is
architecture structure of half_adder is
component and
port (x,y : in bit; z : out bit);
end component;
component xor
port (x,y : in bit; z : out bit);
end component;
begin
sum: xor
port map (a,b,s);
carry: and
port map (a,b,c);
end structure;
The BEGIN statement marks the end of the declarative region and the beginning of the architecture body. The architecture body contains the actual description of the operation of the design. The architecture body in this example contains two component instantiation statements. In the TTL analogy a component instantiation corresponds to actually buying a TTL part (an instance) and placing it on the bread board. The first line of the instantiation defines a name for the instance being instantiated and the name of the part begin instantiated. The second line of the instantiation corresponds to the wiring process in the TTL analogy. The port map defines how signals should be mapped (connected) to the inputs and outputs of the part being instantiated. The port map of sum, maps the inputs of the half adder to the inputs of the xor gate and the output of the gate to the sum output of the half adder. The port map of carry, maps the inputs of the half adder to the inputs of the and gate and the outputs of the gate to the carry output of the half adder.