WO2022239148A1 - Equivalence inspection system and equivalence inspection program - Google Patents

Equivalence inspection system and equivalence inspection program Download PDF

Info

Publication number
WO2022239148A1
WO2022239148A1 PCT/JP2021/018051 JP2021018051W WO2022239148A1 WO 2022239148 A1 WO2022239148 A1 WO 2022239148A1 JP 2021018051 W JP2021018051 W JP 2021018051W WO 2022239148 A1 WO2022239148 A1 WO 2022239148A1
Authority
WO
WIPO (PCT)
Prior art keywords
source code
code
target function
change source
post
Prior art date
Application number
PCT/JP2021/018051
Other languages
French (fr)
Japanese (ja)
Inventor
古▲月▼ 王
誠 磯田
Original Assignee
三菱電機株式会社
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 三菱電機株式会社 filed Critical 三菱電機株式会社
Priority to PCT/JP2021/018051 priority Critical patent/WO2022239148A1/en
Priority to JP2023519108A priority patent/JP7309099B2/en
Publication of WO2022239148A1 publication Critical patent/WO2022239148A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management

Definitions

  • the present disclosure relates to differential analysis of software behavior.
  • control software installed in the control device, the control functions are computerized in order to respond to multi-functionality and increased added value.
  • control software is rapidly increasing in scale and complexity.
  • variations in control software will increase rapidly in the future due to differences in model derivations and destinations.
  • difference development and derivative development by introducing a software execution environment can be considered.
  • the software execution environment includes communication processing, timer processing, scheduler, operating system (OS), middleware, and the like.
  • Another possible measure is to apply techniques and tools for ensuring quality and improving development efficiency to software development.
  • Equivalence checking is a technique for accurately determining whether or not processing contents have been modified in programming language function units for two source codes before and after modification. Specifically, if the same output value is always obtained when the same input value is given to two functions that have correspondence before and after the change, it is determined that the processing contents are logically the same (that is, equivalent). Otherwise, it is determined that the processing contents are logically different (that is, unequal).
  • a function may have multiple state variables, and the values (state values) taken by the state variables are inherited and changed from the previous step to the next step.
  • a step is a one-time process that is executed when a function is called.
  • a function has a state variable, each time the function receives an input value at each step, the execution part inside the function switches depending on the state value at that time, and the output value and the state value of the next step are determined by the processing content.
  • Patent Literature 1 discloses a technique for determining whether the processing contents of two functions having such state variables are equivalent.
  • the processing contents are analyzed for all steps from the initial state of each state variable until it returns to the initial state again.
  • the amount of computer resources required for analysis is determined depending on the number of values taken by the state variables, that is, the number of states. If there is even one state variable with a very large number of states, the number of steps analyzed at one time may become very large, and the amount of computational resources required may become very large. Therefore, when state variables with a small number of states and state variables with a large number of states coexist in the source code, it is difficult to analyze the processing details regarding the number of steps until all state variables return to their initial states.
  • the purpose of the present disclosure is to enable equivalence checking while reducing the amount of computer resources.
  • the equivalence checking system of the present disclosure includes: an influence state variable extraction unit for extracting an influence state variable, which is a state variable that influences an output value of a target function that is repeatedly called, from each of the pre-change source code and the post-change source code;
  • the target function is repeatedly called in the pre-change source code and the value of the effect state variable is returned to the initial value, and the target function is repeatedly called in the post-change source code and the value of the effect state variable is returned to the initial value.
  • a determination step number calculation unit that calculates the number of times the target function is called that satisfies the condition of returning as a determination step number; each of the target function of the pre-change source code and the target function of the post-change source code is repeatedly called the same number of times as the determination step number, and the target function of the pre-change source code and the post-change source code are called and an equivalence determination unit that determines whether the target functions are equivalent.
  • equivalence checking can be performed by focusing on the influence state variables. Therefore, it is possible to perform the equivalence check while suppressing the amount of computer resources.
  • FIG. 1 is a configuration diagram of an equivalence checking system 100 according to Embodiment 1.
  • FIG. FIG. 2 is a functional configuration diagram of the equivalence checking system 100 according to the first embodiment;
  • FIG. 4 is a diagram showing terms for functions in Embodiment 1.
  • FIG. 4 shows an example of pre-change source code 201 according to the first embodiment;
  • FIG. FIG. 2 shows an example of a post-change source code 202 according to the first embodiment;
  • FIG. 4 is a flowchart of an equivalence checking method according to the first embodiment;
  • 4 is a flowchart of the influence state variable extraction process (S110) according to the first embodiment;
  • 4 is a diagram showing an affected portion 203 according to the first embodiment;
  • FIG. 4 is a flowchart of determination step number calculation processing (S120) according to the first embodiment; 4 is a flowchart for calculating the number of return steps according to Embodiment 1; 4 is a diagram showing calculation code 221 according to Embodiment 1.
  • FIG. 4 is a diagram showing calculation code 222 according to Embodiment 1.
  • FIG. 4 shows analysis results 223 according to Embodiment 1;
  • FIG. 4 shows analysis result 224 according to Embodiment 1;
  • FIG. 4 shows a calculation code 225 according to Embodiment 1;
  • FIG. 10 shows analysis results 226 according to Embodiment 1;
  • FIG. 5 is a diagram showing how the value of the influence state variable returns to the initial value according to the first embodiment;
  • FIG. 4 is a flow chart of determination code generation processing (S130) according to the first embodiment;
  • FIG. 4 shows an example of pre-change source code 231 according to the first embodiment;
  • FIG. 4 shows an example of a post-change source code 232 according to the first embodiment;
  • FIG. 4 shows an example of a determination header 233 according to the first embodiment;
  • FIG. 4 shows an example of a decision wrapper 234 according to the first embodiment;
  • FIG. 4 is a flowchart of an equivalence determination process (S140) according to the first embodiment;
  • FIG. 4 shows an example of an analysis result 241 according to the first embodiment;
  • FIG. FIG. 4 shows an example of an analysis result 242 according to Embodiment 1;
  • FIG. 2 is a hardware configuration diagram of the equivalence checking system 100 according to the first embodiment;
  • FIG. 1 is a hardware configuration diagram of
  • Embodiment 1 The equivalence checking system 100 will be described with reference to FIGS. 1 to 27.
  • FIG. The equivalence checking system 100 is used as a difference analysis system for software operations before and after change.
  • the equivalence checking system 100 is a computer comprising hardware such as a processor 101 , a memory 102 , an auxiliary storage device 103 , a communication device 104 and an input/output interface 105 . These pieces of hardware are connected to each other via signal lines.
  • the processor 101 is an IC that performs arithmetic processing and controls other hardware.
  • processor 101 is a CPU.
  • IC is an abbreviation for Integrated Circuit.
  • CPU is an abbreviation for Central Processing Unit.
  • Memory 102 is a volatile or non-volatile storage device. Memory 102 is also referred to as main storage or main memory. For example, memory 102 is RAM. The data stored in the memory 102 is saved in the auxiliary storage device 103 as required. RAM is an abbreviation for Random Access Memory.
  • Auxiliary storage device 103 is a non-volatile storage device.
  • the auxiliary storage device 103 is ROM, HDD or flash memory. Data stored in the auxiliary storage device 103 is loaded into the memory 102 as required.
  • ROM is an abbreviation for Read Only Memory.
  • HDD is an abbreviation for Hard Disk Drive.
  • Communication device 104 is a receiver and transmitter.
  • communication device 104 is a communication chip or NIC.
  • Communication of equivalence checking system 100 is performed using communication device 104 .
  • NIC is an abbreviation for Network Interface Card.
  • the input/output interface 105 is a port to which an input device and an output device are connected.
  • the input/output interface 105 is a USB terminal
  • the input device is a keyboard and mouse
  • the output device is a display.
  • Input/output of the equivalence checking system 100 is performed using the input/output interface 105 .
  • USB is an abbreviation for Universal Serial Bus.
  • the equivalence checking system 100 includes elements such as an influence state variable extraction unit 110 , a determination step number calculation unit 120 , a determination code generation unit 130 and an equivalence determination unit 140 . These elements are implemented in software.
  • the auxiliary storage device 103 stores an equivalence checking program for causing the computer to function as an influence state variable extraction unit 110 , a determination step count calculation unit 120 , a determination code generation unit 130 and an equivalence determination unit 140 .
  • the equivalence checking program is loaded into memory 102 and executed by processor 101 .
  • the auxiliary storage device 103 further stores an OS. At least part of the OS is loaded into memory 102 and executed by processor 101 .
  • the processor 101 executes the equivalence checking program while executing the OS.
  • OS is an abbreviation for Operating System.
  • the input/output data of the equivalence checking program are stored in the storage unit 190 .
  • Memory 102 functions as storage unit 190 .
  • a storage device such as the auxiliary storage device 103 , a register within the processor 101 and a cache memory within the processor 101 may function as the storage unit 190 instead of or together with the memory 102 .
  • the equivalence checking system 100 may include multiple processors that substitute for the processor 101 .
  • the equivalence checking program can be recorded (stored) in a computer-readable manner on a non-volatile recording medium such as an optical disc or flash memory.
  • FIG. 2 shows the functional configuration of the equivalence checking system 100. As shown in FIG. In FIG. 2, arrows indicate main data flows. The contents of each data will be described later.
  • the operating procedure of the equivalence checking system 100 corresponds to the equivalence checking method. Also, the operation procedure of the equivalence checking system 100 corresponds to the processing procedure of the equivalence checking program. The equivalence checking method will be described below.
  • a single process that is executed when a function is called is called a "step”.
  • the number of times the function is called is called the "step number”.
  • the number of steps corresponds to the number of times the function is executed.
  • the number of steps is N.
  • a variable that serves as an input to a function is called an "input variable”.
  • the input variables are the arguments or global variables required for processing the function.
  • the value of the input variable is called “input value”.
  • Each of in_1 to in_N represents the value of the input variable in at each step.
  • a variable that is the output of a function is called an “output variable”.
  • an output variable is a return value or global variable that represents the result of processing a function.
  • Each of out_1 to out_N represents the value of the output variable out at each step.
  • a variable representing the state of the software is called a "state variable”.
  • the values of state variables are called “state values”.
  • Each of st_1 to st_N represents the value of the state variable state at the end of each step.
  • State values are carried over from the previous step to the next step.
  • the state value st_1 at the end of the first step is used in the second step
  • the state value st_2 at the end of the second step is used in the third step.
  • input and output values are not carried over from the previous step to the next step.
  • FIG. 4 shows an example of pre-change source code 201 .
  • the pre-change source code 201 is the original source code.
  • pre-change source code 201 is written in C language.
  • FIG. 5 shows an example of the post-change source code 202 .
  • Modified source code 202 is modified source code.
  • the post-change source code 202 is written in C language. Different portions between the pre-change source code 201 and the post-change source code 202, that is, changed portions are underlined.
  • Each of pre-change source code 201 and post-change source code 202 includes a main function, a func1 function, and a func2 function.
  • the func1 function and the func2 function are functions to be checked for equivalence.
  • a function to be checked for equivalence is called a "target function”.
  • the target function is included in the pre-change source code 201 and the post-change source code 202, has a state variable, and is repeatedly called and executed.
  • the func1 and func2 functions are repeatedly executed while a specific condition is satisfied in the main function.
  • the pre-change source code 201 in FIG. 4 will be described.
  • the target function switches the part to be executed inside the function according to the state value each time an input value is received at each step. Then, the state value of the next step is determined by the execution result of the target function.
  • the func1 function has two state variables (state, counter). These state values then change each time the func1 function is executed. In the initial state, the value of each of the state variable state and the state variable counter is 0. When the func1 function is executed when the value of the state variable state is 0, the values of the state variable state and the state variable counter are changed to 1, respectively. When the func1 function is executed when the value of the state variable state is 1, the values of the state variable state and the state variable counter are changed to 2, respectively.
  • the state variable counter is a variable for recording statistical information about the number of times the func1 function is called. Each time the func1 function is called, 1 is added to the value of the state variable counter.
  • the func2 function has a state variable num. And this state value changes each time the func2 function is executed. In the initial state, the value of the state variable num is 1. Each time the func2 function is executed, 1 is added to the value of the state variable num. However, if the func1 function is executed when the value of the state variable num is 1000000000, the value of the state variable num returns to 1.
  • the target function determines the output value according to the content of the processing corresponding to the state value.
  • the func1 function determines an output value according to the content of processing corresponding to the value of the state variable state.
  • the output value is represented by in+1 with respect to the input value in of the func1 function.
  • the output value is represented by in+2 for the input value in of the func1 function.
  • the output value is represented by in+3 with respect to the input value in of the func1 function.
  • the func2 function determines an output value according to the contents of processing corresponding to the value of the state variable num.
  • the output value is represented by in+1 for the input value in of the func2 function. If the value of the state variable num is not 1000000000, the output value is expressed as in+num for the input value in of the func2 function.
  • the post-change source code 202 in FIG. 5 will be described.
  • the output values of the func1 function and the func2 function are changed with respect to the pre-change source code 201 .
  • the func1 function when the value of the state variable state is 2, the output value is expressed as in+5 with respect to the input value in of the func1 function.
  • the func2 function when the value of the state variable num is 1000000000, the output value is expressed as in+2 for the input value in of the func2 function.
  • Steps S110 to S140 are executed for each target function.
  • the influence state variable extraction unit 110 extracts influence state variables for the target function from the pre-change source code 201 and the post-change source code 202, respectively.
  • the effect state variables extracted from the pre-change source code 201 are referred to as pre-change effect state variables 211 .
  • the effect state variables extracted from the post-change source code 202 are referred to as post-change effect state variables 212 .
  • Influencing state variables are state variables that affect the output value of the target function.
  • Steps S111 to S114 are executed by analyzing the pre-change source code 201 .
  • Steps S115 to S118 are executed by analyzing the modified source code 202 .
  • step S ⁇ b>112 the influence state variable extraction unit 110 extracts, from the pre-change source code 201 , the influence portion of the target function on the output variables.
  • the influencing part is the part that affects the value of the output variable of the target function.
  • the effect state variable extraction unit 110 extracts the effect part from the pre-change source code 201 using program slicing.
  • step S ⁇ b>113 the affected state variable extracting unit 110 extracts a non-function scope variable from the affected portion of the pre-change source code 201 .
  • An out-of-function scope variable is a variable that has an out-of-function scope of the target function and can be referenced from outside the target function.
  • global variables are out-of-function scope variables.
  • step S ⁇ b>114 the influence state variable extraction unit 110 excludes the input variables of the target function and the output variables of the target function from the non-function scope variables of the pre-change source code 201 .
  • the remaining out-of-function scope variables become pre-change impact state variables 211 .
  • step S ⁇ b>115 the influence state variable extraction unit 110 extracts input variables and output variables from the target function of the post-change source code 202 .
  • the extraction method is the same as the method in step S111.
  • step S ⁇ b>116 the influence state variable extraction unit 110 extracts from the post-change source code 202 the influence portion of the target function on the output variables.
  • the extraction method is the same as the method in step S112.
  • step S ⁇ b>117 the affected state variable extracting unit 110 extracts a non-function scope variable from the affected portion of the post-change source code 202 .
  • the extraction method is the same as the method in step S113.
  • step S ⁇ b>118 the influence state variable extraction unit 110 excludes the input variables of the target function and the output variables of the target function from the non-function scope variables of the post-change source code 202 .
  • the remaining out-of-function scope variables become post-change impact state variables 212 .
  • the influence state variable extraction processing (S110) will be described using the pre-change source code 201 in FIG. 4 and the post-change source code 202 in FIG. 5 as examples.
  • the effect state variable extraction unit 110 extracts the argument in as an input variable from the func1 function of each of the pre-change source code 201 and the post-change source code 202, and uses the return value specified in the return statement as an output variable. Extract.
  • the effect state variable extraction unit 110 extracts the argument in as an input variable from the func2 function of each of the pre-change source code 201 and the post-change source code 202, and uses the return value specified in the return statement as an output variable. Extract.
  • the influence state variable extraction unit 110 extracts portions (influence portions) that affect the values of the output variables of the func1 and func2 functions from the pre-change source code 201 and the post-change source code 202, respectively.
  • the affected portion 203 is shown in FIG.
  • the affected portion 203 is the affected portion extracted from the pre-change source code 201 in FIG.
  • Affected portion 204 is shown in FIG.
  • Affected portion 204 is the affected portion extracted from modified source code 202 of FIG.
  • the effect state variable extraction unit 110 extracts the effect state variable state for the func1 function and the effect state variable num for the func2 function from the respective effect portions of the pre-change source code 201 and the post-change source code 202. .
  • step S ⁇ b>120 the determination step number calculation unit 120 calculates the determination step number 220 based on the influence state variables for the target function of the pre-change source code 201 and the post-change source code 202 .
  • the number of determination steps 220 determines whether the target function of the pre-change source code 201 and the target function of the post-change source code 202 are equivalent. is the number of times that is called and executed.
  • the determination step number 220 is the number of calls (number of executions) of the target function when both the condition (1) and the condition (2) are satisfied.
  • Condition (1) is that the target function is repeatedly called in the pre-change source code 201 and the value of the affected state variable returns to the initial value.
  • Condition (2) is a condition that the target function is repeatedly called in the post-change source code 202 and the value of the affected state variable returns to the initial value.
  • step S ⁇ b>121 the determination step number calculation unit 120 calculates the number of return steps of the target function of the pre-change source code 201 by analyzing the pre-change source code 201 .
  • the number of return steps is the number of calls (number of executions) of the target function when the target function is repeatedly called and the value of the affected state variable returns to the initial value. A method for calculating the number of return steps will be described later.
  • step S122 the determination step number calculation unit 120 calculates the number of return steps of the target function of the post-change source code 202 by analyzing the post-change source code 202.
  • step S ⁇ b>123 the determination step number calculation unit 120 calculates the least common multiple of the return step number of the target function of the pre-change source code 201 and the return step number of the target function of the post-change source code 202 .
  • the calculated lowest common multiple is the determination step number 220 .
  • the determination step number 220 can be calculated by the determination step number calculation process (S120). By using the number of determination steps 220, even if there are state variables with an extremely large number of states, it is possible to determine equivalence until both the target functions before and after the change return to the initial state.
  • step s121 the judgment step number calculation unit 120 determines the upper limit number of steps based on the amount of computer resources that can be used for analysis of the calculation code, which will be described later.
  • the upper limit number of steps is the upper limit of the number of times the target function is executed without releasing computer resources.
  • step s122 the determination step count calculator 120 generates a calculation code.
  • the calculation code is source code for calculating the number of return steps, and is also called a calculation wrapper. Specifically, a calculation code for the first time and a calculation code for the second and subsequent times are generated.
  • FIG. 12 shows calculation code 221 .
  • the calculation code 221 is an example of the first calculation code for the func1 function.
  • FIG. 13 shows an example of calculation code 222 .
  • Calculation code 222 is an example of the first calculation code for the func2 function.
  • Code (0) to code (3) are described in each of the calculation code 221 and the calculation code 222 .
  • the upper limit number of steps X is 1,000.
  • Code (0) is the code for saving the initial values of the effect state variables.
  • the initial value of the impact state variable is the value of the impact state variable when the subject function is first called.
  • Code (1) is a code for calling the target function the same number of times as the upper limit number of steps. In this case, 1000 steps of processing for reading the target function are described.
  • Code (2) is a code for determining whether the post-condition is satisfied for the same number of times as the upper limit number of steps.
  • the condition that the value of the influence state variable is equal to the initial value is the postcondition.
  • Code (3) is for recording the value of the influence state variable at the end of the upper limit number of steps.
  • the value of the influence state variable at the end of the upper limit number of steps is referred to as the final step state value.
  • step s123 the number-of-judgments-steps calculation unit 120 secures computer resources for the analysis of the calculation code for the first time.
  • step s124 the determination step count calculator 120 analyzes the calculation code and executes the calculation code. For example, the determination step count calculator 120 analyzes the calculation code using bounded model checking. In step s124 for the first time, the calculation code for the first time is used. In step s124 for the second and subsequent times, the calculation code for the second and subsequent times is used.
  • step s125 the judgment step number calculation unit 120 judges whether the value of the influence state variable has returned to the initial value in any step up to the upper limit number of steps, based on the analysis result of the calculation code. If the value of the influence state variable returns to the initial value at any step up to the upper limit number of steps, the process proceeds to step s128. If the value of the influence state variable has not returned to the initial value in any step up to the upper limit number of steps, the process proceeds to step s126.
  • the analysis result 223 is shown in FIG.
  • the analysis result 223 is the analysis result of the first calculation code 221 for the func1 function.
  • FAILURE means that the value of the impact state variable is different from the initial value.
  • SUCCESS means that the value of the impact state variable is equal to the initial value.
  • Analysis result 223 indicates that the value of the influence state variable of the func1 function returns to the initial value in the third step. In this case, after step s125, the process proceeds to step s129.
  • the analysis result 224 is shown in FIG.
  • the analysis result 224 is the analysis result of the first calculation code 222 for the func2 function.
  • Analysis result 224 indicates that the value of the influence state variable of the func2 function does not return to the initial value by the 1000th step. In this case, after step s125, the process proceeds to step s126.
  • step s126 the number-of-judgments-steps calculator 120 temporarily releases the computer resources reserved for the analysis of the first calculation code (or the second and subsequent calculation codes). Note that the state value of the final step is recorded in a storage area other than the computer resource to be released.
  • step s127 the number-of-judgments-steps calculation unit 120 secures computer resources again for analysis of calculation codes for the second and subsequent times. After step s127, the process proceeds to step s124.
  • step s124 for the second and subsequent times the calculation code for the second and subsequent times is used.
  • a code for taking over the state value of the final step is added to the second and subsequent calculation codes.
  • Calculation code 225 is shown in FIG.
  • Calculation code 225 is an example of calculation code for the second and subsequent times for the func2 function.
  • Code (0) is changed and code (4) is added to the calculation code 222 of FIG.
  • Code (0) saves the initial value of the effect state variable "1" without using the effect state variable "num”.
  • Code (4) is a code for taking over the state value of the final step.
  • the state value of the final step is set to the influence state variable num.
  • state_last_step represents the state value of the last step.
  • step s128 will be described.
  • the judgment step number calculation unit 120 judges the number of steps when the value of the influence state variable returns to the initial value for the first time as the number of return steps. Thereby, the number of return steps is obtained.
  • the determination step number calculation unit 120 determines that the number of return steps of the func1 function is 3.
  • the analysis result 226 is shown in FIG.
  • the analysis result 226 is the analysis result when the calculation code for the func2 function is analyzed 1000000 times.
  • the upper limit number of steps X is 1,000.
  • FIG. 18 shows how the calculation code is parsed ten times and the values of the impact state variables return to their initial values.
  • the upper limit number of steps X is determined based on the amount of computer resources that can be used for one analysis of the computational code.
  • the subject function is called X times each time the computational code is parsed.
  • step S ⁇ b>130 the determination code generation section 130 generates the determination code 230 based on the number of determination steps 220 .
  • the determination code 230 repeatedly calls the target function of the pre-change source code 201 and the target function of the post-change source code 202 the same number of times as the number of determination steps 220, and determines the target function of the pre-change source code 201 and the post-change source code.
  • 202 is a source code for determining whether the target functions of 202 are equivalent.
  • step S ⁇ b>131 the determination code generation unit 130 edits the pre-change source code 201 and the post-change source code 202 in order to eliminate name conflicts between the pre-change source code 201 and the post-change source code 202 .
  • pre-change source code 231 and post-change source code 232 are generated.
  • the pre-change source code 231 is the edited pre-change source code 201 .
  • the modified source code 232 is the edited modified source code 202 .
  • determination code generation unit 130 attaches different prefixes or suffixes to function names and global variable names between pre-change source code 201 and post-change source code 202 .
  • FIG. 20 shows an example of pre-change source code 231 .
  • FIG. 21 shows an example of the post-change source code 232 .
  • the function names "main”, “func1” and “func2” and the global variable names "state” and “counter” are each given the suffix "_1”.
  • the function names "main”, “func1” and “func2” and the global variable names "state” and “counter” are each given the suffix "_2”.
  • step S ⁇ b>132 the determination code generator 130 generates the determination header 233 .
  • the determination header 233 is a header describing a declaration necessary for determining whether the target function of the pre-change source code 231 and the target function of the post-change source code 232 are equivalent.
  • the determination code generation unit 130 describes the prototype declaration of the target function of the pre-change source code 231 and the prototype declaration of the target function of the post-change source code 232 in the determination header 233 .
  • the determination code generation unit 130 writes, in the determination header 233, the extern declaration of the global variables of the pre-change source code 231 and the extern declaration of the global variables of the post-change source code 232, etc., as necessary.
  • FIG. 22 shows an example of the determination header 233.
  • the determination header 233 describes the declarations of the target functions “func1_1” and “func2_1” of the pre-change source code 231 and the declarations of the target functions “func1_2” and “func2_2” of the post-change source code 232 .
  • step S133 will be described.
  • the judgment code generation unit 130 generates the judgment wrapper 234 .
  • the determination wrapper 234 is a wrapper that describes processing necessary to determine whether the target function of the pre-change source code 231 and the target function of the post-change source code 232 are equivalent.
  • the determination code generation unit 130 writes code (A) to code (C) in the determination wrapper 234 .
  • Code (A) is a code for specifying preconditions. The precondition is that the input value of the target function of the pre-change source code 231 and the input value of the target function of the post-change source code 232 are the same in all the steps corresponding to 220 determination steps.
  • Code (B) is a code for repeatedly calling each of the target function of the pre-change source code 231 and the target function of the post-change source code 232 as many times as the determination step number 220 .
  • Code (C) is a code for determining whether the postcondition is satisfied.
  • the post-condition is that the output value of the target function of the pre-change source code 231 and the output value of the target function of the post-change source code 232 are equal in all steps corresponding to 220 determination steps.
  • FIG. 23 shows an example decision wrapper 234 for the func1 function.
  • the determination step number STEP is three.
  • code (A) preconditions for three steps are specified.
  • code (B) the func1 function (func1_1, func1_2) is called three times.
  • code (C) three steps of postconditions are determined.
  • a set of pre-change source code 231 , post-change source code 232 , decision header 233 and decision wrapper 234 is decision code 230 .
  • the determination code 230 can be generated by the determination code generation process (S130). By using the determination code 230, even when there are state variables with a very large number of states, it is possible to correctly determine whether the processing contents of the target function before and after the change are equivalent.
  • step S140 the equivalence determination unit 140 uses the determination code 230 to determine whether the target function of the pre-change source code 201 and the target function of the post-change source code 202 are equivalent.
  • step S ⁇ b>141 the equivalence determination unit 140 analyzes the determination code 230 and executes the process of the determination wrapper 234 .
  • the equivalence determination unit 140 analyzes the determination code 230 using bounded model checking.
  • step S ⁇ b>142 the equivalence determination unit 140 determines whether the target function of the pre-change source code 201 and the target function of the post-change source code 202 are equivalent based on the analysis result of the determination code 230 .
  • the analysis result of the judgment code 230 corresponds to the processing result of the judgment wrapper 234 .
  • step S ⁇ b>143 the equivalence determination unit 140 outputs the determination result 240 .
  • the determination result 240 indicates whether the target function of the pre-change source code 201 and the target function of the post-change source code 202 are equivalent.
  • the determination result 240 also indicates a step (inequality step) at which the target function of the pre-change source code 201 and the target function of the post-change source code 202 become unequal.
  • FIG. 25 shows an example of the analysis result 241.
  • the analysis result 241 is the analysis result of the determination code 230 for the func1 function.
  • the number of decision steps 220 is three.
  • SUCCESS means that the output values are equal before and after the change.
  • FAILURE means that the output value is different before and after the change.
  • the output values of the func1 function before and after the change are the same in the first step and the second step, but the output values of the func1 function are different before and after the change in the third step. Therefore, the func1 function before and after the change is unequal, and the inequality step is the third step.
  • FIG. 26 shows an example of the analysis result 242.
  • the analysis result 242 is the analysis result of the determination code 230 for the func2 function.
  • the determination step number 220 is 1000000000.
  • the output value of the func2 function differs before and after the change. Therefore, the func2 function before and after the change is unequal, and the unequal step is the 1000000000th step.
  • Embodiment 1 it is possible to analyze the processing content by excluding state variables that do not affect the calculation of the output value of the target function and focusing on only the state variables that affect the calculation. In addition, by dividing the analysis for equivalence checking into multiple times and repeating the release and re-allocation of computer resources between the divided analyses, the target function before and after the change that has an extremely large number of state variables are equivalent.
  • Equivalence checking system 100 comprises processing circuitry 109 .
  • the processing circuit 109 is hardware that realizes the influence state variable extraction unit 110 , the determination step number calculation unit 120 , the determination code generation unit 130 , and the equivalence determination unit 140 .
  • the processing circuit 109 may be dedicated hardware, or may be the processor 101 that executes a program stored in the memory 102 .
  • processing circuitry 109 may be, for example, a single circuit, multiple circuits, a programmed processor, a parallel programmed processor, an ASIC, an FPGA, or a combination thereof.
  • ASIC is an abbreviation for Application Specific Integrated Circuit.
  • FPGA is an abbreviation for Field Programmable Gate Array.
  • the equivalence checking system 100 may include a plurality of processing circuits that substitute for the processing circuit 109.
  • processing circuit 109 some functions may be implemented by dedicated hardware, and the remaining functions may be implemented by software or firmware.
  • the functions of the equivalence checking system 100 can be implemented in hardware, software, firmware, or a combination thereof.
  • Embodiment 1 is an example of a preferred form and is not intended to limit the technical scope of the present disclosure. Embodiment 1 may be partially implemented, or may be implemented in combination with other modes. The procedures described using flowcharts and the like may be changed as appropriate.
  • Equivalence checking system 100 may be implemented with two or more devices.
  • a “unit” that is an element of the equivalence checking system 100 may be read as “processing”, “process”, “circuit” or “circuitry”.
  • 100 equivalence check system 101 processor, 102 memory, 103 auxiliary storage device, 104 communication device, 105 input/output interface, 109 processing circuit, 110 influence state variable extraction unit, 120 determination step number calculation unit, 130 determination code generation unit, 140 equivalence determination unit, 190 storage unit, 201 source code before change, 202 source code after change, 203 affected part, 204 affected part, 211 affected state variables before change, 212 affected state variables after change, 220 number of judgment steps, 221 calculation Code, 222 Calculated code, 223 Analysis result, 224 Analysis result, 225 Calculated code, 226 Analysis result, 230 Judgment code, 231 Before change source code, 232 After change source code, 233 Judgment header, 234 Judgment wrapper, 240 Judgment result, 241 Analysis result, 242 Analysis result.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

An effect state variable extraction unit (110) extracts, from each of an unchanged source code and a changed source code, an effect state variable of a target function that is repeatedly called upon. A determination step number calculation unit (120) calculates, as a determination step number, a number of times that the target function is called upon and that satisfies the condition in which: the unchanged target function is repeatedly called upon and the value of the effect state variable returns to an initial value; and the changed target function is repeatedly called upon and the value of the effect state variable returns to the initial value. A determination code generation unit (130) determines equivalence by repeatedly calling upon each of the unchanged target function and the changed target function the same number of times as the determination step number.

Description

等価性検査システムおよび等価性検査プログラムEquivalence Checking System and Equivalence Checking Program
 本開示は、ソフトウェア動作の差分解析に関するものである。 The present disclosure relates to differential analysis of software behavior.
 制御装置に搭載される制御ソフトウェアでは、多機能化と付加価値向上とに応えるために制御機能が電子化される。これにより、制御ソフトウェアの大規模化および複雑化が急速に進んでいる。
 また、機種の派生または仕向け地の違いによる制御ソフトウェアのバリエーションが今後急増していくことが見込まれる。
 このような状況下で収益力の維持および強化を図るためには、制御ソフトウェアの開発において生産性の向上に取り組む必要がある。
In the control software installed in the control device, the control functions are computerized in order to respond to multi-functionality and increased added value. As a result, control software is rapidly increasing in scale and complexity.
In addition, it is expected that variations in control software will increase rapidly in the future due to differences in model derivations and destinations.
In order to maintain and strengthen profitability under these circumstances, it is necessary to work on improving productivity in the development of control software.
 具体的な施策としては、ソフトウェアの実行環境の導入による差分開発および派生開発が考えられる。ソフトウェアの実行環境は、通信処理、タイマ処理、スケジューラ、オペレーティングシステム(OS)およびミドルウェアなどである。
 また、品質の確保および開発の効率化を実現するための手法およびツールをソフトウェアの開発に適用する、という施策が考えられる。
As a concrete measure, difference development and derivative development by introducing a software execution environment can be considered. The software execution environment includes communication processing, timer processing, scheduler, operating system (OS), middleware, and the like.
Another possible measure is to apply techniques and tools for ensuring quality and improving development efficiency to software development.
 このような施策を実施する際には、新たな実行環境への移行前に又は新たな実行環境への移行後に日々開発されるバージョン違いの2つのソフトウェアに対して、変更の影響範囲を特定する必要がある。
 そのためには、変更前後の2つのソースコードに対してテキストの見た目ではなく処理の内容について修正を判断することが重要である。
When implementing such measures, identify the scope of impact of changes to two versions of software that are developed daily before or after migration to a new execution environment. There is a need.
For this purpose, it is important to determine whether to modify the two source codes before and after the modification based on the content of the process rather than the appearance of the text.
 これに対して、処理内容が修正された箇所を形式手法を活用して判別する等価性検査という技術がある。 On the other hand, there is a technology called equivalence checking that uses formal methods to determine where the processing content has been modified.
 等価性検査とは、変更前後の2つのソースコードを対象に、プログラミング言語の関数単位で処理内容を修正したかどうかを正確に判別する技術である。
 具体的には、変更前後で対応が付く2つの関数に同じ入力値を与えたときに常に同じ出力値が得られる場合、処理内容が論理的に同一(すなわち等価)であると判定する。そうでない場合、処理内容が論理的に異なる(すなわち不等価)であると判定する。
Equivalence checking is a technique for accurately determining whether or not processing contents have been modified in programming language function units for two source codes before and after modification.
Specifically, if the same output value is always obtained when the same input value is given to two functions that have correspondence before and after the change, it is determined that the processing contents are logically the same (that is, equivalent). Otherwise, it is determined that the processing contents are logically different (that is, unequal).
 また、関数は複数の状態変数を持つことがあり、状態変数が取る値(状態値)が前のステップから次のステップへ引き継がれて変化していく。ここで、ステップは関数が呼び出されたときに実行される1回分の処理である。関数が状態変数を持つ場合、各ステップで関数が入力値を受け取るたびにそのときの状態値に依存して関数内部の実行部分が切り替わり、処理内容によって出力値と次のステップの状態値が決まる。
 特許文献1は、このような状態変数を持つ2つの関数を対象に、処理内容が等価かどうか判定する技術を開示している。
Also, a function may have multiple state variables, and the values (state values) taken by the state variables are inherited and changed from the previous step to the next step. Here, a step is a one-time process that is executed when a function is called. When a function has a state variable, each time the function receives an input value at each step, the execution part inside the function switches depending on the state value at that time, and the output value and the state value of the next step are determined by the processing content.
Patent Literature 1 discloses a technique for determining whether the processing contents of two functions having such state variables are equivalent.
国際公開第2018/193548号WO2018/193548
 複数の状態変数を持つ関数を対象にした等価性検査では、各状態変数が初期状態から始まって再び初期状態に戻るまで、すべてのステップについて処理内容が解析される。
 また、状態変数が取る値の数すなわち状態数に依存して、解析に必要な計算機リソースの量が決まる。状態数が非常に多い状態変数が1つでもある場合、1回で解析されるステップの数が非常に多くなることがあり、必要な計算機リソースの量が非常に多くなることがある。そのため、状態数が少ない状態変数と状態数が非常に多い状態変数がソースコードに混在する場合、すべての状態変数が初期状態に戻るまでのステップ数について処理内容を解析することは困難である。
In the equivalence check for functions with multiple state variables, the processing contents are analyzed for all steps from the initial state of each state variable until it returns to the initial state again.
Also, the amount of computer resources required for analysis is determined depending on the number of values taken by the state variables, that is, the number of states. If there is even one state variable with a very large number of states, the number of steps analyzed at one time may become very large, and the amount of computational resources required may become very large. Therefore, when state variables with a small number of states and state variables with a large number of states coexist in the source code, it is difficult to analyze the processing details regarding the number of steps until all state variables return to their initial states.
 本開示は、計算機リソースの量を抑えて等価性検査を行えるようにすることを目的とする。 The purpose of the present disclosure is to enable equivalence checking while reducing the amount of computer resources.
 本開示の等価性検査システムは、
 変更前ソースコードと変更後ソースコードとのそれぞれから、繰り返し呼び出される対象関数の出力値に影響を与える状態変数である影響状態変数を抽出する影響状態変数抽出部と、
 前記変更前ソースコードにおいて前記対象関数が繰り返し呼び出され前記影響状態変数の値が初期値に戻り、且つ、前記変更後ソースコードにおいて前記対象関数が繰り返し呼び出され前記影響状態変数の値が初期値に戻る、という条件を満たす前記対象関数の呼び出し回数を判定ステップ数として算出する判定ステップ数算出部と、
 前記変更前ソースコードの前記対象関数と前記変更後ソースコードの前記対象関数とのそれぞれを前記判定ステップ数と同じ回数繰り返し呼び出して、前記変更前ソースコードの前記対象関数と前記変更後ソースコードの前記対象関数が等価であるか判定する等価判定部と、を備える。
The equivalence checking system of the present disclosure includes:
an influence state variable extraction unit for extracting an influence state variable, which is a state variable that influences an output value of a target function that is repeatedly called, from each of the pre-change source code and the post-change source code;
The target function is repeatedly called in the pre-change source code and the value of the effect state variable is returned to the initial value, and the target function is repeatedly called in the post-change source code and the value of the effect state variable is returned to the initial value. a determination step number calculation unit that calculates the number of times the target function is called that satisfies the condition of returning as a determination step number;
each of the target function of the pre-change source code and the target function of the post-change source code is repeatedly called the same number of times as the determination step number, and the target function of the pre-change source code and the post-change source code are called and an equivalence determination unit that determines whether the target functions are equivalent.
 本開示によれば、影響状態変数に絞って等価性検査を行うことができる。そのため、計算機リソースの量を抑えて等価性検査を行うことが可能となる。 According to the present disclosure, equivalence checking can be performed by focusing on the influence state variables. Therefore, it is possible to perform the equivalence check while suppressing the amount of computer resources.
実施の形態1における等価性検査システム100の構成図。1 is a configuration diagram of an equivalence checking system 100 according to Embodiment 1. FIG. 実施の形態1における等価性検査システム100の機能構成図。FIG. 2 is a functional configuration diagram of the equivalence checking system 100 according to the first embodiment; FIG. 実施の形態1における関数についての用語を示す図。4 is a diagram showing terms for functions in Embodiment 1. FIG. 実施の形態1における変更前ソースコード201の例を示す図。4 shows an example of pre-change source code 201 according to the first embodiment; FIG. 実施の形態1における変更後ソースコード202の例を示す図。FIG. 2 shows an example of a post-change source code 202 according to the first embodiment; FIG. 実施の形態1における等価性検査方法のフローチャート。4 is a flowchart of an equivalence checking method according to the first embodiment; 実施の形態1における影響状態変数抽出処理(S110)のフローチャート。4 is a flowchart of the influence state variable extraction process (S110) according to the first embodiment; 実施の形態1における影響部分203を示す図。4 is a diagram showing an affected portion 203 according to the first embodiment; FIG. 実施の形態1における影響部分204を示す図。FIG. 2 shows an affected portion 204 according to the first embodiment; FIG. 実施の形態1における判定ステップ数算出処理(S120)のフローチャート。4 is a flowchart of determination step number calculation processing (S120) according to the first embodiment; 実施の形態1における戻りステップ数を算出するためのフローチャート。4 is a flowchart for calculating the number of return steps according to Embodiment 1; 実施の形態1における算出コード221を示す図。4 is a diagram showing calculation code 221 according to Embodiment 1. FIG. 実施の形態1における算出コード222を示す図。4 is a diagram showing calculation code 222 according to Embodiment 1. FIG. 実施の形態1における解析結果223を示す図。FIG. 4 shows analysis results 223 according to Embodiment 1; 実施の形態1における解析結果224を示す図。FIG. 4 shows analysis result 224 according to Embodiment 1; 実施の形態1における算出コード225を示す図。FIG. 4 shows a calculation code 225 according to Embodiment 1; FIG. 実施の形態1における解析結果226を示す図。FIG. 10 shows analysis results 226 according to Embodiment 1; FIG. 実施の形態1における影響状態変数の値が初期値に戻るまでの様子を示す図。FIG. 5 is a diagram showing how the value of the influence state variable returns to the initial value according to the first embodiment; 実施の形態1における判定コード生成処理(S130)のフローチャート。FIG. 4 is a flow chart of determination code generation processing (S130) according to the first embodiment; FIG. 実施の形態1における変更前ソースコード231の例を示す図。4 shows an example of pre-change source code 231 according to the first embodiment; FIG. 実施の形態1における変更後ソースコード232の例を示す図。FIG. 4 shows an example of a post-change source code 232 according to the first embodiment; FIG. 実施の形態1における判定ヘッダ233の例を示す図。4 shows an example of a determination header 233 according to the first embodiment; FIG. 実施の形態1における判定ラッパー234の例を示す図。4 shows an example of a decision wrapper 234 according to the first embodiment; FIG. 実施の形態1における等価判定処理(S140)のフローチャート。4 is a flowchart of an equivalence determination process (S140) according to the first embodiment; 実施の形態1における解析結果241の例を示す図。FIG. 4 shows an example of an analysis result 241 according to the first embodiment; FIG. 実施の形態1における解析結果242の例を示す図。FIG. 4 shows an example of an analysis result 242 according to Embodiment 1; FIG. 実施の形態1における等価性検査システム100のハードウェア構成図。2 is a hardware configuration diagram of the equivalence checking system 100 according to the first embodiment; FIG.
 実施の形態および図面において、同じ要素または対応する要素には同じ符号を付している。説明した要素と同じ符号が付された要素の説明は適宜に省略または簡略化する。図中の矢印はデータの流れ又は処理の流れを主に示している。 In the embodiments and drawings, the same or corresponding elements are denoted by the same reference numerals. Descriptions of elements having the same reference numerals as those described will be omitted or simplified as appropriate. Arrows in the figure mainly indicate the flow of data or the flow of processing.
 実施の形態1.
 等価性検査システム100について、図1から図27に基づいて説明する。
 等価性検査システム100は、変更前後のソフトウェア動作についての差分解析システムとして利用される。
Embodiment 1.
The equivalence checking system 100 will be described with reference to FIGS. 1 to 27. FIG.
The equivalence checking system 100 is used as a difference analysis system for software operations before and after change.
***構成の説明***
 図1に基づいて、等価性検査システム100の構成を説明する。
 等価性検査システム100は、プロセッサ101とメモリ102と補助記憶装置103と通信装置104と入出力インタフェース105といったハードウェアを備えるコンピュータである。これらのハードウェアは、信号線を介して互いに接続されている。
*** Configuration description ***
The configuration of the equivalence checking system 100 will be described based on FIG.
The equivalence checking system 100 is a computer comprising hardware such as a processor 101 , a memory 102 , an auxiliary storage device 103 , a communication device 104 and an input/output interface 105 . These pieces of hardware are connected to each other via signal lines.
 プロセッサ101は、演算処理を行うICであり、他のハードウェアを制御する。例えば、プロセッサ101はCPUである。
 ICは、Integrated Circuitの略称である。
 CPUは、Central Processing Unitの略称である。
The processor 101 is an IC that performs arithmetic processing and controls other hardware. For example, processor 101 is a CPU.
IC is an abbreviation for Integrated Circuit.
CPU is an abbreviation for Central Processing Unit.
 メモリ102は揮発性または不揮発性の記憶装置である。メモリ102は、主記憶装置またはメインメモリとも呼ばれる。例えば、メモリ102はRAMである。メモリ102に記憶されたデータは必要に応じて補助記憶装置103に保存される。
 RAMは、Random Access Memoryの略称である。
Memory 102 is a volatile or non-volatile storage device. Memory 102 is also referred to as main storage or main memory. For example, memory 102 is RAM. The data stored in the memory 102 is saved in the auxiliary storage device 103 as required.
RAM is an abbreviation for Random Access Memory.
 補助記憶装置103は不揮発性の記憶装置である。例えば、補助記憶装置103は、ROM、HDDまたはフラッシュメモリである。補助記憶装置103に記憶されたデータは必要に応じてメモリ102にロードされる。
 ROMは、Read Only Memoryの略称である。
 HDDは、Hard Disk Driveの略称である。
Auxiliary storage device 103 is a non-volatile storage device. For example, the auxiliary storage device 103 is ROM, HDD or flash memory. Data stored in the auxiliary storage device 103 is loaded into the memory 102 as required.
ROM is an abbreviation for Read Only Memory.
HDD is an abbreviation for Hard Disk Drive.
 通信装置104はレシーバ及びトランスミッタである。例えば、通信装置104は通信チップまたはNICである。等価性検査システム100の通信は通信装置104を用いて行われる。
 NICは、Network Interface Cardの略称である。
Communication device 104 is a receiver and transmitter. For example, communication device 104 is a communication chip or NIC. Communication of equivalence checking system 100 is performed using communication device 104 .
NIC is an abbreviation for Network Interface Card.
 入出力インタフェース105は、入力装置および出力装置が接続されるポートである。例えば、入出力インタフェース105はUSB端子であり、入力装置はキーボードおよびマウスであり、出力装置はディスプレイである。等価性検査システム100の入出力は入出力インタフェース105を用いて行われる。
 USBは、Universal Serial Busの略称である。
The input/output interface 105 is a port to which an input device and an output device are connected. For example, the input/output interface 105 is a USB terminal, the input device is a keyboard and mouse, and the output device is a display. Input/output of the equivalence checking system 100 is performed using the input/output interface 105 .
USB is an abbreviation for Universal Serial Bus.
 等価性検査システム100は、影響状態変数抽出部110と判定ステップ数算出部120と判定コード生成部130と等価判定部140といった要素を備える。これらの要素はソフトウェアで実現される。 The equivalence checking system 100 includes elements such as an influence state variable extraction unit 110 , a determination step number calculation unit 120 , a determination code generation unit 130 and an equivalence determination unit 140 . These elements are implemented in software.
 補助記憶装置103には、影響状態変数抽出部110と判定ステップ数算出部120と判定コード生成部130と等価判定部140としてコンピュータを機能させるための等価性検査プログラムが記憶されている。等価性検査プログラムは、メモリ102にロードされて、プロセッサ101によって実行される。
 補助記憶装置103には、さらに、OSが記憶されている。OSの少なくとも一部は、メモリ102にロードされて、プロセッサ101によって実行される。
 プロセッサ101は、OSを実行しながら、等価性検査プログラムを実行する。
 OSは、Operating Systemの略称である。
The auxiliary storage device 103 stores an equivalence checking program for causing the computer to function as an influence state variable extraction unit 110 , a determination step count calculation unit 120 , a determination code generation unit 130 and an equivalence determination unit 140 . The equivalence checking program is loaded into memory 102 and executed by processor 101 .
The auxiliary storage device 103 further stores an OS. At least part of the OS is loaded into memory 102 and executed by processor 101 .
The processor 101 executes the equivalence checking program while executing the OS.
OS is an abbreviation for Operating System.
 等価性検査プログラムの入出力データは記憶部190に記憶される。
 メモリ102は記憶部190として機能する。但し、補助記憶装置103、プロセッサ101内のレジスタおよびプロセッサ101内のキャッシュメモリなどの記憶装置が、メモリ102の代わりに、又は、メモリ102と共に、記憶部190として機能してもよい。
The input/output data of the equivalence checking program are stored in the storage unit 190 .
Memory 102 functions as storage unit 190 . However, a storage device such as the auxiliary storage device 103 , a register within the processor 101 and a cache memory within the processor 101 may function as the storage unit 190 instead of or together with the memory 102 .
 等価性検査システム100は、プロセッサ101を代替する複数のプロセッサを備えてもよい。 The equivalence checking system 100 may include multiple processors that substitute for the processor 101 .
 等価性検査プログラムは、光ディスクまたはフラッシュメモリ等の不揮発性の記録媒体にコンピュータ読み取り可能に記録(格納)することができる。 The equivalence checking program can be recorded (stored) in a computer-readable manner on a non-volatile recording medium such as an optical disc or flash memory.
 図2に、等価性検査システム100の機能構成を示す。
 図2において、矢印は主なデータの流れを示している。
 各データの内容については後述する。
FIG. 2 shows the functional configuration of the equivalence checking system 100. As shown in FIG.
In FIG. 2, arrows indicate main data flows.
The contents of each data will be described later.
***動作の説明***
 等価性検査システム100の動作の手順は等価性検査方法に相当する。また、等価性検査システム100の動作の手順は等価性検査プログラムによる処理の手順に相当する。
 以下に、等価性検査方法について説明する。
***Description of operation***
The operating procedure of the equivalence checking system 100 corresponds to the equivalence checking method. Also, the operation procedure of the equivalence checking system 100 corresponds to the processing procedure of the equivalence checking program.
The equivalence checking method will be described below.
 図3に基づいて、関数についての用語を説明する。
 関数が呼び出されたときに実行される1回分の処理を「ステップ」と称する。
 関数が呼び出される回数を「ステップ数」と称する。つまり、ステップ数は関数が実行される回数に相当する。図3において、ステップ数はNである。
 関数の入力となる変数を「入力変数」と称する。具体的には、入力変数は、関数の処理に必要な引数または大域変数である。
 入力変数の値を「入力値」と称する。in_1からin_Nのそれぞれは、各ステップにおける入力変数inの値を表す。
 関数の出力となる変数を「出力変数」と称する。具体的には、出力変数は、関数の処理の結果を表す戻り値または大域変数である。
 出力変数の値を「出力値」と称する。out_1からout_Nのそれぞれは、各ステップにおける出力変数outの値を表す。
 ソフトウェアの状態を表す変数を「状態変数」と称する。
 状態変数の値を「状態値」と称する。st_1からst_Nのそれぞれは、各ステップの終了時における状態変数stateの値を表す。
Based on FIG. 3, terminology for functions will be explained.
A single process that is executed when a function is called is called a "step".
The number of times the function is called is called the "step number". In other words, the number of steps corresponds to the number of times the function is executed. In FIG. 3, the number of steps is N.
A variable that serves as an input to a function is called an "input variable". Specifically, the input variables are the arguments or global variables required for processing the function.
The value of the input variable is called "input value". Each of in_1 to in_N represents the value of the input variable in at each step.
A variable that is the output of a function is called an “output variable”. Specifically, an output variable is a return value or global variable that represents the result of processing a function.
The value of the output variable is called "output value". Each of out_1 to out_N represents the value of the output variable out at each step.
A variable representing the state of the software is called a "state variable".
The values of state variables are called "state values". Each of st_1 to st_N represents the value of the state variable state at the end of each step.
 状態値は、前のステップから次のステップに引き継がれる。例えば、第1ステップの終了時の状態値st_1が第2ステップで使用され、第2ステップの終了時の状態値st_2が第3ステップで使用される。
 一方、入力値および出力値は、前のステップから次のステップに引き継がれない。
State values are carried over from the previous step to the next step. For example, the state value st_1 at the end of the first step is used in the second step, and the state value st_2 at the end of the second step is used in the third step.
On the other hand, input and output values are not carried over from the previous step to the next step.
 図4に、変更前ソースコード201の例を示す。変更前ソースコード201は元のソースコードである。図3において、変更前ソースコード201はC言語で記述されている。
 図5に、変更後ソースコード202の例を示す。変更後ソースコード202は変更済みのソースコードである。図4において、変更後ソースコード202はC言語で記述されている。
 変更前ソースコード201と変更後ソースコード202の間で異なる部分、つまり変更された部分に下線を付している。
FIG. 4 shows an example of pre-change source code 201 . The pre-change source code 201 is the original source code. In FIG. 3, pre-change source code 201 is written in C language.
FIG. 5 shows an example of the post-change source code 202 . Modified source code 202 is modified source code. In FIG. 4, the post-change source code 202 is written in C language.
Different portions between the pre-change source code 201 and the post-change source code 202, that is, changed portions are underlined.
 変更前ソースコード201と変更後ソースコード202とのそれぞれは、main関数とfunc1関数とfunc2関数とを含んでいる。
 func1関数とfunc2関数は、等価性検査の対象となる関数である。等価性検査の対象となる関数を「対象関数」と称する。
Each of pre-change source code 201 and post-change source code 202 includes a main function, a func1 function, and a func2 function.
The func1 function and the func2 function are functions to be checked for equivalence. A function to be checked for equivalence is called a "target function".
 対象関数は、変更前ソースコード201と変更後ソースコード202に含まれ、状態変数を持ち、繰り返し呼び出され実行される。
 func1関数とfunc2関数は、main関数の中で特定の条件が満たされる間、繰り返し実行される。
The target function is included in the pre-change source code 201 and the post-change source code 202, has a state variable, and is repeatedly called and executed.
The func1 and func2 functions are repeatedly executed while a specific condition is satisfied in the main function.
 図4の変更前ソースコード201について説明する。
 対象関数は、各ステップで入力値を受け取るたびに、関数内部で実行される部分を状態値に応じて切り替える。そして、次のステップの状態値が対象関数の実行結果によって決まる。
 func1関数は、2つの状態変数(state、counter)を持つ。そして、これらの状態値は、func1関数が実行されるたびに変わる。
 初期状態では、状態変数stateと状態変数counterとのそれぞれの値が0である。
 状態変数stateの値が0である場合にfunc1関数が実行されると、状態変数stateと状態変数counterとのそれぞれの値が1に変わる。
 状態変数stateの値が1である場合にfunc1関数が実行されると、状態変数stateと状態変数counterとのそれぞれの値が2に変わる。
 状態変数stateの値が2である場合にfunc1関数が実行されると、状態変数stateの値が0に変わり、状態変数counterの値が3に変わる。
 状態変数counterは、func1関数の呼び出し回数という統計情報を記録するための変数である。func1関数が呼び出されるたびに、状態変数counterの値に1が加算される。
The pre-change source code 201 in FIG. 4 will be described.
The target function switches the part to be executed inside the function according to the state value each time an input value is received at each step. Then, the state value of the next step is determined by the execution result of the target function.
The func1 function has two state variables (state, counter). These state values then change each time the func1 function is executed.
In the initial state, the value of each of the state variable state and the state variable counter is 0.
When the func1 function is executed when the value of the state variable state is 0, the values of the state variable state and the state variable counter are changed to 1, respectively.
When the func1 function is executed when the value of the state variable state is 1, the values of the state variable state and the state variable counter are changed to 2, respectively.
When the func1 function is executed when the value of the state variable state is 2, the value of the state variable state changes to 0 and the value of the state variable counter changes to 3.
The state variable counter is a variable for recording statistical information about the number of times the func1 function is called. Each time the func1 function is called, 1 is added to the value of the state variable counter.
 func2関数は、状態変数numを持つ。そして、この状態値は、func2関数が実行されるたびに変わる。
 初期状態では、状態変数numの値が1である。
 func2関数が実行されるたびに、状態変数numの値に1が加算される。但し、状態変数numの値が1000000000である場合にfunc1関数が実行されると、状態変数numの値が1に戻る。
The func2 function has a state variable num. And this state value changes each time the func2 function is executed.
In the initial state, the value of the state variable num is 1.
Each time the func2 function is executed, 1 is added to the value of the state variable num. However, if the func1 function is executed when the value of the state variable num is 1000000000, the value of the state variable num returns to 1.
 対象関数は、状態値に対応する処理の内容によって出力値を決める。
 func1関数は、状態変数stateの値に対応する処理の内容によって出力値を決める。
 状態変数stateの値が0である場合、func1関数の入力値inに対して出力値はin+1で表される。
 状態変数stateの値が1である場合、func1関数の入力値inに対して出力値はin+2で表される。
 状態変数stateの値が2である場合、func1関数の入力値inに対して出力値はin+3で表される。
The target function determines the output value according to the content of the processing corresponding to the state value.
The func1 function determines an output value according to the content of processing corresponding to the value of the state variable state.
When the value of the state variable state is 0, the output value is represented by in+1 with respect to the input value in of the func1 function.
When the value of the state variable state is 1, the output value is represented by in+2 for the input value in of the func1 function.
When the value of the state variable state is 2, the output value is represented by in+3 with respect to the input value in of the func1 function.
 func2関数は、状態変数numの値に対応する処理の内容によって出力値を決める。
 状態変数numの値が1000000000である場合、func2関数の入力値inに対して出力値はin+1で表される。
 状態変数numの値が1000000000でない場合、func2関数の入力値inに対して出力値はin+numで表される。
The func2 function determines an output value according to the contents of processing corresponding to the value of the state variable num.
When the value of the state variable num is 1000000000, the output value is represented by in+1 for the input value in of the func2 function.
If the value of the state variable num is not 1000000000, the output value is expressed as in+num for the input value in of the func2 function.
 図5の変更後ソースコード202について説明する。
 変更後ソースコード202では、変更前ソースコード201に対して、func1関数とfunc2関数とのそれぞれの出力値が変更されている。
 func1関数において、状態変数stateの値が2である場合、func1関数の入力値inに対して出力値はin+5で表される。
 func2関数において、状態変数numの値が1000000000である場合、func2関数の入力値inに対して出力値はin+2で表される。
The post-change source code 202 in FIG. 5 will be described.
In the post-change source code 202 , the output values of the func1 function and the func2 function are changed with respect to the pre-change source code 201 .
In the func1 function, when the value of the state variable state is 2, the output value is expressed as in+5 with respect to the input value in of the func1 function.
In the func2 function, when the value of the state variable num is 1000000000, the output value is expressed as in+2 for the input value in of the func2 function.
 図6に基づいて、等価性検査方法を説明する。
 ステップS110からステップS140は、対象関数ごとに実行される。
The equivalence checking method will be described based on FIG.
Steps S110 to S140 are executed for each target function.
 ステップS110において、影響状態変数抽出部110は、変更前ソースコード201と変更後ソースコード202とのそれぞれから、対象関数に対する影響状態変数を抽出する。
 変更前ソースコード201から抽出される影響状態変数を変更前影響状態変数211と称する。
 変更後ソースコード202から抽出される影響状態変数を変更後影響状態変数212と称する。
 影響状態変数は、対象関数の出力値に影響を与える状態変数である。
In step S110, the influence state variable extraction unit 110 extracts influence state variables for the target function from the pre-change source code 201 and the post-change source code 202, respectively.
The effect state variables extracted from the pre-change source code 201 are referred to as pre-change effect state variables 211 .
The effect state variables extracted from the post-change source code 202 are referred to as post-change effect state variables 212 .
Influencing state variables are state variables that affect the output value of the target function.
 図7に基づいて、影響状態変数抽出処理(S110)の手順を説明する。
 ステップS111からステップS114は、変更前ソースコード201を解析して実行される。
 ステップS115からステップS118は、変更後ソースコード202を解析して実行される。
The procedure of the influence state variable extraction process (S110) will be described based on FIG.
Steps S111 to S114 are executed by analyzing the pre-change source code 201 .
Steps S115 to S118 are executed by analyzing the modified source code 202 .
 ステップS111において、影響状態変数抽出部110は、変更前ソースコード201の対象関数から入力変数を抽出する。
 具体的には、対象関数が変数から値を読み込む場合、影響状態変数抽出部110は、その変数を入力変数として抽出する。
 例えば、影響状態変数抽出部110は、対象関数の引数を入力変数として抽出する。また、影響状態変数抽出部110は、代入演算子「=」の右側にある大域変数を入力変数として抽出する。
In step S<b>111 , the influence state variable extraction unit 110 extracts input variables from the target function of the pre-change source code 201 .
Specifically, when the target function reads a value from a variable, the influence state variable extraction unit 110 extracts the variable as an input variable.
For example, the influence state variable extraction unit 110 extracts the argument of the target function as an input variable. Also, the influence state variable extraction unit 110 extracts the global variable on the right side of the assignment operator “=” as an input variable.
 さらに、影響状態変数抽出部110は、変更前ソースコード201の対象関数から出力変数を抽出する。
 具体的には、対象関数が変数に値を書き込む場合、影響状態変数抽出部110は、その変数を出力変数として抽出する。
 例えば、影響状態変数抽出部110は、対象関数の戻り値を出力変数として抽出する。また、影響状態変数抽出部110は、代入演算子「=」の左側にある大域変数を出力変数として抽出する。
Furthermore, the influence state variable extraction unit 110 extracts output variables from the target function of the pre-change source code 201 .
Specifically, when the target function writes a value to a variable, the influence state variable extraction unit 110 extracts the variable as an output variable.
For example, the influence state variable extraction unit 110 extracts the return value of the target function as an output variable. Also, the influence state variable extraction unit 110 extracts the global variable on the left side of the assignment operator “=” as an output variable.
 ステップS112において、影響状態変数抽出部110は、変更前ソースコード201から、対象関数の出力変数に対する影響部分を抽出する。
 影響部分は、対象関数の出力変数の値に影響を与える部分である。
 例えば、影響状態変数抽出部110は、プログラムスライシングを用いて、変更前ソースコード201から影響部分を抽出する。
In step S<b>112 , the influence state variable extraction unit 110 extracts, from the pre-change source code 201 , the influence portion of the target function on the output variables.
The influencing part is the part that affects the value of the output variable of the target function.
For example, the effect state variable extraction unit 110 extracts the effect part from the pre-change source code 201 using program slicing.
 ステップS113において、影響状態変数抽出部110は、変更前ソースコード201の影響部分から、関数外スコープ変数を抽出する。
 関数外スコープ変数は、対象関数の関数外スコープを有する変数であり、対象関数の外から参照することが可能である。例えば、大域変数は関数外スコープ変数である。
In step S<b>113 , the affected state variable extracting unit 110 extracts a non-function scope variable from the affected portion of the pre-change source code 201 .
An out-of-function scope variable is a variable that has an out-of-function scope of the target function and can be referenced from outside the target function. For example, global variables are out-of-function scope variables.
 ステップS114において、影響状態変数抽出部110は、変更前ソースコード201の関数外スコープ変数から、対象関数の入力変数と対象関数の出力変数とを除外する。
 残りの関数外スコープ変数が変更前影響状態変数211となる。
In step S<b>114 , the influence state variable extraction unit 110 excludes the input variables of the target function and the output variables of the target function from the non-function scope variables of the pre-change source code 201 .
The remaining out-of-function scope variables become pre-change impact state variables 211 .
 ステップS115において、影響状態変数抽出部110は、変更後ソースコード202の対象関数から、入力変数と出力変数とを抽出する。
 抽出方法は、ステップS111における方法と同じである。
In step S<b>115 , the influence state variable extraction unit 110 extracts input variables and output variables from the target function of the post-change source code 202 .
The extraction method is the same as the method in step S111.
 ステップS116において、影響状態変数抽出部110は、変更後ソースコード202から、対象関数の出力変数に対する影響部分を抽出する。
 抽出方法は、ステップS112における方法と同じである。
In step S<b>116 , the influence state variable extraction unit 110 extracts from the post-change source code 202 the influence portion of the target function on the output variables.
The extraction method is the same as the method in step S112.
 ステップS117において、影響状態変数抽出部110は、変更後ソースコード202の影響部分から、関数外スコープ変数を抽出する。
 抽出方法は、ステップS113における方法と同じである。
In step S<b>117 , the affected state variable extracting unit 110 extracts a non-function scope variable from the affected portion of the post-change source code 202 .
The extraction method is the same as the method in step S113.
 ステップS118において、影響状態変数抽出部110は、変更後ソースコード202の関数外スコープ変数から、対象関数の入力変数と対象関数の出力変数とを除外する。
 残りの関数外スコープ変数が変更後影響状態変数212となる。
In step S<b>118 , the influence state variable extraction unit 110 excludes the input variables of the target function and the output variables of the target function from the non-function scope variables of the post-change source code 202 .
The remaining out-of-function scope variables become post-change impact state variables 212 .
 図4の変更前ソースコード201と図5の変更後ソースコード202を例にして、影響状態変数抽出処理(S110)を説明する。
 まず、影響状態変数抽出部110は、変更前ソースコード201と変更後ソースコード202とのそれぞれのfunc1関数から、引数inを入力変数として抽出し、return文で指定された戻り値を出力変数として抽出する。
 また、影響状態変数抽出部110は、変更前ソースコード201と変更後ソースコード202とのそれぞれのfunc2関数から、引数inを入力変数として抽出し、return文で指定された戻り値を出力変数として抽出する。
 次に、影響状態変数抽出部110は、変更前ソースコード201と変更後ソースコード202とのそれぞれから、func1関数およびfunc2関数の出力変数の値に影響を与える部分(影響部分)を抽出する。
 図8に、影響部分203を示す。影響部分203は、図4の変更前ソースコード201から抽出された影響部分である。
 図9に、影響部分204を示す。影響部分204は、図5の変更後ソースコード202から抽出された影響部分である。
 そして、影響状態変数抽出部110は、変更前ソースコード201と変更後ソースコード202とのそれぞれの影響部分から、func1関数に対する影響状態変数stateと、func2関数に対する影響状態変数numと、を抽出する。
The influence state variable extraction processing (S110) will be described using the pre-change source code 201 in FIG. 4 and the post-change source code 202 in FIG. 5 as examples.
First, the effect state variable extraction unit 110 extracts the argument in as an input variable from the func1 function of each of the pre-change source code 201 and the post-change source code 202, and uses the return value specified in the return statement as an output variable. Extract.
In addition, the effect state variable extraction unit 110 extracts the argument in as an input variable from the func2 function of each of the pre-change source code 201 and the post-change source code 202, and uses the return value specified in the return statement as an output variable. Extract.
Next, the influence state variable extraction unit 110 extracts portions (influence portions) that affect the values of the output variables of the func1 and func2 functions from the pre-change source code 201 and the post-change source code 202, respectively.
The affected portion 203 is shown in FIG. The affected portion 203 is the affected portion extracted from the pre-change source code 201 in FIG.
Affected portion 204 is shown in FIG. Affected portion 204 is the affected portion extracted from modified source code 202 of FIG.
Then, the effect state variable extraction unit 110 extracts the effect state variable state for the func1 function and the effect state variable num for the func2 function from the respective effect portions of the pre-change source code 201 and the post-change source code 202. .
 影響状態変数抽出処理(S110)により、状態数(状態変数が取る値の数)が非常に多い状態変数が出力値の計算に影響を与えない場合に、後述する判定ステップ数220を必要最小限に抑えることができる。 By the influence state variable extraction processing (S110), when a state variable with a very large number of states (the number of values taken by the state variable) does not affect the calculation of the output value, the number of determination steps 220, which will be described later, is reduced to the necessary minimum. can be reduced to
 図6に戻り、ステップS120から説明を続ける。
 ステップS120において、判定ステップ数算出部120は、変更前ソースコード201と変更後ソースコード202とのそれぞれの対象関数に対する影響状態変数に基づいて、判定ステップ数220を算出する。
 判定ステップ数220は、変更前ソースコード201の対象関数と変更後ソースコード202の対象関数が等価であるか判定するために、変更前ソースコード201の対象関数と変更後ソースコード202の対象関数とが呼び出され実行される回数である。
Returning to FIG. 6, the description continues from step S120.
In step S<b>120 , the determination step number calculation unit 120 calculates the determination step number 220 based on the influence state variables for the target function of the pre-change source code 201 and the post-change source code 202 .
The number of determination steps 220 determines whether the target function of the pre-change source code 201 and the target function of the post-change source code 202 are equivalent. is the number of times that is called and executed.
 具体的には、条件(1)と条件(2)との両方が満たされるときの対象関数の呼び出し回数(実行回数)が判定ステップ数220となる。
 条件(1)は、変更前ソースコード201において、対象関数が繰り返し呼び出され影響状態変数の値が初期値に戻る、という条件である。
 条件(2)は、変更後ソースコード202において、対象関数が繰り返し呼び出され影響状態変数の値が初期値に戻る、という条件である。
Specifically, the determination step number 220 is the number of calls (number of executions) of the target function when both the condition (1) and the condition (2) are satisfied.
Condition (1) is that the target function is repeatedly called in the pre-change source code 201 and the value of the affected state variable returns to the initial value.
Condition (2) is a condition that the target function is repeatedly called in the post-change source code 202 and the value of the affected state variable returns to the initial value.
 図10に基づいて、判定ステップ数算出処理(S120)の手順を説明する。
 ステップS121において、判定ステップ数算出部120は、変更前ソースコード201を解析することによって、変更前ソースコード201の対象関数の戻りステップ数を算出する。
 戻りステップ数は、対象関数が繰り返し呼び出され影響状態変数の値が初期値に戻るときの対象関数の呼び出し回数(実行回数)である。
 戻りステップ数を算出する方法について後述する。
Based on FIG. 10, the procedure of the determination step count calculation process (S120) will be described.
In step S<b>121 , the determination step number calculation unit 120 calculates the number of return steps of the target function of the pre-change source code 201 by analyzing the pre-change source code 201 .
The number of return steps is the number of calls (number of executions) of the target function when the target function is repeatedly called and the value of the affected state variable returns to the initial value.
A method for calculating the number of return steps will be described later.
 ステップS122において、判定ステップ数算出部120は、変更後ソースコード202を解析することによって、変更後ソースコード202の対象関数の戻りステップ数を算出する。 In step S122, the determination step number calculation unit 120 calculates the number of return steps of the target function of the post-change source code 202 by analyzing the post-change source code 202.
 ステップS123において、判定ステップ数算出部120は、変更前ソースコード201の対象関数の戻りステップ数と変更後ソースコード202の対象関数の戻りステップ数の最小公倍数を算出する。
 算出される最小公倍数が判定ステップ数220となる。
In step S<b>123 , the determination step number calculation unit 120 calculates the least common multiple of the return step number of the target function of the pre-change source code 201 and the return step number of the target function of the post-change source code 202 .
The calculated lowest common multiple is the determination step number 220 .
 判定ステップ数算出処理(S120)により、判定ステップ数220を算出することができる。判定ステップ数220を用いることにより、状態数が非常に多い状態変数がある場合でも、変更前後の対象関数が両方とも初期状態に戻るまで等価性を判定することが可能となる。 The determination step number 220 can be calculated by the determination step number calculation process (S120). By using the number of determination steps 220, even if there are state variables with an extremely large number of states, it is possible to determine equivalence until both the target functions before and after the change return to the initial state.
 図11に基づいて、戻りステップ数を算出するための手順を説明する。
 ステップs121において、判定ステップ数算出部120は、後述する算出コードの解析に使用できる計算機リソースの量に基づいて、上限ステップ数を決定する。
 上限ステップ数は、計算機リソースを解放せずに対象関数を実行する回数の上限である。
A procedure for calculating the number of return steps will be described with reference to FIG.
In step s121, the judgment step number calculation unit 120 determines the upper limit number of steps based on the amount of computer resources that can be used for analysis of the calculation code, which will be described later.
The upper limit number of steps is the upper limit of the number of times the target function is executed without releasing computer resources.
 ステップs122において、判定ステップ数算出部120は、算出コードを生成する。
 算出コードは、戻りステップ数を算出するためのソースコードであり、算出ラッパーともいう。
 具体的には、1回目の算出コードと2回目以降の算出コードが生成される。
In step s122, the determination step count calculator 120 generates a calculation code.
The calculation code is source code for calculating the number of return steps, and is also called a calculation wrapper.
Specifically, a calculation code for the first time and a calculation code for the second and subsequent times are generated.
 図12に、算出コード221を示す。算出コード221は、func1関数のための1回目の算出コードの例である。
 図13に、算出コード222の例を示す。算出コード222は、func2関数のための1回目の算出コードの例である。
 算出コード221と算出コード222とのそれぞれには、コード(0)からコード(3)が記述されている。上限ステップ数Xは1000である。
 コード(0)は、影響状態変数の初期値を保存するためのコードである。影響状態変数の初期値は、対象関数が初めて呼び出されるときの影響状態変数の値である。
 コード(1)は、上限ステップ数と同じ回数、対象関数を呼び出すためのコードである。この場合、対象関数を読み出す処理が1000ステップ分、記述される。
 コード(2)は、上限ステップ数と同じ回数分、事後条件が満たされるか判定するためのコードである。影響状態変数の値が初期値と等しい、という条件が事後条件となる。この場合、事後条件の判定処理が1000ステップ分、記述される。
 コード(3)は、上限ステップ数の終了時における影響状態変数の値を記録するためのコードである。上限ステップ数のステップの終了時における影響状態変数の値を、最終ステップの状態値と称する。
FIG. 12 shows calculation code 221 . The calculation code 221 is an example of the first calculation code for the func1 function.
FIG. 13 shows an example of calculation code 222 . Calculation code 222 is an example of the first calculation code for the func2 function.
Code (0) to code (3) are described in each of the calculation code 221 and the calculation code 222 . The upper limit number of steps X is 1,000.
Code (0) is the code for saving the initial values of the effect state variables. The initial value of the impact state variable is the value of the impact state variable when the subject function is first called.
Code (1) is a code for calling the target function the same number of times as the upper limit number of steps. In this case, 1000 steps of processing for reading the target function are described.
Code (2) is a code for determining whether the post-condition is satisfied for the same number of times as the upper limit number of steps. The condition that the value of the influence state variable is equal to the initial value is the postcondition. In this case, 1000 steps of post-condition determination processing are described.
Code (3) is for recording the value of the influence state variable at the end of the upper limit number of steps. The value of the influence state variable at the end of the upper limit number of steps is referred to as the final step state value.
 図11に戻り、ステップs123から説明を続ける。
 ステップs123において、判定ステップ数算出部120は、1回目の算出コードの解析のために計算機リソースを確保する。
Returning to FIG. 11, the description continues from step s123.
In step s123, the number-of-judgments-steps calculation unit 120 secures computer resources for the analysis of the calculation code for the first time.
 ステップs124において、判定ステップ数算出部120は、算出コードを解析して算出コードの処理を実行する。
 例えば、判定ステップ数算出部120は、有界モデル検査を用いて、算出コードを解析する。
 1回目のステップs124では、1回目の算出コードが使用される。
 2回目以降のステップs124では、2回目以降の算出コードが使用される。
In step s124, the determination step count calculator 120 analyzes the calculation code and executes the calculation code.
For example, the determination step count calculator 120 analyzes the calculation code using bounded model checking.
In step s124 for the first time, the calculation code for the first time is used.
In step s124 for the second and subsequent times, the calculation code for the second and subsequent times is used.
 ステップs125において、判定ステップ数算出部120は、算出コードの解析結果に基づいて、上限ステップ数までのいずれかのステップで影響状態変数の値が初期値に戻ったか判定する。
 上限ステップ数までのいずれかのステップで影響状態変数の値が初期値に戻った場合、処理はステップs128に進む。
 上限ステップ数までのいずれかのステップで影響状態変数の値が初期値に戻らなかった場合、処理はステップs126に進む。
In step s125, the judgment step number calculation unit 120 judges whether the value of the influence state variable has returned to the initial value in any step up to the upper limit number of steps, based on the analysis result of the calculation code.
If the value of the influence state variable returns to the initial value at any step up to the upper limit number of steps, the process proceeds to step s128.
If the value of the influence state variable has not returned to the initial value in any step up to the upper limit number of steps, the process proceeds to step s126.
 図14に、解析結果223を示す。解析結果223は、func1関数用の1回目の算出コード221の解析結果である。
 FAILUREは、影響状態変数の値が初期値と異なることを意味する。
 SUCCESSは、影響状態変数の値が初期値と等しいことを意味する。
 解析結果223は、func1関数の影響状態変数の値が第3ステップで初期値に戻ることを示している。
 この場合、ステップs125の後、処理はステップs129に進む。
The analysis result 223 is shown in FIG. The analysis result 223 is the analysis result of the first calculation code 221 for the func1 function.
FAILURE means that the value of the impact state variable is different from the initial value.
SUCCESS means that the value of the impact state variable is equal to the initial value.
Analysis result 223 indicates that the value of the influence state variable of the func1 function returns to the initial value in the third step.
In this case, after step s125, the process proceeds to step s129.
 図15に、解析結果224を示す。解析結果224は、func2関数用の1回目の算出コード222の解析結果である。
 解析結果224は、func2関数の影響状態変数の値が第1000ステップまでに初期値に戻らないことを示している。
 この場合、ステップs125の後、処理はステップs126に進む。
The analysis result 224 is shown in FIG. The analysis result 224 is the analysis result of the first calculation code 222 for the func2 function.
Analysis result 224 indicates that the value of the influence state variable of the func2 function does not return to the initial value by the 1000th step.
In this case, after step s125, the process proceeds to step s126.
 図11に戻り、ステップs126から説明を続ける。
 ステップs126において、判定ステップ数算出部120は、1回目の算出コード(または2回目以降の算出コード)の解析のために確保された計算機リソースを一旦解放する。
 なお、最終ステップの状態値は、解放される計算機リソース以外の記憶領域に記録されている。
Returning to FIG. 11, the description continues from step s126.
In step s126, the number-of-judgments-steps calculator 120 temporarily releases the computer resources reserved for the analysis of the first calculation code (or the second and subsequent calculation codes).
Note that the state value of the final step is recorded in a storage area other than the computer resource to be released.
 ステップs127において、判定ステップ数算出部120は、2回目以降の算出コードの解析のために計算機リソースを再び確保する。
 ステップs127の後、処理はステップs124に進む。
In step s127, the number-of-judgments-steps calculation unit 120 secures computer resources again for analysis of calculation codes for the second and subsequent times.
After step s127, the process proceeds to step s124.
 2回目以降のステップs124では、2回目以降の算出コードが使用される。
 2回目以降の算出コードには、最終ステップの状態値を引き継ぎためのコードが加えられる。
In step s124 for the second and subsequent times, the calculation code for the second and subsequent times is used.
A code for taking over the state value of the final step is added to the second and subsequent calculation codes.
 図16に、算出コード225を示す。算出コード225は、func2関数のための2回目以降の算出コードの例である。
 図13の算出コード222に対して、コード(0)が変更されており、コード(4)が追加されている。
 コード(0)では、影響状態変数「num」を用いずに影響状態変数の初期値「1」が保存される。
 コード(4)は、最終ステップの状態値を引き継ぐためのコードである。最終ステップの状態値が影響状態変数numに設定される。state_last_stepは、最終ステップの状態値を表す。
Calculation code 225 is shown in FIG. Calculation code 225 is an example of calculation code for the second and subsequent times for the func2 function.
Code (0) is changed and code (4) is added to the calculation code 222 of FIG.
Code (0) saves the initial value of the effect state variable "1" without using the effect state variable "num".
Code (4) is a code for taking over the state value of the final step. The state value of the final step is set to the influence state variable num. state_last_step represents the state value of the last step.
 図11に戻り、ステップs128を説明する。
 ステップs128において、判定ステップ数算出部120は、影響状態変数の値が初めて初期値に戻ったときのステップ数を戻りステップ数と判定する。これにより、戻りステップ数が求まる。
Returning to FIG. 11, step s128 will be described.
In step s128, the judgment step number calculation unit 120 judges the number of steps when the value of the influence state variable returns to the initial value for the first time as the number of return steps. Thereby, the number of return steps is obtained.
 図14の解析結果223が得られた場合、判定ステップ数算出部120は、func1関数の戻りステップ数を3と判定する。 When the analysis result 223 of FIG. 14 is obtained, the determination step number calculation unit 120 determines that the number of return steps of the func1 function is 3.
 図17に、解析結果226を示す。解析結果226は、func2関数のための算出コードが1000000回解析されたときの解析結果である。
 図17の解析結果226が得られた場合、判定ステップ数算出部120は、func2関数の戻りステップ数を1000000000(=X×1000000)と判定する。上限ステップ数Xは1000である。
The analysis result 226 is shown in FIG. The analysis result 226 is the analysis result when the calculation code for the func2 function is analyzed 1000000 times.
When the analysis result 226 of FIG. 17 is obtained, the determination step count calculator 120 determines that the return step count of the func2 function is 1000000000 (=X×1000000). The upper limit number of steps X is 1,000.
 図18に、算出コードが10回解析されて影響状態変数の値が初期値に戻る様子を示す。
 上限ステップ数Xは、算出コードの1回の解析に使用できる計算機リソースの量に基づいて決定される。
 算出コードが1回解析されるごとに、対象関数はX回呼び出される。
 算出コードが1回解析されるごとに、計算機リソースは、一旦解放され、再び確保される。
 算出コードが1回解析されるごとに、最終ステップの状態値が引き継がれる。
FIG. 18 shows how the calculation code is parsed ten times and the values of the impact state variables return to their initial values.
The upper limit number of steps X is determined based on the amount of computer resources that can be used for one analysis of the computational code.
The subject function is called X times each time the computational code is parsed.
Each time the computational code is parsed, the computer resource is once released and reallocated.
Each time the computational code is parsed, it inherits the state value of the last step.
 図6に戻り、ステップS130から説明を続ける。
 ステップS130において、判定コード生成部130は、判定ステップ数220に基づいて、判定コード230を生成する。
 判定コード230は、変更前ソースコード201の対象関数と変更後ソースコード202の対象関数とのそれぞれを判定ステップ数220と同じ回数繰り返し呼び出して、変更前ソースコード201の対象関数と変更後ソースコード202の対象関数が等価であるか判定するためのソースコードである。
Returning to FIG. 6, the description continues from step S130.
In step S<b>130 , the determination code generation section 130 generates the determination code 230 based on the number of determination steps 220 .
The determination code 230 repeatedly calls the target function of the pre-change source code 201 and the target function of the post-change source code 202 the same number of times as the number of determination steps 220, and determines the target function of the pre-change source code 201 and the post-change source code. 202 is a source code for determining whether the target functions of 202 are equivalent.
 図19に基づいて、判定コード生成処理(S130)の手順を説明する。
 ステップS131において、判定コード生成部130は、変更前ソースコード201と変更後ソースコード202との間で名前の衝突をなくすために、変更前ソースコード201と変更後ソースコード202とを編集する。
 これにより、変更前ソースコード231と変更後ソースコード232が生成される。
 変更前ソースコード231は、編集済みの変更前ソースコード201である。
 変更後ソースコード232は、編集済みの変更後ソースコード202である。
 具体的には、判定コード生成部130は、変更前ソースコード201と変更後ソースコード202との間で異なる接頭辞または接尾辞を、関数名と大域変数名とのそれぞれに付ける。
Based on FIG. 19, the procedure of determination code generation processing (S130) will be described.
In step S<b>131 , the determination code generation unit 130 edits the pre-change source code 201 and the post-change source code 202 in order to eliminate name conflicts between the pre-change source code 201 and the post-change source code 202 .
As a result, pre-change source code 231 and post-change source code 232 are generated.
The pre-change source code 231 is the edited pre-change source code 201 .
The modified source code 232 is the edited modified source code 202 .
Specifically, determination code generation unit 130 attaches different prefixes or suffixes to function names and global variable names between pre-change source code 201 and post-change source code 202 .
 図20に、変更前ソースコード231の例を示す。
 図21に、変更後ソースコード232の例を示す。
 変更前ソースコード231では、関数名「main」「func1」「func2」と大域変数名「state」「counter」とのそれぞれに接尾辞「_1」が付いている。
 変更後ソースコード232では、関数名「main」「func1」「func2」と大域変数名「state」「counter」とのそれぞれに接尾辞「_2」が付いている。
 これにより、変更前ソースコード231と変更後ソースコード232との間で、関数名および大域変数名が区別され、名前の衝突がなくなる。
FIG. 20 shows an example of pre-change source code 231 .
FIG. 21 shows an example of the post-change source code 232 .
In the pre-change source code 231, the function names "main", "func1" and "func2" and the global variable names "state" and "counter" are each given the suffix "_1".
In the post-change source code 232, the function names "main", "func1" and "func2" and the global variable names "state" and "counter" are each given the suffix "_2".
As a result, function names and global variable names are distinguished between the pre-change source code 231 and the post-change source code 232, and conflicts in names are eliminated.
 図19に戻り、ステップS132から説明を続ける。
 ステップS132において、判定コード生成部130は、判定ヘッダ233を生成する。
 判定ヘッダ233は、変更前ソースコード231の対象関数と変更後ソースコード232の対象関数が等価であるか判定するために必要な宣言が記述されたヘッダである。
 具体的には、判定コード生成部130は、変更前ソースコード231の対象関数のプロトタイプ宣言と、変更後ソースコード232の対象関数のプロトタイプ宣言と、を判定ヘッダ233に記述する。また、判定コード生成部130は、必要に応じて、変更前ソースコード231の大域変数のextern宣言と変更後ソースコード232の大域変数のextern宣言など、を判定ヘッダ233に記述する。
Returning to FIG. 19, the description continues from step S132.
In step S<b>132 , the determination code generator 130 generates the determination header 233 .
The determination header 233 is a header describing a declaration necessary for determining whether the target function of the pre-change source code 231 and the target function of the post-change source code 232 are equivalent.
Specifically, the determination code generation unit 130 describes the prototype declaration of the target function of the pre-change source code 231 and the prototype declaration of the target function of the post-change source code 232 in the determination header 233 . In addition, the determination code generation unit 130 writes, in the determination header 233, the extern declaration of the global variables of the pre-change source code 231 and the extern declaration of the global variables of the post-change source code 232, etc., as necessary.
 図22に、判定ヘッダ233の例を示す。
 判定ヘッダ233には、変更前ソースコード231の対象関数「func1_1」「func2_1」の宣言と、変更後ソースコード232の対象関数「func1_2」「func2_2」の宣言と、が記述されている。
FIG. 22 shows an example of the determination header 233. As shown in FIG.
The determination header 233 describes the declarations of the target functions “func1_1” and “func2_1” of the pre-change source code 231 and the declarations of the target functions “func1_2” and “func2_2” of the post-change source code 232 .
 図19に戻り、ステップS133を説明する。
 ステップS133において、判定コード生成部130は、判定ラッパー234を生成する。
 判定ラッパー234は、変更前ソースコード231の対象関数と変更後ソースコード232の対象関数が等価であるか判定するために必要な処理が記述されたラッパーである。
 具体的には、判定コード生成部130は、コード(A)からコード(C)を判定ラッパー234に記述する。
 コード(A)は、前提条件を指定するためのコードである。判定ステップ数220分の全てのステップで変更前ソースコード231の対象関数の入力値と変更後ソースコード232の対象関数の入力値が等しい、という条件が前提条件となる。
 コード(B)は、変更前ソースコード231の対象関数と変更後ソースコード232の対象関数とのそれぞれを、判定ステップ数220と同じ回数繰り返し呼び出すためのコードである。
 コード(C)は、事後条件が満たされるか判定するためのコードである。判定ステップ数220分の全てのステップで変更前ソースコード231の対象関数の出力値と変更後ソースコード232の対象関数の出力値が等しい、という条件が事後条件となる。
Returning to FIG. 19, step S133 will be described.
In step S<b>133 , the judgment code generation unit 130 generates the judgment wrapper 234 .
The determination wrapper 234 is a wrapper that describes processing necessary to determine whether the target function of the pre-change source code 231 and the target function of the post-change source code 232 are equivalent.
Specifically, the determination code generation unit 130 writes code (A) to code (C) in the determination wrapper 234 .
Code (A) is a code for specifying preconditions. The precondition is that the input value of the target function of the pre-change source code 231 and the input value of the target function of the post-change source code 232 are the same in all the steps corresponding to 220 determination steps.
Code (B) is a code for repeatedly calling each of the target function of the pre-change source code 231 and the target function of the post-change source code 232 as many times as the determination step number 220 .
Code (C) is a code for determining whether the postcondition is satisfied. The post-condition is that the output value of the target function of the pre-change source code 231 and the output value of the target function of the post-change source code 232 are equal in all steps corresponding to 220 determination steps.
 図23に、func1関数のための判定ラッパー234の例を示す。
 判定ステップ数STEPは3である。
 コード(A)では、3ステップ分の前提条件が指定されている。
 コード(B)では、func1関数(func1_1、func1_2)が3回呼び出される。
 コード(C)では、3ステップ分の事後条件が判定される。
FIG. 23 shows an example decision wrapper 234 for the func1 function.
The determination step number STEP is three.
In code (A), preconditions for three steps are specified.
In code (B), the func1 function (func1_1, func1_2) is called three times.
In code (C), three steps of postconditions are determined.
 変更前ソースコード231と変更後ソースコード232と判定ヘッダ233と判定ラッパー234との組が判定コード230となる。 A set of pre-change source code 231 , post-change source code 232 , decision header 233 and decision wrapper 234 is decision code 230 .
 判定コード生成処理(S130)により、判定コード230を生成することができる。判定コード230を用いることにより、状態数が非常に多い状態変数がある場合でも、変更前後の対象関数の処理内容が等価かどうか正しく判定することが可能となる。 The determination code 230 can be generated by the determination code generation process (S130). By using the determination code 230, even when there are state variables with a very large number of states, it is possible to correctly determine whether the processing contents of the target function before and after the change are equivalent.
 図6に戻り、ステップS140を説明する。
 ステップS140において、等価判定部140は、判定コード230を使って、変更前ソースコード201の対象関数と変更後ソースコード202の対象関数が等価であるか判定する。
Returning to FIG. 6, step S140 will be described.
In step S140, the equivalence determination unit 140 uses the determination code 230 to determine whether the target function of the pre-change source code 201 and the target function of the post-change source code 202 are equivalent.
 図24に基づいて、等価判定処理(S140)の手順を説明する。
 ステップS141において、等価判定部140は、判定コード230を解析して判定ラッパー234の処理を実行する。
 例えば、等価判定部140は、有界モデル検査を用いて、判定コード230を解析する。
Based on FIG. 24, the procedure of the equivalence determination process (S140) will be described.
In step S<b>141 , the equivalence determination unit 140 analyzes the determination code 230 and executes the process of the determination wrapper 234 .
For example, the equivalence determination unit 140 analyzes the determination code 230 using bounded model checking.
 ステップS142において、等価判定部140は、判定コード230の解析結果に基づいて、変更前ソースコード201の対象関数と変更後ソースコード202の対象関数が等価であるか判定する。
 判定コード230の解析結果は、判定ラッパー234の処理結果に相当する。
In step S<b>142 , the equivalence determination unit 140 determines whether the target function of the pre-change source code 201 and the target function of the post-change source code 202 are equivalent based on the analysis result of the determination code 230 .
The analysis result of the judgment code 230 corresponds to the processing result of the judgment wrapper 234 .
 ステップS143において、等価判定部140は、判定結果240を出力する。
 判定結果240は、変更前ソースコード201の対象関数と変更後ソースコード202の対象関数が等価であるかを示す。また、判定結果240は、変更前ソースコード201の対象関数と変更後ソースコード202の対象関数が不等価になるステップ(不等価ステップ)を示す。
In step S<b>143 , the equivalence determination unit 140 outputs the determination result 240 .
The determination result 240 indicates whether the target function of the pre-change source code 201 and the target function of the post-change source code 202 are equivalent. The determination result 240 also indicates a step (inequality step) at which the target function of the pre-change source code 201 and the target function of the post-change source code 202 become unequal.
 図25に、解析結果241の例を示す。解析結果241は、func1関数のための判定コード230の解析結果である。
 判定ステップ数220は3である。SUCCESSは、変更前後で出力値が等しいことを意味する。FAILUREは、変更前後で出力値が異なることを意味する。
 第1ステップと第2ステップでは変更前後でfunc1関数の出力値が等しいが、第3ステップでは変更前後でfunc1関数の出力値が異なる。
 そのため、変更前後のfunc1関数は不等価であり、不等価ステップは第3ステップである。
FIG. 25 shows an example of the analysis result 241. As shown in FIG. The analysis result 241 is the analysis result of the determination code 230 for the func1 function.
The number of decision steps 220 is three. SUCCESS means that the output values are equal before and after the change. FAILURE means that the output value is different before and after the change.
The output values of the func1 function before and after the change are the same in the first step and the second step, but the output values of the func1 function are different before and after the change in the third step.
Therefore, the func1 function before and after the change is unequal, and the inequality step is the third step.
 図26に、解析結果242の例を示す。解析結果242は、func2関数のための判定コード230の解析結果である。
 判定ステップ数220は1000000000である。
 第1000000000ステップにおいて、変更前後でfunc2関数の出力値が異なる。
 そのため、変更前後のfunc2関数は不等価であり、不等価ステップは第1000000000ステップである。
FIG. 26 shows an example of the analysis result 242. As shown in FIG. The analysis result 242 is the analysis result of the determination code 230 for the func2 function.
The determination step number 220 is 1000000000.
At the 1000000000th step, the output value of the func2 function differs before and after the change.
Therefore, the func2 function before and after the change is unequal, and the unequal step is the 1000000000th step.
 等価判定処理(S140)により、状態数が非常に多い状態変数がある場合でも、変更前後の対象関数の処理内容が等価であるか正しく判定することができる。
 また、利用者は、判定結果240を参照することにより、変更後の対象関数に対して修正の要否および修正の内容を判断することができる。
Through the equivalence determination process (S140), it is possible to correctly determine whether the processing contents of the target function before and after the change are equivalent even when there are state variables with an extremely large number of states.
Also, the user can determine whether or not the target function after the change needs to be modified and the content of the modification by referring to the determination result 240 .
***実施の形態1の効果***
 実施の形態1により、対象関数の出力値の計算に影響を与えない状態変数を除外して影響を与える状態変数のみに絞って処理内容を解析することができる。また、等価性検査のための解析を複数回に分割し、分割された解析の間で計算機リソースの解放および再確保を繰り返すことで、状態数が非常に多い状態変数を持つ変更前後の対象関数の処理内容が等価かどうか判定することができる。
*** Effect of Embodiment 1 ***
According to Embodiment 1, it is possible to analyze the processing content by excluding state variables that do not affect the calculation of the output value of the target function and focusing on only the state variables that affect the calculation. In addition, by dividing the analysis for equivalence checking into multiple times and repeating the release and re-allocation of computer resources between the divided analyses, the target function before and after the change that has an extremely large number of state variables are equivalent.
***実施の形態1の補足***
 図27に基づいて、等価性検査システム100のハードウェア構成を説明する。
 等価性検査システム100は処理回路109を備える。
 処理回路109は、影響状態変数抽出部110と判定ステップ数算出部120と判定コード生成部130と等価判定部140とを実現するハードウェアである。
 処理回路109は、専用のハードウェアであってもよいし、メモリ102に格納されるプログラムを実行するプロセッサ101であってもよい。
*** Supplement to Embodiment 1 ***
The hardware configuration of the equivalence checking system 100 will be described based on FIG.
Equivalence checking system 100 comprises processing circuitry 109 .
The processing circuit 109 is hardware that realizes the influence state variable extraction unit 110 , the determination step number calculation unit 120 , the determination code generation unit 130 , and the equivalence determination unit 140 .
The processing circuit 109 may be dedicated hardware, or may be the processor 101 that executes a program stored in the memory 102 .
 処理回路109が専用のハードウェアである場合、処理回路109は、例えば、単一回路、複合回路、プログラム化したプロセッサ、並列プログラム化したプロセッサ、ASIC、FPGAまたはこれらの組み合わせである。
 ASICは、Application Specific Integrated Circuitの略称である。
 FPGAは、Field Programmable Gate Arrayの略称である。
If processing circuitry 109 is dedicated hardware, processing circuitry 109 may be, for example, a single circuit, multiple circuits, a programmed processor, a parallel programmed processor, an ASIC, an FPGA, or a combination thereof.
ASIC is an abbreviation for Application Specific Integrated Circuit.
FPGA is an abbreviation for Field Programmable Gate Array.
 等価性検査システム100は、処理回路109を代替する複数の処理回路を備えてもよい。 The equivalence checking system 100 may include a plurality of processing circuits that substitute for the processing circuit 109.
 処理回路109において、一部の機能が専用のハードウェアで実現されて、残りの機能がソフトウェアまたはファームウェアで実現されてもよい。 In the processing circuit 109, some functions may be implemented by dedicated hardware, and the remaining functions may be implemented by software or firmware.
 このように、等価性検査システム100の機能はハードウェア、ソフトウェア、ファームウェアまたはこれらの組み合わせで実現することができる。 In this way, the functions of the equivalence checking system 100 can be implemented in hardware, software, firmware, or a combination thereof.
 実施の形態1は、好ましい形態の例示であり、本開示の技術的範囲を制限することを意図するものではない。実施の形態1は、部分的に実施してもよいし、他の形態と組み合わせて実施してもよい。フローチャート等を用いて説明した手順は、適宜に変更してもよい。 Embodiment 1 is an example of a preferred form and is not intended to limit the technical scope of the present disclosure. Embodiment 1 may be partially implemented, or may be implemented in combination with other modes. The procedures described using flowcharts and the like may be changed as appropriate.
 等価性検査システム100は、2台以上の装置で実現されてもよい。
 等価性検査システム100の要素である「部」は、「処理」、「工程」、「回路」または「サーキットリ」と読み替えてもよい。
Equivalence checking system 100 may be implemented with two or more devices.
A “unit” that is an element of the equivalence checking system 100 may be read as “processing”, “process”, “circuit” or “circuitry”.
 100 等価性検査システム、101 プロセッサ、102 メモリ、103 補助記憶装置、104 通信装置、105 入出力インタフェース、109 処理回路、110 影響状態変数抽出部、120 判定ステップ数算出部、130 判定コード生成部、140 等価判定部、190 記憶部、201 変更前ソースコード、202 変更後ソースコード、203 影響部分、204 影響部分、211 変更前影響状態変数、212 変更後影響状態変数、220 判定ステップ数、221 算出コード、222 算出コード、223 解析結果、224 解析結果、225 算出コード、226 解析結果、230 判定コード、231 変更前ソースコード、232 変更後ソースコード、233 判定ヘッダ、234 判定ラッパー、240 判定結果、241 解析結果、242 解析結果。 100 equivalence check system, 101 processor, 102 memory, 103 auxiliary storage device, 104 communication device, 105 input/output interface, 109 processing circuit, 110 influence state variable extraction unit, 120 determination step number calculation unit, 130 determination code generation unit, 140 equivalence determination unit, 190 storage unit, 201 source code before change, 202 source code after change, 203 affected part, 204 affected part, 211 affected state variables before change, 212 affected state variables after change, 220 number of judgment steps, 221 calculation Code, 222 Calculated code, 223 Analysis result, 224 Analysis result, 225 Calculated code, 226 Analysis result, 230 Judgment code, 231 Before change source code, 232 After change source code, 233 Judgment header, 234 Judgment wrapper, 240 Judgment result, 241 Analysis result, 242 Analysis result.

Claims (10)

  1.  変更前ソースコードと変更後ソースコードとのそれぞれから、繰り返し呼び出される対象関数の出力値に影響を与える状態変数である影響状態変数を抽出する影響状態変数抽出部と、
     前記変更前ソースコードにおいて前記対象関数が繰り返し呼び出され前記影響状態変数の値が初期値に戻り、且つ、前記変更後ソースコードにおいて前記対象関数が繰り返し呼び出され前記影響状態変数の値が初期値に戻る、という条件を満たす前記対象関数の呼び出し回数を判定ステップ数として算出する判定ステップ数算出部と、
     前記変更前ソースコードの前記対象関数と前記変更後ソースコードの前記対象関数とのそれぞれを前記判定ステップ数と同じ回数繰り返し呼び出して、前記変更前ソースコードの前記対象関数と前記変更後ソースコードの前記対象関数が等価であるか判定する等価判定部と、
    を備える等価性検査システム。
    an influence state variable extraction unit for extracting an influence state variable, which is a state variable that influences an output value of a target function that is repeatedly called, from each of the pre-change source code and the post-change source code;
    The target function is repeatedly called in the pre-change source code and the value of the effect state variable is returned to the initial value, and the target function is repeatedly called in the post-change source code and the value of the effect state variable is returned to the initial value. a determination step number calculation unit that calculates the number of times the target function is called that satisfies the condition of returning as a determination step number;
    each of the target function of the pre-change source code and the target function of the post-change source code is repeatedly called the same number of times as the determination step number, and the target function of the pre-change source code and the post-change source code are called an equivalence determination unit that determines whether the target function is equivalent;
    An equivalence checking system comprising:
  2.  前記影響状態変数抽出部は、
     前記変更前ソースコードと前記変更後ソースコードとのそれぞれの前記対象関数から、入力変数と出力変数とを抽出し、
     前記変更前ソースコードと前記変更後ソースコードとのそれぞれから、前記対象関数の前記出力変数の値に影響を与える影響部分を抽出し、
     前記変更前ソースコードと前記変更後ソースコードとのそれぞれの前記影響部分から、前記対象関数の関数外スコープを有する変数を関数外スコープ変数として抽出し、
     前記変更前ソースコードと前記変更後ソースコードとのそれぞれの前記関数外スコープ変数から前記対象関数の前記入力変数と前記対象関数の前記出力変数を除外し、
     前記変更前ソースコードと前記変更後ソースコードとのそれぞれの残りの前記関数外スコープが、前記影響状態変数となる
    請求項1に記載の等価性検査システム。
    The impact state variable extraction unit
    extracting input variables and output variables from the target functions of the pre-change source code and the post-change source code;
    extracting, from each of the pre-change source code and the post-change source code, an influencing portion that affects the value of the output variable of the target function;
    extracting a variable having an out-of-function scope of the target function as an out-of-function scope variable from the affected portions of the pre-change source code and the post-change source code;
    excluding the input variable of the target function and the output variable of the target function from the outside-function scope variables of the pre-change source code and the post-change source code;
    2. The equivalence checking system according to claim 1, wherein the remaining outer-function scopes of the pre-modification source code and the post-modification source code are the effect state variables.
  3.  前記判定ステップ数算出部は、
     前記変更前ソースコードと前記変更後ソースコードとのそれぞれに対して、前記対象関数が繰り返し呼び出され前記影響状態変数の値が前記初期値に戻るときの前記対象関数の呼び出し回数を戻りステップ数として算出し、
     前記変更前ソースコードの前記対象関数の前記戻りステップ数と前記変更後ソースコードの前記対象関数の前記戻りステップ数の最小公倍数を前記判定ステップ数として算出する
    請求項1または請求項2に記載の等価性検査システム。
    The determination step number calculation unit
    For each of the pre-change source code and the post-change source code, the number of times the target function is called when the target function is repeatedly called and the value of the affected state variable returns to the initial value is defined as the number of return steps. calculate,
    3. The least common multiple of the number of return steps of the target function of the pre-change source code and the number of return steps of the target function of the post-change source code is calculated as the determination step number. Equivalence checking system.
  4.  前記判定ステップ数算出部は、前記戻りステップ数を算出するための算出コードを生成し、前記算出コードを解析して前記算出コードの処理を実行し、前記算出コードの解析結果に基づいて前記戻りステップ数を判定する
    請求項3に記載の等価性検査システム。
    The determination step number calculation unit generates a calculation code for calculating the number of return steps, analyzes the calculation code, executes processing of the calculation code, and performs the return step based on the analysis result of the calculation code. 4. The equivalence checking system of claim 3, wherein the number of steps is determined.
  5.  前記算出コードは、上限ステップ数と同じ回数、前記対象関数を呼び出すための第1コードと、前記上限ステップ数と同じ回数分、前記影響状態変数の値が前記初期値と等しいという事後条件を判定するための第2コードと、を含む
    請求項4に記載の等価性検査システム。
    The calculation code determines a first code for calling the target function the same number of times as the upper limit number of steps, and a post-condition that the value of the influence state variable is equal to the initial value the same number of times as the upper limit number of steps. 5. The equivalence checking system of claim 4, comprising a second code for doing.
  6.  前記判定ステップ数算出部は、前記算出コードとして、1回目の算出コードと2回目以降の算出コードを生成し、
     前記1回目の前記算出コードは、前記第1コードと、前記第2コードと、前記上限ステップ数の終了時における前記影響状態変数の値を最終ステップの状態値として記録するための第3コードと、を含み、
     前記2回目以降の前記算出コードは、前記影響状態変数に前記最終ステップの前記状態値を設定するための第4コードと、前記第1コードと、前記第2コードと、前記第3コードと、を含み、
     前記判定ステップ数算出部は、前記1回目の前記算出コードを解析して前記戻りステップ数が求まらなかった場合、前記1回目の前記算出コードの解析のために確保された計算機リソースを解放し、前記2回目の前記算出コードの解析のために前記計算機リソースを確保し、前記2回目以降の前記算出コードを解析して前記戻りステップ数を求める
    請求項5に記載の等価性検査システム。
    The determination step count calculation unit generates a calculation code for the first calculation and a calculation code for the second and subsequent calculations as the calculation codes,
    The first calculation code includes the first code, the second code, and the third code for recording the value of the influencing state variable at the end of the upper limit number of steps as the state value of the final step. , including
    The calculation code for the second and subsequent times includes a fourth code for setting the state value of the final step to the influencing state variable, the first code, the second code, and the third code; including
    If the number of return steps cannot be obtained by analyzing the calculation code for the first time, the determination step number calculation unit releases computer resources secured for the analysis of the calculation code for the first time. 6. The equivalence checking system according to claim 5, wherein the computer resource is secured for the second analysis of the calculation code, and the number of return steps is obtained by analyzing the calculation code after the second time.
  7.  前記等価性検査システムは、
     前記変更前ソースコードの前記対象関数と前記変更後ソースコードの前記対象関数とのそれぞれを前記判定ステップ数と同じ回数繰り返し呼び出すための判定コードを生成する判定コード生成部を備え、
     前記等価判定部は、前記判定コードを解析して前記判定コードの処理を実行し、前記変更前ソースコードの前記対象関数と前記変更後ソースコードの前記対象関数が等価であるか前記判定コードの解析結果に基づいて判定する
    請求項1から請求項6のいずれか1項に記載の等価性検査システム。
    The equivalence checking system includes:
    a determination code generation unit configured to generate a determination code for repeatedly calling each of the target function of the pre-change source code and the target function of the post-change source code the same number of times as the number of determination steps;
    The equivalence determination unit analyzes the determination code, executes processing of the determination code, and determines whether the target function of the pre-change source code and the target function of the post-change source code are equivalent. 7. The equivalence checking system according to any one of claims 1 to 6, wherein determination is made based on analysis results.
  8.  前記判定コード生成部は、名前の衝突をなくした編集済みの前記変更前ソースコードと編集済みの前記変更後ソースコードと、編集済みの前記変更前ソースコードの前記対象関数と編集済みの前記変更後ソースコードの前記対象関数とのそれぞれの宣言が記述された判定ヘッダと、編集済みの前記変更前ソースコードの前記対象関数と編集済みの前記変更後ソースコードの前記対象関数とのそれぞれを前記判定ステップ数と同じ回数繰り返し呼び出すための判定ラッパーと、を前記判定コードとして生成する
    請求項7に記載の等価性検査システム。
    The determination code generation unit includes the edited pre-change source code and the edited post-change source code in which name conflicts are eliminated, the target function of the edited pre-change source code, and the edited change. determination headers describing respective declarations of the target function of the post-change source code, and the target function of the edited pre-change source code and the target function of the edited post-change source code; 8. The equivalence checking system according to claim 7, wherein a decision wrapper for repeatedly calling the same number of times as the number of decision steps is generated as the decision code.
  9.  前記判定ラッパーは、前記判定ステップ数と同じ回数分の全てのステップで編集済みの前記変更前ソースコードの前記対象関数の入力値と編集済みの前記変更後ソースコードの前記対象関数の入力値が等しいという前提条件を指定するためのコードAと、編集済みの前記変更前ソースコードの前記対象関数と編集済みの前記変更後ソースコードの前記対象関数とのそれぞれを前記判定ステップ数と同じ回数繰り返し呼び出すためのコードBと、前記判定ステップ数と同じ回数分の全てのステップで編集済みの前記変更前ソースコードの前記対象関数の出力値と編集済みの前記変更後ソースコードの前記対象関数の出力値が等しいという事後条件を判定するためのコードCと、を含む
    請求項8に記載の等価性検査システム。
    In the determination wrapper, the input value of the target function of the edited pre-change source code and the input value of the target function of the edited post-change source code are set in all the steps equal to the number of determination steps. Repeating code A for specifying a precondition of equality, and the target function of the edited pre-change source code and the target function of the edited post-change source code the same number of times as the number of determination steps. A code B to be called, an output value of the target function of the edited pre-change source code in all steps equal to the number of determination steps, and an output of the target function of the edited post-change source code. 9. The equivalence checking system of claim 8, comprising code C for determining a postcondition that the values are equal.
  10.  変更前ソースコードと変更後ソースコードとのそれぞれから、繰り返し呼び出される対象関数の出力値に影響を与える状態変数である影響状態変数を抽出する影響状態変数抽出処理と、
     前記変更前ソースコードにおいて前記対象関数が繰り返し呼び出され前記影響状態変数の値が初期値に戻り、且つ、前記変更後ソースコードにおいて前記対象関数が繰り返し呼び出され前記影響状態変数の値が初期値に戻る、という条件を満たす前記対象関数の呼び出し回数を判定ステップ数として算出する判定ステップ数算出処理と、
     前記変更前ソースコードの前記対象関数と前記変更後ソースコードの前記対象関数とのそれぞれを前記判定ステップ数と同じ回数繰り返し呼び出して、前記変更前ソースコードの前記対象関数と前記変更後ソースコードの前記対象関数が等価であるか判定する等価判定処理と、
    をコンピュータに実行させるための等価性検査プログラム。
    an influence state variable extraction process for extracting an influence state variable, which is a state variable that influences the output value of a target function that is repeatedly called, from each of the pre-modification source code and the post-modification source code;
    The target function is repeatedly called in the pre-change source code and the value of the effect state variable is returned to the initial value, and the target function is repeatedly called in the post-change source code and the value of the effect state variable is returned to the initial value. a determination step number calculation process for calculating the number of times the target function is called that satisfies the condition of returning as a determination step number;
    each of the target function of the pre-change source code and the target function of the post-change source code is repeatedly called the same number of times as the determination step number, and the target function of the pre-change source code and the post-change source code are called an equivalence determination process for determining whether the target function is equivalent;
    Equivalence checking program for executing on a computer.
PCT/JP2021/018051 2021-05-12 2021-05-12 Equivalence inspection system and equivalence inspection program WO2022239148A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/JP2021/018051 WO2022239148A1 (en) 2021-05-12 2021-05-12 Equivalence inspection system and equivalence inspection program
JP2023519108A JP7309099B2 (en) 2021-05-12 2021-05-12 Equivalence Checking System and Equivalence Checking Program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2021/018051 WO2022239148A1 (en) 2021-05-12 2021-05-12 Equivalence inspection system and equivalence inspection program

Publications (1)

Publication Number Publication Date
WO2022239148A1 true WO2022239148A1 (en) 2022-11-17

Family

ID=84028025

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2021/018051 WO2022239148A1 (en) 2021-05-12 2021-05-12 Equivalence inspection system and equivalence inspection program

Country Status (2)

Country Link
JP (1) JP7309099B2 (en)
WO (1) WO2022239148A1 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018193548A1 (en) * 2017-04-19 2018-10-25 三菱電機株式会社 Equivalence verification device and equivalence verification program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009134360A (en) * 2007-11-28 2009-06-18 Nec Corp Model inspection system, model inspection method, and model inspection program

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018193548A1 (en) * 2017-04-19 2018-10-25 三菱電機株式会社 Equivalence verification device and equivalence verification program

Also Published As

Publication number Publication date
JP7309099B2 (en) 2023-07-14
JPWO2022239148A1 (en) 2022-11-17

Similar Documents

Publication Publication Date Title
US10691419B2 (en) Reconstructing a high level compilable program from an instruction trace
JP7270764B2 (en) artificial intelligence chip verification
US9367658B2 (en) Method and apparatus for designing and generating a stream processor
US9274923B2 (en) System and method for stack crawl testing and caching
US10423518B2 (en) Systems and methods for analyzing violations of coding rules
KR20090017598A (en) Iterative static and dynamic software analysis
US8387001B2 (en) Method for finding an impact on a computer generated code
JP2022505340A (en) Systems and methods for dynamically identifying data arguments and instrumenting source code
CN111104335B (en) C language defect detection method and device based on multi-level analysis
US20130145347A1 (en) Automatic modularization of source code
JP6342129B2 (en) Source code error position detection apparatus and method for mixed mode program
CN113497809B (en) MIPS framework vulnerability mining method based on control flow and data flow analysis
KR20100106409A (en) Multi language software code analysis
EP1926021A1 (en) Software test case generation
US20070245322A1 (en) System and method for interactive and assisted program development
CN112948828A (en) Binary program malicious code detection method, terminal device and storage medium
US10402309B2 (en) Code coverage tracking for a microcontroller program
US20080127118A1 (en) Method and system for dynamic patching of software
JPH0748182B2 (en) Program error detection method
CN115935631A (en) Test system and method for vehicle equipment and storage medium
US11294653B2 (en) Methods and systems of disassembling executable code
JP7215501B2 (en) DEPENDENCY DETECTION DEVICE AND DEPENDENCY DETECTION METHOD
JP7309099B2 (en) Equivalence Checking System and Equivalence Checking Program
CN116228515A (en) Hardware acceleration system, method and related device
CN113836023B (en) Compiler security testing method based on architecture cross check

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21941882

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2023519108

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21941882

Country of ref document: EP

Kind code of ref document: A1