aboutsummaryrefslogtreecommitdiffstats
path: root/awlsim/core/cpu.pxd.in
blob: 4ac28e08a64710cd88a3534f80382c79df9f9eb6 (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
from awlsim.common.cython_support cimport *
from awlsim.core.statusword cimport *
from awlsim.core.callstack cimport *
from awlsim.core.lstack cimport *
from awlsim.core.offset cimport *
from awlsim.core.operators cimport *
from awlsim.core.memory cimport *
from awlsim.core.blocks cimport *
from awlsim.core.datablocks cimport *
from awlsim.core.timers cimport *
from awlsim.core.counters cimport *
from awlsim.common.cpuspecs cimport *


cdef class S7CPU(object):
	cdef public object cbCycleExit
	cdef public object cbCycleExitData
	cdef public object cbBlockExit
	cdef public object cbBlockExitData
	cdef public object cbPostInsn
	cdef public object cbPostInsnData
	cdef public object cbPeripheralRead
	cdef public object cbPeripheralReadData
	cdef public object cbPeripheralWrite
	cdef public object cbPeripheralWriteData
	cdef public object cbScreenUpdate
	cdef public object cbScreenUpdateData

	cdef public double now
	cdef public double __nowOffset

	cdef public S7CPUSpecs specs
	cdef public object conf
	cdef public object prog
	cdef public double cycleTimeLimit
	cdef public double __runtimeLimit
	cdef public _Bool __obTempPresetsEnabled
	cdef public _Bool __extendedInsnsEnabled
	cdef public dict __dateAndTimeWeekdayMap

	cdef public dict udts
	cdef public dict dbs
	cdef public dict obs
	cdef public dict obTempPresetHandlers
	cdef public dict fcs
	cdef public dict fbs
	cdef public dict sfcs
	cdef public dict sfbs

	cdef public S7StatusWord statusWord
	cdef public _Bool is4accu
	cdef public Accu accu1
	cdef public Accu accu2
	cdef public Accu accu3
	cdef public Accu accu4
	cdef public list timers
	cdef public list counters
	cdef public AwlMemory flags
	cdef public AwlMemory inputs
	cdef public AwlMemory outputs
	cdef public Addressregister ar1
	cdef public Addressregister ar2
	cdef public DB dbRegister
	cdef public DB diRegister
	cdef public DB db0

	cdef public _Bool mcrActive
	cdef public list mcrStack

	cdef public AwlOffset __clockMemByteOffset
	cdef public double __nextClockMemTime
	cdef public uint32_t __clockMemCount
	cdef public uint32_t __clockMemCountLCM

	cdef public int32_t relativeJump
	cdef public CallStackElem callStackTop
	cdef public uint32_t callStackDepth
	cdef public LStackAllocator activeLStack

	cdef public uint32_t __insnCount
	cdef public uint32_t __cycleCount
	cdef public double insnPerSecond
	cdef public double avgInsnPerCycle
	cdef public double cycleStartTime
	cdef public double minCycleTime
	cdef public double maxCycleTime
	cdef public double avgCycleTime
	cdef public object __avgCycleTimes
	cdef public uint32_t __avgCycleTimesCount
	cdef public double __avgCycleTimesSum
	cdef public double startupTime
	cdef public double __speedMeasureStartTime
	cdef public uint32_t __speedMeasureStartInsnCount
	cdef public uint32_t __speedMeasureStartCycleCount

	cdef void setMcrActive(self, _Bool active)
	cdef _Bool mcrIsOn(self)
	cdef mcrStackAppend(self, S7StatusWord statusWord)
	cdef mcrStackPop(self)

	cpdef object fetch(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchIMM(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchIMM_DT(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchIMM_PTR(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchIMM_STR(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchDBLG(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchDBNO(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchDILG(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchDINO(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchAR2(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchSTW(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchSTW_Z(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchSTW_NZ(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchSTW_POS(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchSTW_NEG(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchSTW_POSZ(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchSTW_NEGZ(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchSTW_UO(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchE(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchA(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchM(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchL(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchVL(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchDB(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchDI(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchPE(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchT(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchZ(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchNAMED_LOCAL(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchNAMED_LOCAL_PTR(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchNAMED_DBVAR(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchINDIRECT(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchVirtACCU(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchVirtAR(self, AwlOperator operator, uint32_t allowedWidths)
	cdef object __fetchVirtDBR(self, AwlOperator operator, uint32_t allowedWidths)

	cpdef store(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeE(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeA(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeM(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeL(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeVL(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeDB(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeDI(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storePA(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeAR2(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeSTW(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeNAMED_LOCAL(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeNAMED_DBVAR(self, AwlOperator operator, object value, uint32_t allowedWidths)
	cdef __storeINDIRECT(self, AwlOperator operator, object value, uint32_t allowedWidths)

	cpdef bytearray fetchOutputRange(self, uint32_t byteOffset, uint32_t byteCount)
	cpdef bytearray fetchInputRange(self, uint32_t byteOffset, uint32_t byteCount)
	cpdef storeInputRange(self, uint32_t byteOffset, bytearray data)

	cdef updateTimestamp(self)
	cdef __cycleTimeExceed(self)
	cdef __runTimeExceed(self)

	cdef runCycle(self)
	cdef __runOB(self, OB block)
	cdef run_BE(self)
	cdef openDB(self, int32_t dbNumber, _Bool openDI)
	cdef run_AUF(self, AwlOperator dbOper)
	cdef run_TDB(self)

	cdef Accu getAccu(self, uint32_t index)
	cdef Addressregister getAR(self, uint32_t index)
	cdef Timer getTimer(self, uint32_t index)
	cdef Counter getCounter(self, uint32_t index)

	cdef int32_t labelIdxToRelJump(self, uint32_t labelIndex) except? 0x7FFFFFFF
	cdef jumpToLabel(self, uint32_t labelIndex)
	cdef jumpRelative(self, int32_t insnOffset)

	cdef run_CALL(self, AwlOperator blockOper, AwlOperator dbOper=*, tuple parameters=*, _Bool raw=*)
	cdef CallStackElem __call_FC(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)
	cdef CallStackElem __call_RAW_FC(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)
	cdef CallStackElem __call_FB(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)
	cdef CallStackElem __call_RAW_FB(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)
	cdef CallStackElem __call_SFC(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)
	cdef CallStackElem __call_RAW_SFC(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)
	cdef CallStackElem __call_SFB(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)
	cdef CallStackElem __call_RAW_SFB(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)
	cdef CallStackElem __call_INDIRECT(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)
	cdef CallStackElem __call_MULTI_FB(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)
	cdef CallStackElem __call_MULTI_SFB(self, AwlOperator blockOper, AwlOperator dbOper, tuple parameters)

	cdef AwlOperator __translateFCNamedLocalOper(self, AwlOperator operator, _Bool store)

	cdef makeCurrentDateAndTime(self, bytearray byteArray, uint32_t offset)

	cdef __dumpLStackFrame(self, prefix, LStackFrame *frame)
bues.ch cgit interface