Professional Documents
Culture Documents
320
Digital
Systems
Design
Chapter
6
Combina9onal
Logic
Design
Prac9ces
• 2-level structure of • Enhanced PLAs • For large designs • Has a much larger # of
AND-OR gates with reduced costs • Collection of logic blocks
with programmable multiple PLDs with • Larger interconnection
connections an interconnection network
structure • Largest manufacturer:
Xilinx
programmable
connections
inputs outputs
I7 I6 I5 I4 I3 I2 I1 I0 Y2 Y1 Y0
0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0 1
0 0 0 0 0 1 0 0 0 1 0
0 0 0 0 1 0 0 0 0 1 1
0 0 0 1 0 0 0 0 1 0 0
0 0 1 0 0 0 0 0 1 0 1
0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
Priority
Encoders
§ If
mul%ple
inputs
are
asserted
simultaneously,
the
binary
encoder
gives
undesirable
results
• It
is
bemer
to
assign
priori%es
to
input
lines
• Highest
priority
line
is
serviced
first
• EX:
8-‐to-‐3
Priority
Encoder
with
IDLE
output
§ If
no
input
is
asserted,
IDLE
is
asserted
I7 I6 I5 I4 I3 I2 I1 I0 A2 A1 A0 IDLE
1 x x x x x x x 1 1 1 0
0 1 x x x x x x 1 1 0 0
0 0 1 x x x x x 1 0 1 0
0 0 0 1 x x x x 1 0 0 0
0 0 0 0 1 x x x 0 1 1 0
0 0 0 0 0 1 x x 0 1 0 0
0 0 0 0 0 0 1 x 0 0 1 0
0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1
8-‐to-‐3
Priority
Encoder
§ Intermediate
Variables
§ H7
=
I7
n H6
=
I6.I7‘
§ H5
=
I5.I6’.I7’
n H4
=
I4.I7’.I6’.I5’
§ H3
=
I3.
I7’.I6’.I5’.I4‘
n H2
=
I2.
I7’.I6’.I5’.I4’.I3’
§ H1
=
I1.
I7’.I6’.I5’.I4’.I3’.I2’
n H0
=
I0.
I7’.I6’.I5’.I4’.I3’.I2’.I1‘
§ I7’.I6’.I5’.I4’.I3’.I2’.I1’
MSB
00
00000
00111
VHDL
8-‐to-‐3
Priority
Encoder
library
IEEE;
use
IEEE.std_logic_1164.all;
en%ty
encoder8to3
is
port
(
I:
in
STD_LOGIC_VECTOR
(7
downto
0);
A:
out
STD_LOGIC_VECTOR
(2
downto
0)
);
end
encoder8to3;
architecture
encoder8to3
of
encoder8to3
is
VHDL
8-‐to-‐3
Priority
Encoder
func%on
CONV_STD_LOGIC_VECTOR(arg:
integer;
size:
integer)
return
std_logic_vector
is
variable
result
:
std_logic_vector(size-‐1
downto
0);
variable
temp
:
integer;
begin
temp
:=
arg;
for
i
in
0
to
size-‐1
loop
if
(temp
mod
2)
=
1
then
result(i)
:=
'1';
else
result(i)
:=
'0';
end
if;
temp
:=
temp/2;
end
loop;
return
result;
end;
VHDL
8-‐to-‐3
Priority
Encoder
begin
process
(I)
variable
j:
integer
range
7
downto
0;
begin
for
j
in
7
downto
0
loop
if
I(j)
=
'1'
then
A
<=
CONV_STD_LOGIC_VECTOR(j,
3);
exit;
end
if;
end
loop;
end
process;
end
encoder8to3;
Three-‐State
Devices
§ Three-‐state
buffers
EN
(A’.B’.C’.D0).EN_L’
(A.B’.C’.D1) .EN_L’
EN_L
D0
D1
D2
D3 Y
D4 Y_L
D5 (A.B.C.D7) .EN_L’
D6
D7
CB A
74x157
2-‐Input,
4-‐Bit
Mul9plexer
G_L
A[3:0]
Y[3:0]
B[3:0]
S
Expanding
Mul9plexers
§ 32-Input Mux
§ 5 select lines XA4 – XA0
§ XA2, XA1, XA0 common
§ XA3, XA4 à Decoder
XEN_L
D0
D1
D2
.
. XOUT
.
D29
D30
D31
XXXXX
AAAAA
4 3 2 1 0
Demul9plexers
§ The function of a Demux is the inverse of a Mux: It routes a single
source to 1 of n outputs depending on select lines values
§ X ⊕ Y = X’.Y + X. Y’
Exclusive-‐OR
Gates
and
Parity
Circuits
Daisy Chain
Tree Structure
LIBRARY
IEEE;
USE
IEEE.STD_LOGIC_1164.ALL
En9ty
parity9
is
Port(
I:
in
std_logic_vector(1
to
9);
EVEN,
ODD:
out
std_logic
);
End
parity9;
Architecture
parity9
of
parity9
is
Begin
Behavioral
VHDL
Program:
9-‐Input
Parity
Checker
Process
(I)
variable
p:
std_logic;
begin
p
:=
I(1);
for
j
in
2
to
9
loop
if
I(j)
=
‘1’ then
p:=
not
p;
end
if;
end
loop;
ODD
<=
p;
EVEN
<=
not
p;
end
process;
End
parity9;
Structural
VHDL:
Parity
Checker
LIBRARY
IEEE;
USE
IEEE.STD_LOGIC_1164.ALL
En9ty
V74x280
is
Port(
I:
in
std_logic_vector(1
to
9);
EVEN,
ODD:
out
std_logic
);
End
V74x280;
Architecture
V74x280
of
V74x280
is
Component
vxor3
port
(A,
B,
C:
in
std_logic;
Y:
out
std_logic);
End
component;
Signal
Y1,
Y2,
Y3,
Y3N:
std_logic;
Structural
VHDL:
Parity
Checker
Begin
U1:
vxor3
port
map
(I(1),
I(2),
I(3),
Y1);
U2:
vxor3
port
map
(I(4),
I(5),
I(6),
Y2);
U3:
vxor3
port
map
(I(7),
I(8),
I(9),
Y3);
Y3N
<=
not
Y3;
U4:
vxor3
port
map
(Y1,
Y2,
Y3,
ODD);
U5:
vxor3
port
map
(Y1,
Y2,
Y3N,
EVEN);
End
V74x280;
Comparator
Structure
§ A
1-‐bit
XOR
can
be
viewed
as
a
1-‐bit
comparator
§ A
combina%on
of
XORs
followed
by
OR
opera%on
can
be
used
to
design
comparators
with
any
number
of
inputs
Itera9ve
Circuits
§ An
itera%ve
circuit
is
a
special
type
of
combina%onal
circuit
that
has
the
following
structure:
§ The
boundary
inputs
are
usually
connected
to
fixed
logic
values
§ The
boundary
outputs
provide
important
informa%on
Itera9ve
Circuits
§ Itera%ve
circuits
are
well
suited
to
problems
that
can
be
solved
by
a
simple
itera%ve
algorithm:
1. Set
C0
to
its
ini%al
value
and
and
set
i
to
0
2. Use
Ci
and
PIi
to
determine
the
values
of
POi
and
Ci+1
3. Increment
i
4. If
i
<
n,
go
to
step
2
§ The
loop
of
steps
(2
to
4)
can
be
expanded
by
providing
a
separate
combina%onal
circuit
to
perform
step
2
for
every
i
An
Itera9ve
Comparator
Circuit
§ Two
N-‐bit
values
X
and
Y
can
be
compared
one
bit
at
a
%me
using
a
single
bit
EQi
at
each
step
to
keep
track
of
whether
all
of
the
bit-‐pairs
have
been
equal
so
far:
1. Set
EQ0
to
1
and
set
i
to
0
2. If
EQi
=
1
and
Xi
=
Yi,
set
EQi+1
to
1.
Else
set
it
to
0.
3. Increment
i
4. If
i<n,
go
to
step
2.
An
Itera9ve
Comparator
Circuit