-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathpipeline8.si
112 lines (99 loc) · 1.91 KB
/
pipeline8.si
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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
// mockup of multi-fsm pipeline
unit C(input uint8 i,output! uint8 o,output! uint1 last(0))
{
always_before{ last = 0; }
algorithm {
uint8 t(0);
t = i;
++:
t = t + 1;
++:
t = t + 1;
++:
t = t + 1;
o = t;
last = 1;
}
}
unit B(input uint8 i,output! uint8 o,output! uint1 last(0))
{
always_before{ last = 0; }
algorithm {
uint8 t(0);
t = i;
++:
t = t + 1;
++:
t = t + 1;
o = t;
last = 1;
}
}
unit A(input uint8 i,output! uint8 o,output! uint1 last(0))
{
always_before{ last = 0; }
algorithm {
uint8 t(0);
t = i;
++:
t = t + 1;
o = t;
last = 1;
}
}
unit main(output uint8 leds)
{
uint32 cycle(0);
A a; B b; C c;
algorithm { while (1) {
{
// stage 0
uint1 valid(0);
uint1 first(1);
if (a.last | first) {
// next
a.i = cycle;
first = 0;
valid = 1;
}
if (valid & (b.last | isdone(b))) {
a <- ();
valid = 0;
__display("[cycle %d] A (a.i:%d)",cycle,a.i);
__display("[cycle %d] ==== input :%d",cycle,a.i);
}
// check at every cycle
if (c.last) {
__display("[cycle %d] ==== result:%d",cycle,c.o);
}
cycle vv= cycle + 1;
// ^ assigns out of pipeline
if (cycle == 40) { __finish(); }
-> // stage 1
uint1 valid(0);
if (a.last) {
// next
b.i = a.o;
valid = 1;
}
if (valid & (b.last | isdone(b))
& (c.last | isdone(c))) {
b <- ();
valid = 0;
__display("[cycle %d] B (b.i:%d)",cycle,b.i);
}
-> // stage 2
uint1 valid(0);
if (b.last) {
// next
c.i = b.o;
valid = 1;
}
if (valid & (c.last | isdone(c))) {
c <- ();
valid = 0;
__display("[cycle %d] C (c.i:%d)",cycle,c.i);
}
} // end of pipeline
} }
}