Professional Documents
Culture Documents
Tema 1 - Procesador PDF
Tema 1 - Procesador PDF
1 PROCESADOR: ESPECIFICACIONES
Lluís Terés
Instituto de Microelectrónica de Barcelona, IMB-CNM (CSIC)
Universitat Autònoma de Barcelona (UAB)
P1.1
1. Especificación de dos sistemas digitales
CONTROL DE TEMPERATURA (lección 1.1):
loop
if temp < pos – half_degree then onoff := on;
elsif temp > pos + half_degree then onoff := off;
end if;
wait for 10 s;
end loop;
2
P1.1
CRONÓMETRO (lección 1.1)
loop
if reset = ON then time := 0;
elsif start = ON then
while stop = OFF loop
if ref_positive_edge = TRUE then time := update(time);
end if;
end loop;
end if;
end loop;
3
P1.1
A cada uno de ellos => SISTEMA DIGITAL (lección 1.1):
Controlador de temperatura:
Cronómetro:
4
P1.1
2. Estrategias de diseño
SIN EMBARGO …
5
P1.1
loop
if temp < pos – half_degree then onoff := on;
elsif temp > pos + half_degree then onoff := off;
end if; 1. Las instrucciones se ejecutan secuencialmente
wait for 10 s;
∙∙∙∙∙∙∙∙∙∙∙∙∙
end loop;
n: if temp < pos – half_degree then onoff := on;
elsif temp > pos + half_degree then onoff := off;
loop end if;
if reset = ON then time := 0;
elsif start = ON then n+1: wait for 10 s;
while stop = OFF loop
if ref_positive_edge = TRUE then n+2: if temp < pos – half_degree then onoff := on;
time := update(time); elsif temp > pos + half_degree then onoff := off;
end if; end if;
end loop; n+3: wait for 10 s;
end if;
end loop; ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙
6
P1.1
loop
if temp < pos – half_degree then onoff := on;
elsif temp > pos + half_degree then onoff := off;
end if; 2. Ambos algoritmos contienen bifurcaciones
wait for 10 s; condicionales y saltos:
end loop;
if temp < pos – half_degree then onoff := on;
elsif temp > pos + half_degree then onoff := off;
loop
if reset = ON then time := 0; while stop = OFF loop
elsif start = ON then if ref_positive_edge = TRUE then
while stop = OFF loop time := update(time);
if ref_positive_edge = TRUE then
end if;
time := update(time);
end loop;
end if;
end loop;
end if;
end loop;
7
P1.1
loop
if temp < pos – half_degree then onoff := on;
elsif temp > pos + half_degree then onoff := off;
end if; 3. Algunas instrucciones leen valores de entrada o
wait for 10 s; escriben valores de salida.
end loop;
if temp < pos – half_degree (read temp and pos);
loop
if reset = ON then time := 0; onoff := on (write onoff);
elsif start = ON then
while stop = OFF loop while stop = OFF (read stop);
if ref_positive_edge = TRUE then
time := update(time); time := update(time) (write time);
end if;
end loop;
end if;
end loop;
8
P1.1
loop
if temp < pos – half_degree then onoff := on;
elsif temp > pos + half_degree then onoff := off;
end if; 4. Existen instrucciones que ejecutan cálculos.
wait for 10 s;
end loop; temp – (pos – half_degree);
update(time);
loop
if reset = ON then time := 0;
elsif start = ON then
while stop = OFF loop
if ref_positive_edge = TRUE then
time := update(time);
end if;
end loop;
end if;
end loop;
9
Conclusión (otra idea …) P1.1
Opción 2: Diseñar un nuevo (meta)sistema genérico que incluya …
Puertos de entrada (IN0, IN1, IN2, ∙∙∙ ),
Puertos de salida, OUT1, OUT2, ∙∙∙),
Elementos de memoria capaces de almacenar datos (X0, X1, X2, ∙∙∙),
Recursos de cómputo que permitan realizar cálculos (+, ‐, ∙∙∙),
Xi := A (A constante);
Xi := INj;
OUTi := Xj;
OUTi := A (A constante);
Xi := f(Xj, Xk) (f => un recurso de cómputo);
goto n, donde n es un número de instrucción;
if condicion goto n, donde n es un número de instrucción.
10
P1.1
RESUMEN
Sistema genérico:
Capaz de implementar cualquier
algoritmo
11
P1.1
12
P1.2
14
P1.2
Tipos de instrucción:
Xi := A;
Xi := INj;
OUTi := Xj;
OUTi := A;
Xi := Xj + Xk;
Xi := Xj ‐ Xk;
goto n;
if Xi < 0 goto n;
if Xi > 0 goto n;
15
P1.2
Seis elementos de memoria para almacenar los
datos:
X0: temp (leído por IN0)
X1: pos (leído por IN1)
X2: time (leído por IN2)
X3: initial time (leído por IN2)
X4: computation result (generado interamente)
X5: constant 10 (generado interamente)
16
P1.2
loop
if temp < pos then onoff := on;
elsif temp > pos then onoff := off;
end if;
wait for 10 s;
end loop;
17
P1.2
loop
if temp < pos then onoff := on;
elsif temp > pos then onoff := off;
end if;
wait for 10 s;
end loop;
18
P1.2
0: X5 := 10;
1: X0 := IN0;
2: X1 := IN1;
3: X4 := X0 ‐ X1;
4: if X4 < 0 then go to 7;
5: if X4 > 0 then go to 9;
6: go to 10;
7: OUT0 := 1;
8: go to 10;
9: OUT0 := 0;
10: X3 := IN2;
11: X2 := IN2;
12: X4 := X2 ‐ X3;
13: X4 := X4 ‐ X5;
14: if X4 < 0 then go to 11;
15: go to 1;
19
P1.2
2. Cronómetro
loop
if reset = ON then time := 0;
elsif start = ON then
while stop = OFF loop
if ref_positive_edge = TRUE then
time := update(time);
end if;
end loop;
end if;
end loop;
20
P1.2
Cuatro elementos de memoria para almecenar los datos:
X0: reset, start, stop, ref o computation result
(leído por IN0, IN1, IN2, IN3 o generado internamente)
X1: initial ref (leído por IN3)
X2: time (generado internamente)
X3: constant 1 (generado internamente)
21
P1.2
loop
if reset = ON then time := 0;
elsif start = ON then
while stop = OFF loop
if ref_positive_edge = TRUE then
time := update(time);
end if;
end loop;
end if;
end loop;
Tiempo de
ejecución de
X0: reset, start, stop, ref o computation result cada
instrucción
(leído por IN0, IN1, IN2, IN3 o generado internamente) << Tref = 0.1 s
X1: initial ref (leído por IN3)
X2: time (generado internamente)
X3: constant 1 (generado internamente)
22
P1.2
loop
if reset = ON then time := 0;
elsif start = ON then
while stop = OFF loop
if ref_positive_edge = TRUE then
time := update(time);
end if;
end loop;
end if;
end loop;
Tiempo de
ejecución de
X0: reset, start, stop, ref o computation result cada
instrucción
(leído por IN0, IN1, IN2, IN3 o generado internamente) << Tref = 0.1 s
X1: initial ref (leído por IN3)
X2: time (generado internamente)
X3: constant 1 (generado internamente)
23
(Ejercicio) P1.2
Construir el programa correspondiente a diagrama de fujo anterior. Para ello debéis asignar
números a las instrucciones tal como aparecen en los cuadros siguientes:
Tipos de instrucción
Xi := A;
Xi := INj;
OUTi := Xj;
cc OUTi := A;
i: if a_condition goto j;
Xi := Xj + Xk;
i+1: an_instruction; Xi := Xj ‐ Xk;
i: instrucción;
i+1: instrución siguiente; ··········· goto n;
j: another_instruction; if Xi < 0 goto n;
if Xi > 0 goto n;
i-1: an instruction
i: go to j;
···········
j: another_instruction;
24
(Solución) P1.2
0: X3 := 1:
1: X0 := IN0;
2: if X0 > 0 then go to 6 ;
3: X0 := IN1;
4: if X0 > 0 then go to 9 ;
5: go to 1;
6: X2 := 0;
7: OUT0 := X2;
8: go to 1;
9: X0 ;= IN2;
10: if X0 > 0 then go to 1 ;
11: X1 := IN3;
12: X0 := IN3;
13: X0 := X0 ‐ X1;
14: if X0 > 0 then go to 16;
15: go to 9;
16: X2 := X2 + X3;
17: OUT0 := X2;
25
18: go to 9;
P1.2
RESUMEN
26