Documentos de Académico
Documentos de Profesional
Documentos de Cultura
PRE INFORME Nº 2
GRUPO: M2
INTEGRANTES:
MATERIA: MICROPROCESADORES
FECHA: 24/SEPTIEMBRE/2013
LA PAZ – BOLIVIA
2013
MICROPROCESADORES Condori Poma Ivan David
ETN 801 Inquillo Torrez Marco Antonio
Laboratorio Nº 2
OBJETIVOS
INTRODUCCIÓN
Las señales de control pueden ser agrupadas en un mismo nivel y sus correspondientes
combinaciones relevantes ser codificadas para conformar un conjunto de operaciones
codificadas.
PREINFORME
Operación NAND
X3
r3
Y3
Modelo simplificado
X2
r2 4
Y2 X
4
4 R
X1 Y
r1
Y1
X0
r0
Y0
MICROPROCESADORES Condori Poma Ivan David
ETN 801 Inquillo Torrez Marco Antonio
Laboratorio Nº 2
Operación OR y XOR
X 4 X 4
4 4
4 R 4 R
Y Y
Diagrama de partes
X
Salida
Control
x Y salida
0 0 0
0 1 0
1 0 0
1 1 1
Salida
Control
x Y salida
0 0 0
0 1 1
1 0 1
1 1 1
Salida
Control
x Y salida
0 0 0
0 1 1
1 0 1
1 1 0
MICROPROCESADORES Condori Poma Ivan David
ETN 801 Inquillo Torrez Marco Antonio
Laboratorio Nº 2
El diseño de la ALU, en este diseño implementamos a la UBC las funciones lógicas básicas
que son AND, OR y XOR, de la siguiente manera.
n
X n
Y n
n
n
n MUX
n 4a1 C
n n
R
n
n
n UBC
S6 S5
S4 S3 S 2 S 1 S0
S6 S5 Salida selecta
0 0 AND
0 1 OR
1 0 XOR
1 1 UBC
Selección del MUX
MICROPROCESADORES Condori Poma Ivan David
ETN 801 Inquillo Torrez Marco Antonio
Laboratorio Nº 2
Para elaborar la Tabla Funcional de la ALU tomamos solo las funciones básicas simples de
la tabla de 32 funciones y omitimos tanto las funciones complejas como las redundantes.
S4 S3 S2 S1 S0 C R FUNCION
0 0 0 0 0 0 0 Borrar salida
0 0 0 0 1 0 1 Constante uno positivo
0 0 0 1 0 0 -1 Constante uno negativo
MICROPROCESADORES Condori Poma Ivan David
ETN 801 Inquillo Torrez Marco Antonio
Laboratorio Nº 2
0 0 0 1 1 1 0 Borrar salida
0 0 1 0 0 0 -1 Constante uno negativo
0 0 1 0 1 1 0 Borrar salida
0 0 1 1 0 0 -2 Constante dos negativo
0 0 1 1 1 1 -1 Constante uno negativo
0 1 0 0 0 0 y Leer y
0 1 0 0 1 ↕ y+1 Incrementar y
0 1 0 1 0 0 -y-1 Complemento1 y
0 1 0 1 1 ↕ -y Complemento2 y
0 1 1 0 0 ↕ y-1 Decrementar y
0 1 1 0 1 1 y Leer y
0 1 1 1 0 ↕ -y-2 Función compleja 1
0 1 1 1 1 1 -y-1 Complemento1 y
1 0 0 0 0 0 x Leer x
1 0 0 0 1 ↕ x+1 Incrementar x
1 0 0 1 0 ↕ x-1 Decrementar x
1 0 0 1 1 1 x Leer x
1 0 1 0 0 0 -x-1 Complemento1 x
1 0 1 0 1 ↕ -x Complemento2 x
1 0 1 1 0 ↕ -x-2 Función compleja 2
1 0 1 1 1 1 -x-1 Complemento1 x
1 1 0 0 0 ↕ x+y Sumar
1 1 0 0 1 ↕ x+y+1 Función compleja 3
1 1 0 1 0 ↕ x-y-1 Función compleja 4
1 1 0 1 1 ↕ x-y Restar y de x
1 1 1 0 0 ↕ -x+y-1 Función compleja 5
1 1 1 0 1 ↕ y-x Restar x de y
1 1 1 1 0 ↕ -x-y-2 Función compleja 6
1 1 1 1 1 ↕ -x-y-1 Función compleja 7
Una vez escogidas las 9 funciones más importantes (resaltadas con verde en la tabla de las
32 funciones) y añadiendo la otras 3 funciones básicas de una ALU (AND, OR, XOR)
procedemos a realizar la siguiente tabla:
MICROPROCESADORES Condori Poma Ivan David
ETN 801 Inquillo Torrez Marco Antonio
Laboratorio Nº 2
S6 S5 S4 S3 S2 S1 S0 C R FUNCION
1 1 0 0 0 0 0 0 0 Constante, borrar la
salida
1 1 1 0 0 0 0 0 x Leer x
1 1 0 1 0 0 0 0 y Leer y
1 1 1 0 1 0 1 ↕ -x Negar x
1 1 1 0 1 0 0 ↕ -x-1 Invertir x
0 0 0 0 0 0 0 0 x^y x and y
0 1 0 0 0 0 0 0 xνy x or y
1 0 0 0 0 0 0 0 xѳy x xor y
1 1 1 1 0 0 0 ↕ x+y Sumar
1 1 1 1 0 1 1 ↕ x-y Restar y de x
1 1 1 0 0 0 1 ↕ x+1 Incrementar x
1 1 1 0 0 1 0 ↕ x-1 Decrementar x
Como podemos ver en la tabla, contamos con una palabra de control demasiado larga, para
soluciona este problema procedemos a codificar la palabra de control mediante la
asignación arbitraria a un código mínimo, para nuestro caso basta con tener 4 bits para
codificar la 12 operaciones o funciones mas importantes. De esta manera al introducir un
código de 4 bits el descodificador generara la palabra de control y se ejecutara la operación.
C3 C2 C1 C0 C FUNCION
0 0 0 0 0 borrar
0 0 0 1 0 leer x
0 0 1 0 0 leer y
0 0 1 1 1 negar x
0 1 0 0 ↕ not x
0 1 0 1 0 and
0 1 1 0 0 or
0 1 1 1 0 xor
1 0 0 0 ↕ Sumar
1 0 0 1 ↕ restar
1 0 1 0 ↕ incrementar x
1 0 1 1 ↕ decrementar y
X
Salida
Control
Tabla funcional:
Control C
0 0
1 C
Dirección Datos
Nº HEX C3 C2 C1 C0 ctl S6 S5 S4 S3 S2 S1 S0
0 0 0 0 0 1 1 1 0 0 0 0 0
1 0 0 0 1 1 1 1 1 0 0 0 0
MICROPROCESADORES Condori Poma Ivan David
ETN 801 Inquillo Torrez Marco Antonio
Laboratorio Nº 2
2 0 0 1 0 1 1 1 0 1 0 0 0
3 0 0 1 1 0 1 1 1 1 1 0 1
4 0 1 0 0 0 1 1 1 0 1 0 0
5 0 1 0 1 1 0 0 0 0 0 0 0
6 0 1 1 0 1 0 1 0 0 0 0 0
7 0 1 1 1 1 1 0 0 0 0 0 0
8 1 0 0 0 1 1 1 1 0 0 0 0
9 1 0 0 1 1 1 1 1 0 0 1 1
A 1 0 1 0 1 1 1 1 0 0 0 1
B 1 0 1 1 1 1 1 1 0 0 1 0
ALU+BANDERAS
MICROPROCESADORES Condori Poma Ivan David
ETN 801 Inquillo Torrez Marco Antonio
Laboratorio Nº 2
Entity ubc is
Port( x,y : in std_logic_vector(3 downto 0);
S : in std_logic_vector(4 downto 0);
R : out std_logic_vector(3 downto 0);
c : out std_logic);
end ubc;
R(0)<=s(0) xor a(0) xor b(0); acar(0)<=(b(0)and a(0)) or (s(0) and (a(0) xor b(0)));
R(1)<=a(1) xor b(1) xor acar(0); acar(1)<=(a(0) and b(0) and (a(1) xor b(1))) or (s(0) and
(a(0) xor b(0)) and (a(1) xor b(1))) or (a(1) and b(1));
R(2)<=a(2) xor b(2) xor acar(1); acar(2)<=(a(1) and b(1) and (a(2) xor b(2))) or ((a(0) and
b(0)) and (a(1) xor b(1)) and (a(2) xor b(2))) or (s(0) and (a(0) xor b(0)) and (a(1) xor b(1))
and (a(2) xor b(2))) or (a(2) and b(2));
R(3)<=a(3) xor b(3) xor acar(2); acar(3)<=(a(2) and b(2) and (a(3) xor b(3))) or ((a(1) and
b(1)) and (a(2) xor b(2)) and (a(3) xor b(3))) or ((a(0) and b(0)) and (a(1) xor b(1)) and (a(2)
xor b(2)) and (a(3) xor b(3))) or (s(0) and (a(0) xor b(0)) and (a(1) xor b(1)) and (a(2) xor
b(2)) and (a(3) xor b(3))) or (a(3) and b(3)); c<=acar(3);
end Comportamiento;
Entity alu is
port(
x, y ,c : in std_logic_vector(3 downto 0);
Ralu : out std_logic_vector(3 downto 0);
Calu, H, Z, N, V, P: out std_logic);
end alu;
MICROPROCESADORES Condori Poma Ivan David
ETN 801 Inquillo Torrez Marco Antonio
Laboratorio Nº 2
begin
with c select
Subc<= "01100000" when "0000",
"01110000" when "0001",
"01101000" when "0010",
"01110101" when "0011",
"01110100" when "0100",
"00000000" when "0101",
"00100000" when "0110",
"01000000" when "0111",
"11111000" when "1000",
"11111011" when "1001",
"11110001" when "1010",
"11110010" when "1011",
"11100000" when others;
stage0: ubc port map(x,y,Subc(4)&Subc(3)&Subc(2)&Subc(1)&Subc(0),Rcal,carry);
asd<=Subc(6)& Subc(5);
process(asd)
begin
case asd is
when "00" => Ralu<=x and y;
when "01" => Ralu<=x or y;
when "10" => Ralu<=x xor y;
when "11" => Ralu<=Rcal;
end case;
end process;
MICROPROCESADORES Condori Poma Ivan David
ETN 801 Inquillo Torrez Marco Antonio
Laboratorio Nº 2
end comportamiento;