Hardware Reference
In-Depth Information
lines 24-42, relative to state A, that the output values are now conditional. Compare
these lines against lines 30-37 in the previous template.
1 //Timed Mealy machine with timer control strategy #1
2 //Part 1: Module header:----------------------------
3
(same as for category 2 Moore, section 10.2)
4
5 //Part 2: Declarations:-----------------------------
6
7
//FSM-related declarations:
8
(same as for category 2 Moore, section 10.2)
9
10
//Timer-related declarations:
11
(same as for category 2 Moore, section 10.2)
12
13 //Part 3: Statements:-------------------------------
14
15
//Timer (using timer control strategy #1):
16
(same as for category 2 Moore, section 10.2)
17
18
//FSM state register:
19
(same as for category 2 Moore, section 10.2)
20
21
//FSM combinational logic:
22
always_comb
23
case (pr_state)
24
A:
25
if (... and t>=T1-1) begin
26
outp1 <= <value>;
27
outp2 <= <value>;
28
...
29
nx_state <= B;
30
end
31
else if (... and t>=T2-1) begin
32
outp1 <= <value>;
33
outp2 <= <value>;
34
...
35
nx_state <= ...;
36
end
37
else begin
38
outp1 <= <value>;
39
outp2 <= <value>;
40
...
41
nx_state <= A;
42
end
43
B:
44
if (... and t>=T3-1) begin
45
outp1 <= <value>;
46
outp2 <= <value>;
47
...
48
nx_state <= C;
49
end
50
else if (condition) begin
51
outp1 <= <value>;
52
outp2 <= <value>;
Search WWH ::




Custom Search