summaryrefslogtreecommitdiffstats
path: root/tests/700-hardware/linuxcnc/linuxcnc-iotest.awl__
blob: 95a7810cbd876ff5103e320a6ae74974598ef448 (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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
ORGANIZATION_BLOCK OB 1
BEGIN
	// Decide which cycle we are in.
	L		MW 0
	SPL	 	def
	SPA		cyc0
	SPA		cyc1
	SPA		fini
def:	SPA		err
err:	__ASSERT==	0,		1


	// Begin: FIRST CYCLE
cyc0:	NOP		0

	// Check initial states of all wired inputs.
	__STWRST
	U		E 0.0
	__ASSERT==	__STW VKE,	0
	__STWRST
	L		EB 1
	__ASSERT==	__ACCU 1,	0
	L		EW 2
	__ASSERT==	__ACCU 1,	0
	L		EW 4
	__ASSERT==	__ACCU 1,	0
	L		ED 6
	__ASSERT==	__ACCU 1,	0
	L		ED 10
	__ASSERT==	__ACCU 1,	0
	L		ED 14
	__ASSERT==	__ACCU 1,	0

	// Check initial states of all wired outputs.
	__STWRST
	U		A 0.0
	__ASSERT==	__STW VKE,	0
	__STWRST
	L		AB 1
	__ASSERT==	__ACCU 1,	0
	L		AW 2
	__ASSERT==	__ACCU 1,	0
	L		AW 4
	__ASSERT==	__ACCU 1,	0
	L		AD 6
	__ASSERT==	__ACCU 1,	0
	L		AD 10
	__ASSERT==	__ACCU 1,	0
	L		AD 14
	__ASSERT==	__ACCU 1,	0

	// Feed all wired outputs with magic values.
	// These will be mirrored by the fake-HAL to the inputs.
	__STWRST
	SET
	=		A 0.0
	__STWRST
	L		B#16#42
	T		AB 1
	L		4242
	T		AW 2
	L		-4242
	T		AW 4
	L		L#42424242
	T		AD 6
	L		L#-42424242
	T		AD 10
	L		42.42
	T		AD 14

	// Check whether outputs have changed.
	__STWRST
	U		A 0.0
	__ASSERT==	__STW VKE,	1
	__STWRST
	L		AB 1
	__ASSERT==	__ACCU 1,	B#16#42
	L		AW 2
	__ASSERT==	__ACCU 1,	4242
	L		AW 4
	__ASSERT==	__ACCU 1,	-4242
	L		AD 6
	__ASSERT==	__ACCU 1,	L#42424242
	L		AD 10
	__ASSERT==	__ACCU 1,	L#-42424242
	L		AD 14
	__ASSERT==	__ACCU 1,	42.42

	// Check that inputs have not changed, yet.
	__STWRST
	U		E 0.0
	__ASSERT==	__STW VKE,	0
	__STWRST
	L		EB 1
	__ASSERT==	__ACCU 1,	0
	L		EW 2
	__ASSERT==	__ACCU 1,	0
	L		EW 4
	__ASSERT==	__ACCU 1,	0
	L		ED 6
	__ASSERT==	__ACCU 1,	0
	L		ED 10
	__ASSERT==	__ACCU 1,	0
	L		ED 14
	__ASSERT==	__ACCU 1,	0

	// End: First cycle done
	SPA		done



	// Begin: SECOND CYCLE
cyc1:	NOP		0

	// Check if the magic output values are still present.
	__STWRST
	U		A 0.0
	__ASSERT==	__STW VKE,	1
	__STWRST
	L		AB 1
	__ASSERT==	__ACCU 1,	B#16#42
	L		AW 2
	__ASSERT==	__ACCU 1,	4242
	L		AW 4
	__ASSERT==	__ACCU 1,	-4242
	L		AD 6
	__ASSERT==	__ACCU 1,	L#42424242
	L		AD 10
	__ASSERT==	__ACCU 1,	L#-42424242
	L		AD 14
	__ASSERT==	__ACCU 1,	42.42

	// Check if the magic output values were mirrored by fake-HAL.
	__STWRST
	U		E 0.0
	__ASSERT==	__STW VKE,	1
	__STWRST
	L		EB 1
	__ASSERT==	__ACCU 1,	B#16#42
	L		EW 2
	__ASSERT==	__ACCU 1,	4242
	L		EW 4
	__ASSERT==	__ACCU 1,	-4242
	L		ED 6
	__ASSERT==	__ACCU 1,	L#42424242
	L		ED 10
	__ASSERT==	__ACCU 1,	L#-42424242
	L		ED 14
	__ASSERT==	__ACCU 1,	42.42

	// End: Second cycle done
	SPA		done



	// Shutdown
	__ASSERT==	1,		2
fini:	CALL		SFC 46 // STOP CPU
	__ASSERT==	1,		2


	// Increment cycle counter
done:	L		MW 0
	+		1
	T		MW 0
END_ORGANIZATION_BLOCK
bues.ch cgit interface