JP5440083B2 - Simulation apparatus, method and program - Google Patents

Simulation apparatus, method and program Download PDF

Info

Publication number
JP5440083B2
JP5440083B2 JP2009233682A JP2009233682A JP5440083B2 JP 5440083 B2 JP5440083 B2 JP 5440083B2 JP 2009233682 A JP2009233682 A JP 2009233682A JP 2009233682 A JP2009233682 A JP 2009233682A JP 5440083 B2 JP5440083 B2 JP 5440083B2
Authority
JP
Japan
Prior art keywords
simulation
instruction
unit
latency
units
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2009233682A
Other languages
Japanese (ja)
Other versions
JP2011081623A (en
Inventor
晶人 片岡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2009233682A priority Critical patent/JP5440083B2/en
Publication of JP2011081623A publication Critical patent/JP2011081623A/en
Application granted granted Critical
Publication of JP5440083B2 publication Critical patent/JP5440083B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Description

本発明は、プロセッサを備えるシステムのシミュレーション装置、方法およびプログラムに関する。   The present invention relates to a simulation apparatus, method, and program for a system including a processor.

CPUやDSPなどのプロセッサは、複雑な内部構成を備える。プロセッサおよびプロセッサを備えるシステムは、ハードウエアの詳細な設計前の段階において、実際のアプリケーションに近いソフトウエアを動作させることにより、システム全体での性能評価を行い、性能を確認することが求められている。そのため、設計前段階の実際のハードウエアが存在していない段階で、ハードウエアを忠実に再現したシミュレーションが行われる。   A processor such as a CPU or DSP has a complicated internal configuration. Processors and systems equipped with processors are required to evaluate the performance of the entire system and confirm the performance by operating software close to the actual application before the detailed design of the hardware. Yes. Therefore, a simulation that faithfully reproduces the hardware is performed at the stage where the actual hardware at the pre-design stage does not exist.

図1は、プロセッサ(プロセッサコア)を備えるシステムの基本構成を示す図であり、(A)がシステムの構成を、(B)がプロセッサコアの内部構成を示す。   FIG. 1 is a diagram showing a basic configuration of a system including a processor (processor core), where (A) shows the configuration of the system and (B) shows the internal configuration of the processor core.

図1の(A)に示すように、システムは、プロセッサコア1と、バス2と、高速メモリ3と、低速メモリ4と、DMAC5と、アクセラレータ6と、外部I/F7と、外部HW(ハードウエア)シュード8と、を備える。プロセッサコア1、高速メモリ3、低速メモリ4、DMAC5およびアクセラレータ6は、バス2を介して相互に接続される。外部HWシュード8は、外部I/Fおよびバス2を介して他の要素に接続される。図1の(A)に示した例は、システムの基本構成であり、複数のプロセッサコアを備えるなど各種の変形例があり得るのは言うまでもない。   As shown in FIG. 1A, the system includes a processor core 1, a bus 2, a high speed memory 3, a low speed memory 4, a DMAC 5, an accelerator 6, an external I / F 7, an external HW (hardware). Wear) pseudo 8. The processor core 1, the high speed memory 3, the low speed memory 4, the DMAC 5, and the accelerator 6 are connected to each other via the bus 2. The external HW pseudo 8 is connected to other elements via the external I / F and the bus 2. The example shown in FIG. 1A is a basic configuration of the system, and it goes without saying that there can be various modifications such as including a plurality of processor cores.

図1の(B)に示すように、プロセッサコア1は、命令キャッシュ11と、命令フェッチ部12と、命令デコード部13と、命令実行部14と、データキャッシュ15と、を備える。命令キャッシュ11は、バス2から入力される命令を格納する。データキャッシュ15は、バス2から入力されるデータを格納すると共に、バス2に出力するデータを格納する。命令フェッチ部12は、命令キャッシュ11から実行順に命令を読み出して命令デコード部13に出力する。命令デコード部13は、命令をデコードして、命令実行部14に出力する。命令実行部14は、デコードされた命令を実行する。命令実行部14は、命令を実行する時に必要なデータをデータキャッシュ15から読み出すと共に、命令の実行の結果得られたデータをデータキャッシュ15に格納する。命令キャッシュ11に格納されている命令を、データキャッシュ15に格納されているデータを使用して実行する場合には、命令は所定のサイクルで実行可能である。これに対して、命令キャッシュ11に格納されていない命令を実行する場合には、バス2を介して命令キャッシュ11に命令を読み込む必要がある。この場合、バスの使用権などの関係で、状況により命令キャッシュ11への命令の入力に要する時間が一定ではない。また、命令を実行するために必要なデータがデータキャッシュ15に格納されていない場合、バス2を介してデータキャッシュ15にデータを読み込む必要がある。この場合も、バスの使用権などの関係で、状況によりデータキャッシュ15への命令の入力に要する時間が一定ではない。命令をフェッチしてから実行を開始するまでの時間(サイクル数)をレイテンシと呼ぶ。従って、命令キャッシュ11に格納されていない命令を実行する場合および命令を実行するために必要なデータがデータキャッシュ15に格納されていない場合は、レイテンシは一定ではない。また、実行する命令が命令キャッシュ11に記憶されていない場合および命令を実行するために必要なデータがデータキャッシュ15に記憶されていない場合を、キャッシュミスと呼ぶ。キャッシュミスが発生した場合には、キャッシュのハードウェアにより、命令キャッシュ11またはデータキャッシュ15に命令またはデータをロードする。以上の構成は広く知られているので、これ以上の説明は省略する。なお、図1の(B)に示した例は、プロセッサコアの基本構成であり、各種の変形例があり得るのは言うまでもない。   As shown in FIG. 1B, the processor core 1 includes an instruction cache 11, an instruction fetch unit 12, an instruction decoding unit 13, an instruction execution unit 14, and a data cache 15. The instruction cache 11 stores instructions input from the bus 2. The data cache 15 stores data input from the bus 2 and stores data output to the bus 2. The instruction fetch unit 12 reads instructions from the instruction cache 11 in the order of execution and outputs them to the instruction decoding unit 13. The instruction decoding unit 13 decodes the instruction and outputs it to the instruction execution unit 14. The instruction execution unit 14 executes the decoded instruction. The instruction execution unit 14 reads data necessary for executing the instruction from the data cache 15 and stores data obtained as a result of executing the instruction in the data cache 15. When an instruction stored in the instruction cache 11 is executed using data stored in the data cache 15, the instruction can be executed in a predetermined cycle. On the other hand, when executing an instruction not stored in the instruction cache 11, it is necessary to read the instruction into the instruction cache 11 via the bus 2. In this case, the time required to input an instruction to the instruction cache 11 is not constant depending on the situation due to the right to use the bus. Further, when data necessary for executing an instruction is not stored in the data cache 15, it is necessary to read the data into the data cache 15 via the bus 2. Also in this case, the time required to input an instruction to the data cache 15 is not constant depending on the situation due to the right to use the bus. The time (number of cycles) from fetching an instruction to starting execution is called latency. Accordingly, when executing an instruction not stored in the instruction cache 11 and when data required for executing the instruction is not stored in the data cache 15, the latency is not constant. A case where an instruction to be executed is not stored in the instruction cache 11 and a case where data necessary for executing the instruction is not stored in the data cache 15 are referred to as a cache miss. When a cache miss occurs, an instruction or data is loaded into the instruction cache 11 or the data cache 15 by the cache hardware. Since the above configuration is widely known, further description is omitted. Note that the example shown in FIG. 1B is a basic configuration of the processor core, and it goes without saying that various modifications can be made.

シミュレーション装置は、コンピュータにおいてソフトウエアにより実現される。図2は、広く知られているコンピュータのハードウエア構成を示す図である。図2に示すように、コンピュータは、CPU81と、メモリ82と、記憶装置83と、表示装置84と、入力装置85と、外部メモリであるディスク装置87を駆動するドライブ装置86と、バス88と、を備える。コンピュータについての説明は省略する。   The simulation apparatus is realized by software in a computer. FIG. 2 is a diagram showing a hardware configuration of a widely known computer. As shown in FIG. 2, the computer includes a CPU 81, a memory 82, a storage device 83, a display device 84, an input device 85, a drive device 86 that drives a disk device 87 that is an external memory, and a bus 88. . A description of the computer is omitted.

性能評価を行うシミュレーション装置としては、プロセッサの命令単位での動作に着目してシミュレーションを行う命令レベルシミュレーション装置と、プロセッサのサイクル単位での動作に着目してシミュレーションを行う論理レベルシミュレーション装置と、が広く使用される。   As a simulation apparatus that performs performance evaluation, there are an instruction level simulation apparatus that performs simulation while paying attention to the operation of each processor in units of instructions, and a logic level simulation apparatus that performs simulation while paying attention to the operation of each cycle of processors. Widely used.

図3は、命令レベルシミュレーション装置によるシミュレーションを説明する図である。図3に示すように、命令レベルシミュレーションでは、1命令ごとに解釈および実行を行い、命令実行に要する時間を積み上げていくことにより、性能評価対象であるシステムで命令列を実行した場合のプロセッサの処理時間を算出する。図3に示す例では、通常命令はパイプライン動作で1サイクルに1命令ずつ処理されるため、1命令につき1サイクル分の時間をプロセッサ処理時間として積み上げていく。キャッシュミスなどを発生したロード命令の場合は、内部レイテンシに、所定の値であると仮定したメインメモリアクセス時間を加えた時間をプロセッサの処理時間に積み上げていく。   FIG. 3 is a diagram for explaining the simulation by the instruction level simulation apparatus. As shown in FIG. 3, in the instruction level simulation, interpretation and execution are performed for each instruction, and the time required for executing the instruction is accumulated, so that the processor in the case where the instruction sequence is executed in the system that is a performance evaluation target. Calculate the processing time. In the example shown in FIG. 3, since normal instructions are processed one instruction per cycle in a pipeline operation, the time for one cycle per instruction is accumulated as the processor processing time. In the case of a load instruction in which a cache miss or the like occurs, a time obtained by adding a main memory access time assumed to be a predetermined value to the internal latency is accumulated in the processing time of the processor.

図3に示した命令レベルシミュレーションは、命令単位でプロセッサの動作をシミュレーションするため、シミュレーションを高速に行える。しかし、プロセッサ内部のハードウエア構成を忠実に再現していないため、動作中のプロセッサの内部状態を再現することはできない。そのため、性能評価対象であるプロセッサが、ノンブロッキングキャッシュや分岐予測器などの複雑な機構を備えている場合、命令レベルシミュレーションではこれらの機構の動作を表現することができない。そのため、命令レベルシミュレーションでは、プロセッサの性能を正確に評価することはできない。図3の例では、メインメモリアクセスに要する時間は一定ではない。   Since the instruction level simulation shown in FIG. 3 simulates the operation of the processor in units of instructions, the simulation can be performed at high speed. However, since the hardware configuration inside the processor is not faithfully reproduced, the internal state of the operating processor cannot be reproduced. Therefore, when the processor that is the target of performance evaluation has complicated mechanisms such as a non-blocking cache and a branch predictor, the operation of these mechanisms cannot be expressed by the instruction level simulation. Therefore, the instruction level simulation cannot accurately evaluate the performance of the processor. In the example of FIG. 3, the time required for main memory access is not constant.

一方で,ハードウェアの検証に用いられる、論理レベルシミュレーション装置を性能評価に用いることができる。   On the other hand, a logic level simulation apparatus used for hardware verification can be used for performance evaluation.

図4は、論理レベルシミュレーション装置によるシミュレーションを説明する図である。図4に示すように、論理レベルシミュレーションでは、1サイクルずつプロセッサの動作をシミュレーションし、性能評価対象のプロセッサの命令列の実行を終了した時に、何サイクルのシミュレーションを行ったかに基づいて、プロセッサの処理時間を算出する。例えば、図2に示すように、命令2はメインメモリアクセスを伴うが、実際のメインメモリアクセスを再現して処理に要する時間を忠実に再現する。命令5で、命令2が発生したメインメモリ(外部メモリ)アクセスによる書き込みデータを使用する場合、メインメモリアクセスによるデータの書き込みが完了するまで待機し、その待機に要した時間(サイクル数)も計算される。   FIG. 4 is a diagram for explaining the simulation by the logic level simulation apparatus. As shown in FIG. 4, in the logic level simulation, the operation of the processor is simulated one cycle at a time, and when the execution of the instruction sequence of the performance evaluation target processor is completed, the processor simulation is performed based on the number of cycles of the simulation. Calculate the processing time. For example, as shown in FIG. 2, instruction 2 accompanies main memory access, but reproduces the actual main memory access and faithfully reproduces the time required for processing. When using the write data by accessing the main memory (external memory) where the instruction 2 is generated in the instruction 5, the process waits until the data writing by the main memory access is completed, and calculates the time (number of cycles) required for the wait. Is done.

論理レベルシミュレーションは、プロセッサ内部のハードウエアを忠実に再現しているため、プロセッサの内部状態を正確に再現することができる。このため、性能評価対象のプロセッサが、複雑な機構を備えている場合であっても、プロセッサが備える性能を正確に評価することができる。   Since the logic level simulation faithfully reproduces the hardware inside the processor, the internal state of the processor can be accurately reproduced. For this reason, even if the performance evaluation target processor has a complicated mechanism, the performance of the processor can be accurately evaluated.

しかし、論理レベルシミュレーションでは、プロセッサ内部での各命令の各サイクルの処理を忠実にシミュレーションする必要があり、命令レベルシミュレーションと比較して、シミュレーションに必要な計算量が多くなる。従って、論理レベルシミュレーションは、命令レベルシミュレーションと比較して、低速であり、シミュレーション時間が長くなる。   However, in the logic level simulation, it is necessary to faithfully simulate the processing of each cycle of each instruction in the processor, and the amount of calculation required for the simulation is increased as compared with the instruction level simulation. Therefore, the logic level simulation is slower than the instruction level simulation, and the simulation time is longer.

以上説明したように、性能評価を行うシミュレーションでは、精度と速度のトレードオフが存在し、高い精度で性能評価を行う場合シミュレーションが低速となり、シミュレーションを高速化するには精度を低下させなければならない。   As explained above, there is a trade-off between accuracy and speed in simulations that perform performance evaluation. When performing performance evaluation with high accuracy, the simulation becomes slow, and the accuracy must be lowered to speed up the simulation. .

特開平1−067645号公報Japanese Patent Laid-Open No. 1-067645 特開平8−110919号公報JP-A-8-110919 特開2001−273340号公報JP 2001-273340 A

実施形態は、精度を維持しながら、高速化を図ったシミュレーション装置および方法を記載する。   Embodiments describe a simulation apparatus and method that achieves high speed while maintaining accuracy.

実施形態の第1の態様は、プロセッサを備えるシステムのシミュレーション装置であって、命令単位でのシミュレーションによってレイテンシ算出可能な動作について、命令単位でのシミュレーションを実行する命令レベルシミュレーション部と、命令単位でのシミュレーションによってレイテンシ算出不可能な動作について、システムのハードウエアを再現したサイクル単位でのシミュレーションを実行する論理レベルシミュレーション部と、シミュレーションで使用する資源が使用可能になる時刻情報を格納する資源管理表を備える資源管理部と、を備える。命令レベルシミュレーション部は、命令単位でのシミュレーションによってレイテンシ算出不可能な動作の場合に、論理レベルシミュレーション部にサイクル単位でのシミュレーションの実行を要求する。これに応じて、論理レベルシミュレーション部は、要求されたサイクル単位でのシミュレーションの結果に基づいて、シミュレーションで使用する資源が使用可能になる時刻情報を、資源管理部に通知する。これに応じて、資源管理部は、シミュレーションで使用する資源が使用可能になる時刻情報を格納する。   A first aspect of an embodiment is a simulation apparatus of a system including a processor, and an instruction level simulation unit that executes simulation in units of instructions for an operation capable of calculating latency by simulation in units of instructions, and in units of instructions A logic level simulation unit that performs simulation in cycle units that reproduces system hardware for operations whose latency cannot be calculated by simulation, and a resource management table that stores time information when resources used in the simulation can be used And a resource management unit. The instruction level simulation unit requests the logic level simulation unit to execute the simulation in the cycle unit when the latency cannot be calculated by the instruction unit simulation. In response to this, the logic level simulation unit notifies the resource management unit of time information at which the resources used in the simulation can be used, based on the requested simulation results in cycle units. In response to this, the resource management unit stores time information at which resources used in the simulation can be used.

また、実施形態の第2の態様は、プロセッサを備えるシステムのシミュレーション方法であって、命令単位でのシミュレーションによってレイテンシ算出可能な動作について、命令単位でのシミュレーションを実行し、命令単位でのシミュレーションによってレイテンシ算出不可能な動作の場合に、システムのハードウエアを再現したサイクル単位でのシミュレーションを実行し、サイクル単位でのシミュレーションの結果に基づいて、レイテンシ算出不可能な動作のレイテンシが関係する資源が使用可能になる時刻情報を格納する。   A second aspect of the embodiment is a method for simulating a system including a processor, and performs an instruction-by-instruction simulation for an operation whose latency can be calculated by an instruction-by-instruction simulation. In the case of an operation where latency cannot be calculated, a simulation is performed for each cycle that reproduces the system hardware. Based on the result of the simulation for each cycle, the resources related to the latency of operations for which latency cannot be calculated are Stores available time information.

実施形態によれば、プロセッサを備えるシステムのシミュレーションが、精度を維持しながら、高速に行える。   According to the embodiment, a system including a processor can be simulated at high speed while maintaining accuracy.

図1は、シミュレーションの対象であるプロセッサを備えるシステムの構成およびプロセッサの構成を示す図である。FIG. 1 is a diagram illustrating a configuration of a system including a processor to be simulated and a configuration of the processor. 図2は、シミュレーション装置が実現される、一般的なコンピュータのハードウエア構成を示す図である。FIG. 2 is a diagram illustrating a hardware configuration of a general computer in which the simulation apparatus is realized. 図3は、一般的な命令レベルシミュレーションの動作を説明する図である。FIG. 3 is a diagram for explaining a general instruction level simulation operation. 図4は、一般的な論理レベルシミュレーションの動作を説明する図である。FIG. 4 is a diagram for explaining the operation of a general logic level simulation. 図5は、第1実施形態におけるシミュレーション装置の構成を示す図である。FIG. 5 is a diagram illustrating a configuration of the simulation apparatus according to the first embodiment. 図6は、第1実施形態における命令レベルシミュレーション部の動作を説明する図である。FIG. 6 is a diagram for explaining the operation of the instruction level simulation unit in the first embodiment. 図7は、第1実施形態における論理レベルシミュレーション部の動作を説明する図である。FIG. 7 is a diagram for explaining the operation of the logic level simulation unit in the first embodiment. 図8は、第1実施形態における資源管理部の構成を示す図である。FIG. 8 is a diagram illustrating a configuration of the resource management unit in the first embodiment. 図9は、第1実施形態におけるシミュレーション動作を示すブロック図である。FIG. 9 is a block diagram showing a simulation operation in the first embodiment. 図10は、第1実施形態における動作を示すフローチャートである。FIG. 10 is a flowchart showing the operation in the first embodiment. 図11は、第1実施形態におけるシミュレーション動作例のタイムチャートである。FIG. 11 is a time chart of a simulation operation example in the first embodiment. 図12は、第1実施形態におけるシミュレーション動作を行った場合の、資源管理部の資源管理表内の値の変化を示す図である。FIG. 12 is a diagram illustrating changes in values in the resource management table of the resource management unit when the simulation operation in the first embodiment is performed. 図13は、第1実施形態におけるシミュレーション動作を行った場合の、資源管理部の資源管理表内の値の変化を示す図である。FIG. 13 is a diagram illustrating changes in values in the resource management table of the resource management unit when the simulation operation in the first embodiment is performed. 図14は、第1実施形態におけるシミュレーション動作を行った場合の、資源管理部の資源管理表内の値の変化を示す図である。FIG. 14 is a diagram illustrating changes in values in the resource management table of the resource management unit when the simulation operation in the first embodiment is performed. 図15は、第1実施形態におけるシミュレーション動作を行った場合の、資源管理部の資源管理表内の値の変化を示す図である。FIG. 15 is a diagram illustrating changes in values in the resource management table of the resource management unit when the simulation operation in the first embodiment is performed. 図16は、第1実施形態におけるシミュレーション動作を行った場合の、資源管理部の資源管理表内の値の変化を示す図である。FIG. 16 is a diagram illustrating changes in values in the resource management table of the resource management unit when the simulation operation in the first embodiment is performed. 図17は、第1実施形態におけるシミュレーション動作を行った場合の、資源管理部の資源管理表内の値の変化を示す図である。FIG. 17 is a diagram illustrating changes in values in the resource management table of the resource management unit when the simulation operation in the first embodiment is performed. 図18は、第1実施形態におけるシミュレーション動作を行った場合の、資源管理部の資源管理表内の値の変化を示す図である。FIG. 18 is a diagram illustrating changes in values in the resource management table of the resource management unit when the simulation operation in the first embodiment is performed. 図19は、第2実施形態におけるシミュレーション動作を示すブロック図である。FIG. 19 is a block diagram showing a simulation operation in the second embodiment. 図20は、第2実施形態におけるシミュレーション動作例のタイムチャートである。FIG. 20 is a time chart of a simulation operation example in the second embodiment.

第1実施形態のシミュレーション装置(シミュレータ)は、図2に示したようなハードウエア構成を備えるコンピュータ上でソフトウエアにより実現され、図1に示したようなプロセッサを備えるシステムをシミュレーションする。   The simulation apparatus (simulator) of the first embodiment is realized by software on a computer having a hardware configuration as shown in FIG. 2, and simulates a system having a processor as shown in FIG.

図5は、第1実施形態のシミュレーション装置(シミュレータ)の機能ブロック図である。図5に示すように、シミュレーション装置は、命令レベルシミュレーション部21と、論理レベルシミュレーション部22と、資源管理部23と、制御部(スケジューラ)24と、を備える。   FIG. 5 is a functional block diagram of the simulation apparatus (simulator) of the first embodiment. As shown in FIG. 5, the simulation apparatus includes an instruction level simulation unit 21, a logic level simulation unit 22, a resource management unit 23, and a control unit (scheduler) 24.

命令レベルシミュレーション部21は、命令単位でのシミュレーションによってレイテンシ算出可能な動作について、命令単位でのシミュレーションを実行する。論理レベルシミュレーション部22は、命令単位でのシミュレーションによってレイテンシ算出不可能な動作について、システムのハードウエアを再現したサイクル単位でのシミュレーションを実行する。資源管理部23は、シミュレーションで使用するプロセッサ内のレジスタ、演算器、ポートなどの資源が使用可能になる時刻情報を格納する。また、資源管理部23は、シミュレーションを行う一連の命令に関する情報を格納している。スジューラ24は、命令レベルシミュレーション部21および論理レベルシミュレーション部22への開始要求および待ち合わせの解除を制御する。   The instruction level simulation unit 21 performs a simulation in units of instructions for an operation that can calculate latency by a simulation in units of instructions. The logic level simulation unit 22 executes a cycle unit simulation that reproduces the system hardware for an operation in which the latency cannot be calculated by the instruction unit simulation. The resource management unit 23 stores time information at which resources such as registers, arithmetic units, and ports in the processor used in the simulation can be used. Further, the resource management unit 23 stores information related to a series of instructions for performing a simulation. The scheduler 24 controls the start request to the instruction level simulation unit 21 and the logic level simulation unit 22 and release of waiting.

命令レベルシミュレーション部21は、命令単位でのシミュレーションによってレイテンシ算出不可能な動作の場合に、論理レベルシミュレーション部22にサイクル単位でのシミュレーションの実行を要求すると共に、シミュレーションで使用する資源が使用可能になる時刻が不明であることを資源管理部23に通知する。   The instruction level simulation unit 21 requests the logic level simulation unit 22 to execute a simulation in cycle units and can use resources used in the simulation when the operation cannot perform latency calculation by simulation in units of instructions. The resource management unit 23 is notified that the time to be unknown is unknown.

論理レベルシミュレーション部22は、要求されたサイクル単位でのシミュレーションを実行し、その結果に基づいて、シミュレーションで使用する資源が使用可能になる時刻情報を資源管理部23に通知する。論理レベルシミュレーション部22は、要求されたサイクル単位でのシミュレーションの実行が終了すると、未処理の要求が残留しているか判定し、残留している場合には要求されたサイクル単位でのシミュレーションを実行し、残留いない場合には動作を停止する。   The logic level simulation unit 22 executes the simulation in the requested cycle unit, and notifies the resource management unit 23 of time information at which the resources used in the simulation can be used based on the result. When the execution of the simulation in the requested cycle unit is completed, the logic level simulation unit 22 determines whether or not an unprocessed request remains, and if it remains, executes the simulation in the requested cycle unit. If it does not remain, the operation is stopped.

資源管理部23は、シミュレーションで実行する命令に関する情報を格納すると共に、シミュレーションで使用する資源が使用可能になる時刻情報を格納する。なお、命令レベルシミュレーション部21は、命令単位でのシミュレーションによってレイテンシ算出不可能な動作の後のレイテンシ算出不可能な動作のレイテンシを必要とする後続命令を検出するまで、命令単位でのシミュレーションを継続する。そして、命令レベルシミュレーション部21は、レイテンシ算出不可能な動作のレイテンシを必要とする後続命令を検出した時点で命令単位でのシミュレーションを停止する。資源管理部23が、後続命令の必要とする資源が使用可能になる時刻情報を更新すると、命令レベルシミュレーション部21は、命令単位でのシミュレーションを再開し、更新された時刻情報を利用して命令単位でのシミュレーションを続行する。   The resource management unit 23 stores information related to instructions executed in the simulation, and stores time information at which resources used in the simulation can be used. Note that the instruction level simulation unit 21 continues the simulation for each instruction until it detects a subsequent instruction that requires the latency for the operation that cannot calculate the latency after the operation that cannot calculate the latency by the simulation for each instruction. To do. Then, the instruction level simulation unit 21 stops the simulation in units of instructions when a subsequent instruction that requires a latency of an operation that cannot calculate the latency is detected. When the resource management unit 23 updates the time information when the resource required by the subsequent instruction becomes available, the instruction level simulation unit 21 resumes the simulation in units of instructions and uses the updated time information to execute the instruction. Continue simulation in units.

スケジューラ24は、命令レベルシミュレーション部21が使用する資源が使用不可能で待ち合わせをしている場合に、論理レベルシミュレーション部22から資源が使用可能になる時刻が通知されると、命令レベルシミュレーション部21の待ち合わせを解除する。また、スケジューラ24は、命令レベルシミュレーション部21が論理レベルシミュレーション部22にシミュレーション要求を行った場合に、要求を待ち合わせている論理レベルシミュレーション部22の待ち合わせを解除する。   When the resource used by the instruction level simulation unit 21 is unavailable and waiting, the scheduler 24 is notified of the time when the resource becomes available from the logic level simulation unit 22. Release the wait for. Further, when the instruction level simulation unit 21 makes a simulation request to the logic level simulation unit 22, the scheduler 24 cancels the waiting of the logic level simulation unit 22 waiting for the request.

図6は、命令レベルシミュレーション部21の動作を説明する図であり、時刻aで、資源管理部23の資源Bを使用し、結果を資源Aに格納する処理Aをシミュレーションする例を示す。ここで、資源管理部23は、シミュレーションで実行する処理の命令を格納する命令格納部23Aと、資源に関する情報を格納する資源情報格納部23Bと、を備える。   FIG. 6 is a diagram for explaining the operation of the instruction level simulation unit 21 and shows an example of simulating the process A in which the resource B of the resource management unit 23 is used and the result is stored in the resource A at time a. Here, the resource management unit 23 includes an instruction storage unit 23A that stores instructions for processing to be executed in the simulation, and a resource information storage unit 23B that stores information about resources.

スケジューラ24からのシミュレーション開始要求に応じて、命令レベルシミュレーション部21は、資源管理部23の命令格納部23Aに格納された時刻aでの処理Aを選択する。命令レベルシミュレーション部21は、資源管理部23の資源情報格納部23Bに格納された資源Bの情報から処理Aが処理可能であるか判定する。処理可能と判定した場合には、資源Bを使用して処理Aを実行し、処理Aの種別条件からレイテンシを算出し、結果であるレイテンシを資源管理部23の資源情報格納部23Bの資源Aに格納する。実行する処理の種類、条件などに応じて、論理レベルシミュレーションが必要ならば、論理レベルシミュレーション部22に論理レベルシミュレーションを要求する。命令レベルシミュレーション部21は、図3で説明した一般的な方法で実現できる。   In response to the simulation start request from the scheduler 24, the instruction level simulation unit 21 selects the process A at time a stored in the instruction storage unit 23A of the resource management unit 23. The instruction level simulation unit 21 determines whether the process A can be processed from the information of the resource B stored in the resource information storage unit 23B of the resource management unit 23. If it is determined that the processing is possible, the processing A is executed using the resource B, the latency is calculated from the type condition of the processing A, and the resulting latency is determined as the resource A in the resource information storage unit 23B of the resource management unit 23. To store. If logic level simulation is necessary according to the type of process to be executed, conditions, etc., the logic level simulation unit 22 is requested to perform logic level simulation. The instruction level simulation unit 21 can be realized by the general method described with reference to FIG.

命令レベルシミュレーション部21は、指示された処理Aが命令キャッシュ11に存在しない場合や、使用する資源Bが使用不可能の場合、処理不可能と判定してシミュレーションを停止して待機する。   When the instructed process A does not exist in the instruction cache 11 or when the resource B to be used is not usable, the instruction level simulation unit 21 determines that the process is not possible and stops the simulation and waits.

図7は、論理レベルシミュレーション部22の動作を説明する図である。論理レベルシミュレーション部22は、命令レベルシミュレーション部21からの要求(処理リクエスト)に応じて、プロセッサのハードウエア内部のステートマシン、パイプライン、キュー構造などを忠実に再現してシミュレーションを行う。論理レベルシミュレーション部22は、処理に要する時間を、資源管理部23に通知する。資源管理部23は、処理のレイテンシに、論理レベルシミュレーション部22が算出した処理時間を加えて、資源が使用可能になる時刻を算出する。論理レベルシミュレーション部22は、図4で説明した一般的な方法で実現できる。   FIG. 7 is a diagram for explaining the operation of the logic level simulation unit 22. In response to a request (processing request) from the instruction level simulation unit 21, the logic level simulation unit 22 faithfully reproduces a state machine, a pipeline, a queue structure, and the like inside the processor hardware and performs a simulation. The logic level simulation unit 22 notifies the resource management unit 23 of the time required for processing. The resource management unit 23 adds the processing time calculated by the logic level simulation unit 22 to the processing latency to calculate the time when the resource can be used. The logic level simulation unit 22 can be realized by the general method described with reference to FIG.

図8は、資源管理部23の構成を示す図である。図8に示すように、資源管理部23は、資源管理表と、命令実行時刻計算部33と、を備える。資源管理表は、第1資源管理表31と、第2資源管理表32と、に分けられる。第1資源管理表31は、エントリ番号、命令種類、使用資源1、使用資源2、使用資源3、および使用可能時刻(レイテンシ)を対応づけて格納する。第2資源管理表32は、第1資源管理表31の資源ごとに、使用可能時刻を格納する。命令実行時刻計算部33は、第1資源管理表31の命令に対応した使用可能時刻、第2資源管理表32の使用する資源の使用可能時刻から、命令実行時刻を算出して出力する。ここでは、命令実行時刻計算部33は、関係する複数の使用可能時刻の最大値を選択して出力する。資源管理部23は、キュー構造(FIFO)を備え、エントリを順番に処理するパイプラインレジスタを実現する。   FIG. 8 is a diagram illustrating a configuration of the resource management unit 23. As shown in FIG. 8, the resource management unit 23 includes a resource management table and an instruction execution time calculation unit 33. The resource management table is divided into a first resource management table 31 and a second resource management table 32. The first resource management table 31 stores entry numbers, instruction types, used resources 1, used resources 2, used resources 3, and usable time (latency) in association with each other. The second resource management table 32 stores an available time for each resource of the first resource management table 31. The instruction execution time calculator 33 calculates and outputs the instruction execution time from the available time corresponding to the instruction in the first resource management table 31 and the available time of the resource used in the second resource management table 32. Here, the instruction execution time calculator 33 selects and outputs the maximum value of a plurality of related available times. The resource management unit 23 has a queue structure (FIFO) and realizes a pipeline register that processes entries in order.

図9は、第1実施形態における動作を説明するブロック図である。図9では、命令レベルシミュレーション部21は、命令実行動作をシミュレーションする命令実行シミュレーション部21Aと、キャッシュに対するアクセス動作をシミュレーションするキャッシュシミュレーション部(命令単位)21Bと、に分けて示される。同様に、論理レベルシミュレーション部22は、キャッシュに対するアクセス動作をシミュレーションするキャッシュシミュレーション部(サイクル単位)22Aと、バスおよびメモリなどへのアクセスをシミュレーションするバス・メモリ等シミュレーション部22Bと、に分けて示される。   FIG. 9 is a block diagram for explaining the operation in the first embodiment. In FIG. 9, the instruction level simulation unit 21 is divided into an instruction execution simulation unit 21A that simulates an instruction execution operation and a cache simulation unit (instruction unit) 21B that simulates an access operation to the cache. Similarly, the logic level simulation unit 22 is divided into a cache simulation unit (cycle unit) 22A that simulates an access operation to a cache, and a bus / memory simulation unit 22B that simulates access to a bus and a memory. It is.

スケジューラ(乗り移り制御)24は、命令実行シミュレーション部21Aに、命令単位で、シミュレーション開始要求を出力する。これに応じて、命令実行シミュレーション部21Aは、資源管理部23から、実行可能な命令を得て命令レベルシミュレーション動作を開始し、内部でシミュレーション可能であればシミュレーションを行い、結果を資源管理部23に格納する。また、命令実行シミュレーション部21Aは、命令の実行のためにキャッシュアクセスが必要であれば、キャッシュシミュレーション部(命令単位)21Bに、キャッシュアクセスを要求する。キャッシュシミュレーション部(命令単位)21Bは、キャッシュアクセスを受け付け、キャッシュアクセスのシミュレーションを行う。キャッシュヒット(キャッシュに命令またはデータがある)であれば、キャッシュシミュレーション部(命令単位)21Bは、資源管理部23にシミュレーション結果を通知する。キャッシュミス(キャッシュに命令またはデータがない)であれば、キャッシュシミュレーション部(命令単位)21Bは、キャッシュシミュレーション部(サイクル単位)22Aに、サイクル単位のシミュレーション処理を要求する。それと共に、キャッシュシミュレーション部(命令単位)21Bは、資源管理部23に、キャッシュアクセスした結果として資源の使用可能時刻が不明であることを通知する。   The scheduler (transfer control) 24 outputs a simulation start request to the instruction execution simulation unit 21A in units of instructions. In response to this, the instruction execution simulation unit 21A obtains an executable instruction from the resource management unit 23 and starts an instruction level simulation operation. If internal simulation is possible, the instruction execution simulation unit 21A performs a simulation and outputs the result to the resource management unit 23. To store. Further, the instruction execution simulation unit 21A requests a cache access from the cache simulation unit (instruction unit) 21B if cache access is necessary for execution of an instruction. The cache simulation unit (instruction unit) 21B receives a cache access and performs a cache access simulation. If there is a cache hit (there is an instruction or data in the cache), the cache simulation unit (instruction unit) 21B notifies the resource management unit 23 of the simulation result. If there is a cache miss (there is no instruction or data in the cache), the cache simulation unit (instruction unit) 21B requests a cycle-by-cycle simulation process from the cache simulation unit (cycle unit) 22A. At the same time, the cache simulation unit (instruction unit) 21B notifies the resource management unit 23 that the available time of the resource is unknown as a result of the cache access.

キャッシュシミュレーション部(サイクル単位)22Aは、キャッシュシミュレーション部(命令単位)21Bからのシミュレーション要求を受け付け、キャッシュリプレース動作(外部メモリからキャッシュへのデータ転送)のシミュレーションを行い、バス・メモリ等シミュレーション部22Bにアクセス要求を出す。   The cache simulation unit (cycle unit) 22A accepts a simulation request from the cache simulation unit (instruction unit) 21B, performs a cache replacement operation (data transfer from an external memory to the cache), and performs a bus / memory simulation unit 22B. An access request is issued.

バス・メモリ等シミュレーション部22Bは、キャッシュシミュレーション部(サイクル単位)22Aとの間で信号線を再現したインターフェースで接続され、キャッシュシミュレーション部(サイクル単位)22Aからのメモリアクセス要求を受付、適切なレイテンシを再現して、その結果をキャッシュシミュレーション部(サイクル単位)22Aに返す。キャッシュシミュレーション部(サイクル単位)22Aは、この結果を、資源管理部23に通知する。   The bus / memory simulation unit 22B is connected to the cache simulation unit (cycle unit) 22A through an interface that reproduces a signal line, receives a memory access request from the cache simulation unit (cycle unit) 22A, and has an appropriate latency. And the result is returned to the cache simulation unit (cycle unit) 22A. The cache simulation unit (cycle unit) 22A notifies the resource management unit 23 of this result.

資源管理部23は、命令実行シミュレーション部21A、キャッシュシミュレーション部(命令単位)21Bおよびキャッシュシミュレーション部(サイクル単位)22Aから通知される結果を受付、内部の資源管理表に格納する。   The resource management unit 23 receives the results notified from the instruction execution simulation unit 21A, the cache simulation unit (instruction unit) 21B, and the cache simulation unit (cycle unit) 22A, and stores them in the internal resource management table.

図10は、第1実施形態における動作を示すフローチャートであり、左側が命令レベルシミュレーション部21の動作を、右側が論理レベルシミュレーション部22の動作を示す。   FIG. 10 is a flowchart showing the operation in the first embodiment. The left side shows the operation of the instruction level simulation unit 21, and the right side shows the operation of the logic level simulation unit 22.

命令レベルシミュレーション200では、ステップ201で、命令レベルシミュレーション部21が、スケジューラ24からシミュレーション開始要求を受け、それに応じて資源管理部23から処理すべき命令を得る。   In the instruction level simulation 200, in step 201, the instruction level simulation unit 21 receives a simulation start request from the scheduler 24, and obtains an instruction to be processed from the resource management unit 23 accordingly.

ステップ202では、命令レベルシミュレーション部21が、得られた命令が使用する資源について、資源管理部23に問い合わせ、資源が使用可能になるまで待ち合わせる。なお、アウトオブオーダーの命令発行機構を備えるプロセッサを正確にシミュレーションする場合は、命令レベルシミュレーション部21が、資源が使用可能である命令を、資源管理部23から受けるようにする。資源が使用可能な命令が存在していなければ、資源管理部23が待ち合わせるようにして、ステップ201と202を同時に行うようにしてもよい。   In step 202, the instruction level simulation unit 21 inquires the resource management unit 23 about the resource used by the obtained instruction, and waits until the resource becomes available. In the case of accurately simulating a processor having an out-of-order instruction issue mechanism, the instruction level simulation unit 21 receives instructions from the resource management unit 23 that resources can be used. If there is no instruction that can use the resource, the resource management unit 23 may wait and perform steps 201 and 202 simultaneously.

ステップ202では、命令レベルシミュレーション部21は、シミュレーションする命令が使用する資源がその時点で使用不可能であれば待ち合わせるが、使用可能であれば処理を継続する。   In step 202, the instruction level simulation unit 21 waits if the resource used by the instruction to be simulated is not available at that time, but continues the process if the resource is available.

ステップ203では、命令レベルシミュレーション部21が、命令を解釈してキャッシュアクセスを含めて命令実行をシミュレーションする。   In step 203, the instruction level simulation unit 21 interprets the instruction and simulates instruction execution including cache access.

ステップ204では、命令レベルシミュレーション部21が、シミュレーション対象命令が、固定値のレイテンシを持つ演算命令であった場合やキャッシュヒットするロード命令であった場合など、レイテンシ算出が可能であるか判定する。可能であれば、命令レベルシミュレーション部21の制御は、ステップ205に進む。キャッシュミスが発生するロード命令など、レイテンシ算出が不可能である場合には、命令レベルシミュレーション部21の制御はステップ206に進む。   In step 204, the instruction level simulation unit 21 determines whether latency calculation is possible, for example, when the simulation target instruction is an operation instruction having a fixed value latency or a load instruction causing a cache hit. If possible, the control of the instruction level simulation unit 21 proceeds to Step 205. If the latency calculation is impossible, such as a load instruction that causes a cache miss, the control of the instruction level simulation unit 21 proceeds to step 206.

ステップ205では、命令レベルシミュレーション部21が、シミュレーション対象命令の結果に関係する資源が使用可能になる時刻を算出し、ステップ208に進む。   In step 205, the instruction level simulation unit 21 calculates a time at which resources related to the result of the simulation target instruction can be used, and proceeds to step 208.

ステップ206では、命令レベルシミュレーション部21が、論理レベルシミュレーショ部22にレイテンシ算出が不可能である命令のシミュレーションを要求する。この時、命令レベルシミュレーション部21は、論理レベルシミュレーショ部22でのシミュレーションに必要な情報を一緒に通知する。シミュレーション要求の通知方法は、論理レベルシミュレーショ部22に直接通知する方法、スケジューラ24を介して行う方法、資源管理部23の資源管理表のプロセッサ内部資源のエントリを使用する方法などがある。これにより、シミュレーションの一部が論理レベルシミュレーション300に乗り移るが、命令レベルシミュレーションはそのまま続行し、ステップ207に進む。   In step 206, the instruction level simulation unit 21 requests the logic level simulation unit 22 to simulate an instruction whose latency cannot be calculated. At this time, the instruction level simulation unit 21 notifies information necessary for the simulation in the logic level simulation unit 22 together. The simulation request notification method includes a method of directly reporting to the logic level simulation unit 22, a method performed via the scheduler 24, and a method of using an entry of processor internal resources in the resource management table of the resource management unit 23. As a result, a part of the simulation is transferred to the logic level simulation 300, but the instruction level simulation is continued as it is, and the process proceeds to Step 207.

ステップ207では、命令レベルシミュレーション部21が、シミュレーション対象命令の結果に関係する資源が使用可能になる時刻を不明に設定し、ステップ208に進む。   In step 207, the instruction level simulation unit 21 sets the time when the resource related to the result of the simulation target instruction can be used as unknown, and proceeds to step 208.

ステップ208では、資源管理部23の資源管理表の書き込み先エントリ(その命令の結果格納先)に、その資源が使用可能になる時刻を格納する。したがって、ステップ205からステップ208に進む場合には、資源が使用可能になる時刻が格納され、ステップ207からステップ208に進む場合には、資源が使用可能になる時刻は不明になる。   In step 208, the time at which the resource becomes usable is stored in the write destination entry (the result storage location of the command) of the resource management table of the resource management unit 23. Therefore, when the process proceeds from step 205 to step 208, the time when the resource becomes available is stored, and when the process proceeds from step 207 to step 208, the time when the resource becomes available is unknown.

ステップ208の後ステップ201に戻り、以上のステップを繰り返す。   After step 208, the process returns to step 201 and the above steps are repeated.

論理レベルシミュレーション300では、ステップ301で、論理レベルシミュレーション部22が、命令レベルシミュレーション部21からのシミュレーション要求が残留しているかチェックする。シミュレーション要求があれば、論理レベルシミュレーション部22は、命令レベルシミュレーション部21からのシミュレーション要求を待つ。シミュレーション要求がある場合には、論理レベルシミュレーション部22の制御は、ステップ302に進む。   In the logic level simulation 300, in step 301, the logic level simulation unit 22 checks whether a simulation request from the instruction level simulation unit 21 remains. If there is a simulation request, the logic level simulation unit 22 waits for a simulation request from the instruction level simulation unit 21. If there is a simulation request, the control of the logic level simulation unit 22 proceeds to step 302.

ステップ302では、論理レベルシミュレーション部22が、1サイクル分のサイクル単位シミュレーションを行い、ステップ303に進む。   In step 302, the logic level simulation unit 22 performs cycle unit simulation for one cycle, and proceeds to step 303.

ステップ303では、論理レベルシミュレーション部22が、要求されたシミュレーション処理が完了したかを判定し、完了していなければステップ301に戻り、完了していればステップ304に進む。完了していない場合、ステップ301を経てステップ302が繰り返し行われることになり、要求されたシミュレーション処理が完了する。   In step 303, the logic level simulation unit 22 determines whether the requested simulation process is completed. If not completed, the process returns to step 301. If completed, the process proceeds to step 304. If not completed, step 302 is repeated through step 301, and the requested simulation process is completed.

ステップ304では、論理レベルシミュレーション部22が、シミュレーションの結果得られたシミュレーション対象命令の結果に関係する資源が使用可能になる時刻を、資源管理部23の資源管理表の書き込み先エントリ(その命令の結果格納先)に、格納し、ステップ301に進む。以下、シミュレーション要求が残留していればステップ301から304を繰り返し、残留していなければステップ301で待ち合わせる。   In step 304, the logic level simulation unit 22 sets the time at which the resource related to the result of the simulation target instruction obtained as a result of the simulation becomes usable, as the write destination entry (the instruction of the instruction) of the resource management unit 23. The result is stored in (result storage location), and the process proceeds to step 301. Thereafter, if the simulation request remains, steps 301 to 304 are repeated, and if not, the process waits at step 301.

資源管理表への時刻書き込みにより、シミュレーションの一部が再び論理レベルシミュレーション300から命令レベルシミュレーション200に乗り移る。これにより、ステップ202で命令レベルシミュレーション部21の制御が待ち合わせている場合には、待ち合わせが解消して制御が進むことになる。   By writing the time in the resource management table, a part of the simulation is transferred from the logic level simulation 300 to the instruction level simulation 200 again. Thereby, when the control of the instruction level simulation unit 21 is waiting in step 202, the waiting is canceled and the control proceeds.

上記の動作において、資源管理部23は、命令レベルシミュレーション部21からの資源要求アクセスがあった場合は、命令レベルシミュレーション部21が要求する資源の使用可能時刻に基づいて、その時点で資源が使用可能であるかを判定し、判定結果を返す。資源管理部23は、命令レベルシミュレーション部21からの結果格納アクセスがあった場合は、通知された結果を格納して資源管理表を更新する。同様に、資源管理部23は、論理レベルシミュレーション部22からの結果格納アクセスがあった場合は、通知された結果を格納して資源管理表を更新する。資源管理部23は、資源管理表を更新した場合には、そのことをスケジューラ24に通知する。   In the above operation, when there is a resource request access from the instruction level simulation unit 21, the resource management unit 23 uses the resource at that time based on the available time of the resource requested by the instruction level simulation unit 21. Determine whether it is possible and return the result. When there is a result storage access from the instruction level simulation unit 21, the resource management unit 23 stores the notified result and updates the resource management table. Similarly, when there is a result storage access from the logic level simulation unit 22, the resource management unit 23 stores the notified result and updates the resource management table. If the resource management unit 23 has updated the resource management table, the resource management unit 23 notifies the scheduler 24 accordingly.

スケジューラ24は、命令レベルシミュレーション部21が使用不可能であるために待ち合わせている資源について、論理レベルシミュレーション部22から使用可能になる時刻が通知された場合に、命令レベルシミュレーション部21の待ち合わせを解除する。さらに、スケジューラ24は、命令レベルシミュレーション部21が論理レベルシミュレーション部22にシミュレーション要求を行った場合に、論理レベルシミュレーション部22の待ち合わせを解除する。   The scheduler 24 cancels the waiting of the instruction level simulation unit 21 when the logic level simulation unit 22 is notified of the time when the resource that is waiting because the instruction level simulation unit 21 is unavailable cannot be used. To do. Furthermore, the scheduler 24 cancels the waiting of the logic level simulation unit 22 when the instruction level simulation unit 21 makes a simulation request to the logic level simulation unit 22.

図11は、第1実施形態におけるシミュレーション動作例のタイムチャートであり、(A)は比較のため一般的な論理レベルシミュレーションを行った場合を示し、(B)は第1実施形態のシミュレーションを行った場合を、示す。図11において、IFは命令フェッチを、IDは命令デコードを、EXは命令実行を、DCはデータキャッシュアクセスを、WBは書き戻し(Write Back)を、memはメモリアクセスを、waitは資源が使用可能になるまでの待ち合わせ(結果待ち合わせ)を、示す。   FIG. 11 is a time chart of a simulation operation example in the first embodiment. FIG. 11A illustrates a case where a general logic level simulation is performed for comparison, and FIG. 11B illustrates a simulation according to the first embodiment. The case is shown. In FIG. 11, IF is instruction fetch, ID is instruction decode, EX is instruction execution, DC is data cache access, WB is write back, mem is memory access, and wait is resource use. Waiting until it becomes possible (waiting for results) is shown.

図11の(A)に示すように、各命令はパイプライン処理される。例えば、各命令は、IF、ID、EX、DC、WBが連続して5サイクルで行われる。サイクル0で、パイプラインのIFが命令1のフェッチを行う。サイクル2で、パイプラインのIFが命令2のフェッチを行い、IDが命令1のデコードを行う。サイクル2では、パイプラインのIFが命令3のフェッチを行い、IDが命令2のデコードを行い、EXが命令1を実行する。サイクル3では、パイプラインのIFが命令4のフェッチを行い、IDが命令3のデコードを行い、EXが命令2を実行し、DCが命令1のデータキャッシュアクセスを行う。サイクル4では、パイプラインのIFが命令5のフェッチを行い、IDが命令4のデコードを行い、EXが命令3を実行し、DCが命令2のデータキャッシュアクセスを行い、WBが命令1の書き戻しを行う。   As shown in FIG. 11A, each instruction is pipeline processed. For example, for each instruction, IF, ID, EX, DC, and WB are continuously executed in five cycles. At cycle 0, the pipeline IF fetches instruction 1. In cycle 2, the pipeline IF fetches instruction 2 and the ID decodes instruction 1. In cycle 2, the pipeline IF fetches instruction 3, ID decodes instruction 2, and EX executes instruction 1. In cycle 3, pipeline IF fetches instruction 4, ID decodes instruction 3, EX executes instruction 2, and DC performs instruction 1 data cache access. In cycle 4, the pipeline IF fetches instruction 5, ID decodes instruction 4, EX executes instruction 3, DC performs data cache access of instruction 2, and WB writes instruction 1. Perform the return.

ここで、命令2はメモリアクセスを伴うロード命令であり、命令5は命令2の結果を利用する。そこで、サイクル5では、パイプラインのIDが命令5のデコードを行い、EXが命令4を実行し、DCが命令3のデータキャッシュアクセスを行うが、命令2についてはメモリアクセスmemが行われる。さらに、サイクル6では、パイプラインのDCが命令4のデータキャッシュアクセスを行い、WBが命令3の結果の書き戻しを行う。しかし、命令2についてはメモリアクセスmemの状態が継続され、命令2の結果を必要とする命令5も実行できないので待機状態になる。さらに、サイクル7では、パイプラインのWBが命令4の結果の書き戻しを行うが、命令2についてはメモリアクセスmemの状態が命令5については待機状態が続く。この状態が、命令2のメモリアクセスが完了してメモリからデータが得られるサイクル34まで続く。そして、サイクル35で、パイプラインのWBが命令2のメモリアクセスの結果を書き戻し、EXがその結果を利用して命令5を実行する。以下、サイクル36で、パイプラインのDCが命令5のデータキャッシュアクセスを行い、サイクル37で、パイプラインのWBが命令5の結果の書き戻しを行う。   Here, instruction 2 is a load instruction with memory access, and instruction 5 uses the result of instruction 2. Therefore, in cycle 5, the pipeline ID decodes instruction 5, EX executes instruction 4, and DC performs data cache access of instruction 3, but for instruction 2, memory access mem is performed. Further, in cycle 6, the pipeline DC performs data cache access of instruction 4, and WB writes back the result of instruction 3. However, for the instruction 2, the state of the memory access mem is continued, and the instruction 5 that requires the result of the instruction 2 cannot be executed, so that the instruction 2 enters a standby state. Further, in cycle 7, the pipeline WB writes back the result of the instruction 4, but the instruction 2 has a memory access mem state and the instruction 5 has a standby state. This state continues until cycle 34 when the memory access of instruction 2 is completed and data is obtained from the memory. Then, in cycle 35, the pipeline WB writes back the result of the memory access of the instruction 2, and the EX executes the instruction 5 using the result. Thereafter, in cycle 36, the pipeline DC performs data cache access of instruction 5, and in cycle 37, the pipeline WB writes back the result of instruction 5.

ここで、IF、ID、mem、waitなどの1サイクルの動作を1単位とする。図11の(A)に示すように、メインメモリアクセスに30サイクルを要する場合、待機時間なども含めるため、図11の(A)での処理量は107単位になる。これまでの一般的な論理レベルシミュレーションでは、これらの単位動作をシミュレーションするため、計算量は107単位分となる。   Here, one cycle of operations such as IF, ID, mem, and wait is defined as one unit. As shown in FIG. 11A, when 30 cycles are required for main memory access, the processing time in FIG. In conventional general logic level simulations, since these unit operations are simulated, the amount of calculation is 107 units.

また、一般的な命令レベルシミュレーションによれば、フェッチ、デコード実行、書き戻しについて所定のレイテンシを使用し、メモリアクセス以外のインタロックを考慮し、メモリアクセス時間を所定値、例えば30サイクルと仮定して処理時間を算出する。メモリアクセス時間は、状況により異なるので、正確な処理時間は算出できない。   Further, according to a general instruction level simulation, a predetermined latency is used for fetch, decode execution, and write-back, and an interlock other than memory access is considered, and a memory access time is assumed to be a predetermined value, for example, 30 cycles. To calculate the processing time. Since the memory access time varies depending on the situation, an accurate processing time cannot be calculated.

次に、第1実施形態におけるシミュレーション動作について、図11の(B)を参照して、図9と関連付けて説明する。サイクル0で、スケジューラ24が命令実行シミュレーション部21Aにシミュレーションの開始を要求する。命令実行シミュレーション部21Aは、要求を受け付けると、サイクル0に資源管理部23を介して得られた命令1を実行し、その結果に4サイクルのレイテンシを付けて資源管理部23に格納する。   Next, the simulation operation in the first embodiment will be described with reference to FIG. In cycle 0, the scheduler 24 requests the instruction execution simulation unit 21A to start simulation. When the instruction execution simulation unit 21A receives the request, the instruction execution simulation unit 21A executes the instruction 1 obtained through the resource management unit 23 in cycle 0, adds the latency of 4 cycles to the result, and stores the result in the resource management unit 23.

サイクル1で、命令実行シミュレーション部21Aは、命令2を実行する。この場合、命令2はロード命令であるため、命令実行シミュレーション部21Aは、キャッシュシミュレーション部(命令単位)21Bにキャッシュアクセスを要求する。キャッシュシミュレーション部(命令単位)21Bは、キャッシュの動作をシミュレーションし、この例ではキャッシュミスであることを検出する。キャッシュシミュレーション部(命令単位)21Bは、キャッシュアクセスに要した3サイクルのレイテンシを付けて、キャッシュシミュレーション部(サイクル単位)22Aに、キャッシュリプレース動作を要求する。また、キャッシュシミュレーション部(命令単位)21Bは、命令2の結果の書き込み先の使用可能時刻が不明であることを資源管理部23に通知する。   In cycle 1, the instruction execution simulation unit 21 </ b> A executes instruction 2. In this case, since the instruction 2 is a load instruction, the instruction execution simulation unit 21A requests a cache access from the cache simulation unit (instruction unit) 21B. The cache simulation unit (instruction unit) 21B simulates the cache operation and detects a cache miss in this example. The cache simulation unit (instruction unit) 21B adds a latency of 3 cycles required for cache access, and requests a cache replacement operation from the cache simulation unit (cycle unit) 22A. Further, the cache simulation unit (instruction unit) 21B notifies the resource management unit 23 that the usable time of the write destination of the result of the instruction 2 is unknown.

サイクル2で、命令実行シミュレーション部21Aは、命令3を実行し、その結果に4サイクルのレイテンシを付けて資源管理部23に格納する。   In cycle 2, the instruction execution simulation unit 21 </ b> A executes the instruction 3, adds a 4-cycle latency to the result, and stores the result in the resource management unit 23.

同様に、サイクル3で、命令実行シミュレーション部21Aは、命令4を実行し、その結果に4サイクルのレイテンシを付けて資源管理部23に格納する。   Similarly, in cycle 3, the instruction execution simulation unit 21 </ b> A executes the instruction 4, adds the latency of 4 cycles to the result, and stores it in the resource management unit 23.

サイクル4で、命令実行シミュレーション部21Aが命令5を実行する。この場合、この例では命令5は命令2の結果に依存する命令であるため、命令実行シミュレーション部21Aは、資源管理部23に資源を要求したタイミングで、結果の待ち合わせ(待機)を行う。   In cycle 4, the instruction execution simulation unit 21 </ b> A executes the instruction 5. In this case, since the instruction 5 depends on the result of the instruction 2 in this example, the instruction execution simulation unit 21A waits for the result at the timing when the resource management unit 23 requests the resource.

サイクル5から、キャッシュシミュレーション部(サイクル単位)22Aは、キャッシュシミュレーション部(命令単位)21Bから受け付けた要求の処理を開始し、サイクル34までシミュレーションを行う。サイクル35で命令2の結果が資源管理部23に通知されるため、スケジューラ24は、命令実行シミュレーション部21Aにシミュレーション再開を要求し、命令5の実行が行われる。   From cycle 5, the cache simulation unit (cycle unit) 22A starts processing the request received from the cache simulation unit (instruction unit) 21B, and performs simulation until cycle 34. Since the result of the instruction 2 is notified to the resource management unit 23 in the cycle 35, the scheduler 24 requests the instruction execution simulation unit 21A to resume the simulation, and the instruction 5 is executed.

以上説明したように、第1実施形態では、命令レベルシミュレーションでレイテンシの算出が可能な命令については、命令レベルシミュレーションで行うため、計算時間を短縮できる。また、第1実施形態では、命令レベルシミュレーションでレイテンシの算出が不可能な命令については、論理レベルシミュレーションで行うため、高精度が維持される。第1実施形態では、計算量は37単位分となり、シミュレーション時間は図11の(A)の場合に比べて35%に低減できる。   As described above, in the first embodiment, since the instruction whose latency can be calculated by the instruction level simulation is performed by the instruction level simulation, the calculation time can be shortened. In the first embodiment, since the instruction whose latency cannot be calculated by the instruction level simulation is performed by the logic level simulation, high accuracy is maintained. In the first embodiment, the calculation amount is 37 units, and the simulation time can be reduced to 35% compared to the case of FIG.

次に、図11の(B)の第1実施形態におけるシミュレーション動作を行った場合の、資源管理部23の資源管理表内の値の変化について、図12から図18を参照して詳細に説明する。資源管理表の第1資源管理表31には、実行する命令1から命令5が格納されている。   Next, changes in values in the resource management table of the resource management unit 23 when the simulation operation in the first embodiment of FIG. 11B is performed will be described in detail with reference to FIGS. 12 to 18. To do. The first resource management table 31 of the resource management table stores instructions 1 to 5 to be executed.

図12から図17は、時刻1から6の時点における、パイプラインのシミュレーション状態と、資源管理表の第1資源管理表31および第2資源管理表32の状態を示す。   FIG. 12 to FIG. 17 show the pipeline simulation state and the state of the first resource management table 31 and the second resource management table 32 of the resource management table at time points 1 to 6.

時刻0では、第2資源管理表32内の各資源の使用可能時刻はすべて0であり、パイプラインには何も入っていない。時刻0で、命令1をフェッチする。   At time 0, the available times of each resource in the second resource management table 32 are all 0, and nothing is in the pipeline. At time 0, instruction 1 is fetched.

図12に示すように、時刻0〜1では、パイプラインの1段目のIFが命令1をフェッチした状態である。命令1は、レジスタR0とレジスタR1の値を加算してレジスタR2に格納する加算命令である。命令1を実行に要する時間は1なので、時刻1との和2が命令1の使用可能時刻になる。時刻1では、パイプラインは、IFが命令1をフェッチした状態であり、命令が実行される段階ではないので、この時刻における第2資源管理表32内の各資源の使用可能時刻は、すべて0である。そして、時刻1で、命令2をフェッチする。   As shown in FIG. 12, at time 0 to 1, the IF in the first stage of the pipeline is in a state where the instruction 1 is fetched. The instruction 1 is an addition instruction that adds the values of the register R0 and the register R1 and stores the result in the register R2. Since the time required to execute the instruction 1 is 1, the sum 2 with the time 1 becomes the usable time of the instruction 1. At time 1, the pipeline is in a state where the IF has fetched the instruction 1, and is not in the stage where the instruction is executed. Therefore, the usable time of each resource in the second resource management table 32 at this time is all 0. It is. At time 1, instruction 2 is fetched.

図13に示すように、時刻1〜2では、パイプラインのIFが命令2をフェッチした状態である。命令2は、レジスタR2の値とレジスタR3の値の和をアドレスとしてメモリにアクセスし、メモリからそのアドレスのデータを読み出してレジスタR4に格納するロード命令である。すなわち、命令2はメモリアクセスを必要とする命令である。命令2自体を実行するのに要する時間は1なので、その時点の時刻2との和3が使用可能時刻になる。実際の動作では、時刻1〜2では、パイプラインの2段目のIDが命令1をデコードし、1段目のIFが命令2をフェッチした状態であり、命令が実行される段階ではないので、第2資源管理表32内の各資源の使用可能時刻は、0である。そして、時刻2で、命令3をフェッチする。   As shown in FIG. 13, at time 1 to 2, the IF of the pipeline fetches the instruction 2. The instruction 2 is a load instruction that accesses the memory using the sum of the value of the register R2 and the value of the register R3 as an address, reads the data at the address from the memory, and stores it in the register R4. That is, instruction 2 is an instruction that requires memory access. Since the time required to execute the instruction 2 itself is 1, the sum 3 with the time 2 at that time becomes the usable time. In actual operation, at time 1-2, the second stage ID of the pipeline is in the state where instruction 1 is decoded and the first stage IF is fetching instruction 2, and the instruction is not executed. The usable time of each resource in the second resource management table 32 is 0. At time 2, instruction 3 is fetched.

図14に示すように、時刻2〜3では、パイプラインのIFが命令3をフェッチした状態である。命令3は、レジスタR3の値に整数を加算して再びレジスタR3に格納する整数加算命令である。命令3を実行するのに要する時間は1なので、その時点の時刻3との和4が使用可能時刻になる。実際の動作では、時刻2〜3では、パイプラインのEXが命令1を実行し、IDが命令2をデコードし、IFが命令3をフェッチした状態である。上記のように、命令1によりレジスタR2の値が変化するので、第2資源管理表32内のレジスタR2の使用可能時刻が3に設定される。そして、時刻3で、命令4をフェッチする。   As shown in FIG. 14, at time 2 to 3, the IF of the pipeline fetches the instruction 3. The instruction 3 is an integer addition instruction for adding an integer to the value of the register R3 and storing it again in the register R3. Since the time required to execute the instruction 3 is 1, the sum 4 with the time 3 at that time becomes the usable time. In actual operation, at time 2 to 3, the EX of the pipeline executes the instruction 1, the ID decodes the instruction 2, and the IF fetches the instruction 3. As described above, since the value of the register R2 is changed by the instruction 1, the usable time of the register R2 in the second resource management table 32 is set to 3. At time 3, instruction 4 is fetched.

図15に示すように、時刻3〜4では、パイプラインのIFが命令4をフェッチした状態である。命令4は、レジスタR3の値からレジスタR5の値を減算して、結果をレジスタR0に格納する減算命令である。命令4を実行するのに要する時間は1なので、その時点の時刻4との和5が使用可能時刻になる。実際の動作では、時刻3〜4では、パイプラインのDCがデータキャッシュにアクセスし、キャッシュヒットが判明するので、レジスタR2は使用可能状態になり、0に設定される。また、パイプラインのEXが命令2を実行する。上記のように、命令2はレジスタR4の値を変化させるが、命令2はメモリアクセス動作を伴うので、レジスタ4の値が使用可能になる時刻は不明である。そこで、第2資源管理表32内のレジスタR4の使用可能時刻が不明(?)に設定される。そして、時刻4で、命令5をフェッチする。   As shown in FIG. 15, at time 3 to 4, the pipeline IF fetches the instruction 4. The instruction 4 is a subtraction instruction that subtracts the value of the register R5 from the value of the register R3 and stores the result in the register R0. Since the time required to execute the instruction 4 is 1, the sum 5 with the time 4 at that time becomes the usable time. In actual operation, at time 3-4, the pipeline DC accesses the data cache and a cache hit is found, so the register R2 becomes available and is set to zero. Further, the EX of the pipeline executes the instruction 2. As described above, instruction 2 changes the value of register R4. However, since instruction 2 involves a memory access operation, the time at which the value of register 4 becomes usable is unknown. Therefore, the usable time of the register R4 in the second resource management table 32 is set to unknown (?). At time 4, instruction 5 is fetched.

図16に示すように、時刻4〜5では、パイプラインのIFが命令5をフェッチした状態である。命令5は、レジスタR4の値にレジスタR6の値を乗算して、結果をレジスタR7に格納する乗算命令である。命令5を実行するのに要する時間は1なので、その時点の時刻5との和6が使用可能時刻になる。実際の動作では、時刻4〜5では、命令3が実行される。上記のように、命令3はレジスタR3の値を変化させるので、第2資源管理表32内のレジスタR3の使用可能時刻が5に設定される。レジスタR4の使用可能時刻は不明の状態が維持される。そして、時刻5で、命令6をフェッチする。   As shown in FIG. 16, at time 4 to 5, the pipeline IF fetches the instruction 5. The instruction 5 is a multiplication instruction that multiplies the value of the register R4 by the value of the register R6 and stores the result in the register R7. Since the time required to execute the instruction 5 is 1, the sum 6 with the time 5 at that time becomes the usable time. In actual operation, instruction 3 is executed at times 4-5. As described above, since the instruction 3 changes the value of the register R3, the usable time of the register R3 in the second resource management table 32 is set to 5. An unknown state is maintained for the usable time of the register R4. At time 5, instruction 6 is fetched.

図17に示すように、時刻5〜6では、図示していないが、第6パイプラインのIFが命令6をフェッチする。命令6は、レジスタR8の値にレジスタR7の値を加算して、結果をレジスタR8に格納する加算命令である。命令6を実行するのに要する時間は1なので、その時点の時刻6との和7が使用可能時刻になる。時刻6では、命令4が実行される。上記のように、命令4はレジスタR0の値を変化させるので、第2資源管理表32内のレジスタR0の使用可能時刻が6に設定される。命令3のキャッシュヒットによりレジスタR3は0に設定され、レジスタR4の使用可能時刻は不明の状態が維持される。   As shown in FIG. 17, at time 5-6, although not shown, the IF of the sixth pipeline fetches the instruction 6. The instruction 6 is an addition instruction for adding the value of the register R7 to the value of the register R8 and storing the result in the register R8. Since the time required to execute the instruction 6 is 1, the sum 7 with the time 6 at that time becomes the usable time. At time 6, instruction 4 is executed. As described above, since the instruction 4 changes the value of the register R0, the usable time of the register R0 in the second resource management table 32 is set to 6. The register R3 is set to 0 by the cache hit of the instruction 3, and the usable time of the register R4 is kept in an unknown state.

ここで、第5パイプラインのEXが命令5を実行しようとするが、上記のように、命令5の実行に必要なレジスタR4の使用可能時刻が不明であり、命令5は実行できない。そこで、命令レベルシミュレーション部21は、この時点で動作を一時的に停止して待機状態になる。   Here, EX of the fifth pipeline tries to execute the instruction 5, but as described above, the usable time of the register R4 necessary for executing the instruction 5 is unknown, and the instruction 5 cannot be executed. Therefore, the instruction level simulation unit 21 temporarily stops its operation at this time and enters a standby state.

命令レベルシミュレーション部21は、パイプラインのDCがキャッシュアクセスした段階で、命令2がキャッシュミスが判明するので、論理レベルシミュレーション部22に、命令2のメモリアクセス動作をシミュレーションするように要求する。これに応じて、論理レベルシミュレーション部22はメモリアクセス動作のシミュレーションを実行し、メモリアクセス動作時間を算出し、資源管理部23に算出結果を通知する。資源管理部23は、命令レベルシミュレーション部21から通知された内部レイテンシとメモリアクセス動作時間を加算してレジスタR4の使用可能時刻を算出し、第2資源管理表32内のレジスタR4の使用可能時刻に格納する。   The instruction level simulation unit 21 requests the logic level simulation unit 22 to simulate the memory access operation of the instruction 2 because the cache miss is found in the instruction 2 when the pipeline DC performs the cache access. In response to this, the logic level simulation unit 22 executes a memory access operation simulation, calculates the memory access operation time, and notifies the resource management unit 23 of the calculation result. The resource management unit 23 adds the internal latency notified from the instruction level simulation unit 21 and the memory access operation time to calculate the usable time of the register R4, and the usable time of the register R4 in the second resource management table 32 To store.

図18は、論理レベルシミュレーション部32のシミュレーション結果により、第2資源管理表32のレジスタR4の値が変化した状態を示す。命令2のメモリアクセス動作を実行してレジスタR4が使用可能になる時刻は32であり、命令実行時刻計算部33の時刻は32に設定され、第2資源管理表32のレジスタR4の値は32に設定される。   FIG. 18 shows a state in which the value of the register R4 of the second resource management table 32 has changed due to the simulation result of the logic level simulation unit 32. The time when the register R4 becomes usable after executing the memory access operation of the instruction 2 is 32, the time of the instruction execution time calculator 33 is set to 32, and the value of the register R4 of the second resource management table 32 is 32. Set to

以上のようにして、資源管理表23に格納されている命令のシミュレーションを実行し、処理実行時間を算出する。   As described above, the simulation of the instruction stored in the resource management table 23 is executed, and the processing execution time is calculated.

図19は、第2実施形態のシミュレーション装置の構成を示す図である。第2実施形態でシミュレーションを行うプロセッサコア1は、図1の(B)に示す構成を備え、構成部分に対応した複数のパイプラインを備えるものとする。第2実施形態のシミュレーション装置は、図1の(B)に示したプロセッサコア1の構成に対応させてシミュレーションを行う。   FIG. 19 is a diagram illustrating a configuration of the simulation apparatus according to the second embodiment. The processor core 1 that performs the simulation in the second embodiment includes the configuration illustrated in FIG. 1B and includes a plurality of pipelines corresponding to the components. The simulation apparatus according to the second embodiment performs a simulation corresponding to the configuration of the processor core 1 shown in FIG.

図19に示すように、第2実施形態のシミュレーション装置では、命令レベルシミュレーション部21は、命令フェッチシミュレーション部21Cと、命令キャッシュシミュレーション部(命令単位)21Dと、命令デコードシミュレーション部21Eと、命令実行シミュレーション部21Fと、データキャッシュシミュレーション部(命令単位)21Gと、を備える。論理レベルシミュレーション部22は、命令キャッシュシミュレーション部(サイクル単位)22Cと、バス・メモリ等シミュレーション部(サイクル単位)22Bと、データキャッシュシミュレーション部(サイクル単位)22Dと、を備える。バス・メモリ等シミュレーション部(サイクル単位)22Bは、接続される外部メモリを想定したメモリイメージ25をシミュレーションする。また、資源管理部23は、第1資源管理部23Aと、第2資源管理部23Bと、第3資源管理部23Cと、を備える。   As shown in FIG. 19, in the simulation apparatus of the second embodiment, the instruction level simulation unit 21 includes an instruction fetch simulation unit 21C, an instruction cache simulation unit (instruction unit) 21D, an instruction decode simulation unit 21E, and instruction execution. A simulation unit 21F and a data cache simulation unit (instruction unit) 21G are provided. The logic level simulation unit 22 includes an instruction cache simulation unit (cycle unit) 22C, a bus / memory simulation unit (cycle unit) 22B, and a data cache simulation unit (cycle unit) 22D. The bus / memory simulation unit (cycle unit) 22B simulates a memory image 25 assuming an external memory to be connected. The resource management unit 23 includes a first resource management unit 23A, a second resource management unit 23B, and a third resource management unit 23C.

命令フェッチシミュレーション部21Cは、命令フェッチの動作をシミュレーションする。命令キャッシュシミュレーション部(命令単位)21Dは、命令キャッシュアクセス動作をシミュレーションする。命令デコードシミュレーション部21Eは、命令デコード動作をシミュレーションする。命令実行シミュレーション部21Fは、命令実行動作をシミュレーションする。データキャッシュシミュレーション部(命令単位)21Gは、データキャッアクセス動作をシュシミュレーションする。   The instruction fetch simulation unit 21C simulates an instruction fetch operation. The instruction cache simulation unit (instruction unit) 21D simulates an instruction cache access operation. The instruction decode simulation unit 21E simulates an instruction decode operation. The instruction execution simulation unit 21F simulates an instruction execution operation. The data cache simulation unit (instruction unit) 21G simulates the data cache access operation.

命令キャッシュシミュレーション部(サイクル単位)22Cは、命令キャッシュリプレース動作をシュシミュレーションする。データキャッシュシミュレーション部(サイクル単位)22Dは、データキャッシュリプレース動作をシュシミュレーションする。バス・メモリ等シミュレーション部(サイクル単位)22Bは、命令キャッシュシミュレーション部(サイクル単位)22Cおよびデータキャッシュシミュレーション部(サイクル単位)22Dからのメモリアクセス要求をシュシミュレーションする。   The instruction cache simulation unit (cycle unit) 22C performs a simulation of the instruction cache replacement operation. The data cache simulation unit (cycle unit) 22D performs a simulation of the data cache replacement operation. The bus / memory simulation unit (cycle unit) 22B performs a simulation of memory access requests from the instruction cache simulation unit (cycle unit) 22C and the data cache simulation unit (cycle unit) 22D.

第1資源管理部23Aは、命令フェッチから命令デコードの間の処理に関係する命令バッファに関係する資源を管理する。第2資源管理部23Bは、命令デコードから命令実行の間の処理に関係するパイプラインレジスタに関係する資源を管理する。第3資源管理部23Cは、レジスタ、演算器、ポートなどに関係する資源を管理する。   The first resource management unit 23A manages resources related to the instruction buffer related to processing between instruction fetch and instruction decode. The second resource management unit 23B manages resources related to pipeline registers related to processing between instruction decoding and instruction execution. The third resource management unit 23C manages resources related to registers, arithmetic units, ports, and the like.

スケジューラ(乗り移り制御)24は、図19の各部にシミュレーションの開始・再開を要求する。   The scheduler (transfer control) 24 requests each part of FIG. 19 to start and restart the simulation.

図20は、第2実施形態におけるシミュレーション動作例のタイムチャートであり、(A)は比較のため一般的な論理レベルシミュレーションを行った場合を示し、(B)は第2実施形態のシミュレーションを行った場合を、示す。この動作例では、処理ごとに処理単位が異なる。例えば、フェッチは4命令単位で行われ、デコードは同時実行可能な命令の組を単位として行われ、実行は1命令単位で行われる。デコードは2サイクルで行われ、実行は命令によりサイクル数が異なる。   FIG. 20 is a time chart of a simulation operation example in the second embodiment. FIG. 20A shows a case in which a general logic level simulation is performed for comparison, and FIG. 20B shows a simulation in the second embodiment. The case is shown. In this operation example, the processing unit is different for each process. For example, fetching is performed in units of four instructions, decoding is performed in units of instructions that can be executed simultaneously, and execution is performed in units of instructions. Decoding is performed in two cycles, and the number of cycles varies depending on the instruction.

図20の(A)に示すように、サイクル0で、フェッチのパイプラインの1段目に4命令1〜4がフェッチされる。サイクル1で、4命令1〜4がフェッチのパイプラインの2段目にシフトされ、フェッチのパイプラインの1段目に4命令5〜8がフェッチされる。サイクル2で、4命令1〜4がフェッチのパイプラインの3段目にシフトされ、4命令5〜8がフェッチのパイプラインの2段目にシフトされる。   As shown in FIG. 20A, in cycle 0, four instructions 1 to 4 are fetched in the first stage of the fetch pipeline. In cycle 1, 4 instructions 1 to 4 are shifted to the second stage of the fetch pipeline, and 4 instructions 5 to 8 are fetched to the first stage of the fetch pipeline. In cycle 2, 4 instructions 1-4 are shifted to the third stage of the fetch pipeline, and 4 instructions 5-8 are shifted to the second stage of the fetch pipeline.

サイクル3では、命令1〜3が同時にデコードされ、4命令5〜8がフェッチのパイプラインの3段目にシフトされる。サイクル4では、命令1〜3がさらにデコードされると共に、命令4〜6がデコードされる。サイクル5では、命令1〜3が実行され、命令4〜6がさらにデコードされ、命令7もデコードされる。サイクル6では、命令1および3の結果が書き戻され、命令2の実行が継続し、命令4〜6が実行され、命令7はさらにデコードされ、命令8もデコードされる。従って、命令1および3の処理は終了する。   In cycle 3, instructions 1 to 3 are decoded simultaneously, and 4 instructions 5 to 8 are shifted to the third stage of the fetch pipeline. In cycle 4, instructions 1 to 3 are further decoded and instructions 4 to 6 are decoded. In cycle 5, instructions 1 to 3 are executed, instructions 4 to 6 are further decoded, and instruction 7 is also decoded. In cycle 6, the results of instructions 1 and 3 are written back, execution of instruction 2 continues, instructions 4-6 are executed, instruction 7 is further decoded, and instruction 8 is also decoded. Therefore, the processing of instructions 1 and 3 is finished.

サイクル7では、命令2の実行が継続し、命令4および5の結果が書き戻され、命令6の実行が継続し、命令8もデコードされる。ここで、命令7は、命令2の結果を使用するのでインタロックが発生する。   In cycle 7, execution of instruction 2 continues, the results of instructions 4 and 5 are written back, execution of instruction 6 continues, and instruction 8 is also decoded. Here, since the instruction 7 uses the result of the instruction 2, an interlock occurs.

サイクル8では、命令2の結果が書き戻され、命令7の実行が再開する。命令6はメモリアクセスを伴う命令であり、命令8は命令6の結果を使用する。一般的な論理レベルシミュレーションでは、サイクル8の後命令6のメモリアクセス動作をシミュレーションしてメモリアクセスの結果が得られるまでシミュレーションを行う。   In cycle 8, the result of instruction 2 is written back and execution of instruction 7 resumes. Instruction 6 is an instruction with memory access, and instruction 8 uses the result of instruction 6. In a general logic level simulation, the memory access operation of the instruction 6 is simulated after the cycle 8 and the simulation is performed until a memory access result is obtained.

サイクル11で、命令7の結果の書き戻しが行われる。この時、命令6はメモリアクセス動作のシミュレーションが行われ、命令8は命令6の結果を待ち合わせている。   In cycle 11, the result of instruction 7 is written back. At this time, the instruction 6 is simulating the memory access operation, and the instruction 8 waits for the result of the instruction 6.

サイクルNで、命令6のメモリアクセス動作時間が得られる。サイクルN+1で、命令8が実行され、命令6の結果が書き戻される。命令8の実行はサイクルN+3まで継続し、サイクルN+3で命令8の結果が書き戻される。以上のシミュレーションで、シミュレーション単位量は107になる。   In cycle N, the memory access operation time of instruction 6 is obtained. In cycle N + 1, instruction 8 is executed and the result of instruction 6 is written back. Execution of instruction 8 continues until cycle N + 3, and the result of instruction 8 is written back at cycle N + 3. In the above simulation, the simulation unit amount is 107.

また、一般的な命令レベルシミュレーションによれば、フェッチ、デコード実行、書き戻しについて所定のレイテンシを使用し、メモリアクセス以外のインタロックを考慮し、メモリアクセス時間を所定値、例えば30サイクルと仮定して処理時間を算出する。メモリアクセス時間は、状況により異なるので、正確な処理時間は算出できない。   Further, according to a general instruction level simulation, a predetermined latency is used for fetch, decode execution, and write-back, and an interlock other than memory access is considered, and a memory access time is assumed to be a predetermined value, for example, 30 cycles. To calculate the processing time. Since the memory access time varies depending on the situation, an accurate processing time cannot be calculated.

これに対して、第2実施形態では、図20の(B)に示すように、命令レベルシミュレーションでレイテンシが算出可能な動作については、命令レベルシミュレーションを行う。図20の(B)では、命令レベルシミュレーションでレイテンシが算出可能な動作を、太線の実線の矢印で示す。命令レベルシミュレーションでレイテンシが算出不可能なメモリアクセスなどの動作Pについては、論理レベルシミュレーションが動作時間を算出する。図20の(B)で白線の矢印で示す動作は、命令レベルシミュレーションを行うが、論理レベルシミュレーションの結果を必要とするので、資源管理部で使用する資源が使用可能になる時刻を管理して、正確な処理時間を算出する。   On the other hand, in the second embodiment, as shown in FIG. 20B, for the operation whose latency can be calculated by the instruction level simulation, the instruction level simulation is performed. In FIG. 20B, an operation that can calculate the latency by the instruction level simulation is indicated by a solid line arrow. For the operation P such as memory access in which the latency cannot be calculated by the instruction level simulation, the logic level simulation calculates the operation time. The operation indicated by the white arrow in FIG. 20B performs an instruction level simulation, but requires the result of the logic level simulation. Calculate the exact processing time.

以上、実施形態を説明したが、ここに記載したすべての例や条件は、発明および技術に適用する発明の概念の理解を助ける目的で記載されたものであり、特に記載された例や条件は発明の範囲を制限することを意図するものではなく、明細書のそのような例の構成は発明の利点および欠点を示すものではない。発明の実施形態を詳細に記載したが、各種の変更、置き換え、変形が発明の精神および範囲を逸脱することなく行えることが理解されるべきである。   Although the embodiment has been described above, all examples and conditions described herein are described for the purpose of helping understanding of the concept of the invention applied to the invention and the technology. It is not intended to limit the scope of the invention, and the construction of such examples in the specification does not indicate the advantages and disadvantages of the invention. Although embodiments of the invention have been described in detail, it should be understood that various changes, substitutions and modifications can be made without departing from the spirit and scope of the invention.

21 命令レベルシミュレーション部
22 論理レベルシミュレーション部
23 資源管理部(資源管理表)
24 制御部(スケジューラ)
21 Instruction level simulation unit 22 Logic level simulation unit 23 Resource management unit (resource management table)
24 Control unit (scheduler)

Claims (10)

プロセッサを備えるシステムのシミュレーション装置であって、
命令単位でのシミュレーションによってレイテンシ算出可能な動作について、命令単位でのシミュレーションを実行する命令レベルシミュレーション部と、
命令単位でのシミュレーションによってレイテンシ算出不可能な動作について、前記システムのハードウエアを再現したサイクル単位でのシミュレーションを実行する論理レベルシミュレーション部と、
シミュレーションで使用する資源が使用可能になる時刻情報を格納する資源管理表を備える資源管理部と、を備え、
前記命令レベルシミュレーション部は、命令単位でのシミュレーションによってレイテンシ算出不可能な動作の場合に、前記論理レベルシミュレーション部にサイクル単位でのシミュレーションの実行を要求し、
前記論理レベルシミュレーション部は、要求されたサイクル単位でのシミュレーションの結果に基づいて、シミュレーションで使用する資源が使用可能になる時刻情報を、前記資源管理部に通知し、
前記資源管理部は、シミュレーションで使用する資源が使用可能になる時刻情報を格納することを特徴とするシミュレーション装置。
A simulation apparatus for a system including a processor,
An instruction level simulation unit that performs simulation in units of instructions for operations that can calculate latency by simulation in units of instructions,
A logic level simulation unit that executes a simulation in a cycle unit that reproduces the hardware of the system for an operation in which a latency cannot be calculated by a simulation in an instruction unit,
A resource management unit comprising a resource management table for storing time information when resources used in the simulation are available,
The instruction level simulation unit requests the logic level simulation unit to execute a simulation in a cycle unit in the case of an operation in which a latency cannot be calculated by a simulation in an instruction unit.
The logic level simulation unit notifies the resource management unit of time information at which resources used in the simulation can be used, based on a simulation result in a requested cycle unit,
The said resource management part stores the time information when the resource used by simulation becomes usable, The simulation apparatus characterized by the above-mentioned.
前記命令レベルシミュレーション部は、命令単位でのシミュレーションによってレイテンシ算出不可能な動作の場合に、シミュレーションで使用する資源が使用可能になる時刻が不明であることを、前記資源管理部に通知する請求項1に記載のシミュレーション装置。   The instruction level simulation unit notifies the resource management unit that the time at which a resource used in the simulation becomes available is unknown in an operation in which latency cannot be calculated by simulation in units of instructions. 1. The simulation apparatus according to 1. 前記命令レベルシミュレーション部は、
命令単位でのシミュレーションによってレイテンシ算出不可能な動作の後の前記レイテンシ算出不可能な動作のレイテンシを必要とする後続命令を検出するまで、命令単位でのシミュレーションを継続し、
前記レイテンシ算出不可能な動作のレイテンシを必要とする後続命令を検出した時点で命令単位でのシミュレーションを停止し、
前記資源管理部が、前記後続命令の必要とする資源が使用可能になる時刻情報を格納すると、命令単位でのシミュレーションを再開し、格納された前記時刻情報を利用する請求項2に記載のシミュレーション装置。
The instruction level simulation unit
The simulation in the instruction unit is continued until the subsequent instruction that requires the latency of the operation in which the latency cannot be calculated after the operation in which the latency cannot be calculated by the simulation in the instruction unit is detected.
The simulation in units of instructions is stopped when a subsequent instruction that requires the latency of the operation that cannot calculate the latency is detected,
The simulation according to claim 2, wherein when the resource management unit stores time information at which a resource required by the subsequent instruction becomes available, the simulation is resumed in units of instructions and the stored time information is used. apparatus.
前記論理レベルシミュレーション部は、要求されたサイクル単位でのシミュレーションの実行が終了すると、未処理の要求が残留していない場合には、動作を停止する請求項に記載のシミュレーション装置。 The simulation apparatus according to claim 3 , wherein when the execution of the simulation in the requested cycle unit ends, the logic level simulation unit stops the operation when there is no unprocessed request remaining. シミュレーション処理要求が存在する前記命令レベルシミュレーション部および前記論理レベルシミュレーション部に対してのみ、処理実行要求を行うスケジューラを備える請求項に記載のシミュレーション装置。 The simulation apparatus according to claim 4 , further comprising a scheduler that issues a process execution request only to the instruction level simulation unit and the logic level simulation unit in which a simulation processing request exists. 当該シミュレーション装置は、複数の前記命令レベルシミュレーション部と、複数の前記論理レベルシミュレーション部と、複数の前記資源管理部と、を備え、
前記後続命令の必要とする資源を管理している前記資源管理部は、前記後続命令の必要とする資源が使用可能になるのを待機している前記命令レベルシミュレーション部以外の他の前記命令レベルシミュレーション部または複数の前記論理レベルシミュレーション部から、前記資源が使用可能になる時刻情報が通知されると、前記資源が使用可能になる時刻情報を格納し、
前記スケジューラは、前記資源が使用可能になる時刻情報の更新をトリガとして、前記後続命令の必要とする資源が使用可能になるのを待機している前記命令レベルシミュレーション部に処理再開要求を行う請求項5に記載のシミュレーション装置。
The simulation apparatus includes a plurality of the instruction level simulation units, a plurality of the logic level simulation units, and a plurality of the resource management units,
The resource management unit managing resources required by the subsequent instruction is the instruction level other than the instruction level simulation unit waiting for the resource required by the subsequent instruction to be usable. When the time information at which the resource can be used is notified from the simulation unit or the plurality of logic level simulation units, the time information at which the resource can be used is stored,
The scheduler makes a process resumption request to the instruction level simulation unit waiting for the resource required by the succeeding instruction to become available, triggered by the update of time information when the resource becomes available. Item 6. The simulation device according to Item 5.
プロセッサを備えるシステムのシミュレーション方法であって、
命令単位でのシミュレーションによってレイテンシ算出可能な動作について、命令単位でのシミュレーションを実行し、
命令単位でのシミュレーションによってレイテンシ算出不可能な動作の場合に、前記システムのハードウエアを再現したサイクル単位でのシミュレーションを実行し、
前記サイクル単位でのシミュレーションの結果に基づいて、前記レイテンシ算出不可能な動作のレイテンシが関係する資源が使用可能になる時刻情報を格納することを特徴とするシミュレーション方法。
A method for simulating a system comprising a processor,
For operations that can calculate latency by simulation in instruction unit, execute simulation in instruction unit,
In the case of an operation in which the latency cannot be calculated by simulation in units of instructions, a simulation in units of cycles that reproduces the hardware of the system is executed,
A simulation method comprising: storing time information at which a resource related to a latency of an operation incapable of calculating the latency can be used based on a simulation result in cycle units.
命令単位でのシミュレーションによってレイテンシ算出不可能な動作の後、前記レイテンシ算出不可能な動作のレイテンシを必要とする後続命令を検出するまで、命令単位でのシミュレーションを継続し、
前記レイテンシ算出不可能な動作のレイテンシを必要とする後続命令を検出した時点で命令単位でのシミュレーションを停止し、
前記レイテンシ算出不可能な動作のレイテンシが関係する資源が使用可能になる時刻情報が格納されると、命令単位でのシミュレーションを再開し、格納された前記時刻情報を利用する請求項7に記載のシミュレーション方法。
After an operation in which latency cannot be calculated by simulation in units of instructions, simulation in units of instructions is continued until a subsequent instruction that requires the latency of operations in which the latency cannot be calculated is detected.
The simulation in units of instructions is stopped when a subsequent instruction that requires the latency of the operation that cannot calculate the latency is detected,
8. The simulation according to claim 7, wherein when the time information at which the resource related to the latency of the operation incapable of calculating the latency can be used is stored, simulation in units of instructions is resumed and the stored time information is used. Simulation method.
コンピュータに、プロセッサを備えるシステムのシミュレーションを実行させるシミュレーション用プログラムであって、
命令単位でのシミュレーションによってレイテンシ算出可能な動作について、命令単位でのシミュレーションを実行し、
命令単位でのシミュレーションによってレイテンシ算出不可能な動作の場合に、前記システムのハードウエアを再現したサイクル単位でのシミュレーションを実行し、
前記サイクル単位でのシミュレーションの結果に基づいて、前記レイテンシ算出不可能な動作のレイテンシが関係する資源が使用可能になる時刻情報を格納するように、制御することを特徴とするシミュレーション用プログラム。
A simulation program for causing a computer to execute a simulation of a system including a processor,
For operations that can calculate latency by simulation in instruction unit, execute simulation in instruction unit,
In the case of an operation in which the latency cannot be calculated by simulation in units of instructions, a simulation in units of cycles that reproduces the hardware of the system is executed,
A simulation program for controlling to store time information at which resources related to the latency of an operation whose latency cannot be calculated are stored based on a simulation result in cycle units.
命令単位でのシミュレーションによってレイテンシ算出不可能な動作の後、前記レイテンシ算出不可能な動作のレイテンシを必要とする後続命令を検出するまで、命令単位でのシミュレーションを継続し、
前記レイテンシ算出不可能な動作のレイテンシを必要とする後続命令を検出した時点で命令単位でのシミュレーションを停止し、
前記レイテンシ算出不可能な動作のレイテンシが関係する資源が使用可能になる時刻情報が格納されると、命令単位でのシミュレーションを再開し、格納された前記時刻情報を利用するように制御する請求項9に記載のシミュレーション用プログラム。
After an operation in which latency cannot be calculated by simulation in units of instructions, simulation in units of instructions is continued until a subsequent instruction that requires the latency of operations in which the latency cannot be calculated is detected.
The simulation in units of instructions is stopped when a subsequent instruction that requires the latency of the operation that cannot calculate the latency is detected,
The control is performed such that when the time information at which the resource related to the latency of the operation incapable of calculating the latency can be used is stored, the simulation in units of instructions is resumed and the stored time information is used. 9. The simulation program according to 9.
JP2009233682A 2009-10-07 2009-10-07 Simulation apparatus, method and program Expired - Fee Related JP5440083B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009233682A JP5440083B2 (en) 2009-10-07 2009-10-07 Simulation apparatus, method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009233682A JP5440083B2 (en) 2009-10-07 2009-10-07 Simulation apparatus, method and program

Publications (2)

Publication Number Publication Date
JP2011081623A JP2011081623A (en) 2011-04-21
JP5440083B2 true JP5440083B2 (en) 2014-03-12

Family

ID=44075608

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009233682A Expired - Fee Related JP5440083B2 (en) 2009-10-07 2009-10-07 Simulation apparatus, method and program

Country Status (1)

Country Link
JP (1) JP5440083B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5961971B2 (en) * 2011-10-12 2016-08-03 富士通株式会社 Simulation apparatus, method, and program
KR101575783B1 (en) 2014-12-23 2015-12-08 한국항공우주산업 주식회사 The method of controlling system simulation and the device for that and the computer readable medium having that

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2663893B2 (en) * 1994-12-27 1997-10-15 日本電気株式会社 Architecture simulator
JP2000011022A (en) * 1998-06-22 2000-01-14 Matsushita Electric Ind Co Ltd Method for verifying cooperation between hardware and software
JP2000250957A (en) * 1999-03-01 2000-09-14 Hitachi Ltd Logic simulation device

Also Published As

Publication number Publication date
JP2011081623A (en) 2011-04-21

Similar Documents

Publication Publication Date Title
JP5278624B2 (en) Simulation apparatus, method, and program
US9830158B2 (en) Speculative execution and rollback
JP3781419B2 (en) Exception handling in pipelined processors
US7444501B2 (en) Methods and apparatus for recognizing a subroutine call
US20120029900A1 (en) Simulation method and system for simulating a multi-core hardware platform
US9092346B2 (en) Speculative cache modification
JP2008210107A (en) Simulation method and simulation device
JP2006518053A (en) Prefetch generation by speculatively executing code through hardware scout threading
US20140316761A1 (en) Simulation apparatus and storage medium
US20220188121A1 (en) Pipeline Protection for CPUs With Save and Restore of Intermediate Results
JP5128382B2 (en) Method and apparatus for executing multiple load instructions
JP5440083B2 (en) Simulation apparatus, method and program
JP2007102333A (en) Data processing device and data processing method
JP5542643B2 (en) Simulation apparatus and simulation program
JP2007094986A (en) Simulation apparatus and simulation method
JP5209390B2 (en) Information processing apparatus and instruction fetch control method
US11442757B2 (en) Simulation method and simulation system
JP2008299729A (en) Processor
CN114610388A (en) Instruction jump method, processor and electronic equipment
US10261909B2 (en) Speculative cache modification
CN112395000B (en) Data preloading method and instruction processing device
EP1220088A2 (en) Circuit and method for supporting misaligned accesses in the presence of speculative load instructions
KR102028729B1 (en) Apparatus and method for non-blocking execution of a static scheduled processor
US6807628B2 (en) System and method for supporting precise exceptions in a data processor having a clustered architecture
US20230315453A1 (en) Forward conditional branch event for profile-guided-optimization (pgo)

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120605

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130828

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130903

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20131105

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20131119

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20131202

R150 Certificate of patent or registration of utility model

Ref document number: 5440083

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees