ConOpSys V2970  P004.07
ANVILEX control operating system
AVM2020.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file AVM2020.h
3 //! @brief Anvilex vertual machine class 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/Engine/Virtual_Machine/AVM2020.h $
7 //! $Revision: 2264 $
8 //! $Date: 2020-12-05 09:59:27 +0500 (Сб, 05 дек 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 #pragma once
41 
42 //------------------------------------------------------------------------------
43 // System includes
44 //------------------------------------------------------------------------------
45 
46 #include "System_Resource.h"
47 #include "AVM_Defines.h"
48 
49 //------------------------------------------------------------------------------
50 
51 #define MAX_STACK_INDEX 256
52 
53 //------------------------------------------------------------------------------
54 // Class declaration
55 //------------------------------------------------------------------------------
56 
57 //! @brief Anvilex vertual machine class
58 //! @details None
59 class AVM2020
60 {
61 
62  //----------------------------------------------------------------------------
63  // Public defines, methods and variables
64  //----------------------------------------------------------------------------
65 
66  public:
67 
68  //--------------------------------------------------------------------------
69  // Public methods
70  //--------------------------------------------------------------------------
71 
72  //!-------------------------------------------------------------------------
73  //! @brief Class constructor method
74  //! @note The method create application object.
75  //! @return None
76  //! \par Override
77  //! Not allowed
78  //! @attention Don't call this method directly.
79  //--------------------------------------------------------------------------
80 
81  AVM2020();
82 
83  //!-------------------------------------------------------------------------
84  //! @brief Application destructor method
85  //! @note The method destroys application object.
86  //! @return None
87  //! \par Override
88  //! Not allowed
89  //! @attention Don't call this method directly.
90  //--------------------------------------------------------------------------
91 
92  ~AVM2020();
93 
94  //!-------------------------------------------------------------------------
95  //! @brief Application initialisation method
96  //! @note The method initialise hardware and system objects.
97  //! @return None
98  //! \par Override
99  //! Allowed
100  //! @attention Don't call this method directly.
101  //--------------------------------------------------------------------------
102 
103  VOID Init();
104 
105  //!-------------------------------------------------------------------------
106  //! @brief Vertual machine cyclic execution method.
107  //! @note None
108  //! \par Override
109  //! Not allowed
110  //! @attention Don't call this method directly.
111  //--------------------------------------------------------------------------
112 
113  VOID Execute();
114 
115  //!-------------------------------------------------------------------------
116  //! @brief Vertual machine cyclic assign input method.
117  //! @note None
118  //! @param [in] *struct_Input_Memory - Pointer to input memory array
119  //! @param [in] u32_Size - Size of input memory array
120  //! \par Override
121  //! Not allowed
122  //! @attention Don't call this method directly.
123  //--------------------------------------------------------------------------
124 
125  VOID Assign_Inputs( TConOpSys_Variant_Data *struct_Input_Memory, U32 u32_Size );
126 
127  //!-------------------------------------------------------------------------
128  //! @brief Vertual machine cyclic assign output method.
129  //! @note None
130  //! @param [in] *struct_Output_Memory - Pointer to output memory array
131  //! @param [in] u32_Size - Size of output memory array
132  //! \par Override
133  //! Not allowed
134  //! @attention Don't call this method directly.
135  //--------------------------------------------------------------------------
136 
137  VOID Assign_Outputs( TConOpSys_Variant_Data *struct_Output_Memory, U32 u32_Size );
138 
139  //!-------------------------------------------------------------------------
140  //! @brief Vertual machine cyclic assign data memory method.
141  //! @note None
142  //! @param [in] *struct_Data_Memory - Pointer to data memory array
143  //! @param [in] u32_Size - Size of data memory array
144  //! \par Override
145  //! Not allowed
146  //! @attention Don't call this method directly.
147  //--------------------------------------------------------------------------
148 
149  VOID Assign_Data_Memory( TConOpSys_Variant_Data *struct_Data_Memory, U32 u32_Size );
150 
151  //!-------------------------------------------------------------------------
152  //! @brief Vertual machine cyclic assign program memory method.
153  //! @note None
154  //! @param [in] *struct_Program_Memory - Pointer to program memory array
155  //! @param [in] u32_Size - Size of program memory array
156  //! \par Override
157  //! Not allowed
158  //! @attention Don't call this method directly.
159  //--------------------------------------------------------------------------
160 
161  VOID Assign_Program_Memory( TConOpSys_Variant_Data *struct_Program_Memory, U32 u32_Size );
162 
163  //!-------------------------------------------------------------------------
164  //! @brief Vertual machine cyclic assign parameters method.
165  //! @note None
166  //! @param [in] *struct_Input_Memory - Pointer to parameter memory array
167  //! @param [in] u32_Size - Size of parameter memory array
168  //! \par Override
169  //! Not allowed
170  //! @attention Don't call this method directly.
171  //--------------------------------------------------------------------------
172 
173  VOID Assign_Parameter( TConOpSys_Variant_Data *struct_Parameter_Memory, U32 u32_Size );
174 
176 
178 
179  VOID Store_Result();
180 
182 
184 
186 
188 
190 
192 
194 
196 
198 
200 
202 
204 
206 
207  VOID Execute_HALT();
208 
209  VOID Execute_CALL();
210 
211  VOID Execute_RET();
212 
213  //!-------------------------------------------------------------------------
214  //! @brief Application finalisation method
215  //! @note The method prepare hardware and system objects for the system shutdown.
216  //! @return None
217  //! \par Override
218  //! Allowed
219  //! @attention Don't call this method directly.
220  //--------------------------------------------------------------------------
221 
222  VOID Done();
223 
224  //----------------------------------------------------------------------------
225  // Protected defines, methods and variables
226  //----------------------------------------------------------------------------
227 
228  protected:
229 
230  //----------------------------------------------------------------------------
231  // Private defines, methods and variables
232  //----------------------------------------------------------------------------
233 
234  private:
235 
236  //--------------------------------------------------------------------------
237  // Private variables
238  //--------------------------------------------------------------------------
239 
240  //! @brief Program counter
242 
243  //! @brief Programm counter immediate data offset
245 
246  //! @brief Stack pointer
248 
249  //! @brief Operand 1 value
251 
252  //! @brief Operand 2 value
254 
255  //! @brief Result value
257 
258  //! @brief Stack
260 
261  //! @brief Pointer to the input memory
263 
264  //! @brief Pointer to the output memory
266 
267  //! @brief Pointer to the data memory
269 
270  //! @brief Pointer to the program code memory
272 
273  //! @brief Pointer to the parameter data memory
275 
276  //! @brief Input memory size
278 
279  //! @brief Output memory size
281 
282  //! @brief Data memory size
284 
285  //! @brief Program code memory size
287 
288  //! @brief Parameter data memory size
290 
291 };
292 
293 //------------------------------------------------------------------------------
294 // End of file
295 //------------------------------------------------------------------------------
#define MAX_STACK_INDEX
Definition: AVM2020.h:51
Scope defines header file.
#define NULL
Definition: Defines.h:388
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
System resource header file.
Anvilex vertual machine class.
Definition: AVM2020.h:60
U32 u32_Data_Memory_Size
Data memory size.
Definition: AVM2020.h:283
TConOpSys_Variant_Data * struct_Operand_1_Value
Operand 1 value.
Definition: AVM2020.h:250
VOID Execute_JLE_F32()
Definition: AVM2020.cpp:908
TConOpSys_Variant_Data * Data_Memory
Pointer to the data memory.
Definition: AVM2020.h:268
VOID Execute_HALT()
Definition: AVM2020.cpp:1102
AVM2020()
Class constructor method.
Definition: AVM2020.cpp:70
VOID Assign_Parameter(TConOpSys_Variant_Data *struct_Parameter_Memory, U32 u32_Size)
Vertual machine cyclic assign parameters method.
Definition: AVM2020.cpp:182
VOID Load_Operand_1()
Definition: AVM2020.cpp:470
~AVM2020()
Application destructor method.
Definition: AVM2020.cpp:95
VOID Execute_COPY_F32()
Definition: AVM2020.cpp:1044
U32 u32_Stack_Pointer
Stack pointer.
Definition: AVM2020.h:247
VOID Init()
Application initialisation method.
Definition: AVM2020.cpp:104
VOID Execute_JL_F32()
Definition: AVM2020.cpp:840
U32 u32_Program_Counter_Offset
Programm counter immediate data offset.
Definition: AVM2020.h:244
VOID Execute_DIV_F32()
Definition: AVM2020.cpp:777
U32 u32_Program_Memory_Size
Program code memory size.
Definition: AVM2020.h:286
VOID Execute_JG_F32()
Definition: AVM2020.cpp:874
TConOpSys_Variant_Data * Program_Memory
Pointer to the program code memory.
Definition: AVM2020.h:271
VOID Execute_MUL_F32()
Definition: AVM2020.cpp:756
TConOpSys_Variant_Data * Parameter
Pointer to the parameter data memory.
Definition: AVM2020.h:274
VOID Assign_Program_Memory(TConOpSys_Variant_Data *struct_Program_Memory, U32 u32_Size)
Vertual machine cyclic assign program memory method.
Definition: AVM2020.cpp:167
VOID Done()
Application finalisation method.
Definition: AVM2020.cpp:461
VOID Execute_SUB_F32()
Definition: AVM2020.cpp:819
U32 u32_Program_Counter
Program counter.
Definition: AVM2020.h:241
VOID Execute_CALL()
Definition: AVM2020.cpp:1113
VOID Execute_GO_TO()
Definition: AVM2020.cpp:1062
VOID Execute_NOT_EQUL_F32()
Definition: AVM2020.cpp:1010
VOID Assign_Data_Memory(TConOpSys_Variant_Data *struct_Data_Memory, U32 u32_Size)
Vertual machine cyclic assign data memory method.
Definition: AVM2020.cpp:152
TConOpSys_Variant_Data * Output
Pointer to the output memory.
Definition: AVM2020.h:265
VOID Assign_Inputs(TConOpSys_Variant_Data *struct_Input_Memory, U32 u32_Size)
Vertual machine cyclic assign input method.
Definition: AVM2020.cpp:122
VOID Execute()
Vertual machine cyclic execution method.
Definition: AVM2020.cpp:197
TConOpSys_Variant_Data * struct_Operand_2_Value
Operand 2 value.
Definition: AVM2020.h:253
VOID Execute_JGE_F32()
Definition: AVM2020.cpp:942
TConOpSys_Variant_Data * struct_Result_Value
Result value.
Definition: AVM2020.h:256
VOID Execute_ADD_F32()
Definition: AVM2020.cpp:798
VOID Execute_EQUL_F32()
Definition: AVM2020.cpp:976
U32 u32_Parameter_Memory_Size
Parameter data memory size.
Definition: AVM2020.h:289
U32 u32_Input_Memory_Size
Input memory size.
Definition: AVM2020.h:277
VOID Store_Result()
Definition: AVM2020.cpp:674
TConOpSys_Variant_Data * Input
Pointer to the input memory.
Definition: AVM2020.h:262
VOID Load_Operand_2()
Definition: AVM2020.cpp:572
TConOpSys_Variant_Data struct_Stack[MAX_STACK_INDEX]
Stack.
Definition: AVM2020.h:259
U32 u32_Output_Memory_Size
Output memory size.
Definition: AVM2020.h:280
VOID Execute_RET()
Definition: AVM2020.cpp:1139
VOID Execute_IF_GO_TO()
Definition: AVM2020.cpp:1078
VOID Assign_Outputs(TConOpSys_Variant_Data *struct_Output_Memory, U32 u32_Size)
Vertual machine cyclic assign output method.
Definition: AVM2020.cpp:137
ConOpSys variant data storage structure.
Definition: ConOpSys_Variant.h:403