WO2019198235A1 - Simulation device and simulation program - Google Patents

Simulation device and simulation program Download PDF

Info

Publication number
WO2019198235A1
WO2019198235A1 PCT/JP2018/015580 JP2018015580W WO2019198235A1 WO 2019198235 A1 WO2019198235 A1 WO 2019198235A1 JP 2018015580 W JP2018015580 W JP 2018015580W WO 2019198235 A1 WO2019198235 A1 WO 2019198235A1
Authority
WO
WIPO (PCT)
Prior art keywords
unit
guest
code block
code
event
Prior art date
Application number
PCT/JP2018/015580
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/JP2018/015580 priority Critical patent/WO2019198235A1/en
Publication of WO2019198235A1 publication Critical patent/WO2019198235A1/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

Definitions

  • the present invention relates to a technique for simulating the operation of a microcomputer and peripheral devices.
  • the software simulator is a simulator that simulates the operation of a system in which software operates.
  • the simulated system is composed of a microcomputer and peripheral devices.
  • a conventional simulator is disclosed in Patent Document 1, for example.
  • a conventional simulator includes an ISS (instruction set simulator), a peripheral device simulation unit, a host code storage unit, a management table, and a guest code storage unit.
  • the ISS reads guest code, which is a program that runs on a CPU (Central Processing Unit), and divides the guest code into blocks.
  • the ISS then inserts periodic processing into the block, converts the block into a host code block, and executes the host code block.
  • Periodic processing includes simulation time update, interrupt processing, and program counter update.
  • a host code block is stored in the host code storage unit.
  • the following processing is performed. First, it is checked whether the next host code address exists based on the program counter. If the host code does not exist, the guest code is divided, cyclic processing is inserted, and conversion into a host code block is performed. Next, the ISS reads the host code block from the host code storage unit and executes the read host code block. At this time, the program counter is updated by periodic processing. Thereafter, when the simulation is not finished, the process for the next host code block is performed.
  • the conversion unit is a unit that does not span at least an unconditional branch instruction. The block is divided so as not to straddle at least the conditional branch instruction. At least before the branch destination (label), the data is divided into blocks or conversion units.
  • Patent Document 1 discloses a technique for switching a guest code division unit to a smaller division unit according to the presence of a breakpoint and an instruction execution event. However, since event processing of the peripheral device occurs at the associated time, switching cannot be performed in the event processing of the peripheral device.
  • An object of the present invention is to make it possible to execute a host code block obtained by re-division by dividing a guest code based on an event processing occurrence time of a peripheral device.
  • the simulation apparatus of the present invention A division conversion unit that divides the guest code of the conversion unit into one or more guest code blocks, and converts each guest code block into a host code block; Based on the event processing occurrence time of the peripheral device and the offset time, the guest code of the conversion unit is subdivided into one or more guest code blocks below the subdivision unit, and each guest code block after the subdivision is A re-converter that converts to host code blocks; A code execution unit that executes either the host code block obtained by the division conversion unit or the host code block obtained by the re-conversion unit;
  • the present invention it is possible to execute a host code block obtained by re-division by dividing a guest code based on the event processing occurrence time of a peripheral device.
  • FIG. 1 is a configuration diagram of a simulation apparatus 100 according to Embodiment 1.
  • FIG. FIG. 3 is a configuration diagram of a simulation unit 110 in the first embodiment.
  • FIG. 3 shows a storage unit 160 in Embodiment 1;
  • 3 is a flowchart of a simulation method according to the first embodiment.
  • FIG. 3 is a diagram illustrating an example of block division according to the first embodiment.
  • FIG. 5 is a diagram illustrating an example of block conversion according to the first embodiment. 5 is a flowchart of subdivision control (S110) in the first embodiment.
  • FIG. 3 shows an example of block re-division in Embodiment 1.
  • 6 is a flowchart of event registration processing in the first embodiment. 6 is a flowchart of event deletion processing according to the first embodiment.
  • difference of the timing of the event process of a peripheral device and the process of ISS. 2 is a hardware configuration diagram of a simulation apparatus 100 according to Embodiment 1.
  • Embodiment 1 FIG.
  • the simulation apparatus 100 will be described with reference to FIGS.
  • the simulation apparatus 100 is also called a simulator.
  • the simulation apparatus 100 is a computer including hardware such as a processor 101, a memory 102, an auxiliary storage device 103, an input device 104, and a display 105. These hardwares are connected to each other via signal lines.
  • the processor 101 is an IC (Integrated Circuit) that performs arithmetic processing, and controls other hardware.
  • the processor 101 is a CPU (Central Processing Unit), a DSP (Digital Signal Processor), or a GPU (Graphics Processing Unit).
  • the memory 102 is a volatile storage device.
  • the memory 102 is also called main memory or main memory.
  • the memory 102 is a RAM (Random Access Memory).
  • Data stored in the memory 102 is stored in the auxiliary storage device 103 as necessary.
  • the auxiliary storage device 103 is a nonvolatile storage device.
  • the auxiliary storage device 103 is a ROM (Read Only Memory), a HDD (Hard Disk Drive), or a flash memory. Data stored in the auxiliary storage device 103 is loaded into the memory 102 as necessary.
  • the input device is a keyboard, a mouse, and a pointing device. An example of a pointing device is a touch panel.
  • the display 105 is a display device.
  • the simulation apparatus 100 includes elements such as a simulation unit 110, a device simulation unit 120, and an event management unit 130. These elements are realized by software.
  • the auxiliary storage device 103 stores a simulation program for causing a computer to function as the simulation unit 110, the device simulation unit 120, and the event management unit 130.
  • the simulation program is loaded into the memory 102 and executed by the processor 101.
  • the auxiliary storage device 103 stores an OS (Operating System). At least a part of the OS is loaded into the memory 102 and executed by the processor 101. That is, the processor 101 executes the simulation program while executing the OS.
  • Data obtained by executing the simulation program is stored in a storage device such as the memory 102, the auxiliary storage device 103, a register in the processor 101, or a cache memory in the processor 101.
  • the memory 102 functions as a guest code storage unit 140, a host code storage unit 150, and a storage unit 160.
  • other storage devices may function as the guest code storage unit 140, the host code storage unit 150, and the storage unit 160 instead of the memory 102 or together with the memory 102.
  • the simulation apparatus 100 may include a plurality of processors that replace the processor 101.
  • the plurality of processors share the role of the processor 101.
  • the simulation program can be recorded (stored) in a computer-readable manner on a nonvolatile recording medium such as an optical disk or a flash memory.
  • the guest code storage unit 140 stores a guest code 141.
  • the host code storage unit 150 stores one or more host code blocks 152 generated based on the guest code 141.
  • the simulation part 110 is demonstrated.
  • the simulation unit 110 is also called an ISS (instruction set simulator).
  • the simulation unit 110 simulates the CPU of the system to be simulated.
  • a system to be simulated is called a target system.
  • the simulation unit 110 includes a division conversion unit 111, a program counter 112, an interrupt reception unit 113, a time management unit 114, a code execution unit 115, a reconversion unit 116, and a control unit 117.
  • the division conversion unit 111 divides the guest code for the conversion unit into one or more guest code blocks before subdivision, inserts periodic processing into each guest code block, and converts each guest code block into a host code. Thus, one or more host code blocks before subdivision are generated.
  • An event execution routine for executing event processing of peripheral devices is not added to the periodic processing inserted by the division conversion unit 111.
  • the program counter 112 stores an address of an instruction to be executed next, and updates the address as the program progresses in the target system.
  • the interrupt reception unit 113 simulates an interrupt to the CPU in the target system.
  • the time management unit 114 calculates the simulation time based on the CPU consumption cycle in the target system, and manages the simulation time.
  • the simulation time is the time in the target system.
  • the re-conversion unit 116 re-divides the guest code for the conversion unit into one or more guest code blocks equal to or less than the re-division unit based on the event processing occurrence time of the peripheral device and an offset time 162 to be described later.
  • One or more host code blocks after re-division are generated by inserting processing into each guest code block after re-division and converting each guest code block into host code.
  • An event execution routine for executing event processing of peripheral devices is added to the periodic processing inserted by the re-dividing unit 116.
  • the code execution unit 115 executes either the host code block obtained by the division conversion unit 111 or the host code block obtained by the re-division unit 116.
  • the control unit 117 performs various controls.
  • the device simulation unit 120 simulates the operation of peripheral devices in the target system.
  • the event management unit 130 manages event processing of peripheral devices in the target system.
  • the storage unit 160 stores data such as a management table 161, an offset time 162, a subdivision unit 163, a conversion unit 164, a first status 165, a second status 166, and a change content 167.
  • the management table 161 associates a guest address with a host address for each guest code block 142 obtained by dividing a part of the guest code 141.
  • the guest address is the head address of the guest code block 142.
  • the host address is the head address of the host code block 152 corresponding to the guest code block 142.
  • the offset time 162 is a time length used for calculating a pre-timer time to be described later.
  • the offset time 162 is also referred to as prefetch timing information.
  • the offset time 162 is input to the simulation apparatus 100 from the outside.
  • the re-division unit 163 is the maximum size of re-division by the re-conversion unit 116, and is smaller than the maximum size of division by the division-conversion unit 111.
  • the subdivision unit 163 is specified in units of one instruction.
  • the re-division unit 163 is input to the simulation apparatus 100 from the outside.
  • the conversion unit 164 is a unit for reading the guest code 141.
  • the guest code 141 is read for each conversion unit.
  • the conversion unit 164 is a unit that does not span at least an unconditional branch instruction.
  • the guest code 141 for the conversion unit is divided so as not to cross at least the conditional branch instruction. Further, the guest code 141 for the conversion unit is divided at least before the branch destination (label).
  • the first status 165 is a status indicating the presence / absence of a subdivision code.
  • the re-division code means the host code block 152 after re-division.
  • the second status 166 is a status indicating before and after subdivision. Specifically, the second status 166 indicates whether the host address obtained from the management table 161 is the host address of the host code block before re-division or the host address of the host code block after re-division.
  • the change content 167 is the change content of the management table 161.
  • the operation of the simulation apparatus corresponds to a simulation method.
  • the procedure of the simulation method corresponds to the procedure of the simulation program.
  • step S ⁇ b> 101 the control unit 117 determines whether there is a host code block 152 corresponding to the program counter 112. Specifically, the control unit 117 determines whether the host address corresponding to the program counter 112 is set in the management table 161. When the host address corresponding to the program counter 112 is set in the management table 161, there is a host code block 152 corresponding to the program counter 112. If there is a host code block 152 corresponding to the program counter 112, the process proceeds to step S105. If there is no host code block 152 corresponding to the program counter 112, the process proceeds to step S102.
  • step S102 the division conversion unit 111 divides the guest code 141 for the conversion unit into one or more guest code blocks 142. Specifically, the division conversion unit 111 reads the guest code 141 corresponding to the conversion unit with the address corresponding to the program counter 112 as the head. Then, the division conversion unit 111 divides the guest code 141 for the conversion unit into one or more guest code blocks 142.
  • FIG. 5 shows an example of block division.
  • the guest code 141 corresponding to the conversion unit is divided into two guest code blocks 142 including a first guest code block and a second guest code block.
  • step S ⁇ b> 103 the division conversion unit 111 inserts periodic processing into each guest code block 142 and converts each guest code block 142 into a host code block 152.
  • the periodic processing includes at least simulation time update, interrupt processing, and program counter 112 update. Then, the division conversion unit 111 stores each host code block 152 in the host code storage unit 150.
  • FIG. 6 shows an example of block conversion.
  • periodic processing is inserted into each of the first guest code block and the second guest code block.
  • the first host code block is a block obtained by inserting periodic processing into the first guest code block and converting the format of the first guest code block from the format for guest code to the format for host code.
  • the second host code block is a block obtained by inserting periodic processing into the second guest code block and converting the format of the second guest code block from the format for guest code to the format for host code.
  • step S104 the division conversion unit 111 updates the management table 161. Specifically, the division conversion unit 111 associates the guest address and the host address with each other for each guest code block 142 and adds them to the management table 161.
  • step S105 the control unit 117 acquires the host address corresponding to the program counter 112 from the management table 161.
  • step S110 the reconversion unit 116 performs reconversion control.
  • the reconversion control (S110) will be described later.
  • step S120 the code execution unit 115 executes the host code block 152 corresponding to the program counter 112.
  • the code execution unit 115 operates as follows. First, the code execution unit 115 acquires a host address corresponding to the program counter 112 from the management table 161. Next, the code execution unit 115 reads the host code block 152 corresponding to the acquired host address from the host code storage unit 150. Then, the code execution unit 115 executes the read host code block 152.
  • the second status 166 is “before subdivision”
  • the host code block 152 before subdivision is executed.
  • the second status 166 is “after re-division”
  • the post-division host code block 152 is executed.
  • the code execution unit 115 When executing a periodic process to which an event execution routine is added, the code execution unit 115 operates as follows. First, the code execution unit 115 acquires the current time (simulation time) from the time management unit 114. Next, information on each event whose event occurrence time is earlier than the current time among the events registered in the event queue is acquired from the event management unit 130. Then, the code execution unit 115 executes each event whose event occurrence time is earlier than the current time based on the acquired information. That is, the code execution unit 115 executes each event whose event occurrence time has passed but has not been executed. Information about each event to be executed is deleted from the event queue by the event management unit 130. Furthermore, the pre-timer time described later is updated by the event management unit 130. The operation of the event management unit 130 will be described later.
  • step S131 the control unit 117 determines whether the simulation is finished. Specifically, the control unit 117 determines whether the program counter 112 indicates the final address of the guest code 141. When the program counter 112 indicates the final address of the guest code 141, the simulation ends. However, the control unit 117 may determine whether the simulation is completed by another method. For example, the control unit 117 may determine that the simulation has ended when the simulation time is after a predetermined end time. When the simulation is finished, the process of the simulation method is finished. If the simulation has not ended, the process proceeds to step S101.
  • the reconversion unit 116 compares the current time (simulation time) with the pretimer time. Specifically, the reconversion unit 116 acquires the current time from the time management unit 114, acquires the pretimer time from the event management unit 130, and compares the current time with the pretimer time.
  • the pre-timer time is a time that is earlier by the offset time 162 than the earliest event occurrence time among one or more event occurrence times registered in the event queue. That is, the pre-timer time is a time that is earlier than the earliest occurrence time among the occurrence times of unexecuted events by the offset time 162.
  • step S112 the reconversion unit 116 refers to the first status 165 and determines the presence / absence of a subdivision code. If there is no re-division code, the process proceeds to step S1131. If there is a subdivision code, the process proceeds to step S114.
  • step S1131 the re-conversion unit 116 re-divides the guest code 141 for the conversion unit into one or more guest code blocks 142.
  • the guest code 141 for the conversion unit is the same as that divided in step S102 (see FIG. 4).
  • the reconversion unit 116 divides the guest code 141 for the conversion unit into one or more guest code blocks 142 with the repartition unit 163 as the maximum size of each guest code block.
  • the conversion unit 164 is a unit in which neither a conditional branch instruction nor a branch destination (label) is present.
  • step S1132 the re-conversion unit 116 inserts the periodic process to which the event execution routine is added into each guest code block 142 after the re-division, and converts each guest code block 142 into the host code block 152. Thereby, one or more host code blocks 152 corresponding to the one or more guest code blocks 142 after the re-division are obtained.
  • the event execution routine is a routine for executing each event having an occurrence time before the current time (simulation time) among events registered in the event queue. That is, the event execution routine is a routine for executing each event whose occurrence time is before the current time but is not executed.
  • step S ⁇ b> 1133 the reconversion unit 116 updates the management table 161. Specifically, the re-conversion unit 116 updates the address set set in the management table 161 to the address set after re-division.
  • Each address set is a set of a guest address and a host address.
  • step S ⁇ b> 1134 the reconversion unit 116 stores the change content 167 of the management table 161. Further, the re-conversion unit 116 sets “division code present” to the first status 165 and sets “after division” to the second status 166. After step S1134, the re-division control (S110) ends.
  • FIG. 8 shows an example of block subdivision.
  • the guest code 141 for the conversion unit is subdivided into a first guest code block and a second guest code block. Periodic processing is inserted into each of the first guest code block and the second guest code block. An event execution routine is added to each periodic process of the first guest code block and the second guest code block.
  • the first host code block is a block obtained by inserting a periodic process with an event execution routine added to the first guest code block.
  • the second host code block is a block obtained by inserting a periodic process with an event execution routine added to the second guest code block.
  • step S ⁇ b> 114 the reconversion unit 116 determines the second status 166. If the second status 166 is “before subdivision”, the process proceeds to step S115. When the second status 166 is “after subdivision”, the subdivision control (S110) ends.
  • step S ⁇ b> 115 the reconversion unit 116 changes the management table 161 based on the change content 167. Further, the re-conversion unit 116 changes the second status 166 from “before re-division” to “after re-division”. After step S115, the subdivision control (S110) ends.
  • step S ⁇ b> 116 the reconversion unit 116 determines the second status 166.
  • the restoration condition is satisfied, and the process proceeds to step S117.
  • the re-division control (S110) ends.
  • step S117 the re-conversion unit 116 returns the management table 161 to the state before the re-division based on the change content 167. Furthermore, the re-conversion unit 116 changes the second status 166 from “after re-division” to “before re-division”. After step S117, the re-division control (S110) ends.
  • step S ⁇ b> 201 the device simulation unit 120 passes the event occurrence time and the reference to the callback function to the event management unit 130.
  • the event management unit 130 receives the event occurrence time and the reference to the callback function from the device simulation unit 120.
  • step S202 the event management unit 130 registers the event occurrence time and the reference to the callback function in the event queue. Specifically, the event management unit 130 inserts a set of the event occurrence time and the reference to the callback function into the event queue so that the event occurrence times are arranged in the order from the earliest time in the event queue.
  • step S203 the event management unit 130 updates the pretimer time. Specifically, the event management unit 130 selects the earliest event occurrence time from the event queue, and calculates a time that is an offset time 162 before the selected event occurrence time. Then, the event management unit 130 updates the pretimer time with the calculated time.
  • step S211 the event management unit 130 deletes the executed event from the event queue. Specifically, the event management unit 130 deletes a set of the event occurrence time and the reference to the callback function from the event queue for the executed event.
  • step S212 the event management unit 130 updates the pretimer time.
  • the update method is the same as the method in step S203 (see FIG. 9).
  • a simulator to be compared with the simulation apparatus 100 will be described as a target simulator, and then the effects of the simulation apparatus 100 will be described.
  • the target simulator it may be necessary to simulate the operation of peripheral devices of the CPU.
  • peripheral device operations There are roughly two types of peripheral device operations.
  • the first operation is an operation that accepts read access or write access from the CPU and responds to the accepted access.
  • the second operation is an operation that performs processing spontaneously when a specific time has elapsed from a certain timing.
  • a voluntary process a process that generates an interrupt from a timer at regular intervals, a process that detects reception from the outside after a certain period of time has elapsed from a transmission process in a communication device, or after analog-digital conversion is started For example, a process of terminating the analog-digital conversion when a predetermined time has elapsed.
  • event processing of peripheral devices When such an operation of the peripheral device is simulated by the target simulator, it is considered that the first operation can be included in the ISS instruction execution. However, the second operation is considered to execute event processing that matches the simulation time at that time in the periodic processing.
  • the processing of the target simulator is described in time order from top to bottom, and ISS processing (1), periodic processing (1), ISS processing (2), and periodic processing (2) are executed in order.
  • the event process (1) of the peripheral device is executed.
  • the event process (1) occurrence time is the event (1) occurrence time shown in FIG. 11 on the same time axis as the ISS process (1).
  • the ISS process and the periodic process are not executed in parallel, and the ISS process and the periodic process are executed in order as shown in FIG. This is because parallel operation greatly reduces the overall simulation speed.
  • This shift is due to the fact that the ISS process (that is, instruction execution) in the shaded area shown in FIG. 11 should be executed after the event (1) process, but is executed before the event (1) process. It means a difference in context.
  • This shift is called a timing shift between the event processing of the peripheral device and the ISS processing. In FIG. 11, this deviation is referred to as a timing deviation (1) between the event process and the ISS process.
  • the difference in timing between the event processing of the peripheral device and the ISS processing increases as the block size increases.
  • the guest code is subdivided based on the offset time and the event occurrence time. Therefore, the code before and after the occurrence of the event can be subdivided finely, and the timing deviation between the event processing of the peripheral device and the ISS processing can be reduced. Furthermore, since re-division is performed only on the code before and after the occurrence of the event, a reduction in processing speed due to re-division can be reduced. Further, in the simulation apparatus 100, since the state before the re-division is restored based on the offset time and the event occurrence time, the re-division is performed if the next event does not occur for a while even after the re-division is performed once.
  • the previous state is restored (see step S117 in FIG. 7). For this reason, a decrease in processing speed due to re-division becomes temporary, and the decrease in processing speed can be reduced. Moreover, in the simulation apparatus 100, by making the subdivision unit changeable, it is possible to prevent the division from becoming finer than necessary depending on the simulation situation. As a result, a decrease in processing speed is reduced. In the simulation apparatus 100, the presence / absence of the event execution routine can be switched together with the re-division. Therefore, the event execution routine can be omitted in a state where no event execution is necessary, and the execution speed can be increased.
  • time and time may be expressed using the number of cycles.
  • the simulation apparatus 100 includes a processing circuit 109.
  • the processing circuit 109 is hardware that implements the simulation unit 110, the device simulation unit 120, and the event management unit 130.
  • the processing circuit 109 may be dedicated hardware or the processor 101 that executes a program stored in the memory 102.
  • the processing circuit 109 is dedicated hardware, the processing circuit 109 is, for example, a single circuit, a composite circuit, 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 simulation apparatus 100 may include a plurality of processing circuits that replace the processing circuit 109. The plurality of processing circuits share the role of the processing circuit 109.
  • processing circuit 109 some functions may be realized by dedicated hardware, and the remaining functions may be realized by software or firmware.
  • the processing circuit 109 can be realized by hardware, software, firmware, or a combination thereof.
  • the embodiment is an example of a preferred embodiment and is not intended to limit the technical scope of the present invention.
  • the embodiment may be implemented partially or in combination with other embodiments.
  • the procedure described using the flowchart and the like may be changed as appropriate.
  • simulation device 101 processor, 102 memory, 103 auxiliary storage device, 104 input device, 105 display, 109 processing circuit, 110 simulation unit, 111 division conversion unit, 112 program counter, 113 interrupt reception unit, 114 time management unit, 115 Code execution unit, 116 re-conversion unit, 117 control unit, 120 device simulation unit, 130 event management unit, 140 guest code storage unit, 141 guest code, 142 guest code block, 150 host code storage unit, 152 host code block, 160 Storage unit, 161 management table, 162 offset time, 163 subdivision unit, 164 conversion unit, 165 first status, 166 second status, 167 change The contents, 168 Puretaima time.

Abstract

According to the present invention, a division and conversion unit (111) divides a guest code of a unit of conversion into one or more guest code blocks, and converts each guest code block into a host code block. A reconversion unit (116) re-divides the guest code of the unit of conversion into one or more guest code blocks of a unit equal to or smaller than a unit of re-division, and converts each guest code block after the re-division into host code blocks, on the basis of an occurrence time of an event processing of a peripheral device and an offset time. A code execution unit (115) executes any one among the host code blocks obtained by the division and conversion unit and the host code blocks obtained by the re-conversion unit.

Description

シミュレーション装置およびシミュレーションプログラムSimulation apparatus and simulation program
 本発明は、マイクロコンピュータおよび周辺デバイスなどの動作を模擬するための技術に関するものである。 The present invention relates to a technique for simulating the operation of a microcomputer and peripheral devices.
 近年、組み込み機器向けのソフトウェア開発では、ソフトウェアデバッグを早期に開始するために、ソフトウェアシミュレータが用いられる。ソフトウェアシミュレータは、ソフトウェアが動作するシステムの動作を模擬するシミュレータである。模擬されるシステムは、マイコンと周辺機器とで構成される。このシミュレータを用いることにより、ソフトウェアが動作するハードウェア試験環境が完成する前から、ソフトウェアデバッグを行うことができる。 In recent years, software simulators are used in software development for embedded devices in order to start software debugging early. The software simulator is a simulator that simulates the operation of a system in which software operates. The simulated system is composed of a microcomputer and peripheral devices. By using this simulator, software debugging can be performed before the hardware test environment in which the software operates is completed.
 従来のシミュレータは、例えば特許文献1に開示されている。
 従来のシミュレータは、ISS(命令セットシミュレータ)と周辺デバイス模擬部とホストコード格納部と管理テーブルとゲストコード格納部とで構成される。ISSは、CPU(Central Processing Unit)で動作するプログラムであるゲストコードを読み込み、ゲストコードをブロックに分割する。そして、ISSは、ブロックに周期処理を挿入し、ブロックをホストコードブロックへ変換し、ホストコードブロックを実行する。周期処理は、シミュレーション時刻の更新、割り込み処理およびプログラムカウンタの更新などを行う。ホストコード格納部にはホストコードブロックが格納される。
A conventional simulator is disclosed in Patent Document 1, for example.
A conventional simulator includes an ISS (instruction set simulator), a peripheral device simulation unit, a host code storage unit, a management table, and a guest code storage unit. The ISS reads guest code, which is a program that runs on a CPU (Central Processing Unit), and divides the guest code into blocks. The ISS then inserts periodic processing into the block, converts the block into a host code block, and executes the host code block. Periodic processing includes simulation time update, interrupt processing, and program counter update. A host code block is stored in the host code storage unit.
 従来のシミュレータにおいて、次のような処理が行われる。
 まず、プログラムカウンタに基づいて、次のホストコードアドレスが存在するか調べられる。
 そして、ホストコードが存在しない場合、ゲストコードが分割され、周期処理が挿入され、ホストコードブロックへの変換が行われる。
 次に、ISSは、ホストコード格納部からホストコードブロックを読み込み、読み込んだホストコードブロックを実行する。このとき、周期処理にてプログラムカウンタが更新される。
 その後、シミュレーション終了でない場合、次のホストコードブロックに対する処理が行われる。
 なお、変換単位は、少なくとも無条件分岐命令をまたがないような単位である。また、ブロックは、少なくとも条件分岐命令をまたがないように分割される。また、少なくとも分岐先(ラベル)の前では、ブロックか変換単位で分割される。
In the conventional simulator, the following processing is performed.
First, it is checked whether the next host code address exists based on the program counter.
If the host code does not exist, the guest code is divided, cyclic processing is inserted, and conversion into a host code block is performed.
Next, the ISS reads the host code block from the host code storage unit and executes the read host code block. At this time, the program counter is updated by periodic processing.
Thereafter, when the simulation is not finished, the process for the next host code block is performed.
The conversion unit is a unit that does not span at least an unconditional branch instruction. The block is divided so as not to straddle at least the conditional branch instruction. At least before the branch destination (label), the data is divided into blocks or conversion units.
特許第5021584号公報Japanese Patent No. 5021584
 特許文献1には、ブレークポイントと命令実行イベントの有無とに応じてゲストコードの分割単位を小さい分割単位に切り替える技術が開示されている。しかし、対応付けられた時刻に周辺デバイスのイベント処理が発生するので、周辺デバイスのイベント処理での切り替えができない。 Patent Document 1 discloses a technique for switching a guest code division unit to a smaller division unit according to the presence of a breakpoint and an instruction execution event. However, since event processing of the peripheral device occurs at the associated time, switching cannot be performed in the event processing of the peripheral device.
 本発明は、周辺デバイスのイベント処理の発生時刻に基づいてゲストコードを再分割して再分割によって得られるホストコードブロックを実行できるようにすることを目的とする。 An object of the present invention is to make it possible to execute a host code block obtained by re-division by dividing a guest code based on an event processing occurrence time of a peripheral device.
 本発明のシミュレーション装置は、
 変換単位のゲストコードを1つ以上のゲストコードブロックに分割し、各ゲストコードブロックをホストコードブロックに変換する分割変換部と、
 周辺デバイスのイベント処理の発生時刻と、オフセット時間とに基づいて、前記変換単位のゲストコードを再分割単位以下の1つ以上のゲストコードブロックに再分割し、再分割後の各ゲストコードブロックをホストコードブロックに変換する再変換部と、
 前記分割変換部によって得られたホストコードブロックと前記再変換部によって得られたホストコードブロックとのいずれかを実行するコード実行部とを備える。
The simulation apparatus of the present invention
A division conversion unit that divides the guest code of the conversion unit into one or more guest code blocks, and converts each guest code block into a host code block;
Based on the event processing occurrence time of the peripheral device and the offset time, the guest code of the conversion unit is subdivided into one or more guest code blocks below the subdivision unit, and each guest code block after the subdivision is A re-converter that converts to host code blocks;
A code execution unit that executes either the host code block obtained by the division conversion unit or the host code block obtained by the re-conversion unit;
 本発明によれば、周辺デバイスのイベント処理の発生時刻に基づいてゲストコードを再分割して再分割によって得られるホストコードブロックを実行することができる。 According to the present invention, it is possible to execute a host code block obtained by re-division by dividing a guest code based on the event processing occurrence time of a peripheral device.
実施の形態1におけるシミュレーション装置100の構成図。1 is a configuration diagram of a simulation apparatus 100 according to Embodiment 1. FIG. 実施の形態1におけるシミュレーション部110の構成図。FIG. 3 is a configuration diagram of a simulation unit 110 in the first embodiment. 実施の形態1における記憶部160を示す図。FIG. 3 shows a storage unit 160 in Embodiment 1; 実施の形態1におけるシミュレーション方法のフローチャート。3 is a flowchart of a simulation method according to the first embodiment. 実施の形態1におけるブロック分割の一例を示す図。FIG. 3 is a diagram illustrating an example of block division according to the first embodiment. 実施の形態1におけるブロック変換の一例を示す図。FIG. 5 is a diagram illustrating an example of block conversion according to the first embodiment. 実施の形態1における再分割制御(S110)のフローチャート。5 is a flowchart of subdivision control (S110) in the first embodiment. 実施の形態1におけるブロック再分割の一例を示す図。FIG. 3 shows an example of block re-division in Embodiment 1. 実施の形態1におけるイベント登録処理のフローチャート。6 is a flowchart of event registration processing in the first embodiment. 実施の形態1におけるイベント削除処理のフローチャート。6 is a flowchart of event deletion processing according to the first embodiment. 周辺デバイスのイベント処理とISSの処理とのタイミングのずれを示す図。The figure which shows the shift | offset | difference of the timing of the event process of a peripheral device and the process of ISS. 実施の形態1におけるシミュレーション装置100のハードウェア構成図。2 is a hardware configuration diagram of a simulation apparatus 100 according to Embodiment 1. FIG.
 実施の形態および図面において、同じ要素および対応する要素には同じ符号を付している。同じ符号が付された要素の説明は適宜に省略または簡略化する。図中の矢印はデータの流れ又は処理の流れを主に示している。 In the embodiment and the drawings, the same reference numerals are given to the same elements and corresponding elements. Description of elements having the same reference numerals will be omitted or simplified as appropriate. The arrows in the figure mainly indicate the flow of data or the flow of processing.
 実施の形態1.
 シミュレーション装置100について、図1から図12に基づいて説明する。
 シミュレーション装置100はシミュレータとも呼ばれる。
Embodiment 1 FIG.
The simulation apparatus 100 will be described with reference to FIGS.
The simulation apparatus 100 is also called a simulator.
***構成の説明***
 図1に基づいて、シミュレーション装置100の構成を説明する。
 シミュレーション装置100は、プロセッサ101とメモリ102と補助記憶装置103と入力装置104とディスプレイ105といったハードウェアを備えるコンピュータである。これらのハードウェアは、信号線を介して互いに接続されている。
*** Explanation of configuration ***
Based on FIG. 1, the structure of the simulation apparatus 100 is demonstrated.
The simulation apparatus 100 is a computer including hardware such as a processor 101, a memory 102, an auxiliary storage device 103, an input device 104, and a display 105. These hardwares are connected to each other via signal lines.
 プロセッサ101は、演算処理を行うIC(Integrated Circuit)であり、他のハードウェアを制御する。例えば、プロセッサ101は、CPU(Central Processing Unit)、DSP(Digital Signal Processor)、またはGPU(Graphics Processing Unit)である。
 メモリ102は揮発性の記憶装置である。メモリ102は、主記憶装置またはメインメモリとも呼ばれる。例えば、メモリ102はRAM(Random Access Memory)である。メモリ102に記憶されたデータは必要に応じて補助記憶装置103に保存される。
 補助記憶装置103は不揮発性の記憶装置である。例えば、補助記憶装置103は、ROM(Read Only Memory)、HDD(Hard Disk Drive)、またはフラッシュメモリである。補助記憶装置103に記憶されたデータは必要に応じてメモリ102にロードされる。
 入力装置は、キーボード、マウスおよびポインティングデバイスである。ポインティングデバイスの一例はタッチパネルである。
 ディスプレイ105は、表示装置である。
The processor 101 is an IC (Integrated Circuit) that performs arithmetic processing, and controls other hardware. For example, the processor 101 is a CPU (Central Processing Unit), a DSP (Digital Signal Processor), or a GPU (Graphics Processing Unit).
The memory 102 is a volatile storage device. The memory 102 is also called main memory or main memory. For example, the memory 102 is a RAM (Random Access Memory). Data stored in the memory 102 is stored in the auxiliary storage device 103 as necessary.
The auxiliary storage device 103 is a nonvolatile storage device. For example, the auxiliary storage device 103 is a ROM (Read Only Memory), a HDD (Hard Disk Drive), or a flash memory. Data stored in the auxiliary storage device 103 is loaded into the memory 102 as necessary.
The input device is a keyboard, a mouse, and a pointing device. An example of a pointing device is a touch panel.
The display 105 is a display device.
 シミュレーション装置100は、シミュレーション部110とデバイス模擬部120とイベント管理部130といった要素を備える。これらの要素はソフトウェアで実現される。 The simulation apparatus 100 includes elements such as a simulation unit 110, a device simulation unit 120, and an event management unit 130. These elements are realized by software.
 補助記憶装置103には、シミュレーション部110とデバイス模擬部120とイベント管理部130としてコンピュータを機能させるためのシミュレーションプログラムが記憶されている。シミュレーションプログラムは、メモリ102にロードされて、プロセッサ101によって実行される。
 さらに、補助記憶装置103にはOS(Operating System)が記憶されている。OSの少なくとも一部は、メモリ102にロードされて、プロセッサ101によって実行される。
 つまり、プロセッサ101は、OSを実行しながら、シミュレーションプログラムを実行する。
 シミュレーションプログラムを実行して得られるデータは、メモリ102、補助記憶装置103、プロセッサ101内のレジスタまたはプロセッサ101内のキャッシュメモリといった記憶装置に記憶される。
The auxiliary storage device 103 stores a simulation program for causing a computer to function as the simulation unit 110, the device simulation unit 120, and the event management unit 130. The simulation program is loaded into the memory 102 and executed by the processor 101.
Furthermore, the auxiliary storage device 103 stores an OS (Operating System). At least a part of the OS is loaded into the memory 102 and executed by the processor 101.
That is, the processor 101 executes the simulation program while executing the OS.
Data obtained by executing the simulation program is stored in a storage device such as the memory 102, the auxiliary storage device 103, a register in the processor 101, or a cache memory in the processor 101.
 メモリ102はゲストコード格納部140とホストコード格納部150と記憶部160として機能する。但し、他の記憶装置が、メモリ102の代わりに、又は、メモリ102と共に、ゲストコード格納部140とホストコード格納部150と記憶部160として機能してもよい。 The memory 102 functions as a guest code storage unit 140, a host code storage unit 150, and a storage unit 160. However, other storage devices may function as the guest code storage unit 140, the host code storage unit 150, and the storage unit 160 instead of the memory 102 or together with the memory 102.
 シミュレーション装置100は、プロセッサ101を代替する複数のプロセッサを備えてもよい。複数のプロセッサは、プロセッサ101の役割を分担する。 The simulation apparatus 100 may include a plurality of processors that replace the processor 101. The plurality of processors share the role of the processor 101.
 シミュレーションプログラムは、光ディスクまたはフラッシュメモリ等の不揮発性の記録媒体にコンピュータで読み取り可能に記録(格納)することができる。 The simulation program can be recorded (stored) in a computer-readable manner on a nonvolatile recording medium such as an optical disk or a flash memory.
 次に、ゲストコード格納部140とホストコード格納部150とについて説明する。
 ゲストコード格納部140は、ゲストコード141を記憶する。
 ホストコード格納部150は、ゲストコード141を元に生成される1つ以上のホストコードブロック152を記憶する。
Next, the guest code storage unit 140 and the host code storage unit 150 will be described.
The guest code storage unit 140 stores a guest code 141.
The host code storage unit 150 stores one or more host code blocks 152 generated based on the guest code 141.
 図2に基づいて、シミュレーション部110について説明する。
 シミュレーション部110は、ISS(命令セットシミュレータ)とも呼ばれる。
 シミュレーション部110は、シミュレーションの対象となるシステムのCPUを模擬する。シミュレーションの対象となるシステムを対象システムと呼ぶ。
Based on FIG. 2, the simulation part 110 is demonstrated.
The simulation unit 110 is also called an ISS (instruction set simulator).
The simulation unit 110 simulates the CPU of the system to be simulated. A system to be simulated is called a target system.
 シミュレーション部110は、分割変換部111とプログラムカウンタ112と割込み受付部113と時刻管理部114とコード実行部115と再変換部116と制御部117とを備える。
 分割変換部111は、変換単位分のゲストコードを再分割前の1つ以上のゲストコードブロックに分割して周期処理を各ゲストコードブロックに挿入して各ゲストコードブロックをホストコードに変換することで、再分割前の1つ以上のホストコードブロックを生成する。分割変換部111によって挿入される周期処理には、周辺デバイスのイベント処理を実行するためのイベント実行ルーチンが付加されない。
 プログラムカウンタ112は、次に実行される命令のアドレスを記憶し、対象システムにおけるプログラムの進行と共にアドレスを更新する。
 割込み受付部113は、対象システムにおけるCPUに対する割込みを模擬する。
 時刻管理部114は、対象システムにおけるCPUの消費サイクルを元にシミュレーション時刻を算出し、シミュレーション時刻を管理する。シミュレーション時刻は、対象システムにおける時刻である。
 再変換部116は、周辺デバイスのイベント処理の発生時刻と後述するオフセット時間162とに基づいて、変換単位分のゲストコードを再分割単位以下の1つ以上のゲストコードブロックに再分割して周期処理を再分割後の各ゲストコードブロックに挿入して各ゲストコードブロックをホストコードに変換することで、再分割後の1つ以上のホストコードブロックを生成する。再分割部116によって挿入される周期処理には、周辺デバイスのイベント処理を実行するためのイベント実行ルーチンが付加される。
 コード実行部115は、分割変換部111によって得られたホストコードブロックと再分割部116によって得られたホストコードブロックとのいずれかを実行する。
 制御部117は、各種制御を行う。
The simulation unit 110 includes a division conversion unit 111, a program counter 112, an interrupt reception unit 113, a time management unit 114, a code execution unit 115, a reconversion unit 116, and a control unit 117.
The division conversion unit 111 divides the guest code for the conversion unit into one or more guest code blocks before subdivision, inserts periodic processing into each guest code block, and converts each guest code block into a host code. Thus, one or more host code blocks before subdivision are generated. An event execution routine for executing event processing of peripheral devices is not added to the periodic processing inserted by the division conversion unit 111.
The program counter 112 stores an address of an instruction to be executed next, and updates the address as the program progresses in the target system.
The interrupt reception unit 113 simulates an interrupt to the CPU in the target system.
The time management unit 114 calculates the simulation time based on the CPU consumption cycle in the target system, and manages the simulation time. The simulation time is the time in the target system.
The re-conversion unit 116 re-divides the guest code for the conversion unit into one or more guest code blocks equal to or less than the re-division unit based on the event processing occurrence time of the peripheral device and an offset time 162 to be described later. One or more host code blocks after re-division are generated by inserting processing into each guest code block after re-division and converting each guest code block into host code. An event execution routine for executing event processing of peripheral devices is added to the periodic processing inserted by the re-dividing unit 116.
The code execution unit 115 executes either the host code block obtained by the division conversion unit 111 or the host code block obtained by the re-division unit 116.
The control unit 117 performs various controls.
 次に、デバイス模擬部120およびイベント管理部130について説明する。
 デバイス模擬部120は、対象システムにおける周辺デバイスの動作を模擬する。
 イベント管理部130は、対象システムにおける周辺デバイスのイベント処理を管理する。
Next, the device simulation unit 120 and the event management unit 130 will be described.
The device simulation unit 120 simulates the operation of peripheral devices in the target system.
The event management unit 130 manages event processing of peripheral devices in the target system.
 図3に基づいて、記憶部160について説明する。
 記憶部160は、管理テーブル161とオフセット時間162と再分割単位163と変換単位164と第1ステータス165と第2ステータス166と変更内容167といったデータを記憶する。
The storage unit 160 will be described with reference to FIG.
The storage unit 160 stores data such as a management table 161, an offset time 162, a subdivision unit 163, a conversion unit 164, a first status 165, a second status 166, and a change content 167.
 管理テーブル161は、ゲストコード141の一部を分割して得られるゲストコードブロック142毎に、ゲストアドレスとホストアドレスとを互いに対応付ける。
 ゲストアドレスは、ゲストコードブロック142の先頭のアドレスである。
 ホストアドレスは、ゲストコードブロック142に対応するホストコードブロック152の先頭のアドレスである。
The management table 161 associates a guest address with a host address for each guest code block 142 obtained by dividing a part of the guest code 141.
The guest address is the head address of the guest code block 142.
The host address is the head address of the host code block 152 corresponding to the guest code block 142.
 オフセット時間162は、後述するプレタイマ時刻を算出するために用いる時間長である。オフセット時間162は、先読みタイミング情報とも呼ぶ。オフセット時間162は、外部からシミュレーション装置100に入力される。 The offset time 162 is a time length used for calculating a pre-timer time to be described later. The offset time 162 is also referred to as prefetch timing information. The offset time 162 is input to the simulation apparatus 100 from the outside.
 再分割単位163は、再変換部116による再分割の最大サイズであり、分割変換部111による分割の最大サイズよりも小さい。例えば、再分割単位163は、1命令単位で指定される。再分割単位163は、外部からシミュレーション装置100に入力される。 The re-division unit 163 is the maximum size of re-division by the re-conversion unit 116, and is smaller than the maximum size of division by the division-conversion unit 111. For example, the subdivision unit 163 is specified in units of one instruction. The re-division unit 163 is input to the simulation apparatus 100 from the outside.
 変換単位164は、ゲストコード141の読み込み単位である。ゲストコード141は、変換単位ずつ読み込まれる。
 変換単位164は、少なくとも無条件分岐命令をまたがないような単位である。変換単位分のゲストコード141は、少なくとも条件分岐命令をまたがないように分割される。また、変換単位分のゲストコード141は、少なくとも分岐先(ラベル)の前で分割される。
The conversion unit 164 is a unit for reading the guest code 141. The guest code 141 is read for each conversion unit.
The conversion unit 164 is a unit that does not span at least an unconditional branch instruction. The guest code 141 for the conversion unit is divided so as not to cross at least the conditional branch instruction. Further, the guest code 141 for the conversion unit is divided at least before the branch destination (label).
 第1ステータス165は、再分割コードの有無を示すステータスである。
 再分割コードは、再分割後のホストコードブロック152を意味する。
The first status 165 is a status indicating the presence / absence of a subdivision code.
The re-division code means the host code block 152 after re-division.
 第2ステータス166は、再分割の前後を示すステータスである。
 具体的には、第2ステータス166は、管理テーブル161から得られるホストアドレスが再分割前のホストコードブロックのホストアドレスと再分割後のホストコードブロックのホストアドレスとのいずれであるかを表す。
The second status 166 is a status indicating before and after subdivision.
Specifically, the second status 166 indicates whether the host address obtained from the management table 161 is the host address of the host code block before re-division or the host address of the host code block after re-division.
 変更内容167は、管理テーブル161の変更内容である。 The change content 167 is the change content of the management table 161.
***動作の説明***
 シミュレーション装置の動作はシミュレーション方法に相当する。また、シミュレーション方法の手順はシミュレーションプログラムの手順に相当する。
*** Explanation of operation ***
The operation of the simulation apparatus corresponds to a simulation method. The procedure of the simulation method corresponds to the procedure of the simulation program.
 図4に基づいて、シミュレーション方法を説明する。
 ステップS101において、制御部117は、プログラムカウンタ112に対応するホストコードブロック152が有るか判定する。
 具体的には、制御部117は、プログラムカウンタ112に対応するホストアドレスが管理テーブル161に設定されているか判定する。プログラムカウンタ112に対応するホストアドレスが管理テーブル161に設定されている場合、プログラムカウンタ112に対応するホストコードブロック152が有る。
 プログラムカウンタ112に対応するホストコードブロック152が有る場合、処理はステップS105に進む。
 プログラムカウンタ112に対応するホストコードブロック152が無い場合、処理はステップS102に進む。
A simulation method will be described with reference to FIG.
In step S <b> 101, the control unit 117 determines whether there is a host code block 152 corresponding to the program counter 112.
Specifically, the control unit 117 determines whether the host address corresponding to the program counter 112 is set in the management table 161. When the host address corresponding to the program counter 112 is set in the management table 161, there is a host code block 152 corresponding to the program counter 112.
If there is a host code block 152 corresponding to the program counter 112, the process proceeds to step S105.
If there is no host code block 152 corresponding to the program counter 112, the process proceeds to step S102.
 ステップS102において、分割変換部111は、変換単位分のゲストコード141を1つ以上のゲストコードブロック142に分割する。
 具体的には、分割変換部111は、プログラムカウンタ112に対応するアドレスを先頭にして、変換単位分のゲストコード141を読み込む。そして、分割変換部111は、変換単位分のゲストコード141を1つ以上のゲストコードブロック142に分割する。
In step S102, the division conversion unit 111 divides the guest code 141 for the conversion unit into one or more guest code blocks 142.
Specifically, the division conversion unit 111 reads the guest code 141 corresponding to the conversion unit with the address corresponding to the program counter 112 as the head. Then, the division conversion unit 111 divides the guest code 141 for the conversion unit into one or more guest code blocks 142.
 図5に、ブロック分割の一例を示す。
 図5において、変換単位分のゲストコード141は、第1ゲストコードブロックと第2ゲストコードブロックとの2つのゲストコードブロック142に分割されている。
FIG. 5 shows an example of block division.
In FIG. 5, the guest code 141 corresponding to the conversion unit is divided into two guest code blocks 142 including a first guest code block and a second guest code block.
 図4に戻り、ステップS103から説明を続ける。
 ステップS103において、分割変換部111は、各ゲストコードブロック142に周期処理を挿入し、各ゲストコードブロック142をホストコードブロック152に変換する。
 周期処理は、少なくとも、シミュレーション時刻の更新と割り込み処理とプログラムカウンタ112の更新とを含む。
 そして、分割変換部111は、各ホストコードブロック152をホストコード格納部150に記憶する。
Returning to FIG. 4, the description will be continued from step S103.
In step S <b> 103, the division conversion unit 111 inserts periodic processing into each guest code block 142 and converts each guest code block 142 into a host code block 152.
The periodic processing includes at least simulation time update, interrupt processing, and program counter 112 update.
Then, the division conversion unit 111 stores each host code block 152 in the host code storage unit 150.
 図6に、ブロック変換の一例を示す。
 図6において、第1ゲストコードブロックと第2ゲストコードブロックとのそれぞれに周期処理が挿入されている。第1ホストコードブロックは、第1ゲストコードブロックに周期処理を挿入して第1ゲストコードブロックの形式をゲストコード用の形式からホストコード用の形式に変換して得られるブロックである。第2ホストコードブロックは、第2ゲストコードブロックに周期処理を挿入して第2ゲストコードブロックの形式をゲストコード用の形式からホストコード用の形式に変換して得られるブロックである。
FIG. 6 shows an example of block conversion.
In FIG. 6, periodic processing is inserted into each of the first guest code block and the second guest code block. The first host code block is a block obtained by inserting periodic processing into the first guest code block and converting the format of the first guest code block from the format for guest code to the format for host code. The second host code block is a block obtained by inserting periodic processing into the second guest code block and converting the format of the second guest code block from the format for guest code to the format for host code.
 図4に戻り、ステップS104から説明を続ける。
 ステップS104において、分割変換部111は、管理テーブル161を更新する。
 具体的には、分割変換部111は、ゲストコードブロック142毎にゲストアドレスとホストアドレスとを互いに対応付けて管理テーブル161に追加する。
Returning to FIG. 4, the description will be continued from step S104.
In step S104, the division conversion unit 111 updates the management table 161.
Specifically, the division conversion unit 111 associates the guest address and the host address with each other for each guest code block 142 and adds them to the management table 161.
 ステップS105において、制御部117は、プログラムカウンタ112に対応するホストアドレスを管理テーブル161から取得する。 In step S105, the control unit 117 acquires the host address corresponding to the program counter 112 from the management table 161.
 ステップS110において、再変換部116は、再変換制御を行う。
 再変換制御(S110)については後述する。
In step S110, the reconversion unit 116 performs reconversion control.
The reconversion control (S110) will be described later.
 ステップS120において、コード実行部115は、プログラムカウンタ112に対応するホストコードブロック152を実行する。 In step S120, the code execution unit 115 executes the host code block 152 corresponding to the program counter 112.
 具体的には、コード実行部115は次のように動作する。
 まず、コード実行部115は、プログラムカウンタ112に対応するホストアドレスを管理テーブル161から取得する。
 次に、コード実行部115は、取得したホストアドレスに対応するホストコードブロック152をホストコード格納部150から読み込む。
 そして、コード実行部115は、読み込んだホストコードブロック152を実行する。
Specifically, the code execution unit 115 operates as follows.
First, the code execution unit 115 acquires a host address corresponding to the program counter 112 from the management table 161.
Next, the code execution unit 115 reads the host code block 152 corresponding to the acquired host address from the host code storage unit 150.
Then, the code execution unit 115 executes the read host code block 152.
 第2ステータス166が「再分割前」である場合、再分割前のホストコードブロック152が実行される。
 第2ステータス166が「再分割後」である場合、再分割後のホストコードブロック152が実行される。
When the second status 166 is “before subdivision”, the host code block 152 before subdivision is executed.
When the second status 166 is “after re-division”, the post-division host code block 152 is executed.
 イベント実行ルーチンが付加されている周期処理を実行する場合、コード実行部115は、次のように動作する。
 まず、コード実行部115は、時刻管理部114から現時刻(シミュレーション時刻)を取得する。
 次に、イベントキューに登録されているイベントのうち、現時刻よりもイベント発生時刻が早い各イベントの情報をイベント管理部130から取得する。
 そして、コード実行部115は、取得した情報に基づいて、現時刻よりもイベント発生時刻が早い各イベントを実行する。つまり、コード実行部115は、イベント発生時刻が過ぎているが実行されていない各イベントを実行する。
 実行される各イベントの情報はイベント管理部130によってイベントキューから削除される。さらに、後述するプレタイマ時刻がイベント管理部130によって更新される。イベント管理部130の動作については後述する。
When executing a periodic process to which an event execution routine is added, the code execution unit 115 operates as follows.
First, the code execution unit 115 acquires the current time (simulation time) from the time management unit 114.
Next, information on each event whose event occurrence time is earlier than the current time among the events registered in the event queue is acquired from the event management unit 130.
Then, the code execution unit 115 executes each event whose event occurrence time is earlier than the current time based on the acquired information. That is, the code execution unit 115 executes each event whose event occurrence time has passed but has not been executed.
Information about each event to be executed is deleted from the event queue by the event management unit 130. Furthermore, the pre-timer time described later is updated by the event management unit 130. The operation of the event management unit 130 will be described later.
 ステップS131において、制御部117は、シミュレーションが終了したか判定する。
 具体的には、制御部117は、プログラムカウンタ112がゲストコード141の最終アドレスを示すか判定する。プログラムカウンタ112がゲストコード141の最終アドレスを示す場合、シミュレーションが終了する。
 但し、制御部117は、シミュレーションが終了したか別の方法で判定してもよい。例えば、制御部117は、シミュレーション時刻が所定の終了時刻以後の時刻になっている場合にシミュレーションが終了したと判定してもよい。
 シミュレーションが終了した場合、シミュレーション方法の処理は終了する。
 シミュレーションが終了していない場合、処理はステップS101に進む。
In step S131, the control unit 117 determines whether the simulation is finished.
Specifically, the control unit 117 determines whether the program counter 112 indicates the final address of the guest code 141. When the program counter 112 indicates the final address of the guest code 141, the simulation ends.
However, the control unit 117 may determine whether the simulation is completed by another method. For example, the control unit 117 may determine that the simulation has ended when the simulation time is after a predetermined end time.
When the simulation is finished, the process of the simulation method is finished.
If the simulation has not ended, the process proceeds to step S101.
 図7に基づいて、再変換制御(S110)を説明する。
 ステップS111において、再変換部116は、現時刻(シミュレーション時刻)をプレタイマ時刻と比較する。
 具体的には、再変換部116は、時刻管理部114から現時刻を取得し、プレタイマ時刻をイベント管理部130から取得し、現時刻をプレタイマ時刻と比較する。
 プレタイマ時刻は、イベントキューに登録されている1つ以上のイベント発生時刻のうちの最も早いイベント発生時刻よりもオフセット時間162だけ早い時刻である。つまり、プレタイマ時刻は、未実行イベントの発生時刻のうちの最も早い発生時刻よりもオフセット時間162だけ早い時刻である。
 現時刻がプレタイマ時刻の後の時刻である場合、処理はステップS112に進む。
 現時刻がプレタイマ時刻以前の時刻である場合、処理はステップS116に進む。
 但し、イベントがイベントキューに登録されていない場合には、現時刻に関わらず、処理はステップS116に進む。
Based on FIG. 7, the reconversion control (S110) will be described.
In step S111, the reconversion unit 116 compares the current time (simulation time) with the pretimer time.
Specifically, the reconversion unit 116 acquires the current time from the time management unit 114, acquires the pretimer time from the event management unit 130, and compares the current time with the pretimer time.
The pre-timer time is a time that is earlier by the offset time 162 than the earliest event occurrence time among one or more event occurrence times registered in the event queue. That is, the pre-timer time is a time that is earlier than the earliest occurrence time among the occurrence times of unexecuted events by the offset time 162.
If the current time is a time after the pretimer time, the process proceeds to step S112.
If the current time is a time before the pre-timer time, the process proceeds to step S116.
However, if the event is not registered in the event queue, the process proceeds to step S116 regardless of the current time.
 ステップS112において、再変換部116は、第1ステータス165を参照し、再分割コードの有無を判定する。
 再分割コードが無い場合、処理はステップS1131に進む。
 再分割コードが有る場合、処理はステップS114に進む。
In step S112, the reconversion unit 116 refers to the first status 165 and determines the presence / absence of a subdivision code.
If there is no re-division code, the process proceeds to step S1131.
If there is a subdivision code, the process proceeds to step S114.
 ステップS1131において、再変換部116は、変換単位分のゲストコード141を1つ以上のゲストコードブロック142に再分割する。
 変換単位分のゲストコード141は、ステップS102(図4参照)で分割されたものと同じである。
 具体的には、再変換部116は、再分割単位163を各ゲストコードブロックの最大サイズとして、変換単位分のゲストコード141を1つ以上のゲストコードブロック142に分割する。変換単位164は、条件分岐命令と分岐先(ラベル)とのいずれもまたがないような単位である。
In step S1131, the re-conversion unit 116 re-divides the guest code 141 for the conversion unit into one or more guest code blocks 142.
The guest code 141 for the conversion unit is the same as that divided in step S102 (see FIG. 4).
Specifically, the reconversion unit 116 divides the guest code 141 for the conversion unit into one or more guest code blocks 142 with the repartition unit 163 as the maximum size of each guest code block. The conversion unit 164 is a unit in which neither a conditional branch instruction nor a branch destination (label) is present.
 ステップS1132において、再変換部116は、イベント実行ルーチンが付加された周期処理を再分割後の各ゲストコードブロック142に挿入し、各ゲストコードブロック142をホストコードブロック152に変換する。
 これにより、再分割後の1つ以上のゲストコードブロック142に対応する1つ以上のホストコードブロック152が得られる。
 イベント実行ルーチンは、イベントキューに登録されているイベントのうち、発生時刻が現時刻(シミュレーション時刻)以前の時刻である各イベントを実行するためのルーチンである。つまり、イベント実行ルーチンは、発生時刻が現時刻以前の時刻であるが実行されていない各イベントを実行するためのルーチンである。
In step S1132, the re-conversion unit 116 inserts the periodic process to which the event execution routine is added into each guest code block 142 after the re-division, and converts each guest code block 142 into the host code block 152.
Thereby, one or more host code blocks 152 corresponding to the one or more guest code blocks 142 after the re-division are obtained.
The event execution routine is a routine for executing each event having an occurrence time before the current time (simulation time) among events registered in the event queue. That is, the event execution routine is a routine for executing each event whose occurrence time is before the current time but is not executed.
 ステップS1133において、再変換部116は、管理テーブル161を更新する。
 具体的には、再変換部116は、管理テーブル161に設定されているアドレス組を再分割後のアドレス組に更新する。各アドレス組は、ゲストアドレスとホストアドレスとの組である。
In step S <b> 1133, the reconversion unit 116 updates the management table 161.
Specifically, the re-conversion unit 116 updates the address set set in the management table 161 to the address set after re-division. Each address set is a set of a guest address and a host address.
 ステップS1134において、再変換部116は、管理テーブル161の変更内容167を記憶する。また、再変換部116は、第1ステータス165に「分割コード有り」を設定し、第2ステータス166に「分割後」を設定する。
 ステップS1134の後、再分割制御(S110)は終了する。
In step S <b> 1134, the reconversion unit 116 stores the change content 167 of the management table 161. Further, the re-conversion unit 116 sets “division code present” to the first status 165 and sets “after division” to the second status 166.
After step S1134, the re-division control (S110) ends.
 図8に、ブロック再分割の一例を示す。
 図8において、変換単位分のゲストコード141は、第1ゲストコードブロックと第2ゲストコードブロックとに再分割されている。第1ゲストコードブロックと第2ゲストコードブロックとのそれぞれに周期処理が挿入されている。第1ゲストコードブロックと第2ゲストコードブロックとのそれぞれの周期処理にはイベント実行ルーチンが付加されている。第1ホストコードブロックは、イベント実行ルーチンが付加された周期処理を第1ゲストコードブロックに挿入して得られるブロックである。第2ホストコードブロックは、イベント実行ルーチンが付加された周期処理を第2ゲストコードブロックに挿入して得られるブロックである。
FIG. 8 shows an example of block subdivision.
In FIG. 8, the guest code 141 for the conversion unit is subdivided into a first guest code block and a second guest code block. Periodic processing is inserted into each of the first guest code block and the second guest code block. An event execution routine is added to each periodic process of the first guest code block and the second guest code block. The first host code block is a block obtained by inserting a periodic process with an event execution routine added to the first guest code block. The second host code block is a block obtained by inserting a periodic process with an event execution routine added to the second guest code block.
 図7に戻り、説明を続ける。
 次に、現時刻がプレタイマ時刻の後の時刻であり、且つ、第1ステータス165が「再分割コード有り」である場合について説明する。
 ステップS114において、再変換部116は、第2ステータス166を判定する。
 第2ステータス166が「再分割前」である場合、処理はステップS115に進む。
 第2ステータス166が「再分割後」である場合、再分割制御(S110)は終了する。
Returning to FIG. 7, the description will be continued.
Next, a case where the current time is a time after the pre-timer time and the first status 165 is “with re-division code” will be described.
In step S <b> 114, the reconversion unit 116 determines the second status 166.
If the second status 166 is “before subdivision”, the process proceeds to step S115.
When the second status 166 is “after subdivision”, the subdivision control (S110) ends.
 ステップS115において、再変換部116は、変更内容167を元に管理テーブル161を変更する。さらに、再変換部116は、第2ステータス166を「再分割前」から「再分割後」に変更する。
 ステップS115の後、再分割制御(S110)は終了する。
In step S <b> 115, the reconversion unit 116 changes the management table 161 based on the change content 167. Further, the re-conversion unit 116 changes the second status 166 from “before re-division” to “after re-division”.
After step S115, the subdivision control (S110) ends.
 次に、現時刻がプレタイマ時刻以前の時刻である場合について説明する。
 ステップS116において、再変換部116は、第2ステータス166を判定する。
 第2ステータス166が「再分割後」である場合、復元条件を満たし、処理はステップS117に進む。
 第2ステータス166が「再分割前」である場合、再分割制御(S110)は終了する。
Next, a case where the current time is a time before the pre-timer time will be described.
In step S <b> 116, the reconversion unit 116 determines the second status 166.
When the second status 166 is “after subdivision”, the restoration condition is satisfied, and the process proceeds to step S117.
When the second status 166 is “before re-division”, the re-division control (S110) ends.
 ステップS117において、再変換部116は、変更内容167を元に管理テーブル161を再分割前の状態に戻す。さらに、再変換部116は、第2ステータス166を「再分割後」から「再分割前」に変更する。
 ステップS117の後、再分割制御(S110)は終了する。
In step S117, the re-conversion unit 116 returns the management table 161 to the state before the re-division based on the change content 167. Furthermore, the re-conversion unit 116 changes the second status 166 from “after re-division” to “before re-division”.
After step S117, the re-division control (S110) ends.
 図9に基づいて、イベント登録処理を説明する。
 ステップS201において、デバイス模擬部120は、イベント発生時刻とコールバック関数への参照とをイベント管理部130に渡す。
 イベント管理部130は、イベント発生時刻とコールバック関数への参照とをデバイス模擬部120から受け取る。
The event registration process will be described based on FIG.
In step S <b> 201, the device simulation unit 120 passes the event occurrence time and the reference to the callback function to the event management unit 130.
The event management unit 130 receives the event occurrence time and the reference to the callback function from the device simulation unit 120.
 ステップS202において、イベント管理部130は、イベント発生時刻とコールバック関数への参照とをイベントキューに登録する。
 具体的には、イベント管理部130は、イベントキューの中で各イベント発生時刻が時刻の早い順に並ぶように、イベント発生時刻とコールバック関数への参照との組をイベントキューに挿入する。
In step S202, the event management unit 130 registers the event occurrence time and the reference to the callback function in the event queue.
Specifically, the event management unit 130 inserts a set of the event occurrence time and the reference to the callback function into the event queue so that the event occurrence times are arranged in the order from the earliest time in the event queue.
 ステップS203において、イベント管理部130は、プレタイマ時刻を更新する。
 具体的には、イベント管理部130は、イベントキューから最も早いイベント発生時刻を選択し、選択したイベント発生時刻よりもオフセット時間162前の時刻を算出する。そして、イベント管理部130は、算出した時刻でプレタイマ時刻を更新する。
In step S203, the event management unit 130 updates the pretimer time.
Specifically, the event management unit 130 selects the earliest event occurrence time from the event queue, and calculates a time that is an offset time 162 before the selected event occurrence time. Then, the event management unit 130 updates the pretimer time with the calculated time.
 図10に基づいて、イベント削除処理を説明する。
 ステップS211において、イベント管理部130は、実行されたイベントをイベントキューから削除する。
 具体的には、イベント管理部130は、実行されたイベントについて、イベント発生時刻とコールバック関数への参照との組をイベントキューから削除する。
Based on FIG. 10, the event deletion process will be described.
In step S211, the event management unit 130 deletes the executed event from the event queue.
Specifically, the event management unit 130 deletes a set of the event occurrence time and the reference to the callback function from the event queue for the executed event.
 ステップS212において、イベント管理部130は、プレタイマ時刻を更新する。
 更新方法は、ステップS203における方法と同じである(図9参照)。
In step S212, the event management unit 130 updates the pretimer time.
The update method is the same as the method in step S203 (see FIG. 9).
***実施の形態1の効果***
 まず、シミュレーション装置100と比較するシミュレータを対象シミュレータとして説明し、その後、シミュレーション装置100の効果を説明する。
 対象シミュレータでは、CPUの周辺デバイスの動作を模擬する必要がある場合がある。周辺デバイスの動作には大別して2種類ある。第1の動作は、CPUからリードアクセスまたはライトアクセスを受け付け、受け付けたアクセスに対して応答する動作である。第2の動作は、あるタイミングから特定の時間が経過したことを契機として、自発的に処理を行う動作である。例えば、自発的な処理として、一定周期毎にタイマーから割り込みを発生させる処理、通信機器において送信処理から一定時間が経過したら外部からの受信を検知する処理、または、アナログデジタル変換が開始された後に所定の時間が経過したときにアナログデジタル変換を終了させる処理などが挙げられる。このように時刻を契機として発生する自発的な処理を周辺デバイスのイベント処理と呼ぶ。
 このような周辺デバイスの動作を対象シミュレータで模擬する場合、第1の動作はISSの命令実行に含めて動作させることができると考えられる。しかし、第2の動作は周期処理の中で、その時点のシミュレーション時刻にマッチしたイベント処理を実行すると考えられる。
*** Effects of Embodiment 1 ***
First, a simulator to be compared with the simulation apparatus 100 will be described as a target simulator, and then the effects of the simulation apparatus 100 will be described.
In the target simulator, it may be necessary to simulate the operation of peripheral devices of the CPU. There are roughly two types of peripheral device operations. The first operation is an operation that accepts read access or write access from the CPU and responds to the accepted access. The second operation is an operation that performs processing spontaneously when a specific time has elapsed from a certain timing. For example, as a voluntary process, a process that generates an interrupt from a timer at regular intervals, a process that detects reception from the outside after a certain period of time has elapsed from a transmission process in a communication device, or after analog-digital conversion is started For example, a process of terminating the analog-digital conversion when a predetermined time has elapsed. Such spontaneous processing that occurs at the time is called event processing of peripheral devices.
When such an operation of the peripheral device is simulated by the target simulator, it is considered that the first operation can be included in the ISS instruction execution. However, the second operation is considered to execute event processing that matches the simulation time at that time in the periodic processing.
 対象シミュレータでは、ブロックの分割サイズが大きいと、周辺デバイスのイベント処理とISSの処理とのタイミングのずれが大きくなってしまう。
 図11に基づいて、周辺デバイスのイベント処理とISSの処理とのタイミングのずれについて説明する。
 図11において対象シミュレータの処理が上から下へ時間順に記しており、ISS処理(1)、周期処理(1)、ISS処理(2)および周期処理(2)が順に実行される。
 周期処理(1)では、周辺デバイスのイベント処理(1)が実行される。イベント処理(1)の発生時刻は、ISS処理(1)と同じ時間軸において図11に示すイベント(1)発生時刻である。しかし、一般的なソフトウェア開発用途の高速なシミュレータでは、ISS処理と周期処理とが並列に実行されず、ISS処理と周期処理とが図11に示すように順番に実行される。これは、並列動作がシミュレーション速度を全体的に大きく低下させてしまうためである。その結果、本来はイベント(1)発生時刻に処理されるべきイベント(1)処理が周期処理(1)で処理される、というずれが生じる。このずれは、図11に示す斜線部分のISS処理(すなわち命令実行)が、本来ならイベント(1)処理の後に実行されるはずが、イベント(1)処理の前に実行される、という処理の前後関係のずれを意味する。このずれを周辺デバイスのイベント処理とISSの処理とのタイミングのずれと呼ぶ。図11において、このずれを、イベント処理とISS処理とのタイミングのずれ(1)と記す。
 周辺デバイスのイベント処理とISSの処理とのタイミングのずれは、ブロックのサイズが大きくなるほど大きくなる。
In the target simulator, if the block division size is large, the timing difference between the event processing of the peripheral device and the ISS processing becomes large.
Based on FIG. 11, a timing shift between the event processing of the peripheral device and the ISS processing will be described.
In FIG. 11, the processing of the target simulator is described in time order from top to bottom, and ISS processing (1), periodic processing (1), ISS processing (2), and periodic processing (2) are executed in order.
In the periodic process (1), the event process (1) of the peripheral device is executed. The event process (1) occurrence time is the event (1) occurrence time shown in FIG. 11 on the same time axis as the ISS process (1). However, in a general high-speed simulator for software development, the ISS process and the periodic process are not executed in parallel, and the ISS process and the periodic process are executed in order as shown in FIG. This is because parallel operation greatly reduces the overall simulation speed. As a result, there arises a deviation that the event (1) processing that should be processed at the time of occurrence of the event (1) is processed by the periodic processing (1). This shift is due to the fact that the ISS process (that is, instruction execution) in the shaded area shown in FIG. 11 should be executed after the event (1) process, but is executed before the event (1) process. It means a difference in context. This shift is called a timing shift between the event processing of the peripheral device and the ISS processing. In FIG. 11, this deviation is referred to as a timing deviation (1) between the event process and the ISS process.
The difference in timing between the event processing of the peripheral device and the ISS processing increases as the block size increases.
 また、対象シミュレータでは、周辺デバイスのイベント処理が実行されるタイミング付近でブロックを小さく分割する手段が無い。そのため、全ブロックを小さく分割しなければ、周辺デバイスのイベント処理とISSの処理とのタイミングのずれを小さくすることができない。しかし、全ブロックを小さく分割するとブロックの数が増え、実行される周期処理の数も増える。そのため、全体のシミュレーション速度が低下してしまう。 Also, in the target simulator, there is no means to divide the block into smaller parts near the timing when the event processing of the peripheral device is executed. For this reason, unless all the blocks are divided into small pieces, the timing shift between the event processing of the peripheral device and the ISS processing cannot be reduced. However, dividing all blocks into smaller blocks increases the number of blocks and the number of periodic processes to be executed. Therefore, the entire simulation speed is reduced.
 シミュレーション装置100では、オフセット時間とイベント発生時刻とに基づいてゲストコードが再分割される。そのため、イベントが発生する前後のコードを細かく再分割することができ、周辺デバイスのイベント処理とISSの処理とのタイミングのずれを小さくすることができる。さらに、イベントが発生する前後のコードに絞って再分割が行われるため、再分割による処理速度の低下を軽減することができる。
 また、シミュレーション装置100では、オフセット時間とイベント発生時刻とに基づいて再分割前の状態が復元されるため、一度再分割が行われた後でも次のイベントがしばらく発生しない状態になれば再分割前の状態が復元される(図7のステップS117を参照)。そのため、再分割による処理速度の低下が一時的なものとなり、処理速度の低下を軽減することができる。
 また、シミュレーション装置100では、再分割単位を変更可能にすることで、シミュレーションの状況に応じて必要以上に分割が細かくなることを抑制することができる。これにより、処理速度の低下が軽減される。
 また、シミュレーション装置100では、再分割と共にイベント実行ルーチンの有無を切り替えることができる。そのため、イベントの実行が必要ない状態ではイベント実行ルーチンを省略することができ、実行速度を速くすることができる。
In the simulation apparatus 100, the guest code is subdivided based on the offset time and the event occurrence time. Therefore, the code before and after the occurrence of the event can be subdivided finely, and the timing deviation between the event processing of the peripheral device and the ISS processing can be reduced. Furthermore, since re-division is performed only on the code before and after the occurrence of the event, a reduction in processing speed due to re-division can be reduced.
Further, in the simulation apparatus 100, since the state before the re-division is restored based on the offset time and the event occurrence time, the re-division is performed if the next event does not occur for a while even after the re-division is performed once. The previous state is restored (see step S117 in FIG. 7). For this reason, a decrease in processing speed due to re-division becomes temporary, and the decrease in processing speed can be reduced.
Moreover, in the simulation apparatus 100, by making the subdivision unit changeable, it is possible to prevent the division from becoming finer than necessary depending on the simulation situation. As a result, a decrease in processing speed is reduced.
In the simulation apparatus 100, the presence / absence of the event execution routine can be switched together with the re-division. Therefore, the event execution routine can be omitted in a state where no event execution is necessary, and the execution speed can be increased.
***他の構成***
 実施の形態1において、時間および時刻はサイクル数を用いて表してもよい。
*** Other configurations ***
In Embodiment 1, time and time may be expressed using the number of cycles.
***実施の形態の補足***
 図12に基づいて、シミュレーション装置100のハードウェア構成を説明する。
 シミュレーション装置100は処理回路109を備える。
 処理回路109は、シミュレーション部110とデバイス模擬部120とイベント管理部130とを実現するハードウェアである。
 処理回路109は、専用のハードウェアであってもよいし、メモリ102に格納されるプログラムを実行するプロセッサ101であってもよい。
*** Supplement to the embodiment ***
Based on FIG. 12, the hardware configuration of the simulation apparatus 100 will be described.
The simulation apparatus 100 includes a processing circuit 109.
The processing circuit 109 is hardware that implements the simulation unit 110, the device simulation unit 120, and the event management unit 130.
The processing circuit 109 may be dedicated hardware or 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の略称である。
 シミュレーション装置100は、処理回路109を代替する複数の処理回路を備えてもよい。複数の処理回路は、処理回路109の役割を分担する。
When the processing circuit 109 is dedicated hardware, the processing circuit 109 is, for example, a single circuit, a composite circuit, a programmed processor, a parallel programmed processor, an ASIC, an FPGA, or a combination thereof.
ASIC is an abbreviation for Application Specific Integrated Circuit, and FPGA is an abbreviation for Field Programmable Gate Array.
The simulation apparatus 100 may include a plurality of processing circuits that replace the processing circuit 109. The plurality of processing circuits share the role of the processing circuit 109.
 処理回路109において、一部の機能が専用のハードウェアで実現されて、残りの機能がソフトウェアまたはファームウェアで実現されてもよい。 In the processing circuit 109, some functions may be realized by dedicated hardware, and the remaining functions may be realized by software or firmware.
 このように、処理回路109はハードウェア、ソフトウェア、ファームウェアまたはこれらの組み合わせで実現することができる。 Thus, the processing circuit 109 can be realized by hardware, software, firmware, or a combination thereof.
 実施の形態は、好ましい形態の例示であり、本発明の技術的範囲を制限することを意図するものではない。実施の形態は、部分的に実施してもよいし、他の形態と組み合わせて実施してもよい。フローチャート等を用いて説明した手順は、適宜に変更してもよい。 The embodiment is an example of a preferred embodiment and is not intended to limit the technical scope of the present invention. The embodiment may be implemented partially or in combination with other embodiments. The procedure described using the flowchart and the like may be changed as appropriate.
 100 シミュレーション装置、101 プロセッサ、102 メモリ、103 補助記憶装置、104 入力装置、105 ディスプレイ、109 処理回路、110 シミュレーション部、111 分割変換部、112 プログラムカウンタ、113 割込み受付部、114 時刻管理部、115 コード実行部、116 再変換部、117 制御部、120 デバイス模擬部、130 イベント管理部、140 ゲストコード格納部、141 ゲストコード、142 ゲストコードブロック、150 ホストコード格納部、152 ホストコードブロック、160 記憶部、161 管理テーブル、162 オフセット時間、163 再分割単位、164 変換単位、165 第1ステータス、166 第2ステータス、167 変更内容、168 プレタイマ時刻。 100 simulation device, 101 processor, 102 memory, 103 auxiliary storage device, 104 input device, 105 display, 109 processing circuit, 110 simulation unit, 111 division conversion unit, 112 program counter, 113 interrupt reception unit, 114 time management unit, 115 Code execution unit, 116 re-conversion unit, 117 control unit, 120 device simulation unit, 130 event management unit, 140 guest code storage unit, 141 guest code, 142 guest code block, 150 host code storage unit, 152 host code block, 160 Storage unit, 161 management table, 162 offset time, 163 subdivision unit, 164 conversion unit, 165 first status, 166 second status, 167 change The contents, 168 Puretaima time.

Claims (5)

  1.  変換単位のゲストコードを1つ以上のゲストコードブロックに分割し、各ゲストコードブロックをホストコードブロックに変換する分割変換部と、
     周辺デバイスのイベント処理の発生時刻と、オフセット時間とに基づいて、前記変換単位のゲストコードを再分割単位以下の1つ以上のゲストコードブロックに再分割し、再分割後の各ゲストコードブロックをホストコードブロックに変換する再変換部と、
     前記分割変換部によって得られたホストコードブロックと前記再変換部によって得られたホストコードブロックとのいずれかを実行するコード実行部と
    を備えるシミュレーション装置。
    A division conversion unit that divides the guest code of the conversion unit into one or more guest code blocks, and converts each guest code block into a host code block;
    Based on the event processing occurrence time of the peripheral device and the offset time, the guest code of the conversion unit is subdivided into one or more guest code blocks below the subdivision unit, and each guest code block after the subdivision is A re-converter that converts to host code blocks;
    A simulation apparatus comprising: a code execution unit that executes either a host code block obtained by the division conversion unit or a host code block obtained by the reconversion unit.
  2.  前記コード実行部は、シミュレーション時刻が未実行イベントの発生時刻のうちの最も早い発生時刻よりも前記オフセット時間だけ早いプレタイマ時刻の後の時刻である場合に前記再変換部によって得られたホストコードブロックを実行する
    請求項1に記載のシミュレーション装置。
    The code execution unit is a host code block obtained by the reconversion unit when the simulation time is a time after the pre-timer time that is earlier than the earliest occurrence time of occurrence times of unexecuted events by the offset time. The simulation apparatus according to claim 1, wherein:
  3.  前記再変換部は、前記再分割単位を最大サイズとして、前記変換単位のゲストコードを再分割する
    請求項1または請求項2に記載のシミュレーション装置。
    The simulation apparatus according to claim 1, wherein the re-conversion unit re-divides the guest code of the conversion unit with the re-division unit as a maximum size.
  4.  前記分割変換部は、前記イベント処理を実行するためのイベント実行ルーチンが付加されない周期処理をゲストコードブロックに挿入し、前記イベント実行ルーチンが付加されない前記周期処理が挿入されたゲストコードブロックをホストコードブロックに変換し、
     前記再変換部は、前記イベント実行ルーチンが付加された周期処理をゲストコードブロックに挿入し、前記イベント実行ルーチンが付加された前記周期処理が挿入されたゲストコードブロックをホストコードブロックに変換する
    請求項1から請求項3のいずれか1項に記載のシミュレーション装置。
    The division conversion unit inserts a periodic process to which an event execution routine for executing the event process is not added into a guest code block, and the guest code block into which the periodic process to which the event execution routine is not added is inserted as a host code Convert to block,
    The reconversion unit inserts a periodic process to which the event execution routine is added into a guest code block, and converts the guest code block into which the periodic process to which the event execution routine is added is converted into a host code block. The simulation apparatus according to any one of claims 1 to 3.
  5.  変換単位のゲストコードを1つ以上のゲストコードブロックに分割し、各ゲストコードブロックをホストコードブロックに変換する分割変換処理と、
     周辺デバイスのイベント処理の発生時刻と、オフセット時間とに基づいて、前記変換単位のゲストコードを再分割単位以下の1つ以上のゲストコードブロックに再分割し、再分割後の各ゲストコードブロックをホストコードブロックに変換する再変換処理と、
     前記分割変換処理によって得られたホストコードブロックと前記再変換処理によって得られたホストコードブロックとのいずれかを実行するコード実行処理と
    をコンピュータに実行させるためのシミュレーションプログラム。
    A division conversion process for dividing a guest code of a conversion unit into one or more guest code blocks, and converting each guest code block into a host code block;
    Based on the event processing occurrence time of the peripheral device and the offset time, the guest code of the conversion unit is subdivided into one or more guest code blocks below the subdivision unit, and each guest code block after the subdivision is Re-conversion process to convert to host code block;
    A simulation program for causing a computer to execute a code execution process for executing any one of a host code block obtained by the division conversion process and a host code block obtained by the reconversion process.
PCT/JP2018/015580 2018-04-13 2018-04-13 Simulation device and simulation program WO2019198235A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/JP2018/015580 WO2019198235A1 (en) 2018-04-13 2018-04-13 Simulation device and simulation program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2018/015580 WO2019198235A1 (en) 2018-04-13 2018-04-13 Simulation device and simulation program

Publications (1)

Publication Number Publication Date
WO2019198235A1 true WO2019198235A1 (en) 2019-10-17

Family

ID=68164175

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2018/015580 WO2019198235A1 (en) 2018-04-13 2018-04-13 Simulation device and simulation program

Country Status (1)

Country Link
WO (1) WO2019198235A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09282199A (en) * 1996-04-12 1997-10-31 Oki Electric Ind Co Ltd Simulation system
JPH1031595A (en) * 1996-07-15 1998-02-03 Nec Corp Simulator and its simulating method
JP2010033354A (en) * 2008-07-29 2010-02-12 Gaio Technology Co Ltd Microcontroller simulator, its simulation method, program, and computer readable medium
JP2015133083A (en) * 2014-01-15 2015-07-23 キヤノン株式会社 Information processing device, control method therefor, program, and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09282199A (en) * 1996-04-12 1997-10-31 Oki Electric Ind Co Ltd Simulation system
JPH1031595A (en) * 1996-07-15 1998-02-03 Nec Corp Simulator and its simulating method
JP2010033354A (en) * 2008-07-29 2010-02-12 Gaio Technology Co Ltd Microcontroller simulator, its simulation method, program, and computer readable medium
JP2015133083A (en) * 2014-01-15 2015-07-23 キヤノン株式会社 Information processing device, control method therefor, program, and storage medium

Similar Documents

Publication Publication Date Title
US9619233B2 (en) Computer processor providing exception handling with reduced state storage
US8495344B2 (en) Simultaneous execution resumption of multiple processor cores after core state information dump to facilitate debugging via multi-core processor simulator using the state information
US10095542B2 (en) Cooperative thread array granularity context switch during trap handling
JP6234639B2 (en) Simulation apparatus, simulation method, and simulation program
JPH0810437B2 (en) Guest execution control method for virtual machine system
WO2019198235A1 (en) Simulation device and simulation program
AU2017438670B2 (en) Simulation device, simulation method, and simulation program
US5963725A (en) Simulation system and method for microcomputer program
US7793150B1 (en) System, method, and computer program product for saving an unprocessed portion of a push buffer in response to an error
US11099846B2 (en) Apparatus and method for resynchronization prediction with variable upgrade and downgrade capability
US20210096858A1 (en) Mutli-modal gather operation
JP6548848B2 (en) INFORMATION PROCESSING APPARATUS, INFORMATION PROCESSING METHOD, AND INFORMATION PROCESSING PROGRAM
US9983879B2 (en) Operation of a multi-slice processor implementing dynamic switching of instruction issuance order
JP6918267B2 (en) Bottleneck detection device and bottleneck detection program
US11080122B2 (en) Software-invisible interrupt for a microprocessor
JP2007018440A (en) Architecture verification apparatus
JP2016024614A (en) Data processor
WO2018163387A1 (en) Analysis device, analysis method, and analysis program
KR20170065845A (en) Processor and controlling method thereof
US20210157588A1 (en) Dedicated vector sub-processor system
SU849218A1 (en) Device for debugging programs
TW201743149A (en) Simulation device and simulation program
JP2008071251A (en) Electronic circuit simulation device and program for electronic circuit simulation
JPH02291027A (en) Interruption control system
JP2014021563A (en) Information processor and information processing method

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: 18914002

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18914002

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: JP