Professional Documents
Culture Documents
- 225 = 1 1 1 1 0 0 0 0 1 (MyS)
MSB indica valor negativo (S)
1 0 0 0 1 1 1 1 0 (C1)
La magnitud es correcta??
1
1 0 0 0 1 1 1 1 1 (C2)
1 1 0 0 1 0 1 0 0 C1
1
1 1 0 0 1 0 1 0 1 C2
x x+y
y
(x+y)y
y y
Answer: (x+y)y
Or (xy)y
ROSEN, §10.3 QUESTION 2
Find the output of the following circuit
x
x xy xy
y
y
Answer: xy
Or (xy) ≡ xy
ROSEN, §10.3 QUESTION 6
Write the circuits for the following Boolean algebraic
expressions
a) x+y
x
x x+y
y
ROSEN, §10.3 QUESTION 6
Write the circuits for the following Boolean algebraic
expressions
b) (x+y)x
x x+y
x+y (x+y)x
y
WRITING XOR USING AND/OR/NOT
p q (p q) ¬(p q) x y x y
x y (x + y)(xy) 1 1 0
1 0 1
0 1 1
0 0 0
x x+y (x+y)(xy)
y
xy xy
28
HOW TO ADD BINARY NUMBERS
Consider adding two 1-bit binary numbers x and y
0+0 = 0
0+1 = 1
x y Carry Sum
1+0 = 1
1+1 = 10 0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
Carry is x AND y
Sum is x XOR y
x Sum
y
Carry
USING HALF ADDERS
We can then use a half-adder to compute the sum of two
Boolean numbers
1 0 0
1 1 0 0
+1 1 1 0
? 0 1 0
HOW TO FIX THIS
We need to create an adder that can take a carry
bit as an additional input
Inputs:x, y, carry in
Outputs: sum, carry out
c X HA S
s
Y C
x X HA S
c
y
Y C
THE FULL ADDER
ADDING BIGGER BINARY NUMBERS
Just chain full adders together
x0 X HA S
s0
y0 Y C
x1
C
X
FA S
s1
y1 Y C
x2
C
X
FA S
s2
y2 Y C
x3
C
X
FA S
s3
y3 Y C
c
ADDING BIGGER BINARY NUMBERS
A half adder has 2 logic gates
A full adder has two half adders plus a OR gate
Total of 5 logic gates
To add n bit binary numbers, you need 1 HA and
n-1 FAs
To add 32 bit binary numbers, you need 1 HA and
31 FAs
Total of 2+5*31 = 157 logic gates
Toadd 64 bit binary numbers, you need 1 HA and
63 FAs
Total of 2+5*63 = 317 logic gates
MORE ABOUT LOGIC GATES
To implement a logic gate in hardware, you use a
transistor
Transistors are all enclosed in an “IC”, or integrated
circuit
The current Cores I3 processors have 160 million
transistors!
00
100
011
Números con longitud de tres bits:
111 • 1 HA
• 2 FA (n-1)
ASSIGNMENT
Design a circuit for resolve:
Binary C1 C2
ÁLGEBRA DE BOOLE
ALGEBRA DE BOOLE
Leyes fundamentales del álgebra
Por ejemplo, la propiedad Conmutativa de la Suma
A+ B =B +A
(A y B son números enteros o reales)
A+B = B+A
El orden en la OR no importa
CONMUTATIVA DEL PRODUCTO
AB = BA
El orden en la AND no importa
ASOCIATIVA DE LA SUMA
A + (B + C) = (A + B) + C
Agrupar variables en la OR no importa
ASOCIATIVA DEL PRODUCTO
A (B C) = (A B) C
Agrupar variables en la AND no importa
DISTRIBUTIVA
A(B + C) = AB + AC
A
B X=Y
C
X
Y
DISTRIBUTIVA
(A+B)(C+D) = AC + AD + BC + BD
A
B
C
X=Y
D
X
Y
A+0=A
Hacer una operación OR con 0 no cambia nada.
X X=A
A+1=1
Hacer una operación OR con 1 da siempre 1.
X=1
X
A•0=0
Hacer una operación AND con 0 siempre da 0
A X=0
X
A•1 =A
Hacer una operación AND con 1 no cambia nada
X=A
X
A+A = A
Hacer una operación OR consigo mismo da el mismo
resultado
A
A A=A
X
A+A=1
O bien A o A serán 1, luego la salida será 1
A
A
X=1
X
A•A = A
Hacer una operación AND consigo mismo da el mismo
resultado
A
A A=A
X
A•A =0
Bien A o A son 0 luego la salida será 0.
A
A
X=0
X
A=A
Si negamos algo dos veces volvemos al principio
X=A
X
A + AB = A
A
B
X
A + AB = A + B (ABSORCIÓN)
Si A es 1 la salida es 1 Si A es 0 la salida es B
A
B
X
Y X=Y
(A + B)(A + C) = A + BC
A
B
C
X
Y
Tres leyes y doce propiedades en Algebra de Boole
LEYES DE DE MORGAN
A• B=A+ B
A+B=A•B
X e Y son
iguales
CÁLCULO DE LA EXPRESIÓN
ALGEBRAICA DE SALIDA
(EJEMPLO 2)
X = (A+B) C + CD + B
= (A+B) C · CD + B
= (A+B) C · (CD + B)
= A B C · (C +D +B)
= A B C C + A B C D +A B C B
=ABCD
Los
circuitos
son
iguales
ANÁLISIS BOOLEANO DE
FUNCIONES LÓGICAS
El propósito de este apartado es obtener expresiones
booleanas simplificadas a partir de un circuito
Se examina puerta a puerta a partir de sus entradas
Se simplifica usando las leyes y propiedades booleanas.
Ejemplo
1
X= AB+(C+D)
X= AB + C+ D
Ejemplo
2
X = (AB)(CD)
X = ABCD
Ejemplo 3
X = ABCD +A
Simplificando:
X = A + BCD
Ejemplo 4
X = (AB+B)BC
Usando la propiedad
distributiva:
X = ABBC +BBC
X = ABC + BBC
En la siguiente X = ABC + 0•C
transparencia se ve
X = ABC + 0
cómo las dos cosas
X = ABC
son lo mismo
Ejemplo 5
X = (A +AB) +(B(C+D))
X = (A + B) + (B(C + D))
X = (A + B) + (BC + BD)
X = A + B + BC + BD
X = A + B + C + BD (sigue en la próxima
X = A + B + BD + C
Los circuitos
son iguales
X=A+B+D+C
EXPRESIONES BOOLEANAS DESDE TABLAS
DE VERDAD
Producto de sumas
Y=(A+B+C)·(D+C)·(E+F)
Suma de productos
Y= A·B·C+B·C·D+A·C·D o directamente
Y= ABC+BCD+ACD
SUMAS DE PRODUCTOS
La función es 1
cuando ABCD=1111
o cuando
Cuando ABCD=1111, el producto ABCD y ABCD=1110
sólo ése es 1.
o cuando
Cuando ABCD=1110, el producto ABCD’ y
sólo ése es 1,… ABCD=1011
…y así sucesivamente… resultando que o cuando
ABCD=0011
ABCD + ABCD’ + AB’CD + A’B’CD
y en ningún otro caso
Productos de sumas
La función es 0
cuando ABCD=0010
o cuando ABCD=0100
o cuando ABCD=0111
Cuando ABCD=0010, la suma A+B+C’+D o cuando ABCD=1010
y sólo ésa es 0.
Cuando ABCD=0100, la suma A+B’+C+D o cuando ABCD=1101
y sólo ésa es 0, …
y en ningún otro caso
…y así sucesivamente… resultando que
(A+B+C’+D)(A+B’+C+D)(A+B’+C’+D’)(A’+B+C’+D)(A’+B’+C+D’)
MINIMIZACIÓN DE FUNCIONES LÓGICAS
Mapas de Karnaugh: se usan para minimizar el número de
puertas requeridas en un circuito digital
Es adecuado en vez de usar leyes y propiedades cuando el
circuito es grande
Se consigue, aplicando adecuadamente el método, el
circuito más simplificado posible
Mapa de Karnaugh
El mapa se hace con una tabla con tantas celdas
como Sumas de Productos posibles, teniendo en
cuenta el número de variables que se utilice.
Código Gray
C C
0 1
AB 00
AB 01
AB 11
AB 10
X =AB C +AB C +AB C +AB C
Código Gray
C C Cada término de 3
0 1
variables es una
AB 00 1 1 celda en un mapa
01 de Karnaugh 4 X 2
AB
AB 11
10 1 1
AB
X =AB C +AB C +AB C +AB C
Código Gray
C C Una
0 1
simplificación
AB 00 1 1 podría ser:
AB 01 X=AB+AB
AB 11
10 1 1
AB
X =AB C +AB C +AB C +AB C
Código Gray
C C Otra
0 1
simplificación
AB 00 1 1 podría ser:
AB 01 X=BC+BC
AB 11 El mapa de
10 Karnaugh se
AB 1 1
dobla
circularmente
X =AB C +AB C +AB C +AB C
Código Gray
C C La mejor
0 1
simplificación
AB 00 1 1 sería
AB 01
AB 11 X =B
10 1 1
AB
VARIABLES
(OTRA FORMA DE
DIBUJARLA)
Código Gray
BC BC BC BC
00 01 11 10
A 0
A 1
Código Gray
BC BC BC BC
00 01 11 10
Código Gray
C00D CD
01
C D 10C
11
D
A B00
A B01
A B11
A B10
SIMPLIFICAR
X =AB CD +AB C D +ABC D +ABC D +
ABCD+ABCD
Código Gray 00 01 11 10
CD CD CD C
00 01 11 10
D
A B00 1 Intentar con
reducciones
A B01 1 1
booleanas
A B11 1 1
A B10 1
X = ABD + ABC + CD
EN UN MAPA DE 4 VARIABLES
CD CD CD C
D00 01 11 10
A B00 1 1 1 1
A B01 1 1 1
A B11 1 1 1
A B10 1 1
X=C +AB +BD
ENCONTRAR OTRO MÁS
SENCILLO USANDO MAPAS
DE KARNAUGH
Y = A B + BC + A B(C+D)
Y=AB+BC+A BC + A B D
Y=AB+BC+A BC ABD
Y = A B + B C + (A + B + C ) ( A + B + D)
Y = A B + B C + A + AB + A D + B + BD + AC + BC + CD
Y = A B + A + B + CD = A + B + B + C D = 1
C00D C01D C
11
D 10
C
D
A B 00 1 1 1 1
A B 01 1 1 1 1
A B 11 1 1 1 1
A B 10 1 1 1 1
Z=1
SIMPLIFICACIÓN POR KARNAUGH
1) Realizar agrupaciones de 1's, con sus adyacentes, lo mayor
posibles, pero siempre en cantidades potencias de 2.
2) No dejar ningún 1 sin agrupar. Puede ocurrir que un 1 pertenezca a
más de una agrupación. No se pueden coger agrupaciones dentro de
agrupaciones.
3) Por cada agrupación de 1's resulta un producto de variables. Cuanto
más 1's se agrupen, más sencilla resultará la expresión de esa agrupación. En
MK de 5 variables, las agrupaciones que tomen 1’s de las dos porciones deben
ser simétricas respecto al eje central.
4) En cada agrupación, cada una de las variables puede aparecer en
alguno de los siguientes casos:
a) Si siempre vale 1 -----> Se pone afirmada.
b) Si siempre vale 0 -----> Se pone negada.
c) Si cambia de valor (50% de los casos un valor y el otro 50% otro
valor) -----> No se pone.
5) La expresión de la función booleana será la suma lógica de todos
los productos que hayan salido.
DISEÑAR UN SISTEMA DE ALARMA
Sensores disponibles
1. V = Ventana (V=0 CERRADA, V=1 ABIERTA)
2. P = Puerta (P=0 CERRADA, P=1 ABIERTA)
3. C = Calefacción (C=0 APAGADA,
C=1 ENCENDIDA)
4. A = Aire acondicionado (A=0 APAGADO,
A=1 ENCENDIDO)
5. I = Alarma de proximidad de intruso (I=0 NO HAY
INTRUSO,
I=1 SÍ HAY INTRUSO)
El sistema de alarma debe activarse cuando:
1. La puerta está abierta y la calefacción encendida (P=1,
C=1)
2. La puerta está abierta y el aire acondicionado encendido
(P=1, A=1)
3. La puerta está abierta con una alarma de proximidad de
intruso (P=1, I=1)
4. La ventana está abierta y la calefacción encendida.
(V=1, C=1)
5. La ventana está abierta y el aire acondicionado
encendido (V=1, A=1)
6. La ventana está abierta con una alarma de proximidad
de intruso (V=1, I=1)
RELLENANDO EL MAPA…(P=1, C=1)
V P 01 1 1 1 1
11 1 1 1 1
V P
10
V P
RELLENANDO EL MAPA…(P=1, A=1)
V P 01 1 1 1 1 1 1
11 1 1 1 1 1 1
V P
10
V P
RELLENANDO EL MAPA…(P=1, I=1)
V P 01 1 1 1 1 1 1 1
11 1 1 1 1 1 1 1
V P
10
V P
RELLENANDO EL MAPA…
(V=1, C=1)
V P 01 1 1 1 1 1 1 1
11 1 1 1 1 1 1 1
V P
10 1 1 1 1
V P
RELLENANDO EL MAPA…
(V=1, A=1)
V P 01 1 1 1 1 1 1 1
11 1 1 1 1 1 1 1
V P
10 1 1 1 1 1 1
V P
RELLENANDO EL MAPA…(V=1, I=1)
V P 01 1 1 1 1 1 1 1
11 1 1 1 1 1 1 1
V P
10 1 1 1 1 1 1 1
V P
PODEMOS AGRUPAR ASÍ…
01 1 1 1 1 1 1 1
V P
V P 11 1 1 1 1 1 1 1
V P
10 1 1 1 1 1 1 1
X=PA+VA +PC+VC+PI+VI
¿Cuántos chips necesito para esto?
O USANDO LOS CEROS…
X=CA I +V P X=CA I +V P
Lecture Notes # 2
Karnaugh Maps - Two-Level Minimization
2
Karnaugh-Map Based 2-Level Minimization
• Defn: An implicant g of a function is a product term (e.g., g=xyz) s.t. when g=1
f=1
• Defn: A minterm is an implicant containing all n variables of an n-var. function (in
compl. or uncompl. form)
• Defn: Let g, and h be 2 implicants of a function f. g is said to cover h if h=1 g=1
(e.g., g = xz, h = xyz)
• Defn: Let G = {g1, .., gk) be a set of implicants of func f , and let h be another
implicant of f.
Then G is said to cover h if h=1 g1+ .. + gk =1
•Defn: An SOP or POS expression is also called a 2-level expression
• Defn: A 2-level AND-OR (OR-AND) gate realization of an SOP
(POS) expression is one in which all product terms (OR
terms in POS) in the SOP (POS) expression are implemented
by multiple input AND (OR) gates & the ORing (ANDing)
of the product (OR) terms is realized by a multiple input OR
(AND) gate.
3
A
f3
C
B
level 2
D I/Ps
A
AB + BC + ACD
B
f1
B
C
A
C Level 2
D
Level 1
B
(B + C)(A + D)(C + D)
C
f2
A
C
D
126
•Defn. A gate in a logic circuit is a level-1 gate if all its inputs are
primary inputs (i.e., literals, A, A, B, B, etc.)
• This approx. reduces the total # of inputs over all gates in the
circuit in a 2-level gate realization.
127
C
Note: Minimizing # of literals + # of product terms (approx) minimizing total #
of gate inputs
128
Multilevel Minimization (Example):
Gate Impl.:
x2
x3
f
x5
x1 Multilevel
circuit
x4
129
2-variable TT outputs
A B Z1 Z2
Binary 0 0 0 0
place-value Physically adjacent
0 1 1 1
ordering but not logically
(Binary 1 0 0 1 adjacent.
ordering) 1 1 1 0
logically adjacent but not physically adjacent
AB + AB
B
Another ordering of inputs ( Gray-code ordering)
A B Z1
0 0 0
0 1 1
1 1 1 Z1 = B
Physically as well as
1 0 0
logically adjacent.
131
n-variable Gray-code ordering
y 0 •
Throw away variable (A)
1 1 1 • changing across the 2 squares.
We thus obtain BC.
001
132
0 1 1 1
f = AB + AB + AC + BC
1 1 1
Four Prime Implicants AB, BC, AC, AB formed. Not all these PIs
are needed in the expression. Only a minimum set that covers all
minterms is needed.
0 1 1 0
1 1 1 1 1 1 1 1
AB AB
B C
B
AB
More Examples: Both PIs
C 00 01 11 10 (A, BC)
AB are
Redrawn 0
C 00 01 11 10 1 1
essential.
0 1 1 1
1 1 1
1
1 1 1 Not symmetric Thus, f = A + BC
is minimized.
Symmetric ( logically adjacent)
2-minterm implicants : Can be “merged” to form
a 4-minterm implicant, which will be a PI.
135
4-variable K-Map:
AB
C 00 01 11 10
D
00 •
01 •
11
10
136
Example: f = AC + D
Instead of starting with 2-minterm
AB
CD 00 01 11 10
implicants & growing them, you
can form larger implicants directly
00 1 1 1 1 by grouping power of 2 (2, 4, 8,
etc.) # of minterms so as to form
01 1 1 a rectangle or square ( a convex
AC
region).
11
10 1 1 1 1 Convex
D
AB Concave
CD 00 01 11 10
00 1 1 Invalid grouping
(region formed is concave)
01 1 1
f = AB + AC + BCD
Valid 1 1 1
11
groupings
10 1
137
Another Example: AB
TT: CD BD
00 01 11 10
A B C D Z
00 1 1
0 0 0 0 1
0 0 0 1 0 ABD
01
0 0 1 0 1 1
0 0 1 1 1
0 1 0 0 0 C
11 1 1 1 1
0 1 0 1 1
0 1 1 0 1 10
Binary 1 1 1 1
0 1 1 1 1
order
1 0 0 0 1
1 0 0 1 0
1 0 1 0 1
1 0 1 1 1
1 1 0 0 0 f = C + BD + ABD
1 1 0 1 0
1 1 1 0 1
1 1 1 1 1
138
Don’t Cares in K-Maps
• For such combinations, we do not care what the output is, and
we put an ‘x’ in the o/p column for the TT
AB
CD 00 01 11 10
A B C f
0 0 0 1
0 0 1 0 0 x x 1 0
0 1 0 1
f = BC + AB
0 1 1 x
1 0 0 0 by considering all 1 0 1 1 0
1 0 1 1 x’s as 0s
1 1 0 x
1 1 1 x f=B The x’s can, however, be profitably
by selectively used to make larger PIs & thus
considering the 010 further simplify the function.
cell’s x as 1
• In a K-map, the ‘x’s can be profitably used to form larger 139
implicants (which have fewer literals)
• Thus as far as x’s are concerned, we can have the cake and eat it too!
STEP1: Form all PIs by including the Xs with the 1s to form larger
PIs. (Do not form PIs covering only Xs !)
STEP2: Identify all essential PIs by visiting each minterm (1s) &
checking if it is covered by only one PI. If so, then that
PI is an essential PI.
STEP3: Identify all 1s not covered by essential PIs. Select a minimal- cost set of
PIs S to cover them. This requires some trial-and error (in fact, this is a hard
computational problem).
f= essential PIs + Pi
Pi S
PI Pi is in set S
Minimal POS Expr. from a K-Map : 141
Big M notation
Example:
Xs of F
0s of F
AB F F
CD AB
CD 00 01 11 10
D
00 0 0 x 0 Complement 00 1 1 x 1
0 4 12 8
01 1 1 01
1 5 13 x 9 1 0 0 x 0
11 3 1 11 0 0 1 1
7 1 15 0 11 0
AC
10 2 0 10
6 x 14 0 10 0 1 x 1 1
F =D + AC F = D + AC = D(A +C)
METHOD2 : Direct Method : 142
(2) Identify all essential PTs (those that cover at least one 0 not
covered by any other PT).
f= (essential PTs) • qi
qi T
143
Example: (Direct Method)
AB
CD (OR terms)
00 01 11 10
00 0 0 x 0 Prime Implicate
( Groups of 0s that cannot
01 1 1 x 1 be grown any further)
(A + C)
F = D( A + C )
00 0 1 4 00 16 20 28 x 24
12 1 8
01 01
1 5 13 1 9 17 21 29 1 25
11 11
3 1 7 1 15 x 11 19 x 23 1 31 x 27
10 10
2 6 14 x 10 18 22 1 30 1 26
A=0 A=1
145
6-variable K-map: f(A,B,C,D,E,F)--Juxtapose two 5-var. K-submaps
one for the MSB A=0 and other for A=1
CD CD
EF 00 01 11 10 EF 00 01 11 10
00 0 4 12 8 00 16 20 28 24
5-var. 01 1 5 13 9 01 17 21 29 25
A=0
K-submap
11 3 7 15 11 11 19 23 31 27
10 2 6 14 10 10 18 22 30 26
B=0 B=1
CD CD
EF 00 01 11 10 EF 00 01 11 10
00 32 00 48 52 60 56
36 44 40
5-var. 01 49
01 33 37 45 41 53 61 57
K-submap A=1
11 35 11
39 47 43 51 55 63 59
10 34 10
38 46 42 50 54 62 58
B=0 B=1
Adjacencies of a square: Adjacent squares of the 5-var.
K-submap plus the “corresponding” or “mirror” square
in the other 5-var. K-submap.
6-variable K-map: f(A,B,C,D,E,F,)---Example: 146
CD CD
EF 00 01 11 10 EF 00 01 11 10
00 0 4 12 8 00 16 20 28 24
01 1 5 13 9 01 17 21 29 25
A=0
11 3 7 15 11 11 19 23 31 27
10 2 6 14 10 10 18 22 30 26
B=0 B=1
CD CD
EF 00 01 11 10 EF 00 01 11 10
00 32 00 48 52 60 56
36 44 40
01 33 01 49 53 61 57
37 45 41
A=1
11 35 11
39 47 43 51 55 63 59
10 34 10
38 46 42 50 54 62 58
B=1
B=0