It is easier to think that you are designing a black box when you are writing any VHDL code. This black box has inputs and outputs and something in between. This black boxes are called entity.
And the optimized architecture can be written as,
So far we have only seen how to write input and output ports. We only learned to think the entity as a blackbox where the input and output ports are coming out of the box. But what happens when we have to write some ports or wires inside the blackbox. For example, consider the following circuit. The final output is (A or B) and C. It is possible to write the whole thing in a single sentence. But we might have a complex design where its not possible. We have to breakdown the entire operation then. In this case, lets say, we want to break down (A or B) and C into (A or B) first and then use the output to AND with C. This is where we introduce the concept of signals.
The VHDL code of this circuit is written here. The signal here is AB that works as an intermediate signal inside the blackbox. We have to declare the signal after architecture and before begin.
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use ieee.numeric_std.all;
entity signal_example is
port (A, B, C: in STD_LOGIC;
D : out STD_LOGIC);
end signal_example;
architecture signal_example_arc of signal_example is
signal AB: STD_LOGIC;
begin
AB <= A or B;
D <= AB and C;
end signal_example_arc;