WO2002069150A1 - Microprocessor and instruction execution order scheduling method - Google Patents

Microprocessor and instruction execution order scheduling method Download PDF

Info

Publication number
WO2002069150A1
WO2002069150A1 PCT/JP2002/001272 JP0201272W WO02069150A1 WO 2002069150 A1 WO2002069150 A1 WO 2002069150A1 JP 0201272 W JP0201272 W JP 0201272W WO 02069150 A1 WO02069150 A1 WO 02069150A1
Authority
WO
WIPO (PCT)
Prior art keywords
routine
instruction
data structure
data
cache
Prior art date
Application number
PCT/JP2002/001272
Other languages
French (fr)
Japanese (ja)
Inventor
Makoto Ueda
Original Assignee
International Business Machines Corporation
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 International Business Machines Corporation filed Critical International Business Machines Corporation
Priority to KR10-2003-7010997A priority Critical patent/KR20030088031A/en
Priority to JP2002568205A priority patent/JPWO2002069150A1/en
Publication of WO2002069150A1 publication Critical patent/WO2002069150A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3802Instruction prefetching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3824Operand accessing
    • G06F9/383Operand prefetching

Definitions

  • the present invention relates to a microprocessor and an instruction execution order scheduling method, and more particularly, to a method for scheduling an instruction execution order of a microprocessor and a microphone processor that executes instructions in an order specified by a program.
  • FIG. 4 shows an example of the configuration of an MPU (microprocessor unit) 10.
  • the MPU 10 has a smaller capacity and higher-speed access than the external memory 40, and stores a part of the instruction read from the external memory 40 and a part of the data in the cache 'memory 14;
  • a fetch unit 22 for reading an instruction or data from the internal memory 40, an execution unit 26 for executing the read instruction, a general-purpose register 32 for storing data used by the instruction being executed, and an external device ( 40) includes the path interface unit 12 to which it is connected.
  • the cache 'memory 14 includes an instruction cache 20 where instructions are stored and a data' cache 30 where data is stored.
  • the MPU 10 ' is connected to an external memory (semiconductor storage device) 40 via a path interface' unit 12 ', and instructions and data are read and written between the external memory 40 and the MPU 10'.
  • the cache memories 20 and 30 are used with priority over the external memory 40. If the instructions or data required by the MPUs 10 and do not exist in the cache memories 20 and 30, the instructions or data are read from the external memory 40.
  • the reading of instructions or data from the external memory 40 when it does not exist in the cache memories 20 and 30 is controlled by hardware. For example, the control unit (not shown) that controls the entire MPU 10 'performs this control.
  • the external memory 40 is also connected to a hard disk (fixed magnetic storage device) 42, and instructions and data are read and written between the external memory 40 and the hard disk 42. If the command or data required by MPU 10 'is not present in external memory 40, read the command or data from hard disk 42. The reading of instructions or data from the hard disk 42 when it does not exist in the external memory 40 is controlled by software. Normally, OS (operating system) controls this.
  • OS operating system
  • fetch unit 22 reads the instruction from instruction cache 20 or external memory 40. If the target instruction exists in the instruction cache 20, the instruction is read from the instruction cache 20; otherwise, the instruction is read from the external memory 40. When an instruction is read from the external memory 40, the read instruction is also sent to and stored in the instruction cache 20.
  • Fig. 5 (a) shows a flowchart of an example of a program that causes MPU 10 to execute two types of routines (Func A, Func B) using two data (DATAsA, DATAsB).
  • FIG. 5 (a) mainly shows the reading and processing of data (DATAsA. DATAsB). The MPU 10 'reads and executes data in the execution order specified by the program shown in FIG. 5 (a).
  • DATAsA and DATAsB each contain some data (DATA-A0, DATA-Al, DAT
  • FuncA and FuncB are a series of instructions with a certain function that constitute a part of the program. FuncA and FuncB have several instructions (Inst-
  • FuncA and FuncB are independent instructions. For example, unless there is a branch instruction, FuncA executes instructions in the order of Inst-A0, Inst-Al, Inst-A2, and FuncB executes Inst-BO, Inst-Bl, Execute the instruction in the order of Inst-B2, c As shown in FIG. 5 (a), the MPU 10, reads out DATAsA (S172) and executes Func A using DATAs A (S174).
  • DATAsB is read (S 176), and Func A using DATAsB is executed (S 178). Subsequently, DATAs A is read (S 172,), and FuncB using DATAsA is executed (S182). Next, DATAsB is read (S176 ′), and FuncB using DATAsB is executed (S186). ).
  • the waiting time of the MPU 10 When data is read in the order shown in FIG. 5A, if the data to be read does not exist in the data / cache 30, the waiting time of the MPU 10 'increases. For example, when reading DATAsA and executing FuncA (S174), if DATAsA is not in the data cache 30, external memory 40 Read DATAsA from the input. Since the access speed of the external memory 40 is 60 to 100 times slower than that of the data cache 30, the waiting time of the MPU 10 'for reading data from the external memory 40 is 60 to 100 times longer.
  • DATAsA can be read from the external memory 40.
  • the reading (S 172) and FuncB (S 178) of DATAs B cannot be executed until the execution of FuncA (S 174) using the read DATAs A is completed.
  • FIG. 6 is a flowchart showing an example of a program that causes the MPU 10 ′ to execute two routines (FuncA and FuncB).
  • the MPU 10 reads out FuncA (S190) and executes it (S192), and then reads out FuncB (S194) and executes it (S196).
  • prefetching As a method of reducing the increase in the waiting time of the MPU 10 due to such a cache 'hit of the memory 20 or 30' miss, an instruction which is expected to become necessary in near parallel to the program in parallel with the processing being executed Alternatively, there is prefetching (prefetching) in which data is read out to the MPU 10 'as much as possible.
  • prefetching For the pre-touch, for example, a touch instruction is used.
  • the touch instruction is an instruction for instructing the fetch unit 22 to read an instruction or data.
  • the touch instruction or data requested by the touch instruction is read from the external memory 40 to the cache memories 20 and 30. Even while the touch instruction is being executed, the execution unit 26 can execute other instructions in parallel.
  • the program can notify the MPU 10 'of an instruction or data expected to be accessed in the near future.
  • prediction of the instruction or data to be prefetched is usually performed in the state of the source program before executing the program.
  • Prefetched instructions or data are not necessarily needed because the instructions or data that are expected to be needed before the execution of the program are read.
  • the effectiveness of prefetch depends on the accuracy of the prediction before the program is executed, and does not always have an effect.
  • multithreading There is also a method called multithreading that changes the order of instruction execution by using OS during the execution of a program.
  • the scheduler switches the other executable thread to the running state.
  • a thread is a unit that can change the execution order of a program, and each thread is called a content related to the execution state of the program. Has information that can be lost.
  • contexts which are called context switches, are saved to registers and restored. Executing a context switch involves an interrupt indicating that the running thread has entered the wait state, starting the scheduler, accessing a register, and switching the execution of the thread.
  • the execution time of the context switch is sufficiently short and the multi-thread works effectively.
  • the context switch execution time is not short and the multi' thread does not work effectively.
  • An object of the present invention is to reduce a decrease in the utilization rate of an MPU due to a cache 'memory hit' miss.
  • the instructions executed by the execution unit include a test instruction for confirming whether a required routine or data structure exists in the cache memory.
  • a microprocessor executes a test instruction immediately before reading a routine or data structure, so that the routine or data structure being read is keyed. ⁇ You can know beforehand whether or not it exists in memory.
  • the instruction execution order scheduling method of the present invention just before reading a routine or a data structure capable of parallel processing, it is checked whether or not the routine or the data structure exists in the cache memory.
  • FIG. 1 is a block diagram showing one configuration example of the MPU according to the present invention.
  • FIG. 2 is a flowchart showing one embodiment of the scheduling according to the present invention.
  • FIG. 3 is a flowchart showing another embodiment of the scheduling according to the present invention.
  • FIG. 4 is a block diagram showing a configuration example of a conventional MPU.
  • Fig. 5 (a) is a flowchart showing an example of data processing performed by the MPU.
  • Fig. 5 (b) is a routine that executes the routine using the same data structure in Fig. 5 (a).
  • FIG. 11 is a flow chart chart.
  • FIG. 6 is a flowchart showing an example of the routine execution of the MPU.
  • the execution unit 26 of the MPU 10 has a specified routine or data structure stored in the cache memory 14.
  • a test instruction has been added to check for existing forces.
  • the MPU 10 checks whether the routine or data structure specified by the test instruction exists in the instruction cache 20 or the data cache 30 or exists ("1"). Returns a result that does not exist ("0"). This result is stored in general-purpose register 32.
  • the test instruction is executed in the execution unit 26 of the MPU 10 like other instructions.
  • the processing order specified by the program cannot be changed based on the hardware viewpoint. However, there are cases where processing can be performed without problems even if the processing order is changed based on the viewpoint of software. For example, there are cases where the same processing is repeated for a plurality of data structures that do not have a dependency, or where a plurality of independent processings are performed.
  • a description will be given of a conventional (FIG. 5B) scheduling of the execution order of FuncA and FuncB using DATAsA and DATAsB as an example.
  • DATAsA and DATAsB are independent data structures, respectively, and FuncA and FuncB are independent routines.
  • the order of reading DATAsA and DATAsB and reading and executing FuncA and FuncB can be interchanged.
  • DATAs A, DATAs B and Func A, Func B are data units and instruction units, respectively, as viewed from the program.
  • FIG. 2 shows the conventional (FIG. 5 (b)) flow chart showing the scheduling part (S110, S112, S114, S116, S118, S122, S124, S126) of the present invention. , S128, S130) are shown in the flow chart.
  • the reading and processing portions (S172, S174, S182, S176, S178, S186) of DATAs A and DATAsB are the same as the conventional one (FIG. 5 (b)).
  • S172 just before reading DATAsA (S172), it is checked whether DATAsA exists in the data cache 30 (S114). This check is performed using test instructions. Send test instruction to MPU10 Then, MPU10 checks whether DATAsA exists in data cache 30 ("1") or does not exist (“0"), and stores the result ("1" or "0") in general-purpose register 32. I do.
  • MTAsA is read from the data cache 30 (S172), and FuncA and FuncB using DATAsA are executed by the MPU 10 (S174, S182). . If it does not exist, the conventional touch instruction is sent to the MPU 10 to prefetch DATAsA (S118). This prefetch can be performed in parallel with the execution of other instructions of the execution unit 26.
  • DATAsB similarly to DATAsA, immediately before reading DATAsB (S176), it is confirmed by a test instruction whether DATAsB exists in the data cache 30 (S124). As in the case of MTAsA, when DATAsB exists in the data cache 30 ⁇ , DATAsB is read (S176), and the MPU 10 executes FuncA and FuncB (S178, S186). If it does not exist, prefetch DATAsB (S128).
  • a parameter DoneDA indicating whether FuncA and FuncB using DATAsA have been completed and a parameter DoneDB indicating whether FuncA and FuncB using DATAsB have been completed are used. If DoneDA and DoneDB are "1", FuncA and FuncB using DATAs A and DATAsB have been completed, respectively. If DoneDA and DoneDB are "0”, FuncA and DATAs using DATAs A and DATAsB have been completed. Indicates that FuncB is not completed. Done M and DoneDB are stored in the data cache 30 or the external memory 40.
  • DoneDA and DoneDB The initial values of DoneDA and DoneDB are "0" (S110). When FuncA and FuncB using DATAsA are completed, DoneDA is updated to "1" (S116). When FuncA and FuncB using DATAsB are completed, DoneDB is also set to "1". (S126) By referring to DoneDA and DoneDB, it is possible to confirm whether Func A and Func B using DAT AsA and DATAs B have been completed (S1 12). , S 122, S 1 30) 0
  • execution unit 26 can execute other instructions. For example, if DoneDA is "0" and DATAsA is not in the data cache 30, but DoneDB is "0" and DATAsB is in the data cache 30, the FuncA and FuncB using DATAsB during the prefetch of DATAsA Can be performed.
  • DoneM and DoneDB are initialized (S110). Next, it is checked whether Func A and FuncB using DATAsA have been completed with reference to DcmeDA (S112). If DoneDA is "0", Func A and FuncB using DATAs A have not been executed yet, so it is confirmed by a test instruction whether DATAsA exists in the data cache 30 (S114). .
  • Whether or not DATAsA exists in the data cache 30 can be determined based on whether or not all data included in the DAT AsA exists in the data cache 30. It can also be determined by whether or not the data DATA-A0 exists in the data cache 30 ⁇ . If D ATA-A0 exists in the data cache 30, the other parts (DATA-Al, DAT A-A2,;) are also considered to exist in the data cache 30. It is possible to easily and quickly determine the hit and hit / miss mistakes.
  • DATAsA exists in the data cache 30
  • DATAsA is read from the data cache 30 (S172), and FuncA and FuncB are executed (S174, S182).
  • DoneDA is updated to "1" (S116). If DoneDA is "1", the portions related to DATAsA (S114, S172, S174, S182, S116, S118) are not executed (S112).
  • DATAsA does not exist in the data cache 30
  • a touch instruction used in the conventional prefetch is sent to the MPU 10 (S118) to prefetch DATAsA.
  • FuncA and FuncB using DATAsB can be executed in parallel.
  • the following portion related to DATAsB (S122, S124, S176, S178, S186, S126, S128) is the portion related to DATAsA described above (S112, S114, S128). 172, S174, S182, S116, S118). If FuncA and FuncB using DATAsB are not completed (S122), it is confirmed by a test instruction whether DATAsB exists in the data cache 30 (S124). If the data exists in the data cache 30, DATAsB is read from the data cache 30 (S176), and FuncA and FuncB are executed (S178, S186). If it does not exist, prefetching of DATAsB is performed (S128).
  • FuncA and FuncB using DATAsB can be executed (S1 78, S 186) 0 When FuncA and FuncB using DATAsB are completed (S126), FuncA and FuncB using DATAs A prefetched to the data cache 30 during the processing are executed (78). S174, S182). Data ⁇ DatasB present in the cache 30 is processed before DATAsA not present in the cache 30, and DATAsA can be prefetched in parallel with the processing of DATAsB. The waiting time of MP U10 at the time can be shortened. Since the prefetch is performed after confirming the hit / miss of the data cache 30, unlike the conventional prefetch based on the prediction before executing the program, useless prefetch is not executed.
  • DATAsA, DATAsB have been described as examples, but the number of data structures that can be processed in parallel is arbitrary. For example, if the number of data structures that can be processed in parallel is 5, five parameters indicating whether or not the routine using each data structure has been completed (for example, DoneDA, Done DB, DoneDC, DoneDD, DoneDE), a test instruction is executed immediately before each data structure is read out as in FIG. 2, and processing can be executed from the data structure confirmed to exist in the data cache 30. There may be a plurality of groups of data structures that can be processed in parallel. A data structure may contain only one piece of data and no power.
  • FIG. 3 shows the conventional (FIG. 6) flow chart showing the scheduling part (S140, S142, S144, S146, S148, S152, S154, S156, S15) of the present invention. 8, the flow chart with S160) added is shown.
  • the readout and execution part (S190, S192, S194, S196) of FuncA and FuncB are It is the same as Fig. 6).
  • DoneFA is a parameter indicating whether FuncA has been executed
  • DoneFB is a parameter indicating whether FuncB has been executed. If DoneFA and DoneFB are "1", it indicates that FuncA and FuncB have been executed, respectively, and if DoneFA and DoneFB are "0", it indicates that FuncA and FuncB have not been executed.
  • the scheduling of the routine is the same as the scheduling of the data structure (DATAsA, DATAsB) described above.
  • a test instruction S144, S154. If it exists, the instruction is read from the instruction cache 20 (S190, S194) and executed (S192, S196). If not, the instruction is prefetched (S148, S158).
  • Whether FuncA exists in the instruction cache 20 or not can be determined based on whether all instructions included in FuncA exist in the instruction cache 20, but for simplicity, the first instruction of FuncA Inst- The determination can also be made based on whether or not A0 exists in the instruction cache 20. If Inst-AO exists in instruction cache 20, other parts (Inst-Al, Inst-A2,) are also considered to be present in instruction cache 20, so that it is easy and easy to determine cache hit and hit / miss. Can be done at high speed.
  • FuncA is not in instruction cache 20 and FuncB is in instruction cache 20
  • FuncB can be executed in parallel with FuncA prefetch (S148). (S196).
  • FuncA prefetched by the instruction cache 20 is executed while FuncB is being executed (S192).
  • Instruction cache 20 more than FuncA not present in instruction cache 20 Since the existing Func B is executed first, and the Func A can be prefetched in parallel with the execution of Func B, the wait time of the MPU 10 when the instruction cache 20 hits or misses can be shortened. Since prefetching is performed after checking the hit-miss of the instruction cache 20, unlike the conventional prefetch based on the prediction before executing the program, useless prefetching is not performed.
  • the scheduling shown in FIG. 3 can be used for reading out Func A and FuncB shown in FIG. Since the instruction cache 20 and the data-cache 30 are independent of each other, reading and writing of the instruction cache 20 and reading and writing of the data cache 30 can be executed independently.
  • the scheduling part of the present invention which is added to the conventional flow charts shown in FIGS. 5 (b) and 6, is a part related to the reading and processing of the conventional routine or data structure. Does not branch at all.
  • the scheduling part added by the present invention does not affect other parts of the flow chart.
  • the present invention reorders data structures and routines. Instructed in the program. Unlike multi-threading, in which switching is controlled by the OS scheduler, since the content switch is not activated, the load on the MPU and OS is small and high-speed processing is possible.
  • Test instructions to the part immediately before reading a routine or data structure capable of parallel processing can be added automatically at compile time, or manually added to the source program.
  • the compiler can detect concurrency, and in many cases, test instructions can be added automatically at the time of compilation. Since the compiler cannot detect concurrency in the part related to 1/0 (input / output), test instructions are often added manually.
  • a test command can be sent to TLB (Translation Lookaside Buffer) used for address translation.
  • TLB is a cache memory in which a part of the address conversion table existing in the external memory 40 is stored.
  • PTE Peage Table Entry
  • Swap the data stored in B By using the MPU and the instruction execution order scheduling method of the present invention, it is possible to shorten the MPU wait time in the case of a hit / miss of the TLB as in the case of a hit / miss of the data cache and the instruction cache. Can be.
  • the test instruction may examine the instruction cache, data cache, and TLB cache hits all at once, or may examine each cache hit individually.
  • the present invention can be embodied in variously modified, modified, and modified forms based on the knowledge of those skilled in the art without departing from the spirit thereof.
  • test instruction for checking whether a required routine or data structure exists in the cache memory (instruction cache, data cache) is added.
  • the test instruction can determine whether the routine or data structure to be read exists in the cache memory immediately before reading the routine or data structure.
  • a routine or a data structure that can be processed in parallel is examined by a test instruction described above to determine whether a routine or a data structure to be read is present in a cache memory or not. Based on the result, the routine or data structure existing in the cache memory is read preferentially. Routines or data structures that exist in the cache memory are read and processed before routines or data structures that do not exist in the cache memory, and routines or data that do not exist in the cache memory are processed in parallel with the processing. Prefetching the structure can reduce the latency of the micro processor due to cache 'memory hit' misses.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Advance Control (AREA)

Abstract

The degradation of the ratio of utilization of an MPU caused by mishit of a cache memory is suppressed. A microprocessor (10) has an execution unit (26) for executing instructions including an additional test instruction to check if a desired routine including instructions or a desired data structure containing data is present in cache memories (20, 30). Right before reading such a routine, a routine included in such a data structure and parallel processable, or such a data structure, the microprocessor (10) confirms whether the routine or data structure to be read is present in the cache memories (20, 30). The routine or data structure in the cache memories (20, 30), out of the routines parallel processable and data structures, is preferentially executed by the microprocessor (10).

Description

明細書 マイクロプロセッサ及ぴ命令実行順序スケジユーリング方法 技術分野  Description Microprocessor and instruction execution order scheduling method
本発明は、 マイクロプロセッサ及ぴ命令実行順序スケジューリング方 法に関し、 より詳しくは、 プログラムが指示する順序で命令を実行する マイクロプロセッサ及ぴマイク口プロセッサの命令実行順序のスケジュ 一リング方法に関する。 背景技術  The present invention relates to a microprocessor and an instruction execution order scheduling method, and more particularly, to a method for scheduling an instruction execution order of a microprocessor and a microphone processor that executes instructions in an order specified by a program. Background art
図 4に MP U (マイクロプロセッサ ·ュニット) 10, の一構成例を示 す。 MPU10' は、 外部メモリ 40よりも小容量かつ高速アクセス可 能で、 外部メモリ 40から読み出される命令の一部及ぴデータの一部が 記憶されるキャッシュ 'メモリ 14と、 キャッシュ 'メモリ 14又は外 部メモリ 40から命令又はデータを読み出すフェッチ ·ュニット 22と、 読み出された命令を実行する実行ュニット 26, と、 実行中の命令が使 用するデータが記憶される汎用レジスタ 32と、 外部デバイス(40)が 接続されるパスインターフェイス■ュニット 1 2を含む。  Figure 4 shows an example of the configuration of an MPU (microprocessor unit) 10. The MPU 10 has a smaller capacity and higher-speed access than the external memory 40, and stores a part of the instruction read from the external memory 40 and a part of the data in the cache 'memory 14; A fetch unit 22 for reading an instruction or data from the internal memory 40, an execution unit 26 for executing the read instruction, a general-purpose register 32 for storing data used by the instruction being executed, and an external device ( 40) includes the path interface unit 12 to which it is connected.
キャッシュ 'メモリ 14は、 命令が記憶される命令キャッシュ 20と データが記憶されるデータ 'キャッシュ 30とを含む。 MPU10' は パスインタ一フェイス 'ユニット 1 2を介して外部メモリ(半導体記憶装 置) 40に接続されており、 外部メモリ 40と MPU10' 間で命令及ぴ データの読み書きが行われる。 ただし、 キャッシュ 'メモリ 20, 30の アクセス速度は外部メモリ 40よりも 60〜 100倍高速なので、 外部 メモリ 40よりもキャッシュ 'メモリ 20, 30の方を優先的に利用する。 M P U 1 0, が必要とする命令又はデータがキャッシュ ·メモリ 2 0, 3 0に存在しない場合は、 外部メモリ 4 0から命令又はデータを読み出 す。 このキャッシュ 'メモリ 2 0, 3 0に存在しない場合の外部メモリ 4 0からの命令又はデータの読み出しはハードウヱァで制御される。 例え ば、 M P U 1 0 ' 全体の制御を行うコントロール 'ユニット(図示してい ない)がこの制御を行う。 The cache 'memory 14 includes an instruction cache 20 where instructions are stored and a data' cache 30 where data is stored. The MPU 10 'is connected to an external memory (semiconductor storage device) 40 via a path interface' unit 12 ', and instructions and data are read and written between the external memory 40 and the MPU 10'. However, since the access speed of the cache memories 20 and 30 is 60 to 100 times faster than that of the external memory 40, the cache memories 20 and 30 are used with priority over the external memory 40. If the instructions or data required by the MPUs 10 and do not exist in the cache memories 20 and 30, the instructions or data are read from the external memory 40. The reading of instructions or data from the external memory 40 when it does not exist in the cache memories 20 and 30 is controlled by hardware. For example, the control unit (not shown) that controls the entire MPU 10 'performs this control.
外部メモリ 4 0はハード .ディスク(固定磁気記憶装置) 4 2とも接続 されており、 外部メモリ 4 0とハード■ディスク 4 2間で命令及ぴデー タの読み書きが行われる。 M P U 1 0 ' が必要とする命令又はデータが 外部メモリ 4 0に存在しない場合は、 ハード 'ディスク 4 2から命令又 はデータを読み出す。 この外部メモリ 4 0に存在しない場合のハード■ ディスク 4 2からの命令又はデータの読み出しはソフトウエアで制御さ れる。 通常は O S (オペレーティング 'システム)がこの制御を行う。  The external memory 40 is also connected to a hard disk (fixed magnetic storage device) 42, and instructions and data are read and written between the external memory 40 and the hard disk 42. If the command or data required by MPU 10 'is not present in external memory 40, read the command or data from hard disk 42. The reading of instructions or data from the hard disk 42 when it does not exist in the external memory 40 is controlled by software. Normally, OS (operating system) controls this.
M P U 1 0, に命令を実行させる場合、 フェッチ 'ユニット 2 2がそ の命令を命令キャッシュ 2 0又は外部メモリ 4 0から読み出す。 命令キ ャッシュ 2 0に目的の命令が存在すれば命令キャッシュ 2 0からその命 令を読み出し、 無ければ外部メモリ 4 0から読み出す。 外部メモリ 4 0 から命令を読み出した場合、 読み出した命令は命令キャッシュ 2 0にも 送られ記憶される。  To cause MPU 10 to execute an instruction, fetch unit 22 reads the instruction from instruction cache 20 or external memory 40. If the target instruction exists in the instruction cache 20, the instruction is read from the instruction cache 20; otherwise, the instruction is read from the external memory 40. When an instruction is read from the external memory 40, the read instruction is also sent to and stored in the instruction cache 20.
フェッチ.ュニット 2 2に読み出された命令は、 実行ュニット 2 6 , に送られ実行される。 命令の実行に必要なデータは、 データ■キヤッシ ュ 3 0又は外部メモリ 4 0から汎用レジスタ 3 2に読み出される。 デ一 タ■キャッシュ 3 0に目的のデータが存在すればデータ ·キャッシュ 3 0からそのデータを読み出し、 無ければ外部メモリ 4 0から読み出す。 外部メモリ 4 0から読み出したデータはデータ ·キャッシュ 3 0にも送 られ記憶される。 図 5 (a)に、 2つのデータ(DATAsA, DATAsB)を使用 する 2種類のルーチン(Func A, Func B)を MP U 10, に実行させるプロ グラムを例としたフロー 'チャートを示す。 図 5 (a)では、 主にデータ( DATAsA. DATAsB)の読み出し及ぴ処理部分を図示している。 MPU10 ' は、 図 5 (a)に示すプログラムで指示された実行順序でデータの読み 出し及ぴ処理を行う。 The instruction read by the fetch unit 22 is sent to the execution unit 26, where it is executed. Data necessary for executing the instruction is read from the data cache 30 or the external memory 40 to the general-purpose register 32. If the target data exists in the data cache 30, the data is read from the data cache 30; otherwise, the data is read from the external memory 40. Data read from external memory 40 is also sent to data cache 30. And stored. Fig. 5 (a) shows a flowchart of an example of a program that causes MPU 10 to execute two types of routines (Func A, Func B) using two data (DATAsA, DATAsB). FIG. 5 (a) mainly shows the reading and processing of data (DATAsA. DATAsB). The MPU 10 'reads and executes data in the execution order specified by the program shown in FIG. 5 (a).
DATAsAと DATAsBは、 それぞれ幾つかのデータ(DATA- A0, DATA- Al, DAT DATAsA and DATAsB each contain some data (DATA-A0, DATA-Al, DAT
A-A2, と、 DATA - BO, DATA - Bl, DATA - B2, )から構成されたデ一タ 構造体である。 これら DATAs Aと DATAs Bは各々独立したデータである。 A-A2, and DATA-BO, DATA-Bl, DATA-B2,). These DATAs A and DATAs B are independent data.
FuncA,FuncBは、 プログラムの一部分を構成する、 ある機能をもった 一連の命令群である。 FuncAと FuncBは、 それぞれ幾つかの命令(Inst - FuncA and FuncB are a series of instructions with a certain function that constitute a part of the program. FuncA and FuncB have several instructions (Inst-
AO, Inst-Al, Inst-A2, と、 Inst- B0, Inst- Bl, Inst-B2, )から構 成されている。 FuncAと FuncBは各々独立した命令であり、 例えば、 分 岐命令が無い限り FuncAは Inst- A0, Inst-Al, Inst- A2, の順に命令を 実行し、 FuncBは Inst- BO, Inst- Bl, Inst- B2, の順に命令を実行する c 図 5 (a)に示すように、 MPU 10, は、 DATAsAを読み出して(S 1 72)、 DATAs Aを使用した Func Aを実行し(S 174)、 次に DATAsBを読 み出して(S 1 76)、 DATAsBを使用した Func Aを実行する(S 1 78)。 続いて、 DATAs Aを読み出して(S 1 72, ), DATAsAを使用した FuncB を実行し(S 182)、 次に DATAsBを読み出して(S 176' ) DATAsB を使用した FuncBを実行する(S 186)。 AO, Inst-Al, Inst-A2, and Inst-B0, Inst-Bl, Inst-B2,). FuncA and FuncB are independent instructions. For example, unless there is a branch instruction, FuncA executes instructions in the order of Inst-A0, Inst-Al, Inst-A2, and FuncB executes Inst-BO, Inst-Bl, Execute the instruction in the order of Inst-B2, c As shown in FIG. 5 (a), the MPU 10, reads out DATAsA (S172) and executes Func A using DATAs A (S174). Then, DATAsB is read (S 176), and Func A using DATAsB is executed (S 178). Subsequently, DATAs A is read (S 172,), and FuncB using DATAsA is executed (S182). Next, DATAsB is read (S176 ′), and FuncB using DATAsB is executed (S186). ).
図 5 (a)に示す順序でデータを読み出す場合、 読み出そうとしている データがデータ■キャッシュ 30に無ければ、 MPU10' の待ち時間 が増加する。 例えば DATAsAを読み出して FuncA (S 174)を実行する場 合、 もし DATAsAがデータ 'キャッシュ 30に無ければ、 外部メモリ 40 力 ら DATAsAを読み出す。 外部メモリ 40のアクセス速度はデータ ·キヤ ッシュ 30よりも 60〜 100倍遅いので、 この外部メモリ 40からの データ読み出しによる MP U10' の待ち時間は 60〜100倍長くな る。 When data is read in the order shown in FIG. 5A, if the data to be read does not exist in the data / cache 30, the waiting time of the MPU 10 'increases. For example, when reading DATAsA and executing FuncA (S174), if DATAsA is not in the data cache 30, external memory 40 Read DATAsA from the input. Since the access speed of the external memory 40 is 60 to 100 times slower than that of the data cache 30, the waiting time of the MPU 10 'for reading data from the external memory 40 is 60 to 100 times longer.
しかも、 仮に DATAsBがデータ ·キャッシュ 30内に存在し、 DATAsB の方が DATAs Aよりも短時間(1/100〜1ノ60の時間)で読み出せる 状態であっても、 DATAsAを外部メモリ 40から読み出して(S 172)、 この読み出した DATAsAを使用した FuncA(S 174)が実行し終わるまで、 DATAsBの読み出し(S 176)及ぴ FuncB (S 178)を実行することはで きない。  Moreover, even if DATAsB exists in the data cache 30 and DATAsB can be read in a shorter time (1/100 to 1/60) than DATAs A, DATAsA can be read from the external memory 40. After reading (S 172), the reading (S 176) and FuncB (S 178) of DATAs B cannot be executed until the execution of FuncA (S 174) using the read DATAs A is completed.
DATAsAと DATAsBとは独立したデータであり、 FuncAと FuncBとは独 立した命令であるので、 プログラムの実行順序を図 5 (a)のフロー■チ ヤートから図 5 (b)に示すフロー ·チャートに変更することも可能であ る。 MPU10, は、 DATAs Aを読み出して(S 172 )FmicA及ぴ FuncB を実行し(S 174, S 182)、 次に DATAsBを読み出して(S 176)Fu ncA及ぴ FuncBを実行する(S 178, S 186)。 しかし、 この場合も図 5 (a)と同様に、 読み出そうとしているデータがデータ ·キャッシュ 3 0に無ければ、 MP U 10, の待ち時間が增加する。  Since DATAsA and DATAsB are independent data, and FuncA and FuncB are independent instructions, the program execution order is shown in the flow chart of Fig. 5 (a) to the flow chart shown in Fig. 5 (b). It is also possible to change to The MPU 10, reads out DATAs A (S172) and executes FmicA and FuncB (S174, S182), and then reads out DATAsB (S176) and executes FuncA and FuncB (S178, S178). S 186). However, in this case, as in FIG. 5 (a), if the data to be read is not in the data cache 30, the waiting time of the MPU 10, increases.
以上、 DATAsA, MTAsBの読み出しを例にして説明した力 FuncA, Fu ncBを実行する際の FuncA,FuncBの読み出しも同様である。 図 6に、 2 つのルーチン(FuncA, FuncB)を MPU 10 ' に実行させるプログラムを 例としたフロー .チャートを示す。 MPU10' は、 FuncAを読み出し て(S 1 90)実行し(S 1 92)、 次に FuncBを読み出して(S 194)実 行する(S 196)。  As described above, the reading of FuncA and FuncB when executing the forces FuncA and FuncB described in the example of reading DATAsA and MTAsB is the same. FIG. 6 is a flowchart showing an example of a program that causes the MPU 10 ′ to execute two routines (FuncA and FuncB). The MPU 10 'reads out FuncA (S190) and executes it (S192), and then reads out FuncB (S194) and executes it (S196).
この FuncA, FuncBの実行の場合も、 上述したデータ(図 5 ( a ) , (b)) の場合と同様に、 命令キャッシュ 20に目的のルーチンが無ければ、 M PU10の待ち時間が長くなり、 MPU10の利用率は低下する。 In the case of execution of FuncA and FuncB, as in the case of the data described above (FIGS. 5A and 5B), if there is no target routine in the instruction cache 20, M The waiting time of PU10 becomes longer, and the utilization rate of MPU10 decreases.
このようなキャッシュ 'メモリ 20, 30のヒット ' ミスによる MP U 10, の待ち時間の增加を減少させる方法として、 実行中の処理と並行 して、 プログラムが近い^ I来必要になると予想した命令又はデータをあ ら力 じめ MPU10' に読み出しておくプリフェッチ (先読み)がある。 プリフヱツチには、 例えばタツチ命令を使用する。 タツチ命令は、 命 令又はデータの読み出しをフェッチ ·ュニット 22に指示する命令であ る。 タツチ命令が実行されると、 タツチ命令で要求された命令又はデー タが外部メモリ 40からキャッシュ 'メモリ 20, 30に読み出される。 タツチ命令の実行中であっても、 実行ュニット 26, は他の命令を並列 して実行することができる。 タツチ命令を用いることで、 プログラム側 から MPU10' に、 近い将来アクセスを行うと予想される命令又はデ ータを知らせることができる。 MPU10' はタツチ命令で知らされた 命令又はデータをキャッシュ 'メモリ 20, 30に予め読み出しておくこ とで、 キヤッシュ ·メモリ 20, 30のヒット率の向上を図る。  As a method of reducing the increase in the waiting time of the MPU 10 due to such a cache 'hit of the memory 20 or 30' miss, an instruction which is expected to become necessary in near parallel to the program in parallel with the processing being executed Alternatively, there is prefetching (prefetching) in which data is read out to the MPU 10 'as much as possible. For the pre-touch, for example, a touch instruction is used. The touch instruction is an instruction for instructing the fetch unit 22 to read an instruction or data. When the touch instruction is executed, the instruction or data requested by the touch instruction is read from the external memory 40 to the cache memories 20 and 30. Even while the touch instruction is being executed, the execution unit 26 can execute other instructions in parallel. By using a touch instruction, the program can notify the MPU 10 'of an instruction or data expected to be accessed in the near future. The MPU 10 'improves the hit rate of the cache memories 20 and 30 by reading the instruction or data notified by the touch instruction into the caches '20 and 30 in advance.
し力 し、 プリフェッチする命令又はデータの予測は、 通常プログラム を実行する以前のソース .プログラムの状態で行われる。 プログラムの 実行以前に必要になると予想された命令又はデータを読み出すため、 プ リフェッチされた命令又はデータが本当に必要になるとは限らない。 プ リフェッチが有効に機能するかどうかはプログラム実行前の予測の精度 に左右され、 必ず効果が現れるわけではない。  However, prediction of the instruction or data to be prefetched is usually performed in the state of the source program before executing the program. Prefetched instructions or data are not necessarily needed because the instructions or data that are expected to be needed before the execution of the program are read. The effectiveness of prefetch depends on the accuracy of the prediction before the program is executed, and does not always have an effect.
プログラムの実行途中で、 o Sによつて命令実行順序の変更を行うマ ルチ■スレツドと呼ばれる方法もある。 実行中のスレツドが待ち状態に なると、 スケジューラが実行可能な他のスレツドを実行状態に切り換え る。 スレッ ドはプログラムを構成する実行順序の入れ替えが可能な単位 であり、 各スレツドはプログラムの実行状態に関するコンテタストと呼 ばれる情報を持つ。 O Sがスレツド単位で実行順序を入れ替えるときに は、 コンテクスト ■スィツチと呼ばれるコンテキストのレジスタへの退 避及ぴ復帰が発生する。 コンテクスト ·スィツチの実行には、 実行中の スレツドが待ち状態になったことを示す割り込み,スケジューラの起動, レジスタへのアクセス,スレツドの実行切り換えが伴う。 ハード ·ディス クへのアクセス待ち時間にコンテキスト ·スィツチを実行する場合は、 コンテクスト ·スィツチの実行時間は十分短く、 マルチ ·スレツドは有 効に機能する。 し力 し、 キャッシュ ' ミスによる待ち時間にコンテキス ト ·スィツチを実行する場合は、 コンテキスト ·スィツチの実行時間は 短くなく、 マルチ ' スレツドは有効に機能しない。 There is also a method called multithreading that changes the order of instruction execution by using OS during the execution of a program. When a running thread enters the waiting state, the scheduler switches the other executable thread to the running state. A thread is a unit that can change the execution order of a program, and each thread is called a content related to the execution state of the program. Has information that can be lost. When the OS changes the execution order in units of threads, contexts, which are called context switches, are saved to registers and restored. Executing a context switch involves an interrupt indicating that the running thread has entered the wait state, starting the scheduler, accessing a register, and switching the execution of the thread. If the context switch is executed while waiting for access to the hard disk, the execution time of the context switch is sufficiently short and the multi-thread works effectively. However, if the context switch is executed during a cache 'miss latency, the context switch execution time is not short and the multi' thread does not work effectively.
プログラムの実行途中で、 MP U内部で命令実行順序の変更を行うァ ゥト 'ォブ ·オーダーと呼ばれる方法もある。 アウト 'ォブ ·オーダは、 複数の実行ュニットを用いた並列処理を行うスーパー ·スカラー方式の M P Uで行われ、 実行ユニットが待ち状態になると、 プログラムが指示 する命令実行順序に制限されず、 実行可能な命令から先に実行していく。 し力 し、 M P U側で勝手に命令実行順序を変更しているので、 先に実行 した命令が全て無駄になることも多い。 発明の開示  There is also a method called "art-of-order" that changes the order of instruction execution inside the MPU during program execution. Out-of-order is performed by a super-scalar MPU that performs parallel processing using multiple execution units.When the execution unit enters a wait state, execution is not restricted to the instruction execution order specified by the program. The instructions that can be executed are executed first. However, since the order of instruction execution is arbitrarily changed on the MPU side, all previously executed instructions are often wasted. Disclosure of the invention
本発明の目的は、 キャッシュ 'メモリのヒット ' ミスによる MP Uの 利用率の低下を低減させることにある。  An object of the present invention is to reduce a decrease in the utilization rate of an MPU due to a cache 'memory hit' miss.
本発明のマイクロプロセッサは、 実行ユニットが実行する命令に、 所 要のルーチン又はデータ構造体が前記キャッシュ ·メモリ内に存在する か否かを確認するテスト命令が含まれる。 このようなマイクロプロセッ サは、 ルーチン又はデータ構造体を読み出す直前にテスト命令を実行す ることにより、 読み出そうとしているルーチン又はデータ構造体がキヤ ッシュ ·メモリ内に存在するか否かを事前に知ることができる。 In the microprocessor of the present invention, the instructions executed by the execution unit include a test instruction for confirming whether a required routine or data structure exists in the cache memory. Such a microprocessor executes a test instruction immediately before reading a routine or data structure, so that the routine or data structure being read is keyed. · You can know beforehand whether or not it exists in memory.
本発明の命令実行順序スケジユーリング方法は、 並列処理が可能なル 一チン又はデータ構造体を読み出す直前に、 そのルーチン又はデータ構 造体がキャッシュ · メモリ内に存在するか否かを確認する確認ステップ と、 並列処理が可能なルーチン又はデータ構造体の中で、 キャッシュ ' メモリ内に存在することが確認されたルーチン又はデータ構造体から優 先的にマイクロプロセッサに処理させる優先実行ステップとを含む。 図面の簡単な説明  According to the instruction execution order scheduling method of the present invention, just before reading a routine or a data structure capable of parallel processing, it is checked whether or not the routine or the data structure exists in the cache memory. The confirmation step and the priority execution step of causing the microprocessor to preferentially process the routine or data structure that is confirmed to exist in the cache memory among the routines or data structures that can be processed in parallel. Including. BRIEF DESCRIPTION OF THE FIGURES
図 1は、 本発明に係る M P Uの一構成例を示すブロック図である。 図 2は、 本発明に係るスケジューリングの一実施例を示すフロー ·チ ヤートである。  FIG. 1 is a block diagram showing one configuration example of the MPU according to the present invention. FIG. 2 is a flowchart showing one embodiment of the scheduling according to the present invention.
図 3は、 本発明に係るスケジューリングの他の実施例を示すフロー · チヤ一トである。  FIG. 3 is a flowchart showing another embodiment of the scheduling according to the present invention.
図 4は、 従来の M P Uの一構成例を示すブロック図である。  FIG. 4 is a block diagram showing a configuration example of a conventional MPU.
図 5 ( a ) は、 M P Uが行うデータ処理の一例を示すフロー .チヤ ートであり、 図 5 ( b )は図 5 ( a )中の同一データ構造体を使用するルー チンを続けて実行するフロー ·チャート図である。  Fig. 5 (a) is a flowchart showing an example of data processing performed by the MPU. Fig. 5 (b) is a routine that executes the routine using the same data structure in Fig. 5 (a). FIG. 11 is a flow chart chart.
図 6は、 M P Uのルーチン実行の一例を示すフロー ·チャートである。  FIG. 6 is a flowchart showing an example of the routine execution of the MPU.
発明を実施するための最良の態様 BEST MODE FOR CARRYING OUT THE INVENTION
次に、 本発明に係るマイクロプロセッサ及ぴ命令実行順序スケジユー リング方法の実施の形態について、 図面に基づいて詳しく説明する。 図 1に示すように、 本発明に係る M P U 1 0の実行ユニット 2 6には、 指定されたルーチン又はデータ構造体がキャッシュ 'メモリ 1 4内に存 在する力確認するテスト命令が追加されている。 テスト命令が MP U1 0に送られると、 MPU10はテスト命令が指定するルーチン又はデー タ構造体が命令キャッシュ 20又はデータ ·キャッシュ 30に存在する か調ぺ、 存在している( "1" )か存在していない( "0" )かの結果を返 す。 この結果は汎用レジスタ 32に記憶される。 テスト命令は、 他の命 令と同様に MP U 10の実行ュニット 26で実行される。 Next, an embodiment of a microprocessor and an instruction execution order scheduling method according to the present invention will be described in detail with reference to the drawings. As shown in FIG. 1, the execution unit 26 of the MPU 10 according to the present invention has a specified routine or data structure stored in the cache memory 14. A test instruction has been added to check for existing forces. When the test instruction is sent to MPU10, the MPU 10 checks whether the routine or data structure specified by the test instruction exists in the instruction cache 20 or the data cache 30 or exists ("1"). Returns a result that does not exist ("0"). This result is stored in general-purpose register 32. The test instruction is executed in the execution unit 26 of the MPU 10 like other instructions.
プログラムで指示される処理順序をハードウエアの視点に基づいて入 れ換えることはできない。 し力 し、 ソフトウェアの視点に基づいて処理 順序を入れ換えても問題無く処理を行える場合もある。 例えば、 依存関 係の無い複数のデータ構造体に対して同じ処理を繰り返す場合や、 独立 の処理を複数行う場合である。 本実施形態では、 従来(図 5 ( b ) )の DATA sA, DATAsBを使用した FuncA, FuncBの実行順序のスケジユーリングを 例にして説明を行う。 DATAsA, DATAsBは各々独立したデータ構造体であ り、 FuncA, FuncBは各々独立したルーチンであり、 DATAsA, DATAsBの 読み出し、 FuncA, FuncBの読み出し及び実行の順序はそれぞれ入れ替え 可能である。 DATAs A, DATAs B及び Func A , Func Bはそれぞれプログラム から見たデータ単位及び命令単位である。  The processing order specified by the program cannot be changed based on the hardware viewpoint. However, there are cases where processing can be performed without problems even if the processing order is changed based on the viewpoint of software. For example, there are cases where the same processing is repeated for a plurality of data structures that do not have a dependency, or where a plurality of independent processings are performed. In the present embodiment, a description will be given of a conventional (FIG. 5B) scheduling of the execution order of FuncA and FuncB using DATAsA and DATAsB as an example. DATAsA and DATAsB are independent data structures, respectively, and FuncA and FuncB are independent routines. The order of reading DATAsA and DATAsB and reading and executing FuncA and FuncB can be interchanged. DATAs A, DATAs B and Func A, Func B are data units and instruction units, respectively, as viewed from the program.
図 2に、 従来(図 5 (b))のフロー ·チャートに本発明のスケジユーリ ング部分(S 1 10, S 112, S 114, S 1 16, S 118, S 1 22, S 124, S 126, S 128, S 1 30)を追加したフロー ·チヤ一ト図を 示す。 DATAs A及ぴ DATAsBの読み出し及ぴ処理部分(S 172, S 174, S 1 82, S 176, S 178, S 186)は従来(図 5 (b))と同様である。 本発明のスケジューリング方法は、 DATAsAを読み出す(S 172)直前 に、 DATAs Aがデータ ·キャッシュ 30に存在するか確認する(S 114) 。 この確認は、 テスト命令を用いて行う。 テスト命令を MPU10に送 ると、 MPU1 0は DATAsAがデータ■キャッシュ 30に存在する( "1 " )か存在しない( "0" )かを調べ、 その結果( "1" or "0" )を汎用レ ジスタ 32に記憶する。 FIG. 2 shows the conventional (FIG. 5 (b)) flow chart showing the scheduling part (S110, S112, S114, S116, S118, S122, S124, S126) of the present invention. , S128, S130) are shown in the flow chart. The reading and processing portions (S172, S174, S182, S176, S178, S186) of DATAs A and DATAsB are the same as the conventional one (FIG. 5 (b)). In the scheduling method of the present invention, just before reading DATAsA (S172), it is checked whether DATAsA exists in the data cache 30 (S114). This check is performed using test instructions. Send test instruction to MPU10 Then, MPU10 checks whether DATAsA exists in data cache 30 ("1") or does not exist ("0"), and stores the result ("1" or "0") in general-purpose register 32. I do.
DATAsAがデータ キャッシュ 30内に存在していれば、 MTAsAをデ ータ ·キャッシュ 30から読み出して(S 172)、 DATAsAを使用した F uncA及び FuncBを MPU 10に実行させる(S 174, S 182)。 存在 していなければ、 従来から用いられているタツチ命令を MP U10に送 り、 DATAsAのプリフェッチを行う(S 1 18)。 このプリフェッチは、 実 行ュニット 26の他の命令実行と並行して行うことが可能である。  If DATAsA exists in the data cache 30, MTAsA is read from the data cache 30 (S172), and FuncA and FuncB using DATAsA are executed by the MPU 10 (S174, S182). . If it does not exist, the conventional touch instruction is sent to the MPU 10 to prefetch DATAsA (S118). This prefetch can be performed in parallel with the execution of other instructions of the execution unit 26.
DATAsBについても、 DATAsAと同様に、 DATAsBを読み出す(S 176) 直前に、 DATAsBがデータ ·キャッシュ 30内に存在するかテスト命令で 確認する(S 1 24)。 MTAsAの場合と同様に、 DATAsBがデータ ·キヤ ッシュ 30內に存在する場合は DATAsBを読み出して(S 1 76)、 MPU 10に FuncA及ぴ FuncBを実行させる(S 178, S 186)。 存在しない 場合は DATAsBをプリフェッチする(S 128)。  As for DATAsB, similarly to DATAsA, immediately before reading DATAsB (S176), it is confirmed by a test instruction whether DATAsB exists in the data cache 30 (S124). As in the case of MTAsA, when DATAsB exists in the data cache 30 內, DATAsB is read (S176), and the MPU 10 executes FuncA and FuncB (S178, S186). If it does not exist, prefetch DATAsB (S128).
本発明では、 DATAsAを使用した FuncA及ぴ FuncBが完了したか否かを 示すパラメータ DoneDAと、 DATAsBを使用した FuncA及ぴ FuncBが完了し たか否かを示すパラメータ DoneDBを使用している。 DoneDA, DoneDBが "1 " の場合は DATAs A, DATAsBを使用した FuncA及び FuncBがそれぞれ完了 していることを示し、 DoneDA, DoneDBが "0" の場合は DATAs A, DATAsB を使用する FuncA及ぴ FuncBがそれぞれ未完了であることを示す。 Done M及ぴ DoneDBはデータ ·キャッシュ 30又は外部メモリ 40に記憶され る。  In the present invention, a parameter DoneDA indicating whether FuncA and FuncB using DATAsA have been completed and a parameter DoneDB indicating whether FuncA and FuncB using DATAsB have been completed are used. If DoneDA and DoneDB are "1", FuncA and FuncB using DATAs A and DATAsB have been completed, respectively. If DoneDA and DoneDB are "0", FuncA and DATAs using DATAs A and DATAsB have been completed. Indicates that FuncB is not completed. Done M and DoneDB are stored in the data cache 30 or the external memory 40.
DoneDA, DoneDBの初期値は、 "0" である(S 1 10)。 DATAsAを使用 した FuncA及ぴ FuncBが完了すれば、 DoneDAは "1" に更新され(S 1 1 6)、 DATAsBを使用した FuncA及び FuncBが完了すれば、 DoneDBも "1 " に更新される(S 126)。 DoneDA, DoneDBを参照することにより、 DAT AsA, DATAs Bを使用した Func A及ぴ Func Bが完了したか否かをそれぞれ 確認することができる(S 1 12, S 122, S 1 30)0 The initial values of DoneDA and DoneDB are "0" (S110). When FuncA and FuncB using DATAsA are completed, DoneDA is updated to "1" (S116). When FuncA and FuncB using DATAsB are completed, DoneDB is also set to "1". (S126) By referring to DoneDA and DoneDB, it is possible to confirm whether Func A and Func B using DAT AsA and DATAs B have been completed (S1 12). , S 122, S 1 30) 0
DoneMを参照したときに( S 1 1 2) DATAs Aを使用した Func A及ぴ Fun cBが未完了の場合は、 DATAsAがデータ ·キヤッシュ 30内に存在する 力確認を行う(S 1 14)。 同様に、 DoneDBを参照したときに(S 122) DATAsBを使用した Func A及ぴ Func Bが未完了の場合は、 DATAsBがデー タ ·キャッシュ 30内に存在するか確認を行う(S 124)。  When Func A and Fun cB using DATAs A are not completed when DoneM is referenced (S1 12), the force confirmation that DATAsA exists in the data cache 30 is performed (S114). Similarly, when Func A and Func B using DATAsB are not completed when DoneDB is referred to (S122), it is confirmed whether DATAsB exists in the data cache 30 (S124).
データ又は命令のプリフェッチ中でも、 実行ュニット 26は他の命令 を実行できる。 例えば、 DoneDAが "0" かつ DATAsAがデータ ·キヤッシ ュ 30に無く、 DoneDBが " 0 " かつ DATAsBがデータ 'キャッシュ 30内 に存在する場合、 DATAsAのプリフェッチ中に DATAsBを使用した FuncA 及ぴ FuncBを実行することができる。  While data or instructions are prefetched, execution unit 26 can execute other instructions. For example, if DoneDA is "0" and DATAsA is not in the data cache 30, but DoneDB is "0" and DATAsB is in the data cache 30, the FuncA and FuncB using DATAsB during the prefetch of DATAsA Can be performed.
次に、 DATAsA, DATAsBを使用した FuncA, FuncBの実行順序のスケジ ユーリングについて、 その作用を説明する。  Next, the operation of the scheduling of the execution order of FuncA and FuncB using DATAsA and DATAsB will be described.
最初に DoneM及ぴ DoneDBが初期化される(S 1 10)。 次に、 DATAsAを 使用した Func A及び FuncBが完了しているか否かを、 DcmeDAを参照して 調べる(S 112)。 DoneDAが "0" の場合は、 DATAs Aを使用した Func A 及び FuncBがまだ実行されていないので、 DATAsAがデータ ·キャッシュ 30内に存在するか否かをテスト命令で確認する(S 1 14)。  First, DoneM and DoneDB are initialized (S110). Next, it is checked whether Func A and FuncB using DATAsA have been completed with reference to DcmeDA (S112). If DoneDA is "0", Func A and FuncB using DATAs A have not been executed yet, so it is confirmed by a test instruction whether DATAsA exists in the data cache 30 (S114). .
DATAsAがデータ ·キャッシュ 30内に存在するか否かの判断は、 DAT AsAに含まれる全データがデータ ·キャッシュ 30に存在するか否かで 判断することもできるが、 簡略化して、 DATAsAの先頭データ DATA- A0が データ ·キャッシュ 30內に存在するか否かで判断することもできる。 D ATA- A0がデータ ·キャッシュ 30に存在すれば、 他の部分(DATA- Al, DAT A-A2, ;)もデータ■キャッシュ 30に存在すると見なすことで、 キヤ ッシュ ' ヒットとヒット■ ミスの判断を簡単かつ高速に行うことができ る。 Whether or not DATAsA exists in the data cache 30 can be determined based on whether or not all data included in the DAT AsA exists in the data cache 30. It can also be determined by whether or not the data DATA-A0 exists in the data cache 30 內. If D ATA-A0 exists in the data cache 30, the other parts (DATA-Al, DAT A-A2,;) are also considered to exist in the data cache 30. It is possible to easily and quickly determine the hit and hit / miss mistakes.
DATAsAがデータ ·キャッシュ 30内に存在した場合は、 DATAsAをデ ータ ·キャッシュ 30から読み出して(S 172)、 FuncA,FuncBを実行 する(S 174,S 182)。 DATAsAを使用した FuncA及び FuncBが完了 すると、 DoneDAを "1" に更新する(S 116)。 DoneDAが "1" である と、 これら DATAsAに関係する部分(S 1 14, S 172, S 174, S 18 2, S 1 16,S 1 18)は実行されなくなる(S 112)。  If DATAsA exists in the data cache 30, DATAsA is read from the data cache 30 (S172), and FuncA and FuncB are executed (S174, S182). When FuncA and FuncB using DATAsA are completed, DoneDA is updated to "1" (S116). If DoneDA is "1", the portions related to DATAsA (S114, S172, S174, S182, S116, S118) are not executed (S112).
DATAsAがデータ ·キャッシュ 30内に存在しない場合は、 従来のプリ フェッチでも使用していたタツチ命令を MP U10に送り(S 118)、 D ATAsAをプリフェッチする。 この DATAsAのプリフェッチ中に、 DATAsB を使用した FuncA及び FuncBを並行して実行することも可能である。  If DATAsA does not exist in the data cache 30, a touch instruction used in the conventional prefetch is sent to the MPU 10 (S118) to prefetch DATAsA. During prefetching of DATAsA, FuncA and FuncB using DATAsB can be executed in parallel.
次の DATAsBに関係する部分(S 122, S 124, S 176, S 178, S 186, S 126, S 1 28)は、 上述した DATAsAに関係する部分(S 1 1 2, S 1 14,S 172, S 174, S 182, S 116,S 118)と同様 である。 DATAsBを使用した FuncA及び FuncBが未完了であれば(S 12 2)、 DATAsBがデータ ·キャッシュ 30内に存在するか否かをテスト命 令で確認する(S 124)。 データ ·キャッシュ 30内に存在した場合は、 DATAsBをデータ■キャッシュ 30から読み出して(S 176)、 FuncA, FuncBを実行する(S 178, S 186)。 存在しない場合は、 DATAsBの プリフヱツチを行う (S 1 28)。  The following portion related to DATAsB (S122, S124, S176, S178, S186, S126, S128) is the portion related to DATAsA described above (S112, S114, S128). 172, S174, S182, S116, S118). If FuncA and FuncB using DATAsB are not completed (S122), it is confirmed by a test instruction whether DATAsB exists in the data cache 30 (S124). If the data exists in the data cache 30, DATAsB is read from the data cache 30 (S176), and FuncA and FuncB are executed (S178, S186). If it does not exist, prefetching of DATAsB is performed (S128).
DoneDA及ぴ DoneDBが共に "1" であれば、 DATAsA, DATAsBを使用した F uncA,FuncBは全て完了している(S 1 30)。 従来(図 5 (b))の場合と 異なり、 例えば DATAsAがデータ ·キャッシュ 30に無く、 DATAsBがデ 一タ ·キャッシュ 30に存在する場合、 DATAsAのプリフェッチ(S 11 If both DoneDA and DoneDB are "1", FuncA and FuncB using DATAsA and DATAsB have all been completed (S130). Unlike the conventional case (Fig. 5 (b)), for example, when DATAsA is not in the data cache 30 and DATAsB is in the data cache 30, the prefetch of DATAsA (S11
8 )と並行して、 DATAsBを使用した FuncA及ぴ FuncBが実行できる( S 1 78, S 186)0 DATAsBを使用した FuncA及ぴ FuncBが完了すると(S 1 26)、 その処理中にデータ ·キャッシュ 30にプリフェッチされた D ATAs Aを使用した Func A及ぴ FuncBを実行する(S 1 74, S 182)。 データ ·キヤッシュ 30に存在しない DATAsAよりもデータ ·キヤッシ ュ 30に存在する DATAsBを先に処理すると共に、 DATAsBの処理と並行 して DATAsAのプリフェッチを行えるため、 データ ·キャッシュ 30のヒ ット · ミス時の MP U10の待ち時間を短くできる。 データ■キヤッシ ュ 30のヒット · ミスを確認した後にプリフェッチを行うので、 プログ ラムの実行前の予想に基づいた従来のプリフェッチとは異なり、 無駄な プリフェッチは実行されない。 In parallel with 8), FuncA and FuncB using DATAsB can be executed (S1 78, S 186) 0 When FuncA and FuncB using DATAsB are completed (S126), FuncA and FuncB using DATAs A prefetched to the data cache 30 during the processing are executed (78). S174, S182). Data ・ DatasB present in the cache 30 is processed before DATAsA not present in the cache 30, and DATAsA can be prefetched in parallel with the processing of DATAsB. The waiting time of MP U10 at the time can be shortened. Since the prefetch is performed after confirming the hit / miss of the data cache 30, unlike the conventional prefetch based on the prediction before executing the program, useless prefetch is not executed.
以上、 2つのデータ構造体 (DATAsA, DATAsB)を例にして説明したが、 この並列処理が可能なデータ構造体数は任意である。 例えば並列処理が 可能なデータ構造体数が 5個の場合は、 各データ構造体を使用したルー チンが完了しているか否かを示すパラメータを 5つ(例えば DoneDA, Done DB, DoneDC, DoneDD, DoneDE)に増やして、 図 2と同様に各データ構造体を 読み出す直前にテスト命令を実行し、 データ .キャッシュ 30内に存在 することが確認されたデータ構造体から処理を実行することができる。 並列処理が可能なデータ構造体のグループが複数存在する場合もある。 データ構造体は、 データを 1つだけし力含まない場合もある。  In the above, two data structures (DATAsA, DATAsB) have been described as examples, but the number of data structures that can be processed in parallel is arbitrary. For example, if the number of data structures that can be processed in parallel is 5, five parameters indicating whether or not the routine using each data structure has been completed (for example, DoneDA, Done DB, DoneDC, DoneDD, DoneDE), a test instruction is executed immediately before each data structure is read out as in FIG. 2, and processing can be executed from the data structure confirmed to exist in the data cache 30. There may be a plurality of groups of data structures that can be processed in parallel. A data structure may contain only one piece of data and no power.
以上、 データ構造体 (DATAsA, DATAsB)を例にして説明したが、 ルーチ ン(Func A , Func B )を実行する際の Func A , Func Bの読み出しについても、 本発明のスケジューリング方法を用いることができる。 図 3に、 従来(図 6)のフロー ·チャートに本発明のスケジューリング部分(S 140, S 1 42, S 144, S 146, S 148, S 1 52, S 1 54, S 156, S 1 5 8, S 160 )を追加したフロー 'チャートを示す。 FuncA及ぴ FuncBの 読み出し及ぴ実行部分(S 190, S 1 92, S 1 94, S 1 96)は従来( 図 6)と同様である。 Although the data structure (DATAsA, DATAsB) has been described above as an example, the scheduling method of the present invention is also used for reading out Func A and Func B when executing the routine (Func A, Func B). Can be. FIG. 3 shows the conventional (FIG. 6) flow chart showing the scheduling part (S140, S142, S144, S146, S148, S152, S154, S156, S15) of the present invention. 8, the flow chart with S160) added is shown. The readout and execution part (S190, S192, S194, S196) of FuncA and FuncB are It is the same as Fig. 6).
図 3において、 DoneFAは FuncAが実行されたか否かを示すパラメータ であり、 DoneFBは FuncBが実行されたか否かを示すパラメータである。 D oneFA, DoneFBが "1" の場合は FuncA, FuncBがそれぞれ実行済みである ことを示し、 DoneFA, DoneFBが "0" の場合は FuncA, FuncBがそれぞれ 実行されていないことを示す。  In FIG. 3, DoneFA is a parameter indicating whether FuncA has been executed, and DoneFB is a parameter indicating whether FuncB has been executed. If DoneFA and DoneFB are "1", it indicates that FuncA and FuncB have been executed, respectively, and if DoneFA and DoneFB are "0", it indicates that FuncA and FuncB have not been executed.
ルーチン(FuncA, FuncB)のスケジユーリングは、 上述したデータ構造 体(DATAsA,DATAsB)のスケジューリングと同様である。 FuncA, FuncB の読み出し(S 1 90, S 1 94)前に、 FuncA, FuncBが命令キャッシュ 20に存在するか否かをテスト命令で確認する(S 144, S 1 54)。 存 在すれば、 その命令を命令キャッシュ 20から読み出して(S 1 90, S 1 94)、 実行する(S 1 92, S 1 9 6)。 存在しなければ、 その命令を プリフェッチする(S 148, S 1 5 8)。  The scheduling of the routine (FuncA, FuncB) is the same as the scheduling of the data structure (DATAsA, DATAsB) described above. Before reading out FuncA, FuncB (S190, S194), it is checked whether or not FuncA, FuncB exists in the instruction cache 20 by a test instruction (S144, S154). If it exists, the instruction is read from the instruction cache 20 (S190, S194) and executed (S192, S196). If not, the instruction is prefetched (S148, S158).
FuncAが命令キヤッシュ 20内に存在するか否かの判断は、 FuncAに 含まれる全命令が命令キヤッシュ 20に存在するか否かで判断すること もできるが、 簡略化して、 FuncAの先頭命令 Inst- A0が命令キャッシュ 2 0内に存在するか否かで判断することもできる。 Inst-AOが命令キヤッシ ュ 20に存在すれば、 他の部分(Inst- Al, Inst- A2, )も命令キヤッシ ュ 20に存在すると見なすことで、 キャッシュ . ヒットとヒット · ミス の判断を簡単かつ高速に行うことができる。  Whether FuncA exists in the instruction cache 20 or not can be determined based on whether all instructions included in FuncA exist in the instruction cache 20, but for simplicity, the first instruction of FuncA Inst- The determination can also be made based on whether or not A0 exists in the instruction cache 20. If Inst-AO exists in instruction cache 20, other parts (Inst-Al, Inst-A2,) are also considered to be present in instruction cache 20, so that it is easy and easy to determine cache hit and hit / miss. Can be done at high speed.
従来(図 6)の場合と異なり、 FuncAが命令キャッシュ 20に無く、 Fu ncBが命令キャッシュ 20に存在する場合は、 FuncAのプリフェッチ(S 1 48)と並行して、 FuncBを実行することができる(S 1 96)。 FuncB が実行し終わると(S 1 56)、 FuncBが実行されている間に命令キヤッ シュ 20にプリフェッチされた FuncAを実行する(S 1 9 2)。  Unlike the conventional case (Fig. 6), if FuncA is not in instruction cache 20 and FuncB is in instruction cache 20, FuncB can be executed in parallel with FuncA prefetch (S148). (S196). When the execution of FuncB is completed (S156), FuncA prefetched by the instruction cache 20 is executed while FuncB is being executed (S192).
命令キヤッシュ 20に存在しない FuncAよりも命令キャッシュ 20に 存在する Func Bを先に実行すると共に、 Func Bの実行と並行して Func A のプリフェッチを行えるため、 命令キャッシュ 2 0のヒット . ミス時の M P U 1 0の待ち時間を短くできる。 命令キャッシュ 2 0のヒット - ミ スを確認した後にプリフヱツチを行うので、 プログラム実行前の予想に 基づいた従来のプリフェッチとは異なり、 無駄なプリフヱツチは実行さ れない。 Instruction cache 20 more than FuncA not present in instruction cache 20 Since the existing Func B is executed first, and the Func A can be prefetched in parallel with the execution of Func B, the wait time of the MPU 10 when the instruction cache 20 hits or misses can be shortened. Since prefetching is performed after checking the hit-miss of the instruction cache 20, unlike the conventional prefetch based on the prediction before executing the program, useless prefetching is not performed.
以上、 2つのルーチン(FuncA, Func B )を例にして説明したが、 この並 列実行が可能なルーチン数は任意である。 例えば並列実行が可能なルー チン数が 5個の場合は、 各ルーチンの実行が終了しているか否かを示す パラメータを 5つ(例えば DoneFA, DoneFB, DoneFC, DoneFD, DoneFE)に増や して、 図 3と同様に各ルーチンの読み出し前にテスト命令を実行し、 命 令キャッシュ 2 0内に存在することが確認されたルーチンから実行して いくことができる。 並列処理が可能なルーチンのグループが複数存在す る場合もある。 ルーチンは、 命令を 1つだけし力含まない場合もある。 上述したデータ構造体の読み出し時のスケジユーリングとルーチンの 読み出し時のスケジューリングとは、 任意に組み合わせることができる。 例えば、 図 2に示した Func A及び FuncBの読み出しに、 図 3に示したス ケジユーリングを用いることもできる。 命令キャッシュ 2 0とデータ - キャッシュ 3 0とは各々独立しているので、 命令キャッシュ 2 0の読み 書きとデータ ·キヤッシュ 3 0の読み書きとはそれぞれ独立して実行で さる。  In the above, two routines (FuncA, Func B) have been described as examples, but the number of routines that can be executed in parallel is arbitrary. For example, if the number of routines that can be executed in parallel is 5, increase the parameter indicating whether execution of each routine has been completed to 5 (for example, DoneFA, DoneFB, DoneFC, DoneFD, DoneFE). As in FIG. 3, a test instruction can be executed before each routine is read, and execution can be started from a routine that has been confirmed to exist in the instruction cache 20. There may be more than one group of routines that can be processed in parallel. A routine may have only one instruction and no power. The scheduling at the time of reading the data structure and the scheduling at the time of reading the routine can be arbitrarily combined. For example, the scheduling shown in FIG. 3 can be used for reading out Func A and FuncB shown in FIG. Since the instruction cache 20 and the data-cache 30 are independent of each other, reading and writing of the instruction cache 20 and reading and writing of the data cache 30 can be executed independently.
図 5 ( b )及ぴ図 6に示す従来のフロー■チャートに追加された本発明 のスケジューリング部分は、 従来のル一チン又はデータ構造体の読み出 し及び処理に関係しなレ、部分には一切分岐していない。 本発明で追加し たスケジユ^ "リング部分がフロー ·チヤ一トの他の部分に影響を与える ことはない。 本発明は、 データ構造体及ぴルーチンの順序入れ換えをプ ログラムで指示している。 OSのスケジューラで入れ替えを制御するマ ルチ ·スレツドと異なり、 コンテタスト ·スィツチを起動させないため、 MP U及ぴ O Sの負担も少なく髙速処理が可能である。 The scheduling part of the present invention, which is added to the conventional flow charts shown in FIGS. 5 (b) and 6, is a part related to the reading and processing of the conventional routine or data structure. Does not branch at all. The scheduling part added by the present invention does not affect other parts of the flow chart. The present invention reorders data structures and routines. Instructed in the program. Unlike multi-threading, in which switching is controlled by the OS scheduler, since the content switch is not activated, the load on the MPU and OS is small and high-speed processing is possible.
並列処理が可能なルーチン又はデータ構造体を読み出す直前部分への テスト命令等の追加は、 コンパイル時に自動で追加できる場合と、 ソー - ス ·プログラムに手動で追加する場合がある。 一般に、 行列演算等のァ ルゴリズムの場合はコンパイラが並行性を検出できるので、 コンパイル 時にテスト命令等を自動的に追加できることが多い。 1ノ0(入力/出力) に関係する部分は、 コンパイラで並行性を検出できないので、 手動でテ スト命令等を追加することが多い。  Addition of test instructions to the part immediately before reading a routine or data structure capable of parallel processing can be added automatically at compile time, or manually added to the source program. In general, in the case of algorithms such as matrix operations, the compiler can detect concurrency, and in many cases, test instructions can be added automatically at the time of compilation. Since the compiler cannot detect concurrency in the part related to 1/0 (input / output), test instructions are often added manually.
以上、 本発明は特定の実施例について説明されたが、 本発明はこれら に限定されるものではない。 例えば、 アドレス変換時に使用される TL B (Translation Lookaside Buffer)にテスト命令を送ることもできる。 T L Bは、 外部メモリ 40に存在するァドレス変換テーブルの一部が記 憶されるキャッシュ .メモリである。 TLBに格納されたアドレス変換 テーブルの入れ替えは、 PTE (Page Table Entry)の自動検索によって 行われる。 TLBを使用する場合、 キャッシュ ■ ヒットは、 命令キヤッ シュ (又はデータ ·キャッシュ)と TLBの両方がキャッシュ ' ヒットし たことを意味する。  As described above, the present invention has been described with reference to the specific embodiments, but the present invention is not limited thereto. For example, a test command can be sent to TLB (Translation Lookaside Buffer) used for address translation. TLB is a cache memory in which a part of the address conversion table existing in the external memory 40 is stored. The exchange of the address translation table stored in the TLB is performed by automatic search of PTE (Page Table Entry). When using the TLB, a cache hit indicates that both the instruction cache (or data cache) and the TLB have a cache hit.
PTEの自動検索は、 外部メモリ 40を複数回アクセスしながら TL Automatic search of PTE is performed by accessing TL while accessing external memory 40 multiple times.
Bの格納データの入れ替えを行う。 本発明の M P U及び命令実行順序ス ケジユーリング方法を用いることにより、 データ ·キャッシュ及ぴ命令 キャッシュのヒット · ミスの場合と同様に、 TLBのヒット■ ミスの場 合も MPUの待ち時間を短くすることができる。 テスト命令は、 命令キ ャッシュ,データ ·キャッシュ, TLBの各キヤッシュ · ヒットを一括し て調べてもよいし、 各々のキャッシュ■ヒットを独立に調べてもよい。 その他、 本発明はその趣旨を逸脱しない範囲で当業者の知識に基づき種 々なる改良,修正,変形を加えた態様で実施できるものである。 Swap the data stored in B. By using the MPU and the instruction execution order scheduling method of the present invention, it is possible to shorten the MPU wait time in the case of a hit / miss of the TLB as in the case of a hit / miss of the data cache and the instruction cache. Can be. The test instruction may examine the instruction cache, data cache, and TLB cache hits all at once, or may examine each cache hit individually. In addition, the present invention can be embodied in variously modified, modified, and modified forms based on the knowledge of those skilled in the art without departing from the spirit thereof.
本発明のマイクロプロセッサは、 所要のルーチン又はデータ構造体が キャッシュ 'メモリ(命令キャッシュ,データ ·キャッシュ)に存在するか 確認する命令(テスト命令)が追カ卩されている。 テスト命令により、 これ 力 ら読み出すルーチン又はデータ構造体がキャッシュ .メモリに存在す るか否かを、 そのルーチン又はデータ構造体を読み出す直前に知ること ができる。  In the microprocessor of the present invention, an instruction (test instruction) for checking whether a required routine or data structure exists in the cache memory (instruction cache, data cache) is added. The test instruction can determine whether the routine or data structure to be read exists in the cache memory immediately before reading the routine or data structure.
本発明のスケジューリング方法は、 上述したテスト命令により、 並列 処理が可能なルーチン又はデータ構造体に対して、 これから読み出すル 一チン又はデータ構造体がキャッシュ ■メモリに存在するか否かを調べ、 その結果に基づいて、 キャッシュ ·メモリに存在するルーチン又はデー タ構造体を優先的に読み出す。 キャッシュ ·メモリに存在しないルーチ ン又はデータ構造体よりもキャッシュ ·メモリに存在するルーチン又は データ構造体を先に読み出して処理すると共に、 その処理と並行してキ ャッシュ ·メモリに存在しないルーチン又はデータ構造体のプリフェツ チを行うため、 キャッシュ 'メモリのヒット ' ミスにより生じるマイク 口プロセッサの待ち時間を短くすることができる。  According to the scheduling method of the present invention, a routine or a data structure that can be processed in parallel is examined by a test instruction described above to determine whether a routine or a data structure to be read is present in a cache memory or not. Based on the result, the routine or data structure existing in the cache memory is read preferentially. Routines or data structures that exist in the cache memory are read and processed before routines or data structures that do not exist in the cache memory, and routines or data that do not exist in the cache memory are processed in parallel with the processing. Prefetching the structure can reduce the latency of the micro processor due to cache 'memory hit' misses.

Claims

請求の範囲 The scope of the claims
1 . 外部メモリから読み出される命令の一部及ぴデータの一部が記憶さ れるキヤッシュ■ メモリと、 キャッシュ ·メモリ又は外部メモリから読 み出された命令又は読み出されたデータを使用する命令を実行する実行 ュニットとを備え、 プログラムに指示された順序で命令を処理するマイ クロプロセッサであって、 1. A cache memory that stores a part of the instruction read from the external memory and a part of the data, and an instruction read from the cache memory or the external memory or an instruction using the read data. A microprocessor for processing instructions in an order instructed by the program, comprising:
前記実行ュニットが実行する命令に、 複数の命令を含む所要のル一チ ン又は複数のデータを含む所要のデータ構造体が前記キャッシュ ·メモ リ内に存在するか否かを確認するテスト命令が含まれるマイクロプロセ ッサ。  The instruction executed by the execution unit includes a test instruction for confirming whether a required routine including a plurality of instructions or a required data structure including a plurality of data exists in the cache memory. Microprocessor included.
2 . 前記テスト命令が、 前記所要のルーチン又はデータ構造体の先頭ァ ドレス部分が前記キャッシュ ·メモリ內に存在するか否かを確認する命 令を含む請求項 1のマイクロプロセッサ。  2. The microprocessor according to claim 1, wherein the test instruction includes an instruction for confirming whether or not a head address portion of the required routine or data structure exists in the cache memory.
3 . 前記キャッシュ■メモリ力  3. The cache memory capacity
ルーチンが記憶される命令キャッシュ 'メモリと、  The instruction cache where the routine is stored
データ構造体が記憶されるデータ ·キャッシュ 'メモリと  Data structure where data is stored
を含む請求項 1又は請求項 2のマイクロプロセッサ。 3. The microprocessor according to claim 1 or claim 2, comprising:
4 . 前記テスト命令が、 前記所要のルーチンが前記命令キャッシュ ·メ モリ内に存在する力否かを確認する命令と、 4. The test instruction comprises: an instruction for determining whether the required routine is present in the instruction cache memory;
前記所要のデータ構造体が前記データ ·キャッシュ ·メモリ内に存在 するか否かを確認する命令と  Instructions for checking whether the required data structure exists in the data cache memory;
を含む請求項 3のマイクロプロセッサ。 4. The microprocessor of claim 3, comprising:
5 . 前記実行ュニットの命令実行と並行して、 所要のルーチン又はデー タ構造体の読み出しを行うフユツチ ·ュニットをさらに含む請求項 1乃 至請求項 4のいずれかのマイクロプロセッサ。 5. A unit for reading a required routine or data structure in parallel with execution of the instruction of the execution unit. A microprocessor according to any one of claims 1 to 4.
6 . プログラムが指定する順序で、 外部メモリ又はキャッシュ 'メモリ から読み出された複数の命令を含むルーチン又は複数のデータを含むデ ータ構造体を使用するルーチンをマイクロプロセッサに実行させる場合 の、 前記ルーチン又はデータ構造体に含まれる並列処理が可能なル一チ ン又はデータ構造体に対する命令実行順序のスケジューリング方法であ つて、  6. When the microprocessor executes a routine including a plurality of instructions read from the external memory or the cache memory or a routine using a data structure including a plurality of data in an order specified by the program. A method of scheduling an instruction execution order for a routine or a data structure capable of parallel processing included in the routine or the data structure, comprising:
並列処理が可能なルーチン又はデータ構造体を読み出す直前に、 その ルーチン又はデータ構造体がキャッシュ .メモリ內に存在する力、否かを 確認する確認ステツプと、  Immediately before reading a routine or data structure capable of parallel processing, a confirmation step for confirming whether or not the routine or data structure exists in the cache memory or not;
前記並列処理が可能なルーチン又はデータ構造体の中で、 キャッシュ · メモリ内に存在することが確認されたルーチン又はデ一タ構造体から優 先的にマイクロプロセッサに処理させる優先実行ステップと  A priority execution step of causing the microprocessor to preferentially process the routine or data structure among the routines or data structures that can be processed in parallel and confirmed to be present in the cache memory.
を含む命令実行順序スケジューリング方法。 And an instruction execution order scheduling method.
7 . 前記優先実行ステップが、 読み出そうとしているルーチン又はデー タ構造体がキャッシュ■メモリ内に存在すれば、 そのルーチン又はデー タ構造体をキャッシュ ·メモリから読み出してマイクロプロセッサに処 理させる実行ステップと、 7. In the priority execution step, if the routine or data structure to be read exists in the cache memory, the routine or data structure is read from the cache memory and processed by the microprocessor. Steps and
読み出そうとしているルーチン又はデータ構造体がキャッシュ ·メモ リ内に存在しなければ、 そのルーチン又はデータ構造体を外部メモリか ら読み出すようマイクロプロセッサに指示する指示ステップと  If the routine or data structure being read does not exist in cache memory, an instruction step for instructing the microprocessor to read the routine or data structure from external memory.
を含む請求項 6の命令実行順序スケジユーリング方法。 7. The instruction execution order scheduling method according to claim 6, comprising:
8 . 前記指示ステップのルーチン又はデータ構造体の外部メモリからの 読み出しが、 前記実行ステツプと並行して行われる請求項 7の命令実行 順序スケジユーリング方法。  8. The instruction execution order scheduling method according to claim 7, wherein the reading of the routine or the data structure of the instruction step from the external memory is performed in parallel with the execution step.
9 . 前記確認ステップが、 前記実行ステップ又は指示ステップの後、 処 理が未完了のルーチン又はデータ構造体が存在するか確認するステップ と、 9. The checking step is performed after the execution step or the instruction step. Checking for any unfinished routines or data structures;
処理が未完了のルーチン又はデータ構造体が存在すれば、 そのルーチ ン又はデータ構造体がキャッシュ■メモリ内に存在するかマイクロプロ セッサに確認させるステップと  If there is a routine or data structure that has not been processed, the microprocessor checks whether the routine or data structure exists in the cache memory.
を含む請求項 6乃至請求項 8のいずれかの命令実行順序スケジユーリン グ方法。 9. The instruction execution order scheduling method according to claim 6, comprising:
1 0 . 前記実行ステップが、 処理が完了したルーチン又はデータ構造体 に対し、 ルーチン又はデータ構造体が処理されたか否かを示す実行完了 情報を更新するステップを含み、  10. The execution step includes a step of updating execution completion information indicating whether the routine or the data structure has been processed, for the completed routine or data structure,
前記処理が未完了のルーチン又はデータ構造体が存在するか確認する ステップが、 前記実行完了情報に基づいて処理が未完了のルーチン又は データ構造体が存在するか確認を行う請求項 Ί乃至請求項 9のいずれか の命令実行順序スケジュ一リング方法。  4. The method according to claim 1, wherein the step of checking whether there is a routine or a data structure whose processing has not been completed includes checking whether there is a routine or a data structure whose processing has not been completed based on the execution completion information. The instruction execution order scheduling method of any one of 9 above.
1 1 . 前記確認ステップが、 前記ルーチン又はデータ構造体の先頭アド レス部分に基づいてキャッシュ 'メモリ内の存在確認を行う請求項 6乃 至請求項 9のいずれかの命令実行順序スケジユーリング方法。  11. The instruction execution order scheduling method according to any one of claims 6 to 9, wherein the confirming step confirms the presence in the cache memory based on a start address portion of the routine or the data structure. .
PCT/JP2002/001272 2001-02-27 2002-02-14 Microprocessor and instruction execution order scheduling method WO2002069150A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
KR10-2003-7010997A KR20030088031A (en) 2001-02-27 2002-02-14 Microprocessor and Instruction Execution Order Scheduling Method
JP2002568205A JPWO2002069150A1 (en) 2001-02-27 2002-02-14 Microprocessor and instruction execution order scheduling method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2001-51539 2001-02-27
JP2001051539 2001-02-27

Publications (1)

Publication Number Publication Date
WO2002069150A1 true WO2002069150A1 (en) 2002-09-06

Family

ID=18912305

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2002/001272 WO2002069150A1 (en) 2001-02-27 2002-02-14 Microprocessor and instruction execution order scheduling method

Country Status (4)

Country Link
JP (1) JPWO2002069150A1 (en)
KR (1) KR20030088031A (en)
TW (1) TW556082B (en)
WO (1) WO2002069150A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8020169B2 (en) 2003-01-09 2011-09-13 Japan Science And Technology Agency Context switching system having context cache and a register file for the save and restore context operation
JP2013047950A (en) * 2011-08-19 2013-03-07 Canon Inc Efficient cache reuse through application-determined scheduling
JP2016534476A (en) * 2013-09-24 2016-11-04 インテル・コーポレーション Method and apparatus for cache occupancy determination and instruction scheduling

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
HOROWITZ ET AL.: "Informing memory operation: memory performance feedback mechanisms and their applications", ACM TRANS. ON COMPUTER SYSTEMS, ACM, vol. 16, no. 2, 1998, pages 170 - 205, XP000791702 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8020169B2 (en) 2003-01-09 2011-09-13 Japan Science And Technology Agency Context switching system having context cache and a register file for the save and restore context operation
JP2013047950A (en) * 2011-08-19 2013-03-07 Canon Inc Efficient cache reuse through application-determined scheduling
JP2016534476A (en) * 2013-09-24 2016-11-04 インテル・コーポレーション Method and apparatus for cache occupancy determination and instruction scheduling
US10140210B2 (en) 2013-09-24 2018-11-27 Intel Corporation Method and apparatus for cache occupancy determination and instruction scheduling

Also Published As

Publication number Publication date
KR20030088031A (en) 2003-11-15
JPWO2002069150A1 (en) 2004-07-02
TW556082B (en) 2003-10-01

Similar Documents

Publication Publication Date Title
JP5357017B2 (en) Fast and inexpensive store-load contention scheduling and transfer mechanism
US7383391B2 (en) Prefetch mechanism based on page table attributes
JP5089186B2 (en) Data cache miss prediction and scheduling
JP3640355B2 (en) Instruction prefetch method and system for cache control
US8639886B2 (en) Store-to-load forwarding mechanism for processor runahead mode operation
US9710391B2 (en) Methods and apparatuses for efficient load processing using buffers
US20090106499A1 (en) Processor with prefetch function
CN110959154B (en) Private cache for thread local store data access
US20130246709A1 (en) Translation address cache for a microprocessor
JPH096633A (en) Method and system for operation of high-performance multiplelogical route in data-processing system
EP1782184B1 (en) Selectively performing fetches for store operations during speculative execution
WO2005088455A2 (en) Cache memory prefetcher
JPH0630075B2 (en) Data processing device having cache memory
KR100234647B1 (en) Data processing system with instruction prefetch
JP4220473B2 (en) Mechanisms that improve control speculation performance
US6658537B2 (en) DMA driven processor cache
US6892280B2 (en) Multiprocessor system having distributed shared memory and instruction scheduling method used in the same system
US20230315471A1 (en) Method and system for hardware-assisted pre-execution
WO2002069150A1 (en) Microprocessor and instruction execution order scheduling method
JP2008015562A (en) Cache mistake/hit prediction
US6769057B2 (en) System and method for determining operand access to data
US6668306B2 (en) Non-vital loads
JP5116275B2 (en) Arithmetic processing apparatus, information processing apparatus, and control method for arithmetic processing apparatus
JP2008015668A (en) Task management device
JP3161422B2 (en) Microcomputer

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A1

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BY BZ CA CH CN CO CR CU CZ DE DK DM DZ EC EE ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NO NZ OM PH PL PT RO RU SD SE SG SI SK SL TJ TM TN TR TT TZ UA UG US UZ VN YU ZA ZM ZW

AL Designated countries for regional patents

Kind code of ref document: A1

Designated state(s): GH GM KE LS MW MZ SD SL SZ TZ UG ZM ZW AM AZ BY KG KZ MD RU TJ TM AT BE CH CY DE DK ES FI FR GB GR IE IT LU MC NL PT SE TR BF BJ CF CG CI CM GA GN GQ GW ML MR NE SN TD TG

121 Ep: the epo has been informed by wipo that ep was designated in this application
DFPE Request for preliminary examination filed prior to expiration of 19th month from priority date (pct application filed before 20040101)
WWE Wipo information: entry into national phase

Ref document number: 2002568205

Country of ref document: JP

WWE Wipo information: entry into national phase

Ref document number: 1020037010997

Country of ref document: KR

WWP Wipo information: published in national office

Ref document number: 1020037010997

Country of ref document: KR

REG Reference to national code

Ref country code: DE

Ref legal event code: 8642

122 Ep: pct application non-entry in european phase
WWG Wipo information: grant in national office

Ref document number: 1020037010997

Country of ref document: KR