- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
FUNCTION mimi (a, b, c)
RETURNS (res);
SUBDESIGN kuku
(
clk,d: INPUT;
q[8..0],enn: OUTPUT;
)
VARIABLE
mimi1:mimi;
reg[8..0]:dff;
c1[1..0]:dff;
c2[2..0]:dff;
t[1..0]:dff;
sm : MACHINE
WITH STATES (waiting,working,ending);
BEGIN
reg[].clk=clk;
c1[].clk=clk;
c2[].clk=clk;
t[].clk=clk;
sm.clk=clk;
mimi1.a=t[0];
mimi1.b=t[1];
mimi1.c=d;
q[]=reg[].q;
IF sm == waiting THEN
IF d == vcc THEN
c2[].d = 0;
reg[].d = 0;
t[] = 0;
CASE c1[].q IS
WHEN 0 =>
c1[].d = 1;
WHEN 1 =>
c1[].d = 2;
WHEN 2 =>
c1[].d = 0;
sm = working;
END CASE;
ELSE
sm = waiting;
c1[].d = 0;
c2[].d = 0;
reg[].d = 0;
t[] = 0;
END IF;
END IF;
IF sm == working THEN
CASE c1[].q IS
WHEN 0 =>
c1[].d = 1;
c2[].d = c2[].q;
reg[].d = reg[].q;
t[0].d = d;
t[1].d = t[1].q;
WHEN 1 =>
c1[].d = 2;
c2[].d = c2[].q;
reg[].d = reg[].q;
t[0].d = t[0].q;
t[1].d = d;
WHEN 2 =>
c1[].d = 0;
c2[].d = c2[].q + 1;
reg[0].d = mimi1.res;
FOR I IN 1 TO 8 GENERATE
reg[i].d = reg[i-1].q;
END GENERATE;
IF c2[].q == 7 THEN
sm = ending;
ELSE
sm = working;
END IF;
END CASE;
END IF;
IF sm == ending THEN
reg[].d = reg[].q;
IF d == vcc THEN
CASE c1[].q IS
WHEN 0 =>
c1[].d = 1;
WHEN 1 =>
c1[].d = 2;
WHEN 2 =>
c1[].d = 0;
sm = waiting;
Комментарии (0) RSS
Добавить комментарий