Академический Документы
Профессиональный Документы
Культура Документы
Structural Architecture
ENG2410
Week #5
VHDL Design Styles
VHDL Design
Styles
behavioral
dataflow structural
(algorithmic)
Concurrent Components and Sequential statements
statements interconnects • Registers
• State machines
• Test benches
Specifications:
o Input: 2 vectors A(3:0) and B(3:0)
o Output: One bit, E, which is 1 if A and B are
bitwise equal, 0 otherwise
3
Design
4
Design for MX module
Ai Bi Ei
0 0 0
Define the output of the circuit to be:
0 1 1
• `0’ if both inputs are similar and 1 0 1
• `1’ if they are different? 1 1 0
Logic function is Ei = Ai Bi + Ai Bi
Can implement as
5
Design for ME module
Final E is 1 only if all intermediate values are 0
So
E = E0 + E1 + E2 + E3
And a design is
6
Overall Design
E = E0 + E1 + E2 + E3
7
Overall Design
8
MX Module: Data Flow
ND_1
Bi_n
Interface
entity mx_module is
port (
Ai, Bi: in std_logic;
Ei : out std_logic);
end entity mx_module;
Ai_n ND_2
architecture dataflow of mx_module is
Functionality
Ei = Ai Bi + Ai Bi
Signal Ai_n, Bi_n, ND_1, ND_2: std_logic;
begin
Ai_n <= not Ai;
Bi_n <= not Bi;
ND_1 <= Ai and B_n;
ND_2 <= Bi and A_n;
Ei <= ND_1 or ND_2;
end architecture dataflow;
9
ME Module: Structural
entity ME_module is
Interface
port (
A: in std_logic_vector(3 downto 0);
B: in std_logic_vector(3 downto 0);
E: out std_logic);
end entity ME_module;
component mx_module
port ( Ai, Bi: in std_logic;
Ei : out std_logic);
end component;
Functionality
Signal E0,E1,E2,E3: std_logic;
begin
E=E0 +E1 +E2 +E3
mx0: mx_module port map (A(0), B(0), E0);
mx1: mx_module port map (A(1), B(1), E1);
mx2: mx_module port map (A(2), B(2), E2);
mx3: mx_module port map (A(3), B(3), E3);
E <= E0 nor E1 nor E2 nor E3;
10
Decoder: Data Flow
Example: 2-to-4 decoder
D3
Interface
entity dec_2_to_4 is
port ( A(1) D2
A0, A1: in std_logic;
D0, D1, D2, D3: out std_logic); A(0) D1
end entity decoder_2_to_4;
D0
Functionality
begin A0_n
A0_n <= not A0;
A1_n <= not A1; A1_n
D0 <= A0_n and A1_n;
D1 <= A0 and A1_n;
D2 <= A0_n and A1;
D3 <= A0 and A1;
end architecture dataflow1;
11
Structural VHDL Description
of 2-to-4 Line Decoder
12
Structural VHDL Description
(Entity Declaration)
entity decoder_2_4_w_enable is
port (EN, A0, A1 : in std_logic;
D0, D1, D2, D3 : out std_logic);
end decoder_2_to_4_w_enable;
13
Structural VHDL Description
(Components)
component NOT1
port(in1: in std_logic;
out1: out std_logic);
end component;
component AND2
port(in1, in2: in std_logic;
out1: out std_logic);
end component;
14
Structural VHDL Description (Signals)
A0_n
N0
A1_n
N1
N2
N3
15
Structural VHDL Description
(Connecting components)
16