You are on page 1of 26

P1.

1 PROCESADOR: ESPECIFICACIONES
Llus Ters
Instituto de Microelectrnica de Barcelona, IMB-CNM (CSIC)
Universitat Autnoma de Barcelona (UAB)

1.Especificacindedossistemasdigitales

P1.1

CONTROLDETEMPERATURA(leccin 1.1):
loop
if temp<pos half_degree thenonoff :=on;
elsif temp>pos +half_degree thenonoff :=off;
endif;
waitfor10s;
endloop;

P1.1
CRONMETRO(leccin 1.1)
loop
if reset=ONthentime:=0;
elsif start=ONthen
whilestop=OFFloop
if ref_positive_edge =TRUEthentime:=update(time);
endif;
endloop;
endif;
endloop;

P1.1
Acada uno deellos =>SISTEMADIGITAL(leccin 1.1):

Controlador detemperatura:

Cronmetro:

2.Estrategiasdediseo

P1.1

OPCIN1: Asociar acada algoritmo unsistema completamente nuevo que ejecute


exclusivamente dicho algoritmo,ynopueda por tanto ejecutar ningn otro
algoritmo.
SINEMBARGO
Ambosalgoritmos tienen algunas caractersticas comunes.

P1.1
loop
iftemp<pos half_degree thenonoff :=on;
elsif temp>pos +half_degree thenonoff :=off;
end if;
waitfor10s;
end loop;
loop
ifreset=ONthentime:=0;
elsif start=ONthen
whilestop=OFFloop
ifref_positive_edge =TRUEthen
time:=update(time);
endif;
endloop;
endif;
endloop;

1.Lasinstrucciones seejecutan secuencialmente

n: iftemp<pos half_degree thenonoff :=on;


elsif temp>pos +half_degree thenonoff :=off;
endif;
n+1:waitfor10s;
n+2:iftemp<pos half_degree thenonoff :=on;
elsif temp>pos +half_degree thenonoff :=off;
endif;
n+3:waitfor10s;

P1.1
loop
iftemp<pos half_degree thenonoff :=on;
elsif temp>pos +half_degree thenonoff :=off;
end if;
waitfor10s;
end loop;
loop
ifreset=ONthentime:=0;
elsif start=ONthen
whilestop=OFFloop
ifref_positive_edge =TRUEthen
time:=update(time);
endif;
endloop;
endif;
endloop;

2.Ambosalgoritmos contienen bifurcaciones


condicionales ysaltos:
iftemp<pos half_degree thenonoff :=on;
elsif temp>pos +half_degree thenonoff :=off;
whilestop=OFFloop
ifref_positive_edge =TRUEthen
time:=update(time);
end if;
end loop;

P1.1
loop
iftemp<pos half_degree thenonoff :=on;
elsif temp>pos +half_degree thenonoff :=off;
end if;
waitfor10s;
end loop;

3.Algunas instrucciones leen valores deentradao


escriben valores desalida.
iftemp<pos half_degree (readtemp andpos);

loop
ifreset=ONthentime:=0;
elsif start=ONthen
whilestop=OFFloop
ifref_positive_edge =TRUEthen
time:=update(time);
endif;
endloop;
endif;
endloop;

onoff :=on(writeonoff);
whilestop=OFF(readstop);
time:=update(time)(writetime);

P1.1
loop
iftemp<pos half_degree thenonoff :=on;
elsif temp>pos +half_degree thenonoff :=off;
end if;
waitfor10s;
end loop;

4.Existen instrucciones que ejecutan clculos.


temp (pos half_degree);
update(time);

loop
ifreset=ONthentime:=0;
elsif start=ONthen
whilestop=OFFloop
ifref_positive_edge =TRUEthen
time:=update(time);
endif;
endloop;
endif;
endloop;
9

Conclusin (otra idea)

P1.1

Opcin 2: Disear unnuevo (meta)sistema genrico que incluya

Puertos deentrada(IN0,IN1,IN2,),
Puertos desalida,OUT1,OUT2,),
Elementos dememoria capaces dealmacenar datos (X0,X1,X2,),
Recursos decmputo que permitan realizar clculos (+,,),

Yque seacapaz deinterpretar instruciones como

Xi :=A (A constante);
Xi :=INj;
OUTi :=Xj;
OUTi :=A (A constante);
Xi :=f(Xj,Xk)(f =>unrecurso decmputo);
goto n,donde n es unnmero deinstruccin;
if condicion goto n,donde n es unnmero deinstruccin.
10

RESUMEN

P1.1

Sistemagenrico:
Capaz deimplementar cualquier
algoritmo

Lista deinstrucciones (programa):


Dependiendo delalgoritmo particularque se
desee implementar

11

P1.1

12

P1.2

P1.2 EJEMPLOS DE PROGRAMAS


Llus Ters
Instituto de Microelectrnica de Barcelona, IMB-CNM (CSIC)
Universitat Autnoma de Barcelona (UAB)

1.Controladordetemperatura

P1.2

loop
iftemp<pos thenonoff :=on;
elsif temp>pos thenonoff :=off;
end if;
waitfor10s;
end loop;

14

Tipos deinstruccin:

P1.2

Xi :=A;
Xi :=INj;
OUTi :=Xj;
OUTi :=A;
Xi :=Xj +Xk;
Xi :=Xj Xk;
goto n;
if Xi <0goto n;
if Xi >0goto n;

15

Seis elementos dememoria paraalmacenar los


datos:

P1.2

X0:temp(ledo por IN0)


X1:pos (ledo por IN1)
X2:time (ledo por IN2)
X3:initialtime(ledo por IN2)
X4:computationresult(generado interamente)
X5:constant10 (generado interamente)

16

loop
iftemp<pos thenonoff :=on;
elsif temp>pos thenonoff :=off;
end if;
waitfor10s;
end loop;

P1.2

X0:temp(ledo por IN0)


X1:pos (ledo por IN1)
X2:time (ledo por IN2)
X3:initialtime(ledo por IN2)
X4:computationresult(generado interamente)
X5:constant10 (generado interamente)

17

loop
iftemp<pos thenonoff :=on;
elsif temp>pos thenonoff :=off;
end if;
waitfor10s;
end loop;

P1.2

X0:temp(ledo por IN0)


X1:pos (ledo por IN1)
X2:time (ledo por IN2)
X3:initialtime(ledo por IN2)
X4:computationresult(generado interamente)
X5:constant10 (generado interamente)

18

P1.2
0:X5:=10;
1:X0:=IN0;
2:X1:=IN1;
3:X4:=X0 X1;
4:ifX4<0thengoto7;
5:ifX4>0thengoto9;
6:goto10;
7:OUT0:=1;
8:goto10;
9:OUT0:=0;
10:X3:=IN2;
11:X2:=IN2;
12:X4:=X2 X3;
13:X4:=X4 X5;
14:ifX4<0thengoto11;
15:goto1;

19

2.Cronmetro

P1.2

loop
ifreset=ONthentime:=0;
elsif start=ONthen
whilestop=OFFloop
ifref_positive_edge =TRUEthen
time:=update(time);
endif;
endloop;
endif;
endloop;

20

P1.2
Cuatro elementos dememoria paraalmecenar losdatos:
X0:reset,start,stop, refo computationresult
(ledo por IN0,IN1,IN2,IN3ogenerado internamente)
X1:initialref (ledo por IN3)
X2:time(generado internamente)
X3:constant1 (generado internamente)

21

P1.2
loop
ifreset=ONthentime:=0;
elsif start=ONthen
whilestop=OFFloop
ifref_positive_edge =TRUEthen
time:=update(time);
endif;
endloop;
endif;
endloop;

X0:reset,start,stop, refo computationresult


(ledo por IN0,IN1,IN2,IN3ogenerado internamente)
X1:initialref (ledo por IN3)
X2:time(generado internamente)
X3:constant1 (generado internamente)

Tiempo de
ejecucin de
cada
instruccin
<<Tref =0.1s

22

P1.2
loop
ifreset=ONthentime:=0;
elsif start=ONthen
whilestop=OFFloop
ifref_positive_edge =TRUEthen
time:=update(time);
endif;
endloop;
endif;
endloop;

X0:reset,start,stop, refo computationresult


(ledo por IN0,IN1,IN2,IN3ogenerado internamente)
X1:initialref (ledo por IN3)
X2:time(generado internamente)
X3:constant1 (generado internamente)

Tiempo de
ejecucin de
cada
instruccin
<<Tref =0.1s

23

P1.2

(Ejercicio)

Construir elprograma correspondiente adiagrama defujo anterior.Paraello debis asignar


nmeros alas instrucciones tal como aparecen en loscuadros siguientes:

cc
i: instruccin;
i+1: instrucin siguiente;

i: if a_condition goto j;
i+1: an_instruction;

j: another_instruction;

Tipos deinstruccin

Xi :=A;

Xi :=INj;

OUTi :=Xj;

OUTi :=A;

Xi :=Xj +Xk;

Xi :=Xj Xk;

goto n;

if Xi <0goto n;

if Xi >0goto n;

i-1: an instruction
i: go to j;

j: another_instruction;
24

(Solucin)
0:X3:=1:
1:X0 :=IN0;
2:ifX0>0thengoto6;
3:X0 :=IN1;
4:ifX0>0thengoto9;
5:goto1;
6:X2 :=0;
7:OUT0:=X2;
8:goto1;
9:X0;=IN2;
10:ifX0>0thengoto1;
11:X1:=IN3;
12:X0:=IN3;
13:X0:=X0 X1;
14:ifX0>0thengoto16;
15:goto9;
16:X2:=X2+X3;
17:OUT0:=X2;
18:goto9;

P1.2

25

RESUMEN

P1.2

Hemos definido (parcialmente)unsistema genrico alque hemos dadoelnombre de


PROCESADOR.
Dicho sistema permite implementar algoritmos muy distintos entres.
Hemos visto dosejemplos sencillos decmo utilizarlo.

26

You might also like