Code generation device, code generation system, and code generation method
The code generation device addresses the challenge of high development costs and suboptimal control performance by generating both C language and custom code, optimizing control performance on specific hardware.
Patent Information
- Application Number
- JP2024028976
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-02-28
- Publication Date
- 2025-09-09
AI Technical Summary
Existing code generation systems do not support the creation of custom code for specific hardware, leading to increased development costs and suboptimal control performance due to the need for manual writing of assembly language.
A code generation device that includes a model analysis unit to analyze control blocks, generating both C language and custom code (such as assembly language) to improve control performance on specific hardware while reducing development costs.
The system supports the creation of code that enhances control performance for specific hardware while minimizing development costs by automatically generating custom code tailored to the hardware's capabilities.
Smart Images

Figure 2025131310000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to a code generation device, a code generation system, and a code generation method. [Background technology]
[0002] Program developers write source code according to the grammar of a programming language such as C. Because it is costly to learn a programming language, systems that support the writing of source code have been proposed. For example, Patent Document 1 discloses a table recognition system that "consists of a table body that describes various information and a title description table that describes title information that defines the description content and format for searching this table body, and stores semantic generation rules for specifying semantic information corresponding to the matrix structure of the table body for each piece of title information, analyzes a document data file that describes a table to be recognized that is composed of one title description table and at least one table body that describes various information corresponding to the title information in this title description table, recognizes the matrix structure, distinguishes between the title description table and the table body, calls up semantic generation rules based on the title information in the title description table, extracts semantic information from the table body of the table to be recognized based on the semantic generation rules, and recognizes the meaning of the table body." [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Japanese Patent Application Laid-Open No. 2001-195243 Summary of the Invention [Problem to be solved by the invention]
[0004] However, while Patent Document 1 supports generic source code that can be embedded, such as C language, it does not consider custom code for specific hardware. To maximize the use of microcontroller-specific functions, such as shortening software processing time during implementation, developers must manually write custom code, such as assembly language code, which increases development costs.
[0005] In view of the above-mentioned problems, the present invention aims to support the creation of code that can be expected to improve control performance for specific hardware while reducing development costs. [Means for solving the problem]
[0006] In order to solve the above problems, the code generating device of the present invention has the following features. The present invention provides a system including: a model analysis unit that receives an input of a control model that defines a control logic of an object and analyzes each control block that constitutes the control model; a code generation unit that generates at least two different codes for operating the control block analyzed by the model analysis unit on the object; and an output unit that outputs the at least two different codes generated by the code generation unit. Other means will be described later. [Effects of the Invention]
[0007] According to the present invention, it is possible to support the creation of code that can be expected to improve control performance for specific hardware while reducing development costs. [Brief explanation of the drawings]
[0008] [Figure 1] 1 is a configuration diagram illustrating an overview of a code generation device according to a first embodiment. [Figure 2] FIG. 2 is a hardware configuration diagram of a code generating device according to the first embodiment. [Figure 3]FIG. 2 is a configuration diagram showing a processing unit configured by a program executed by a CPU according to the first embodiment. [Figure 4] FIG. 2 is a detailed configuration diagram of a custom code generation unit according to the first embodiment. [Figure 5] FIG. 2 is an overall view of a control model according to the first embodiment. [Figure 6] FIG. 6 is an enlarged view showing a part of the control model of FIG. 5 according to the first embodiment. [Figure 7] 7 is an explanatory diagram showing model type-specific information obtained as a result of a model analysis unit according to the first embodiment analyzing the control models of FIGS. 5 and 6. FIG. [Figure 8] 7 is an explanatory diagram showing control block path information obtained as a result of a model analysis unit according to the first embodiment analyzing the control models of FIGS. 5 and 6. FIG. [Figure 9] 7 is an explanatory diagram showing connection state information obtained as a result of a model analysis unit according to the first embodiment analyzing the control models of FIGS. 5 and 6. FIG. [Figure 10] FIG. 10 is an explanatory diagram showing extracted connection state information extracted from connection state information by a high frequency model extraction unit according to the first embodiment. [Figure 11] FIG. 5 is a configuration diagram showing a modified example of the custom code generating unit of FIG. 4 according to the first embodiment. [Figure 12] FIG. 12 is a configuration diagram showing a modified example of the custom code generating unit 12 of FIG. 11 according to the second embodiment. [Figure 13] FIG. 10 is a diagram illustrating a modification of the code generating device 1 of FIG. 1 according to the third embodiment. [Figure 14] FIG. 14 is a diagram illustrating a modification of the code generating device 1 of FIG. 13 according to the fourth embodiment. [Figure 15] 1 is a configuration diagram of a code generation system 100 according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0009] An embodiment of the present invention will be described below. [Example]
[0010] FIG. 1 is a diagram showing an overview of the code generation device 1. As shown in FIG. The code generating device 1 executes the following procedure (code generating method). (Step 1) An input of a control model 20 including one or more control blocks is received. A control block is a data model that implements control logic such as a control algorithm. (Step 2) The custom code generator 12 analyzes the control model 20 and extracts each control block included in the control model 20. (Step 3) The custom code generation unit 12 generates custom code 22 corresponding to the control block extracted from the control model 20. By running the custom code 22 on an object 29 (specific hardware) such as a specified microcomputer, it is expected that the control performance of the object 29 will be improved. (Step 4) The C language code generator 11 generates C language code 21 including all the control blocks of the control model 20. This C language code 21 is code that causes all the control block groups analyzed from the control model 20 to operate on the target object 29.
[0011] For this reason, the code generation device 1 includes a C language code generation unit 11 and a custom code generation unit 12 as code generation units that generate at least two different codes. The code generation device 1 receives a control model 20 as input and outputs a C language code 21 and a custom code 22. The custom code 22 may be, for example, an assembly language code or a hardware description language code.
[0012] FIG. 2 is a diagram showing the hardware configuration of the code generation device 1. As shown in FIG. The code generation device 1 includes an output device 91, a CPU 92, an input device 93, a storage device 94, a RAM 95, and a ROM 96. The code generation device 1 may also include a display 97. The output device 91 outputs the output information of the CPU 92 to a display 97. The display 97 displays the output information as an image to a user such as a developer. When the code generation device 1 is powered on and started up, the CPU 92 reads and executes a predetermined boot program from the ROM 96, and performs startup processing by reading and executing the operating system (hereinafter referred to as the OS) and other programs specified in this boot program from the storage device 94.
[0013] After the startup process, and until the power is cut off, the CPU 92 executes various programs recorded in the storage device 94 as processes on the OS based on signals from the input device 93, schedules determined by the OS, etc. Furthermore, in the processes of the startup process, the CPU 92 receives signal input from the input device 93 as necessary, outputs output information to the output device 91, and controls the reading and writing of data from and to the RAM 95 and the storage device 94.
[0014] The input device 93 is composed of a keyboard, a mouse, a voice input device, etc., and outputs a signal corresponding to the operation to the CPU 92 when operated by the user. The storage device 94 is a readable and writable non-volatile memory, and stores the various programs, as well as a model and a control software development environment, which will be described later. The RAM 95 is a readable and writable volatile memory, and the ROM 96 is a read-only nonvolatile memory. The RAM 95 is used as a storage area for temporarily storing programs and calculation results when the CPU 92 executes programs stored in the ROM 96 and the storage device 94, and as a storage area for temporarily storing working data. The ROM 96 stores in advance programs and the like that are read and executed by the CPU 92.
[0015] FIG. 3 is a block diagram showing a processing unit configured by a program executed by the CPU 92. As shown in FIG. By executing the program 92B, the CPU 92 forms processing units such as a model creation unit 13 and a model operation unit 14 in addition to the C language code generation unit 11 and the custom code generation unit 12 shown in Fig. 1. These processing units execute processing by referring to the library model 92A. In the following description, the operation of the CPU 92 as a result of executing a program will be considered to be the operation of the executed program itself.
[0016] The model creation unit 13 reads out a program stored in the storage device 94 and enables the user to create a model. The control model 20 is composed of control blocks that represent the output of signals based on predetermined rules, and connections that represent the connection of input and output signals between those control blocks. The control model 20 is created from control blocks that are pre-installed in the model creation unit 13 and models stored in a library model 92A, which will be described later. These control models 20 are then stored in the storage device 94. The model creation unit 13 may be, for example, a program called Simulink or TargetLink (registered trademark) that runs on MATLAB.
[0017] The model operation unit 14 is a program that operates the created control model 20. The model operation unit 14 may be, for example, a program called Simulink or TargetLink that operates on MATLAB. The library model 92A is a collection of models that are previously configured with models corresponding to the model operation unit 14. Then, the control model 20 is created by combining the control blocks and the library model 92A.
[0018] The C language code generator 11 reads out the program stored in the storage device 94 and generates C language code 21 that realizes the operations of all the control blocks included in the control model 20 created by the user. The custom code generator 12 reads out a program stored in the storage device 94 and generates custom code 22 that implements the operations of at least some of the control blocks included in the control model 20 created by the user.
[0019] FIG. 4 is a detailed configuration diagram of the custom code generation unit 12. The custom code generation unit 12 includes a model analysis unit 121 , a model extraction unit 122 , a code generation unit 123 , custom code information 124 , and a code output unit 129 . The model analysis unit 121 receives an input of the control model 20 that defines the control logic of the object 29 , and analyzes each control block that constitutes the control model 20 . The model extraction unit 122 extracts control blocks to be included in the code generated by the code generation unit 123 from the group of control blocks analyzed by the model analysis unit 121. As an example of the model extraction unit 122, the high-frequency model extraction unit 122A extracts frequently used control blocks based on the analysis results of the model analysis unit 121.
[0020] Furthermore, the model extraction unit 122 may extract, for example, at least one of the following control block groups: From the control block groups analyzed by the model analysis unit 121, control block groups that are connected to each other at a given degree of connectivity or more are extracted. A control block group representing a predetermined repetitive process is extracted from the control block group analyzed by the model analysis unit 121. The model extraction unit 122 extracts a control block group including calculation contents from the control block group analyzed by the model analysis unit 121.
[0021] Then, the code generation unit 123 compares the control blocks extracted by the high-frequency model extraction unit 122A with the custom code information 124, and generates custom code 22 that can be used in the target object 29. In other words, the code generation unit 123 generates custom code 22 that operates only the control block group extracted by the model extraction unit 122 for one of the at least two different codes. Then, the code output unit 129 outputs the code generated by the code generation unit 123. Here, the custom code information 124 is information including operations (addition, multiplication, etc.) and branching processing in the object 29, and is information that defines the custom code 22 in an assembly language or a hardware description language. The code generation unit 123 refers to the custom code information 124 to obtain the custom code 22 that realizes the operations and branching processing corresponding to the extracted connection state information 65 (FIG. 10).
[0022] The processing contents of the custom code generation unit 12 will be described below with reference to the specific examples in Figures 5 to 10. Note that the specific examples in Figures 5 to 10 are also diagrams for explanation, but may also be output information for the display screen that the output device 91 displays on the display 97. FIG. 5 is an overall view of a control model 50, which is an example of the control model 20. As shown in FIG. The control model 50 includes, as control blocks, a "Subsystem" 51, a "Subsystem1" 52, and a "Subsystem2" 53. Note that the "1" and "2" in the "Subsystem" 51 are terminal numbers, with the left side of the drawing indicating an input terminal and the right side indicating an output terminal.
[0023] FIG. 6 is an enlarged view showing a portion of the control model 50 of FIG. The "Subsystem" 51 includes a control block for the "Filter" 51A. The "Subsystem 1" 52 has the same content as the "Subsystem" 51. "Filter" 51A includes control blocks such as "Product" and "Unit Delay." "Subsystem2" 53 includes control blocks such as "Product" and "Product1".
[0024] FIG. 7 is an explanatory diagram showing model type information 61, which is the result of the model analysis unit 121 analyzing the control model 20 of FIGS. The model type information 61 is the result of extracting the number of blocks used for each type of control block used in the control model 20. In addition, some control blocks ("Filter" and "SubSystem" in FIG. 7) are associated with control block description information ("M" and "B" in the drawing). The explanatory information "M" indicates that the control block, such as "Filter," is not the calculation content itself, but a block that summarizes calculations. The explanatory information "B" indicates that the control block is a block that does not involve calculation content, such as the "SubSystem" at the first level (top level).
[0025] FIG. 8 is an explanatory diagram showing the control block path information 62 that is the result of the model analysis unit 121 analyzing the control model 20 of FIGS. The control block path information 62 is composed of a list of control block paths that indicate the hierarchy of the control blocks arranged in the control model 20. For example, "SampleModel / In1" on the first line and "SampleModel / Subsystem / In1" on the 14th line are extracted by utilizing the find_system function currently available to users in the MATLAB / Simulink environment.
[0026] FIG. 9 is an explanatory diagram showing connection state information 63, which is the result of the model analysis unit 121 analyzing the control model 20 of FIGS. The connection state information 63 is an analysis result that schematically expresses the connection state (relationships between connection destinations) of each control block, library model, and the like. As shown in the connection status information 63, the model analysis unit 121 detects the control blocks connected to the output side of the Inport control blocks, which are the inputs of signals at each layer, and then sequentially detects the control blocks connected to the output side of the detected control blocks.
[0027] Then, the high frequency model extraction unit 122A grasps the operation content from the relationship between the operation role and the connection destination of the control block detected as the connection state information 63. Furthermore, the high frequency model extraction unit 122A extracts frequently used control blocks by extracting from the connection state information 63 those whose operation content has the same pattern. In other words, the high-frequency model extraction unit 122A extracts from the model type information 61 analyzed by the model analysis unit 121 which control blocks are frequently used, from the control block path information 62 which locations are used including hierarchical levels, and from the connection status information 63 which calculation contents are frequently used.
[0028] For example, the high frequency model extraction unit 122A starts from the information "'SampleModel / In1'" on the first line of the control block path information 62 and executes several functions to determine what block is connected to the output of "In1." As a result, the high frequency model extraction unit 122A extracts "Inport, Subsystem, Subsystem2, Outport1" on the first line of the first layer of the connection state information 63. Furthermore, the high frequency model extraction unit 122A determines the number of layers (first to third layers) of the connection state information 63 from the number of " / "s in the control block path information 62.
[0029] It is possible to determine that there is a block further inside "Filter," which is the third layer of the connection state information 63, because the description information "M" is specified in the model type information 61. Also, because each layer of the connection state information 63 always has an Inport or Outport block, the model analysis unit 121 can also determine the starting point of the connection relationship.
[0030] FIG. 10 is an explanatory diagram showing the extracted connection state information 64 extracted from the connection state information 63 by the high frequency model extraction unit 122A. The high frequency model extraction unit 122A extracts overlapping content from the connection state information 63 (two overlaps for the combination of "Inport, Filter, Outport1" with the same connection destination relationship), and associates the number of overlaps as a usage frequency (for example, "usage frequency 2"). Furthermore, the high frequency model extraction unit 122A obtains extracted connection state information 65 by excluding some entries (blocks of explanation information "M" and explanation information "S") that do not indicate the content of calculations from the extracted connection state information 64.
[0031] The code generation unit 123 references the custom code information 124 and generates custom code 22 in accordance with the operation content of the control block extracted as the extracted connection state information 65. The custom code 22 at this time is assembly language code. Note that the custom code 22 at this time may also be hardware description language code. Furthermore, the target 29 on which the custom code 22 operates may be any microcomputer defined as open source, and a representative example of such a microcomputer is RISC-V.
[0032] FIG. 11 is a configuration diagram showing a modified example of the custom code generating unit 12 of FIG. 11 includes control block information 125A in addition to the components of the custom code generation unit 12 in FIG. 4. The control block information 125A is information indicating frequently used control blocks, such as the extracted connection state information 64 previously extracted by the high-frequency model extraction unit 122A. Furthermore, the control block information 125A includes the contents of operations and branching processes defined for each type of control block. The control block information 125A is prepared in advance by an administrator or the like so that it can be used by the custom code generation unit 12.
[0033] Then, by referring to the control block information 125A, the code generation unit 123 can efficiently generate the custom code 22 from the information for each type of control block obtained from the model type information 61 and the custom code information 124 without using the extracted connection status information 65. In addition, the code generation unit 123 may also generate custom code 22 by referring to control block information 125A and custom code information 124 for entries excluded when creating extracted connection state information 65 from extracted connection state information 64 (the extraction result of only the ``Filter'' control block indicated by explanatory information ``M'').
[0034] 7, the custom code generation unit 12 may store in advance definitions such as "Filter" corresponding to the control block description information "M" and "SubSystem" corresponding to the description information "B" as control block information 125A. This allows the code generation unit 123 to extract a specific control block (for example, "Filter" of description information "M") as a frequently used calculation content from the information in the model type information 61 corresponding to the control block information 125A. The code generation unit 123 can then generate custom code 22 according to the operation content from the extracted control block and custom code information 124. This generation method is effective not only for the "Filter" control block, but also for all control blocks that compile frequently used operation content and control blocks of library models.
[0035] As described above, the custom code 22 created by the code generation unit 123 is expected to be effective in the following respects. Regarding interrupt processing, which allows high-priority processing to be executed during calculation, interrupt processing is not performed while the custom code 22 is being executed, and the interrupt processing is executed after the custom code 22 has finished. This ensures that values during calculation, such as state quantities, are identical to the final calculation result. Furthermore, it is possible to suppress the occurrence of malfunctions when not only calculation results but also state quantities or values during calculation are used for control, and improvement in control performance can be expected. By executing the control logic of the control system, widely known as a PID controller (Proportional-Integral-Differential Controller) as custom code 22, it is possible to ensure consistency between updates of state variables and integral terms and the calculation results that accompany the updates. This can also reduce the occurrence of malfunctions and is expected to improve control performance. [Example]
[0036] FIG. 12 is a configuration diagram showing a modified example of the custom code generating unit 12 of FIG. 11, a configuration has been described in which a high-frequency model extraction unit 122A is used as the model extraction unit 122. In a second embodiment of FIG. 12, a configuration has been described in which a repetitive model extraction unit 122B is used as the model extraction unit 122. The repetition model extraction unit 122B extracts control blocks of repetition processes based on the analysis results of the model analysis unit 121. Examples of repetition processes include "CORDIC," which is known to be used as an approximation method when obtaining the results of trigonometric function calculations, and a Kalman filter, which is known to estimate states from observed points and use the estimated values for control. For control blocks indicating these calculations, the corresponding repetition processes can be identified from the information in the model type information 61 shown in Figure 7, and the number of used repetitions can also be extracted.
[0037] The code generation unit 123 generates custom code 22 from the control block of the repetitive process extracted by the repetition model extraction unit 122B, according to the information in the custom code information 124. The custom code 22 at this time is assembly language code. Note that the custom code 22 at this time may also be hardware description language code. Furthermore, the target 29 on which the custom code 22 operates may be any microcomputer defined as open source, and a typical example of such a microcomputer is RISC-V.
[0038] The control block information 125B is information indicating the control blocks of the repetitive processes previously extracted by the repetitive model extraction unit 122B. By having the control block information 125B in advance in the custom code generation unit 12, the code generation unit 123 can generate the custom code 22 according to the calculation content from the control block information 125B and the custom code information 124. This is an effective method not only for trigonometric functions using "CORDIC" or Kalman filters, but also for all control blocks that summarize the calculation content of repetitive processing and control blocks of library models. Furthermore, with regard to interrupt processing, which allows high-priority processing to be executed during calculation, the interrupt processing is not performed while the custom code 22 is being executed, and the interrupt processing is executed after the custom code 22 has finished, so it is possible to ensure that values during calculation, such as state quantities, are identical to the final calculation result. This makes it possible to suppress the occurrence of malfunctions when not only calculation results but also state quantities and values during calculation are used for control, and is expected to improve control performance. [Example]
[0039] FIG. 13 shows a modified example of the code generating device 1 of FIG. 1, a form has been described in which the C language code 21 and the custom code 22 are output separately. In a third embodiment of FIG. 13, a form will be described in which the C language code 21 and the custom code 22 are output in association with each other. In addition to the functions described in Example 1, the custom code generation unit 12 in Figure 13 has the function of passing information about the part of the control logic that generated the custom code 22 (the overlapping parts of both codes) to the C language code generation unit 11 (arrow in the figure).
[0040] The C language code generation unit 11 outputs C language code 21 that reflects the overlapping parts of both codes notified by the custom code generation unit 12. The process of reflecting the overlapping parts of both codes is, for example, the following (first process) or (second process). (First process) Replace overlapping portions between the C language code 21 and the custom code 22 with a call instruction to the overlapping logic of the custom code 22. In other words, when generating at least two different codes, the C language code generation unit 11 replaces, for a predetermined control block that is included in common in the at least two different codes, the predetermined control block included in the first code with a process that calls the predetermined control block included in the second code.
[0041] (Second process) The developer is notified of the overlapping parts by outputting the overlapping logic as a comment in the C language code 21. In other words, when generating at least two different codes, the C language code generation unit 11 outputs a predetermined control block that is commonly included in the at least two different codes into at least two different codes so that the control block can be distinguished from other control blocks. Therefore, for example, the C language code generation unit 11 may comment out the duplicated logic itself, or may not comment out the duplicated logic itself but add a comment notifying the existence of the duplicated logic immediately before the duplicated logic. This allows the developer to identify the part of the C language code 21 that corresponds to the duplicated logic, and therefore, correct the generated C language code 21. [Example]
[0042] FIG. 14 shows a modified example of the code generating device 1 of FIG. In the third embodiment of Fig. 13, a function of one-way transfer from the custom code generation unit 12 to the C language code generation unit 11 has been described as a form in which the C language code 21 and the custom code 22 are output in association with each other. In the fourth embodiment of Fig. 14, a function of two-way information exchange between the custom code generation unit 12 and the C language code generation unit 11 will be described as a form in which the C language code 21 and the custom code 22 are output in association with each other. The process in which the C language code generation unit 11 reflects the information passed from the custom code generation unit 12 in the C language code 21 is the same in both the third and fourth embodiments.
[0043] 14 receives information about the portion of the control logic that generated the C language code 21 (the overlapping portions of both codes) from the C language code generation unit 11, and reflects that information in the custom code 22. This allows the developer to determine from the custom code 22 that the content generated by the C language code 21 is also included in the output custom code 22. This allows information to be added to facilitate the implementation of the C language code 21 and the custom code 22 in the target object 29. The custom code 22 in this case is assembly language code. Note that the custom code 22 in this case can also be hardware description language code. Furthermore, the target object 29 on which the custom code 22 runs can be any microcomputer defined as open source, and a typical example of such a microcomputer is RISC-V.
[0044] FIG. 15 is a diagram showing the configuration of the code generation system 100. The code generation system 100 is a development system for control system software that includes the code generation device 1 according to any one of the first to fourth embodiments and a simulation device 30. The simulation device 30 simulates the execution of at least two different codes created by the code generation device 1. In other words, the simulation device 30 executes a simulation in which, in addition to the C language code 21 generated by the code generation device 1 from the control model 20, custom code 22 dedicated to the object 29 written in assembly language code or hardware description language code is simulated, and outputs the results. This allows the developer to detect and correct bugs in the code before executing the automatically generated C language code 21 and custom code 22 directly on the object 29.
[0045] Such a code generation system 100 can be applied to, for example, Simulink or TargetLink running on MATLAB as a model-based control system software development system. By adding an automatic generation function for custom code 22 to the automatic generation function for C language code 21 that conventional control system software development systems have, it is possible to reduce the execution time when the control logic is implemented as embedded software in an object 29. This not only improves the functionality of the control software development system, but also increases its value as a control software development system.Furthermore, this allows functions and value to be promoted to users, further expanding business opportunities.
[0046] On the other hand, in the conventional model-based control software development system (comparison example), the system is limited to the automatic generation function of C language code 21, and while it can be incorporated in a general-purpose manner, it is not possible to make full use of the functions specific to the object 29 corresponding to the custom code 22, making it difficult to shorten the software processing time during implementation. The reason why the comparative example is limited to the automatic generation function of C language code 21 is that C language is a high-level and general-purpose language and has a wide range of applications. On the other hand, custom code 22 such as assembly language differs for each developing vendor or each target object 29, so it would take too much time and cost to develop a system that generates assembly language for each target object 29.
[0047] In the comparative example, a developer compiles C code using a C compiler, converts it into assembly language, and then assembles the assembly language, thereby enabling the C code to be processed by the object 29. However, processing specific to the object 29 cannot be fully expressed in the general-purpose C language, and it is difficult for a C compiler to compile and execute code that can demonstrate functions specific to the object 29. In addition, functions specific to the object 29 are generally provided in a dedicated assembly language.
[0048] Furthermore, even if the control logic is the same, implementing it as custom code 22 rather than as C language code 21 can be expected to improve the control performance of the object 29 . In other words, in the comparative example, if the functions specific to the object 29 are not utilized, calculations will be performed using a combination of general-purpose processes, and it will be impossible to utilize the functions provided as processes specific to the object 29. Therefore, the processing performance of the object 29 cannot be utilized to the fullest extent, making it difficult to shorten the processing time during implementation. For example, when performing a 32-bit x 32-bit operation and extracting the central 32 bits of the operation result, if the object 29 is a specific microcomputer, it will have a dedicated instruction, but if that dedicated instruction is not used, it will be necessary to perform a 32-bit shift operation. In fact, such processing cannot be written directly in C language, and when written in C language, it will be written to perform a 32-bit shift operation after multiplication. On the other hand, the code generation device 1 of this embodiment implements instructions dedicated to the object 29 as the custom code 22, and therefore, improvement in the control performance of the object 29 can be expected.
[0049] Furthermore, the present invention is not limited to the above-described embodiments, and various other applications and modifications are possible without departing from the spirit of the present invention as defined in the claims. For example, the above-described embodiments provide a detailed and specific description of the configuration of the code generation device 1 in order to clearly explain the present invention, and the code generation device is not necessarily limited to having all of the components described. Furthermore, it is possible to replace part of the configuration of one embodiment with the components of another embodiment. It is also possible to add the components of another embodiment to the configuration of one embodiment. It is also possible to add, replace, or delete other components from part of the configuration of each embodiment.
[0050] Furthermore, the above-described configurations, functions, processing units, etc. may be partially or entirely realized in hardware, for example, by designing them as integrated circuits, etc. As the hardware, a broad processor device such as an FPGA (Field Programmable Gate Array) or an ASIC (Application Specific Integrated Circuit) may be used. Furthermore, each component of the code generation device 1 according to the above-described embodiment may be implemented in any hardware as long as the respective hardware can transmit and receive information to and from each other via a network. Furthermore, the processing executed by a certain processing unit may be realized by a single piece of hardware, or may be realized by distributed processing using multiple pieces of hardware. [Explanation of symbols]
[0051] 1. Code generator 11 C language code generator 12 Custom Code Generation 13 Model Creation Department 14 Model movement section 20 Control Model 21 C Code 22 Custom Code 29 Object 30 Simulation Device 61 Model type information 62 Control Block Path Information 63 Connection status information 64,65 Extract connection status information 100 Code Generation System 121 Model Analysis Department 122 Model Extraction Unit 123 Code Generation Unit 122A High-Frequency Model Extraction Unit 122B Repetition model extraction unit 124 Custom Code Information 125A,125B Control block information 129 Code Output Unit
Claims
1. a model analysis unit that receives an input of a control model that defines a control logic of an object and analyzes each control block that constitutes the control model; a code generation unit that generates at least two different codes for operating the control block analyzed by the model analysis unit on the object; and an output unit that outputs the at least two different codes generated by the code generation unit. Code generator.
2. the code generation device further includes a model extraction unit; the model extraction unit extracts, from the control block group analyzed by the model analysis unit, a control block group that is connected with a given degree of connectivity or more; The code generation unit generates one of the at least two different codes as a code that operates only the control block group extracted by the model extraction unit. The code generating device according to claim 1 .
3. the code generation device further includes a model extraction unit; the model extraction unit extracts a group of control blocks representing predetermined repetitive processes from the group of control blocks analyzed by the model analysis unit; The code generation unit generates one of the at least two different codes as a code that operates only the control block group extracted by the model extraction unit. The code generating device according to claim 1 .
4. the code generation device further includes a model extraction unit; the model extraction unit extracts a control block group including a calculation content from the control block group analyzed by the model analysis unit; The code generation unit generates one of the at least two different codes as a code that operates only the control block group extracted by the model extraction unit. The code generating device according to claim 1 .
5. the code generation unit generates codes in at least two different languages as the at least two different codes; a first code of the at least two different languages is code in the C language; The second code of the at least two different languages is code in assembly language or code in a hardware description language. The code generating device according to claim 1 .
6. The code generation unit generates, as the first code, a code for operating all of the control blocks analyzed by the model analysis unit. The code generating device according to claim 5 .
7. When generating the at least two different codes, the code generation unit outputs a predetermined control block commonly included in the at least two different codes to the at least two different codes so that the predetermined control block can be distinguished from other control blocks. The code generating device according to claim 1 .
8. When generating the at least two different codes, the code generation unit replaces a predetermined control block included in a first code with a process that calls a predetermined control block included in a second code, for a predetermined control block that is included in common in the at least two different codes. The code generating device according to claim 1 .
9. A code generation system comprising the code generation device according to any one of claims 1 to 8 and a simulation device, The simulation device is characterized in that it executes the at least two different codes generated by the code generation device in a simulated manner. Code generation system.
10. The code generation device includes a model analysis unit, a code generation unit, and an output unit, the model analysis unit receives an input of a control model that defines a control logic of an object, and analyzes each control block that constitutes the control model; the code generation unit generates at least two different codes for operating the control block analyzed by the model analysis unit on the object; The output unit outputs the at least two different codes generated by the code generation unit. Code generation method.
Citation Information
Patent Citations
Chart recognizing system and program development supporting system and computer readable recording medium
JP2001195243A