CN108733365B - Data area multiplexing processing method of function - Google Patents
Data area multiplexing processing method of function Download PDFInfo
- Publication number
- CN108733365B CN108733365B CN201810328950.5A CN201810328950A CN108733365B CN 108733365 B CN108733365 B CN 108733365B CN 201810328950 A CN201810328950 A CN 201810328950A CN 108733365 B CN108733365 B CN 108733365B
- Authority
- CN
- China
- Prior art keywords
- function
- instruction
- variables
- data area
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/36—Software reuse
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
- Executing Machine-Instructions (AREA)
Abstract
The invention discloses a data area multiplexing processing method of a function, which comprises the following steps: step 1, performing lexical and syntactic scanning on a source program to form a syntactic tree; extracting variables and function lists of a program, distributing data areas according to the sequence of input variables, output variables, function variables and temporary variables, distributing only one data area example to the homonymous function, and distributing the function data areas according to the sequence of function input variables and function return value variables; step 2, performing semantic analysis according to the syntax tree to form a binary instruction irrelevant to a machine, and inserting a data replication instruction of a function entity participating in the form parameter before outputting an instruction of a calling function; and 3, interpreting the execution instruction file, executing a data copying instruction before calling the function, copying the actual form parameter value to a data area allocated by the function, and then transmitting the first address of the function data area when executing the function calling instruction. This approach may simplify the implementation of the interpreter and improve reliability.
Description
Technical Field
The invention belongs to the field of industrial control programming, and particularly relates to a data area multiplexing processing method of a function.
Background
The Structured Text (ST) defined by the IEC61131-3 standard is a high-level programming language similar to Pascal, and is particularly suitable for complex application algorithm design programming. The ST code can be compiled into a file which is directly run by a target machine, but generally, in the application process, the requirement of online undisturbed updating in units of Program Organization Units (POUs) exists, and the ST code is not suitable for using a compiled product and needs to interpret and execute binary pseudo instructions which are not related to the machine. The ST program frequently calls standard function functions, the calling of the functions realizes a method of generally using stacks, the stacking and unstacking operations of form parameters and real parameters exist, the design difficulty of an interpreter is increased, and the running efficiency of an embedded system is influenced.
Based on this, the present inventors have intensively studied the solution of the data area of the function, and the present case has been made accordingly.
Disclosure of Invention
The invention aims to provide a data area multiplexing processing method of a function, which can efficiently run through an interpreter program by a method of multiplexing a data area through a homonymy function.
In order to achieve the above purpose, the solution of the invention is:
a data area multiplexing processing method of a function comprises the following steps:
step 2, performing semantic analysis according to the syntax tree to form a binary instruction irrelevant to a machine, and inserting a data replication instruction of a function entity participating in the form parameter before outputting an instruction of a calling function;
and 3, interpreting the execution instruction file, executing a data copying instruction before calling the function, copying the actual form parameter value to a data area allocated by the function, and then transmitting the first address of the function data area when executing the function calling instruction.
In the step 1, the single variable is represented by 1 composite structure in the data area, and the attribute defined by the IEC61131-3 specification is recorded.
In the step 1, the distribution size of each basic type variable in the data area is the same, and for the composite type, the sub-variables spread and expanded into the basic type are distributed in sequence.
In step 2, the data replication command records the sequence numbers of the actual parameters and the shape parameters in the data area.
In step 3, the move instruction is a data copy instruction, and the call instruction is a function execution instruction.
After the scheme is adopted, the invention has the following beneficial effects: aiming at an application scene of interpretation execution, a data synchronous copying instruction is inserted before the function execution through a multiplexing method of a functional function data area, so that the complexity of an interpreter is simplified, a stack mode is not required to process parameters, the data area is fixed in the operation process, the offline analysis is facilitated to determine whether the data area exceeds the limit, and the reliability of the system is improved.
Drawings
Fig. 1 is a data area multiplexing process of a function in the present invention.
Detailed Description
The technical solution and the advantages of the present invention will be described in detail with reference to the accompanying drawings.
As shown in fig. 1, the present invention provides a data area multiplexing method for functional functions, which includes the following steps:
Preferably, taking fig. 1 as an example, array variables of IN1[0..100], IN2[0..100], OUT [0..100], and single variables of VAR1, VAR2, and VAR3 are defined IN the ST program, and ADD functions are called IN loop statements. The ADD function has 2 input variables and 1 return value. Therefore, the data area distribution is sequentially distributed according to the input, the output, the internal variable and the function data area of the program. Each variable is represented by 1 structure in the data area, and preferably, the structure of a single variable in the data area is defined as follows:
and 2, performing semantic analysis according to the syntax tree to form a binary instruction irrelevant to the machine. And inserting a data copying instruction of the function entity participating in the form parameter before outputting the instruction of the calling function. The data copying instruction records the sequence numbers of the real parameter and the shape parameter in the data area. IDX (IN1[ I ]) denotes the sequence number of the I-th input variable IN1[ I ] IN the data area, for example, IDX (IN1[0]) is 0.
And 3, interpreting the execution instruction file, executing a data copying instruction before calling the function, copying the actual form parameter value to a data area allocated by the function, and then transmitting the first address of the function data area when executing the function calling instruction. Preferably, the move instruction is a data copy instruction and the call instruction is a function execution instruction. Taking fig. 1 as an example, the ADD (P1, P2) function is executed after P1 ═ IN1[ I ] and P2 ═ IN2[ I ] are executed. The interpreter does not need to construct a temporary stack structure, but a data area of a multiplexing function, and the size of the data area is fixed in the operation process, so that frequent operations of stack application and destruction, data stacking and popping and the like are avoided.
In summary, the data area multiplexing method for a function according to the present invention optimizes the data space for the case that the same standard function is called multiple times in a Program Organization Unit (POU) defined in the Structured Text (ST) language in IEC61131, and the same standard function is allocated to only one common data area, and the data stores the input variable and the return value declared by the function. When the instruction is compiled and formed, a data copying instruction is inserted before the instruction of the function is called, the actual form parameter value is copied to the data area distributed by the function, and the fixed data area initial address is transmitted when the function is executed. The method realizes the multiplexing of the data area, does not need to construct a temporary stack to maintain the life cycle of the function parameters, simplifies the realization of the instruction interpreter, and is suitable for occasions with limited data space and high execution efficiency requirement in an embedded real-time system.
The above embodiments are only for illustrating the technical idea of the present invention, and the protection scope of the present invention is not limited thereby, and any modifications made on the basis of the technical scheme according to the technical idea of the present invention fall within the protection scope of the present invention.
Claims (1)
1. A data area multiplexing processing method of a function is characterized by comprising the following steps:
step 1, performing lexical and syntactic scanning on a source program to form a syntactic tree; extracting variables and function lists of a program, distributing data areas according to the sequence of input variables, output variables, function variables and temporary variables, distributing only one data area example to the homonymous function, and distributing the function data areas according to the sequence of function input variables and function return value variables; wherein, a single variable is represented by 1 composite structure in a data area, and the attribute defined by IEC61131-3 specification is recorded; the distribution size of each basic type variable in the data area is the same, and for the composite type, sub-variables which are sequentially spread into the basic type are distributed;
step 2, performing semantic analysis according to the syntax tree to form a binary instruction irrelevant to a machine, and inserting a data replication instruction of a function entity participating in the form parameter before outputting an instruction of a calling function; the data replication instruction is to record the sequence numbers of the actual parameter variables and the shape parameter variables in the data area;
and 3, interpreting the execution instruction file, executing a data copying instruction before calling the function, copying the actual form parameter value to a data area allocated by the function, and then transferring a first address of the function data area when executing the function calling instruction, wherein the move instruction is a data copying instruction, and the call instruction is a function execution instruction.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810328950.5A CN108733365B (en) | 2018-04-13 | 2018-04-13 | Data area multiplexing processing method of function |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810328950.5A CN108733365B (en) | 2018-04-13 | 2018-04-13 | Data area multiplexing processing method of function |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108733365A CN108733365A (en) | 2018-11-02 |
CN108733365B true CN108733365B (en) | 2021-10-01 |
Family
ID=63940800
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810328950.5A Active CN108733365B (en) | 2018-04-13 | 2018-04-13 | Data area multiplexing processing method of function |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108733365B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002351509A (en) * | 2001-05-25 | 2002-12-06 | Mitsubishi Electric Corp | Programming tool and programming method |
CN105116800A (en) * | 2015-08-11 | 2015-12-02 | 浙江中控技术股份有限公司 | Method for compiling function type POU object |
-
2018
- 2018-04-13 CN CN201810328950.5A patent/CN108733365B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002351509A (en) * | 2001-05-25 | 2002-12-06 | Mitsubishi Electric Corp | Programming tool and programming method |
CN105116800A (en) * | 2015-08-11 | 2015-12-02 | 浙江中控技术股份有限公司 | Method for compiling function type POU object |
Non-Patent Citations (1)
Title |
---|
可编程控制器结构化文本语言编译前端的研究与设计;蓝海滨;《电子元器件应用》;20111130;第13卷(第11期);正文第7页前言-第11页第2.2节以及图1-6 * |
Also Published As
Publication number | Publication date |
---|---|
CN108733365A (en) | 2018-11-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105550293B (en) | A kind of backstage method for refreshing based on Spark SQL big data processing platforms | |
US20070067471A1 (en) | Message translation systems and methods | |
WO2022028220A1 (en) | Neural network model computing chip, method and apparatus, device and medium | |
US8752056B2 (en) | Running native code across single or multi-core hybrid processor achitecture | |
CN106648681A (en) | System and method for compiling and loading programmable language | |
US20110246962A1 (en) | State machine expressions in database operators | |
CN102147743A (en) | Method for accelerating startup of embedded system application program | |
CN111770204A (en) | Method for executing intelligent contract, block chain node and storage medium | |
CN108733365B (en) | Data area multiplexing processing method of function | |
CN111159268B (en) | Method and device for running ETL (extract-transform-load) process in Spark cluster | |
CN102929853A (en) | DCS (Data Communication System) project data generating system and method based on Excel sheet association | |
US6219835B1 (en) | Multi-language DCE remote procedure call | |
CN111770202B (en) | Method for executing intelligent contract, block chain node and storage medium | |
CN112487092A (en) | Intelligent contract calling method and device based on block chain | |
CN102141917A (en) | Method for realizing multi-service linkage based on IronPython script language | |
CN107704757A (en) | The method that the open Python user programs interface of safety is realized using pypy sandbox modes | |
CN114327778A (en) | Intelligent contract virtual machine based on Webassembey byte codes | |
GB2442497A (en) | Method and Apparatus for Administering a Process Filesystem during Program Code Conversion | |
CN103455374A (en) | Method and device for distributed computation on basis of MapReduce | |
Yamaguchi et al. | Methodology for transferring programs and data | |
Bonsangue et al. | Developing object-based distributed systems | |
CN113741935B (en) | Project and product synchronous iteration upgrading method | |
US20210271484A1 (en) | Thread weave for cross-instruction set architecture procedure calls | |
Khalfallah et al. | Enhancing monitoring queries invoking composition of services | |
JP2585780B2 (en) | DO loop optimization processing method for input / output library |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |