Code Converters
description
Transcript of Code Converters
Code Converters
Section 3-4 Mano & Kime
Code Converters
• BCD-to Excess-3 Code Converter• Hex-to-Seven-Segment Decoder• Lab 3 – ALU2
– Arithmetic and Logic Instructions– 7-Segment Decoder
BCD-to Excess-3 Code Converter
Maps for BCD-to-Excess-3 Code Converter
Logic Diagram of BCD-to-Excess-3 Code Converter
Excess3inp(3:0) outp(3:0)
Note: inp(3:0) = [A, B, C, D] outp(3:0) = [W, X, Y, Z]
Code Converters
• BCD-to Excess-3 Code Converter• Hex-to-Seven-Segment Decoder• Lab 3 – ALU2
– Arithmetic and Logic Instructions– 7-Segment Decoder
Hex-to-Seven-Segment Decoder
a
b
c
d
e
f g
dp
a b c d e f g dp
q0
q1q2q3
seg7dec
Turning on an LED
+5V R LED
GAL output pin
+5V R LED
GAL output pin
1
0
+5V
+0.2V +1.7V
No current
Current light
no light
R = voltage current = 5 1.7
15 x 10 -3= 220 ohms
7-Segment Displaya
b
c
d
e
f g
a b c d e f g
+5V
7-Segment Displaya
b
c
d
e
f g
a b c d e f g0 1 1 1 1 1 1 01 0 1 1 0 0 0 02 1 1 0 1 1 0 13 1 1 1 1 0 0 14 0 1 1 0 0 1 15 1 0 1 1 0 1 16 1 0 1 1 1 1 17 1 1 1 0 0 0 0
7-Segment Displaya
b
c
d
e
f g
a b c d e f g8 1 1 1 1 1 1 19 1 1 1 1 0 1 1A 1 1 1 0 1 1 1b 0 0 1 1 1 1 1C 1 0 0 1 1 1 0d 0 1 1 1 1 0 1E 1 0 0 1 1 1 1F 1 0 0 0 1 1 1
a
b
c
d
e
f g
dp
a b c d e f g dp
q0
q1q2q3
seg7dec
Hex-to-Seven-Segment Decoder
a
b
c
d
e
f g
Note: a – g LOW to turn ON
Code Converters
• BCD-to Excess-3 Code Converter• Hex-to-Seven-Segment Decoder• Lab 3 – ALU2
– Arithmetic and Logic Instructions– 7-Segment Decoder
ALU2 – Arithmetic and Logic
Instructions a(n-1:0)
y(n-1:0)
sel(2:0)
n-lineALU2
b(n-1:0)
sel y Instruction name
“000” a + b +
“001” b - a -
“010” a and b AND
“011” a or b OR
“100” a xor b XOR
“101” true if a = 0false otherwise
0=
“110” true if a < 0false otherwise
0<
“111” true if b > a (unsigned)
false otherwise
U>
true = all 1’sfalse = all 0’s
Digilab2 – DIO1 Boards
Four 7-segmentdisplays
dig1 dig2 dig3 dig4
Digilab2 Board – Common Anodes
A1 A2 A3 A4
AtoG(6 downto 0)
Pins
Pins
switches
7-segment displays LEDs
pushbuttons
Digilab XLA
Digilab Board
dig3 dig2 dig1dig4
Digilab XLA Board – Common Anodes
A4 A3 A2 A1
CA CB CC CD CE CF CG
Pins
Pins
Top-level Design – Lab 3
a(3:0)ALU2
Lab3
sel(2:0)
ySW(5:8)
A(1:4)
BTN(1:3) ldg‘1’
SW(1:4) b(3:0)
AtoG(6:0)
seg7dec
q AtoG
“0001”
LD(1:8)
y1
Display yon dig4