summaryrefslogtreecommitdiffstats
path: root/Bachelor/Digitaltechnik 2/SS07/P6/p6a1b.abl
blob: c3846cea381c0dbbd95996a9e86d639d00079890 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
MODULE ampel1
TITLE 'Ampelsteuerung 1, state diagram'
DEClARATIONS
	clk pin 15;  " I/O 0, Eingang f�r den Takt
	rst pin 16;  " I/O 1, Eingang f�r das Reset Signal
	ce  pin 17;  " I/O 2, Eingang f�r das Enable Signal
	vg,vy,vr,fg,fr pin 25,26,27,28,29 istype 'reg'; " I/O 8,9,10,11,12
	state0 node istype 'reg';
	state1 node istype 'reg';

" bus definition, vector, register
	ampel = [vg,vy,vr,fg,fr];
	states =[state0,state1];

EQUATIONS
	ampel.clk = clk;
	states.clk = clk;

STATE_DIAGRAM states;
	State 0:
		ampel:=17;
		if(!rst & ce) then 1; " Bei Erf�llung der Bedingung erfolgt ein �bergang in State 1
		else 0;
	State 1:
		ampel:=9;
		if (rst) then 0;
		else if (ce) then 2;
		else 0;
	State 2:
		ampel:=6;
		if (rst) then 0;
		else if (ce) then 3;
		else 0;
	State 3:
		ampel:=13;
		if (rst) then 0;
		else if (ce) then 0;
		else 0;
	
END