ConOpSys V2970  P004.07
ANVILEX control operating system
AVM_Defines.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file AVM_Defines.h
3 //! @brief Scope defines header file.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2015-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Defines/AVM_Defines.h $
7 //! $Revision: 2075 $
8 //! $Date: 2020-09-12 14:00:31 +0500 (Сб, 12 сен 2020) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //------------------------------------------------------------------------------
38 
39 //------------------------------------------------------------------------------
40 // Protecting header files from mutual, recursive inclusion.
41 //------------------------------------------------------------------------------
42 
43 #pragma once
44 
45 //------------------------------------------------------------------------------
46 // Include standard libraries header files
47 //------------------------------------------------------------------------------
48 
49 //------------------------------------------------------------------------------
50 // Include thrid party header files
51 //------------------------------------------------------------------------------
52 
53 //------------------------------------------------------------------------------
54 // Include ConOpSys header files
55 //------------------------------------------------------------------------------
56 
57 #include "Defines.h"
58 
59 //------------------------------------------------------------------------------
60 // Include ConOpSys application header files
61 //------------------------------------------------------------------------------
62 
63 //------------------------------------------------------------------------------
64 // Macros
65 //------------------------------------------------------------------------------
66 
67 //! @brief Commands for vertual machine
68 enum class TConOpSys_Opcode : U16
69 {
70 
71  //! @brief Unassigned command
73 
74  //! @brief Unknown command
75  enum_Unknown_Command = 1023,
76 
77  //----------------------------------------------------------------------------
78  // Unar operators
79  //----------------------------------------------------------------------------
80 
81  // '-'
82  enum_NEG_I8 = 1,
83  enum_NEG_I16 = 2,
84  enum_NEG_U16 = 3,
85  enum_NEG_I32 = 4,
86  enum_NEG_F32 = 5,
87  enum_NEG_I64 = 6,
88  enum_NEG_F64 = 7,
89 
90  // '!'
91  enum_NOT_BOOL = 8,
92  enum_NOT_I8 = 9,
93  enum_NOT_U8 = 10,
94  enum_NOT_I16 = 11,
95  enum_NOT_U16 = 12,
96  enum_NOT_I32 = 13,
97  enum_NOT_U32 = 14,
98  enum_NOT_F32 = 15,
99  enum_NOT_I64 = 16,
100  enum_NOT_U64 = 17,
101  enum_NOT_F64 = 18,
102 
103  //----------------------------------------------------------------------------
104  // Binar operators
105  //----------------------------------------------------------------------------
106 
107  // '**'
108  enum_POW_I8 = 20,
109  enum_POW_U8 = 21,
110  enum_POW_I16 = 22,
111  enum_POW_U16 = 23,
112  enum_POW_I32 = 24,
113  enum_POW_U32 = 25,
114  enum_POW_F32 = 26,
115  enum_POW_I64 = 27,
116  enum_POW_U64 = 28,
117  enum_POW_F64 = 29,
118 
119  // '*'
120  enum_MUL_I8 = 30,
121  enum_MUL_U8 = 31,
122  enum_MUL_I16 = 32,
123  enum_MUL_U16 = 33,
124  enum_MUL_I32 = 34,
125  enum_MUL_U32 = 35,
126  enum_MUL_F32 = 36,
127  enum_MUL_I64 = 37,
128  enum_MUL_U64 = 38,
129  enum_MUL_F64 = 39,
130 
131  // '/'
132  enum_DIV_I8 = 40,
133  enum_DIV_U8 = 41,
134  enum_DIV_I16 = 42,
135  enum_DIV_U16 = 43,
136  enum_DIV_I32 = 44,
137  enum_DIV_U32 = 45,
138  enum_DIV_F32 = 46,
139  enum_DIV_I64 = 47,
140  enum_DIV_U64 = 48,
141  enum_DIV_F64 = 49,
142 
143  // '%'
144  enum_MOD_I8 = 50,
145  enum_MOD_U8 = 51,
146  enum_MOD_I16 = 52,
147  enum_MOD_U16 = 53,
148  enum_MOD_I32 = 54,
149  enum_MOD_U32 = 55,
150  enum_MOD_F32 = 56,
151  enum_MOD_I64 = 57,
152  enum_MOD_U64 = 58,
153  enum_MOD_F64 = 59,
154 
155  // '+'
156  enum_ADD_I8 = 60,
157  enum_ADD_U8 = 61,
158  enum_ADD_I16 = 62,
159  enum_ADD_U16 = 63,
160  enum_ADD_I32 = 64,
161  enum_ADD_U32 = 65,
162  enum_ADD_F32 = 66,
163  enum_ADD_I64 = 67,
164  enum_ADD_U64 = 68,
165  enum_ADD_F64 = 69,
166 
167  // '-'
168  enum_SUB_I8 = 70,
169  enum_SUB_U8 = 71,
170  enum_SUB_I16 = 72,
171  enum_SUB_U16 = 73,
172  enum_SUB_I32 = 74,
173  enum_SUB_U32 = 75,
174  enum_SUB_F32 = 76,
175  enum_SUB_I64 = 77,
176  enum_SUB_U64 = 78,
177  enum_SUB_F64 = 79,
178 
179  // '<'
180  enum_JL_I8 = 80,
181  enum_JL_U8 = 81,
182  enum_JL_I16 = 82,
183  enum_JL_U16 = 83,
184  enum_JL_I32 = 84,
185  enum_JL_U32 = 85,
186  enum_JL_F32 = 86,
187  enum_JL_I64 = 87,
188  enum_JL_U64 = 88,
189  enum_JL_F64 = 89,
190 
191  // '>'
192  enum_JG_I8 = 90,
193  enum_JG_U8 = 91,
194  enum_JG_I16 = 92,
195  enum_JG_U16 = 93,
196  enum_JG_I32 = 94,
197  enum_JG_U32 = 95,
198  enum_JG_F32 = 96,
199  enum_JG_I64 = 97,
200  enum_JG_U64 = 98,
201  enum_JG_F64 = 99,
202 
203  // '<='
204  enum_JLE_I8 = 100,
205  enum_JLE_U8 = 101,
206  enum_JLE_I16 = 102,
207  enum_JLE_U16 = 103,
208  enum_JLE_I32 = 104,
209  enum_JLE_U32 = 105,
210  enum_JLE_F32 = 106,
211  enum_JLE_I64 = 107,
212  enum_JLE_U64 = 108,
213  enum_JLE_F64 = 109,
214 
215  // '>='
216  enum_JGE_I8 = 110,
217  enum_JGE_U8 = 111,
218  enum_JGE_I16 = 112,
219  enum_JGE_U16 = 113,
220  enum_JGE_I32 = 114,
221  enum_JGE_U32 = 115,
222  enum_JGE_F32 = 116,
223  enum_JGE_I64 = 117,
224  enum_JGE_U64 = 118,
225  enum_JGE_F64 = 119,
226 
227  // '=='
228  enum_EQUL_BOOL = 120,
229  enum_EQUL_I8 = 121,
230  enum_EQUL_U8 = 122,
231  enum_EQUL_I16 = 123,
232  enum_EQUL_U16 = 124,
233  enum_EQUL_I32 = 125,
234  enum_EQUL_U32 = 126,
235  enum_EQUL_F32 = 127,
236  enum_EQUL_I64 = 128,
237  enum_EQUL_U64 = 129,
238  enum_EQUL_F64 = 130,
239 
240  // '!='
241  enum_NOT_EQUL_BOOL = 131,
242  enum_NOT_EQUL_I8 = 132,
243  enum_NOT_EQUL_U8 = 133,
244  enum_NOT_EQUL_I16 = 134,
245  enum_NOT_EQUL_U16 = 135,
246  enum_NOT_EQUL_I32 = 136,
247  enum_NOT_EQUL_U32 = 137,
248  enum_NOT_EQUL_F32 = 138,
249  enum_NOT_EQUL_I64 = 139,
250  enum_NOT_EQUL_U64 = 140,
251  enum_NOT_EQUL_F64 = 141,
252 
253  // '&&'
254  enum_AND_BOOL = 142,
255  enum_AND_I8 = 143,
256  enum_AND_U8 = 144,
257  enum_AND_I16 = 145,
258  enum_AND_U16 = 146,
259  enum_AND_I32 = 147,
260  enum_AND_U32 = 148,
261  enum_AND_F32 = 149,
262  enum_AND_I64 = 150,
263  enum_AND_U64 = 151,
264  enum_AND_F64 = 152,
265 
266  // '~~'
267  enum_XOR_BOOL = 153,
268  enum_XOR_I8 = 154,
269  enum_XOR_U8 = 155,
270  enum_XOR_I16 = 156,
271  enum_XOR_U16 = 157,
272  enum_XOR_I32 = 158,
273  enum_XOR_U32 = 159,
274  enum_XOR_F32 = 160,
275  enum_XOR_I64 = 161,
276  enum_XOR_U64 = 162,
277  enum_XOR_F64 = 163,
278 
279  // '||'
280  enum_OR_BOOL = 164,
281  enum_OR_I8 = 165,
282  enum_OR_U8 = 166,
283  enum_OR_I16 = 167,
284  enum_OR_U16 = 168,
285  enum_OR_I32 = 169,
286  enum_OR_U32 = 170,
287  enum_OR_F32 = 171,
288  enum_OR_I64 = 172,
289  enum_OR_U64 = 173,
290  enum_OR_F64 = 174,
291 
292  //! @brief Unconditional jump command
293  enum_GO_TO = 200,
294 
295  //! @brief Сonditional jump command
296  enum_IF_GO_TO = 201,
297 
298  //! @brief Halt program execution instruction
299  enum_HALT = 202,
300 
301  //----------------------------------------------------------------------------
302  // Stack operation instructions
303  //----------------------------------------------------------------------------
304 
305  // S[SP] <= PC
306  // SP = SP - 1
307  // PC <= OP1
308  enum_CALL = 210,
309 
310  //! @brief Move Debug
311  //! @note May be replased by COPY SP, M[] command
312  enum_RET = 211,
313 
314  //----------------------------------------------------------------------------
315  // Data transfer instructions
316  //----------------------------------------------------------------------------
317 
318  //! @brief Copy command
319  enum_COPY_BOOL = 221,
320  enum_COPY_I8 = 222,
321  enum_COPY_U8 = 223,
322  enum_COPY_I16 = 224,
323  enum_COPY_U16 = 225,
324  enum_COPY_I32 = 226,
325  enum_COPY_U32 = 227,
326  enum_COPY_F32 = 228,
327  enum_COPY_I64 = 229,
328  enum_COPY_U64 = 230,
329  enum_COPY_F64 = 231,
330 
331  //! @brief Flush result register to data destination
332 // enum_FLUSH,
333 
334 };
335 
336 //! @brief Operand location
338 {
339 
340  //! @brief Input allocated opreand
342 
343  //! @brief Memory allocated opreand
345 
346  //! @brief Parameter allocated opreand
348 
349  //! @brief Immidiate value opreand
351 
352 };
353 
354 //! @brief Result location
356 {
357 
358  //! @brief Output allocated opreand
360 
361  //! @brief Memory allocated opreand
363 
364  //! @brief Parameter allocated opreand
366 
367 };
368 
369 //------------------------------------------------------------------------------
370 // End Of File
371 //------------------------------------------------------------------------------
TConOpSys_Operand_Type
Operand location.
Definition: AVM_Defines.h:338
@ enum_Immidiate_Data_Type
Immidiate value opreand.
@ enum_Input_Data_Type
Input allocated opreand.
@ enum_Parameter_Data_Type
Parameter allocated opreand.
@ enum_Memory_Data_Type
Memory allocated opreand.
TConOpSys_Result_Type
Result location.
Definition: AVM_Defines.h:356
@ enum_Output_Data_Type
Output allocated opreand.
TConOpSys_Opcode
Commands for vertual machine.
Definition: AVM_Defines.h:69
@ enum_Unassigned_Command
Unassigned command.
@ enum_GO_TO
Unconditional jump command.
@ enum_IF_GO_TO
Сonditional jump command.
@ enum_COPY_BOOL
Copy command.
@ enum_HALT
Halt program execution instruction.
@ enum_RET
Move Debug.
@ enum_Unknown_Command
Unknown command.
ConOpSys data type definitions header file.
unsigned short U16
Binary 16-Bit unsigned integer datatype defenition.
Definition: Defines.h:193