WO2010097847A1 - プロセッサ装置、マルチスレッドプロセッサ装置 - Google Patents

プロセッサ装置、マルチスレッドプロセッサ装置 Download PDF

Info

Publication number
WO2010097847A1
WO2010097847A1 PCT/JP2009/003857 JP2009003857W WO2010097847A1 WO 2010097847 A1 WO2010097847 A1 WO 2010097847A1 JP 2009003857 W JP2009003857 W JP 2009003857W WO 2010097847 A1 WO2010097847 A1 WO 2010097847A1
Authority
WO
WIPO (PCT)
Prior art keywords
processor
context data
hardware resource
unit
determination unit
Prior art date
Application number
PCT/JP2009/003857
Other languages
English (en)
French (fr)
Inventor
山本崇夫
尾崎伸治
掛田雅英
中島雅逸
Original Assignee
パナソニック株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by パナソニック株式会社 filed Critical パナソニック株式会社
Priority to CN2009801575253A priority Critical patent/CN102334102B/zh
Priority to JP2011501354A priority patent/JP5433676B2/ja
Publication of WO2010097847A1 publication Critical patent/WO2010097847A1/ja
Priority to US13/215,623 priority patent/US8850168B2/en

Links

Images

Classifications

    • 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/46Multiprogramming arrangements
    • G06F9/461Saving or restoring of program or task context
    • G06F9/462Saving or restoring of program or task context with multiple register sets
    • 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/30098Register arrangements
    • G06F9/30101Special purpose registers
    • 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/30098Register arrangements
    • G06F9/3012Organisation of register space, e.g. banked or distributed register file
    • G06F9/30123Organisation of register space, e.g. banked or distributed register file according to context, e.g. thread buffers
    • 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/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3851Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution from multiple instruction streams, e.g. multistreaming
    • 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/3885Concurrent instruction execution, e.g. pipeline or look ahead using a plurality of independent parallel functional units

Definitions

  • the present invention relates to a processor device and a multi-thread processor device having a plurality of processors that execute while switching programs of the processor device, and more particularly to a processor device and a multi-thread processor device that share hardware resources among a plurality of processors.
  • a multi-thread processor is known as a processor for realizing high performance (for example, see Patent Document 1).
  • This multi-thread processor can improve processing efficiency by simultaneously executing a plurality of threads.
  • the multi-thread processor can share resources in the execution of a plurality of threads, the area efficiency of the processor can be improved as compared with the case where a plurality of processors are provided independently.
  • such a processor performs control-related host processing that does not require real-time processing and media processing such as moving image compression and expansion processing that requires real-time processing.
  • the integrated circuit for video / audio processing described in Patent Document 2 includes a microcomputer block that performs host processing and a media processing block that performs media processing.
  • lazy context switch Lazy context switch
  • FPU floating point number processing unit
  • the above method attempts to reduce the overhead of saving and restoring the FPU context.
  • JP 2006-302261 International Publication No. 2005/096168 JP 2003-271399 A JP 2008-123045 A JP 2004-246862 A
  • a processor device includes a plurality of processors that execute a plurality of programs while switching, and one or more processors that have a register that holds data and supplement the instruction execution of the plurality of processors.
  • a memory that stores extended context data that is a copy of register data in the hardware resource for each program including a hardware resource and a predetermined instruction that uses the hardware resource among the plurality of programs; and the hardware There is a possibility that the extended context data of the program currently being executed may be held in the hardware resource, and a control unit that controls saving and returning of extended context data between the resource and the memory
  • a first determination unit for determining whether or not the extended context data in the hardware resource A second determination unit that determines whether or not the processor belongs to a processor that has attempted to execute the predetermined instruction, the first determination unit determines that the possibility exists, and an extension in the hardware resource When the second determination unit determines that the context data belongs to the processor that has attempted to execute the predetermined instruction, the hardware resource does not perform the saving and restoring of
  • each hardware resource can be shared by a plurality of processors.
  • any hardware resource can be used by any processor. Therefore, the use efficiency of hardware resources can be improved. Since it is not necessary to provide hardware resources for each processor, it is sufficient to provide the minimum necessary number of hardware resources according to the required processing performance, and the circuit scale can be reduced or optimized.
  • control unit saves the extended context data from the hardware resource to the memory according to the determination results of the first determination unit and the second determination unit, and the context belonging to the same processor as the saved extended context data
  • a second transfer unit that restores the extended context data belonging to.
  • the hardware resource may be an extended arithmetic unit that executes an extended instruction that cannot be executed by the plurality of processors, and the predetermined instruction may be the extended instruction.
  • an extended arithmetic unit such as an FPU or a hardware accelerator can be efficiently shared by a plurality of processors, and saving and restoring of extended context data can be minimized.
  • the first determination unit includes a data determination unit provided in each of the plurality of processors, and each data determination unit attempts to execute the predetermined instruction in the program by the processor corresponding to the data determination unit.
  • the second determination unit A processor determination unit provided in each of the plurality of processors, wherein each of the processor determination units determines whether or not the extended context data in the hardware resource belongs to a processor that has attempted to execute the predetermined instruction. May be.
  • the hardware resource holds the extended context data of the currently executing program (that is, the program that issued the predetermined instruction). Can use hardware resources without affecting other processors.
  • each of the plurality of processors has a status register, and a copy of the data of each status register is included in the context data for each program.
  • Each status register is currently being executed for each hardware resource.
  • First state information indicating whether or not there is a possibility that the extended context data of the program is held in the hardware resource, and the extended context held in the hardware resource for each hardware resource.
  • Second state information indicating a processor corresponding to data, and each data determination unit determines whether the first state information is true or false when the corresponding processor attempts to execute the predetermined instruction in the program.
  • Each processor determination unit including a first determination circuit that generates a first exception interrupt signal when it is determined to be false.
  • the hardware resource determines that the second determination circuit matches, the hardware resource operates immediately according to the predetermined instruction without waiting for the saving and restoring of the extended context data You may do that.
  • the data determination unit and the processor determination unit are configured by hardware (first determination circuit and second determination circuit), a program in which hardware resources are currently being executed (that is, a program that has issued a predetermined instruction) If the extended context data is held, hardware resources can be used at high speed without affecting other processors.
  • the first transfer unit includes a save / restore unit provided for each processor, and each save / restore unit extends from the hardware resource to the memory when the first exception interrupt signal is generated. Saving the data, returning the extended context data of the processor that has attempted to execute the predetermined instruction from the memory to the hardware resource, the plurality of processors including a first processor and a second processor; The first processor executes a first operating system to execute a plurality of programs by time division multiplexing, and the second processor executes a second operating system different from the first operating system.
  • a plurality of programs are executed by time division multiplexing, and the program in the first processor
  • the evacuation / recovery unit is activated by the first operating system when the first determination circuit in the first processor generates the first exception interrupt signal, and the evacuation / recovery unit in the second processor.
  • the unit may be activated by a second operating system when the first determination circuit in the second processor generates the first exception interrupt signal.
  • hardware resources can be shared between processors that execute different operating systems (hereinafter abbreviated as OS).
  • OS operating systems
  • the extended context data can be switched efficiently in the OS without affecting other OSs.
  • At least one of the plurality of processors executes a third operating system that manages the first operating system and the second operating system
  • the second transfer unit is any one of When the second determination circuit generates the second exception interrupt signal, it may be activated by a third operating system.
  • hardware resources can be shared between processors that execute different operating systems (hereinafter abbreviated as OS).
  • OS operating systems
  • the extended context data is switched under the management of the third OS.
  • the switching of the extended context data is concealed for the program on any processor, so that the conventional program can be easily used.
  • the third operating system when any one of the second determination circuits generates the second exception interrupt signal, the third operating system, when the hardware resource is executing a predetermined instruction of another processor, The second transfer unit may be activated after waiting for the hardware resource to be released and securing the hardware resource.
  • the second transfer unit executes the predetermined instruction from the memory to the hardware resource from the start of the operation of saving the extended context data corresponding to the other processor from the hardware resource to the memory. Up to the improvement of the operation for restoring the extended context data of the processor may be performed atomically.
  • each processor may further include a clear circuit that clears the second state information corresponding to the processor when the processor transitions to a stopped state, a waiting state, or a sleep state.
  • the hardware resources used by the processor can be released by the clear circuit and are shared by a plurality of processors. Improve the efficiency of using hardware resources.
  • each state register holds third state information indicating whether or not to lock the second state information, and the third operating system indicates that the third state information locks the second state information.
  • clearing clearing of the second state information by the clear circuit may be prohibited.
  • the programmer sets the third state information to “locked” when the processor that uses the hardware resource is fixed or when the processor uses the hardware resource with priority.
  • the hardware resources can be kept occupied by the processor, and wasteful expansion context data can be saved and restored.
  • the processor device of the present invention includes a multi-thread processor including a plurality of virtual processors that switch a plurality of programs by simultaneously executing a plurality of threads, and a register that holds data.
  • a multi-thread processor including a plurality of virtual processors that switch a plurality of programs by simultaneously executing a plurality of threads, and a register that holds data.
  • extended context data For each program including one or more hardware resources that complement execution and a predetermined instruction that uses the hardware resources among the plurality of programs, extended context data that is a copy of register data in the hardware resources
  • a second determination unit that determines whether or not the extended context data in the hardware resource belongs to a processor that has attempted to execute the predetermined instruction. If there is the possibility, the first determination unit And when the second determination unit determines that the extended context data in the hardware resource belongs to the processor that has attempted to execute the predetermined instruction, the control unit saves the extended context data and The hardware resource may be configured to execute the predetermined instruction without performing restoration.
  • This configuration has the same effect as described above.
  • control unit saves the extended context data from the hardware resource to the memory according to the determination results of the first determination unit and the second determination unit, and the context belonging to the same processor as the saved extended context data
  • a first transfer unit that restores data, and a processor different from the saved extended context data that saves the extended context data from the hardware resource to the memory according to the determination results of the first determination unit and the second determination unit It is good also as a structure provided with the 2nd transfer part which resets the extended context data which belong to.
  • each of the plurality of virtual processors corresponds to at least one thread
  • the multi-thread processor is decoded by a plurality of instruction preparation units that fetch and decode instructions of a thread, and the plurality of instruction preparation units.
  • An execution unit that simultaneously executes one or more instructions corresponding to one or more threads, and a status register provided for each instruction preparation unit, wherein the control unit is provided for each instruction preparation unit.
  • Each status register is an extension of the currently executing virtual processor for each hardware resource.
  • Second state information indicating a virtual processor to be executed
  • the multi-thread processor further includes an instruction preparation unit in which the thread has been replaced when the virtual processor being executed is no longer being executed due to the thread replacement. It is good also as a structure provided with the clear circuit which clears the 2nd status information of a status register.
  • the first determination unit includes a data determination unit provided in each of the plurality of instruction preparation units, and each of the data determination units attempts to execute the predetermined instruction by a thread of the corresponding instruction preparation unit.
  • the second determination unit includes a processor determination unit provided in each of the plurality of instruction preparation units, and each of the processor determination units determines that the data determination unit in the corresponding instruction preparation unit is false Determining whether or not the corresponding virtual processor of the instruction preparation unit and the virtual processor indicated by the second state information match, and generating a second exception interrupt signal when determined to be false
  • the multi-thread processor further executes a second exception interrupt process activated by a second exception interrupt signal from the processor determination unit as a function of an operating system, and the operating system includes the hardware
  • the operating system belongs to an instruction preparation unit other than an instruction preparation unit to which the virtual processor that generated the second exception interrupt signal belongs.
  • the state register in the instruction preparation unit that has generated the second exception interrupt signal has first state information indicating true; Second state information indicating the virtual processor that generated the exception interrupt signal of
  • the wait process is executed. It is good also as a structure.
  • hardware resources for example, an extended arithmetic unit such as an FPU or a hardware accelerator
  • any hardware resource can be used by any processor. Therefore, the use efficiency of hardware resources can be improved. Since it is not necessary to provide hardware resources for each processor, it is sufficient to provide the minimum necessary number of hardware resources according to the required processing performance, and the circuit scale can be reduced or optimized.
  • FIG. 1 is a block diagram illustrating a configuration of a processor device according to the first embodiment.
  • FIG. 2 is a diagram illustrating an example of first to third state information in the state register unit according to the first embodiment.
  • FIG. 3 is an explanatory diagram of an operating system in the processor device according to the first embodiment.
  • FIG. 4 is a flowchart illustrating the hardware resource switching operation according to the first embodiment.
  • FIG. 5 is a diagram illustrating an example of data managed by the third OS according to the first embodiment.
  • FIG. 6 is a detailed flowchart showing the hardware resource switching operation in the first embodiment.
  • FIG. 7 is a block diagram illustrating a configuration of a processor system according to the second embodiment.
  • FIG. 8 is a block diagram illustrating a configuration of a processor block according to the second embodiment.
  • FIG. 1 is a block diagram illustrating a configuration of a processor device according to the first embodiment.
  • FIG. 2 is a diagram illustrating an example of first to third state information in the state register unit
  • FIG. 9 is a diagram illustrating a configuration of a context according to the second embodiment.
  • FIG. 10 is a diagram illustrating management of the logical address space according to the second embodiment.
  • FIG. 11 is a diagram illustrating a configuration of an address management table according to the second embodiment.
  • FIG. 12 is a diagram illustrating a correspondence relationship of logical addresses in the second embodiment.
  • FIG. 13 is a diagram illustrating a configuration of an entry designation register according to the second embodiment.
  • FIG. 14 is a diagram showing entry allocation processing by the TLB according to the second embodiment.
  • FIG. 15 is a flowchart showing a flow of processing by the TLB according to the second embodiment.
  • FIG. 16 is a diagram illustrating a configuration of a physical protection register according to the second embodiment.
  • FIG. 17 is a diagram illustrating a physical address space protected by PVID in the second embodiment.
  • FIG. 18 is a diagram illustrating a configuration of a protection violation register according to the second embodiment.
  • FIG. 19 is a diagram illustrating a configuration of an error address register according to the second embodiment.
  • FIG. 20 is a diagram illustrating a configuration of an FPU allocation register according to the second embodiment.
  • FIG. 21 is a diagram illustrating FPU allocation processing by the FPU allocation unit according to the second embodiment.
  • FIG. 22A is a diagram illustrating a configuration of a way designation register according to the second embodiment.
  • FIG. 22B is a diagram illustrating a configuration of a way designation register according to the second embodiment.
  • FIG. 23 is a diagram schematically illustrating way allocation processing by the cache memory according to the second embodiment.
  • FIG. 24 is a flowchart showing a flow of processing by the cache memory according to the second embodiment.
  • FIG. 25 is a diagram illustrating a configuration of an interrupt control register according to the second embodiment.
  • FIG. 26 is a diagram illustrating memory access management in the processor system according to the second embodiment.
  • FIG. 27 is a diagram showing bus bandwidth allocation by the memory IF block according to the second embodiment.
  • FIG. 28 is a flowchart showing the flow of resource division processing in the processor system according to the second embodiment.
  • the processor device is a processor device that shares hardware resources among a plurality of processors, and whether or not extended context data of any program currently being executed is held in a register in the hardware resources.
  • a first determination unit that determines whether the extended context data in the hardware resource corresponds to which processor, and saving and restoring extended context data between programs in the processor
  • a second transfer unit that saves and restores extended context data between programs between processors.
  • FIG. 1 is a block diagram showing a configuration of a processor device according to the first embodiment of the present invention.
  • the processor device includes instruction preparation units 210, 220 and 230, an execution pipeline unit 240, a control unit 250, hardware resources 260 and 270, and memories 310, 320 and 330.
  • the instruction preparation units 210, 220, and 230 and the execution pipeline unit 240 constitute a multi-thread processor.
  • the instruction preparation units 210, 220, and 230 each independently fetch and decode an instruction from a thread (program) and issue a decoding result to the execution pipeline unit 240.
  • the execution pipeline unit 240 includes a plurality of functional units (ALU, load / store unit, branch processing unit, multiplier, divider, etc.), and executes an executable instruction among a plurality of instruction decoding results. Run at the same time.
  • a set of one instruction preparation unit and execution pipeline unit 240 substantially functions as one processor, and is called a virtual processor or a logical processor. That is, the instruction preparation units 210, 220, 230 and the execution pipeline unit 240 correspond to the three virtual processors 0-2. Each virtual processor executes while switching programs.
  • a plurality of physical processors that operate independently may be provided.
  • processors 0 to 2 when it is not necessary to particularly distinguish the three virtual processors 0 to 2 (logical processors) and the three physical processors, they are simply referred to as processors 0 to 2.
  • the memories 310, 320 and 330 have an address space corresponding to three processors.
  • the memory 310 stores a program, normal context data 311 of the program, extended context data 312 of hardware resources, and the like. The same applies to the memories 320 and 330.
  • the three memories 310, 320, and 330 have one physical address space and three independent virtual address spaces.
  • the three memories 310, 320, and 330 may have three independent physical address spaces.
  • the context data 311, 321 and 331 may be stored in another memory dedicated to context data.
  • the instruction preparation unit 210 includes an instruction fetch unit 211 that fetches an instruction from the memory 310, an instruction decoding unit 212 that decodes the fetched instruction, a status register unit 213, a register unit 214, a first determination unit 215, A second determination unit 216.
  • the instruction preparation unit 220 includes an instruction fetch unit 221 that fetches an instruction from the memory 320, an instruction decoding unit 222 that decodes the fetched instruction, a status register unit 223, a register unit 224, a first determination unit 225, A second determination unit 226.
  • the instruction preparation unit 230 includes an instruction fetch unit 231 that fetches an instruction from the memory 330, an instruction decoding unit 232 that decodes the fetched instruction, a status register unit 233, a register unit 234, a first determination unit 235, A second determination unit 236.
  • Each data of the status register unit 213 and the register unit 214 constitutes context data of the program being executed. The same applies to the status register unit 223 and the register unit 224. The same applies to the status register unit 233 and the register unit 234.
  • the control unit 250 includes a first transfer unit 251 and a second transfer unit 252, and controls saving and restoration of extended context data between the hardware resources 260 and 270 and the memories 310, 320, and 330.
  • Hardware resources 260 and 270 each have register groups 261 and 271 that hold data, and complement a plurality of processors.
  • Each hardware resource may be, for example, an FPU (Floating Point Unit: Floating Point Number number processing unit), a hardware accelerator, an extended arithmetic unit, or the like.
  • the FPU executes floating point arithmetic instructions (hereinafter referred to as FPU instructions) in the program.
  • the hardware accelerator receives a command from the processor and executes product-sum operation, butterfly operation, quantization of block data, inverse quantization, or the like on specified data at high speed.
  • the extended arithmetic unit executes an extended instruction (multiplication instruction, division instruction, instruction dedicated to the extended arithmetic unit, etc.) that cannot be directly executed by the processor.
  • Each of the register groups 261 and 271 holds a context of a corresponding hardware resource (hereinafter referred to as extended context data).
  • Each hardware resource is shared by a plurality of processors.
  • the extended context data is performed asynchronously with saving and returning of the context data of the program in each processor. That is, the processor executes a predetermined instruction (the FPU instruction, the command, and the extended instruction) that uses hardware resources, and is saved and restored only when the extended context data is required.
  • the memory 310 stores register data in the hardware resource for each program including context data 311 of each program time-division multiplexed by a plurality of processors and a predetermined instruction using the hardware resource among the plurality of programs.
  • the extended context data 312 that is a copy of is stored.
  • the memory 320 stores context data 321 and extended context data 322.
  • the memory 330 stores context data 331 and extended context data 332.
  • the first determination unit 215 determines whether or not the extended context data of the currently executing program is held in the register in the hardware resource. Determine whether.
  • the second determination unit 216 determines whether or not the extended context data in the hardware resource belongs to a processor that intends to execute the predetermined instruction.
  • the first transfer unit 251 saves the extended context data from the hardware resource to any of the memories 310, 320, and 330 according to the determination results of the first determination unit 215 and the second determination unit 216, and saves the extended context Restore context data belonging to the same processor (or the same memory) as the data. After returning, the hardware resource 260 or 270 executes the predetermined instruction.
  • the second transfer unit 252 saves the extended context data from the hardware resource to any of the memories 310, 320, and 330 according to the determination results of the first determination unit 215 and the second determination unit 216, and saves the extended context Restore context data belonging to a different processor (or different memory) than the data. After returning, the hardware resource 260 or 270 executes the predetermined instruction.
  • the hardware resource 260 or 270 is determined by the first determination unit 215 that the extended context data of the currently executing program is held in the register in the hardware resource, and the extended context data in the hardware resource is If the second determination unit 216 determines that the predetermined instruction belongs to the processor that is to execute the predetermined instruction, the predetermined instruction is immediately executed without waiting for the extension context data to be saved and restored.
  • each hardware resource 260 or 270 can be shared by a plurality of processors.
  • any hardware resource can be used by any processor. Therefore, the use efficiency of hardware resources can be improved. Further, since it is not necessary to provide hardware resources for each processor, it is sufficient to provide the minimum necessary number of hardware resources according to the required processing performance, and the circuit scale can be reduced or optimized.
  • FIG. 2 is a diagram showing an example of the first to third state information in the state register unit in the first embodiment of the present invention.
  • the status register unit 213 includes a register called PSR (Processor Status Register) and a register called LPFOSR (Logical Processor FPU Operation Status Register).
  • PSR Processor Status Register
  • LPFOSR Logical Processor FPU Operation Status Register
  • the LPFOSR is included in the program context data 311 or not included in the program context data 311 and is managed separately by the OS.
  • the PSR includes an FE (FPU Enable) bit as first state information indicating that there is a possibility that extended context data of the currently executing program is held in the hardware resource.
  • FE FPU Enable
  • LPFOSR includes LPFE0 (Logical Processor Processor FPU Enable 0) and LPFE1 bit as the second state information indicating the processor corresponding to the extended context data held in the hardware resource.
  • the LPFE0 and LPFE1 bits are exclusively “1” or only “0” for any one bit.
  • the LPFE0 bit corresponds to processor 0, and the LPFE1 bit corresponds to processors 1 and 2.
  • the LPFOSR further includes third state information (FL bit) indicating whether or not the second state information is locked.
  • the FE bit of the PSR of the program being executed indicates that there is a possibility that the extended context data is held in the hardware resource, and the processor executing the program is further notified by the hardware resource. If it is indicated by LPFE0 or LPFE1 that it corresponds to the extended context data held in the processor, the processor uses either hardware resource indicated by LPFE0 or LPFE1. It becomes possible to use.
  • the first determination unit 215 determines whether the first state information is true or false when the corresponding processor tries to execute the predetermined instruction in the program. When it is determined to be false, the first exception interrupt A first determination circuit (data determination unit) that generates a signal is included.
  • the second determination unit 216 determines whether the corresponding processor and the processor indicated by the second state information match, and is false.
  • a second determination circuit (processor determination unit) that generates a second exception interrupt signal when determined.
  • the first and second determination circuits are configured by hardware. This speeds up the processing especially when it is not necessary to replace the extended context data.
  • FIG. 3 is an explanatory diagram of the operating system in the processor device according to the first embodiment of the present invention.
  • processors 0 to 2 correspond to the three virtual processors or three physical processors shown in FIG.
  • the processor 0 executes a plurality of programs by time division multiplexing by executing a first operating system (hereinafter abbreviated as OS).
  • OS first operating system
  • Processors 1 and 2 execute a plurality of programs by time division multiplexing by executing a second OS different from the first OS.
  • the first OS is, for example, Linux
  • the second OS is, for example, a real-time OS.
  • the first transfer unit 251 includes save / return units 251a, 251b, and 251c provided for each processor.
  • Each save / restore unit saves the extended context data from the hardware resource to the memory when the first exception interrupt signal is generated, and executes the predetermined instruction from the memory to the hardware resource.
  • the extended context data is restored, and the save / restore unit 251a in the processor 0 is activated by the first OS when the first determination unit 215 in the processor 0 generates the first exception interrupt signal.
  • the save / restore units 251b and 251c of the processors 1 and 2 are activated by the second OS when the first determination units 225 and 235 of the processors 1 and 2 generate the first exception interrupt signal.
  • At least one of the processors 0 to 2 controls the second transfer unit 252 by executing a third OS that manages the first OS and the second OS. That is, the second transfer unit 252 is activated by the third operating system when any of the second determination units generates the second exception interrupt signal.
  • the activated second transfer unit 252 starts the operation to save the extended context data belonging to another processor in any of the memories 310, 320, and 330 from the hardware resource, and then starts the operation from the memory to the hardware resource. Perform atomically until the completion of the operation to restore the extended context data of the processor that attempted to execute the instruction.
  • the third OS controls the clear unit 253.
  • the clear unit 253 is a general term for clear circuits provided for each processor.
  • Each clear circuit clears the second state information (LPFE0 and LPFE1 bits) corresponding to the processor when the processor corresponding to the clear circuit transitions to a stop state, a wait state, or a sleep state.
  • the hardware resources used by the processor can be released, and the use efficiency of the hardware resources shared by the plurality of processors is improved.
  • the programmer sets the third state information to “locked”, so that the hardware It is possible to keep the hardware resource occupied by the processor, and it is possible to reduce unnecessary saving and restoring of extended context data.
  • FIG. 4 is a flowchart showing an outline of the hardware resource switching operation in the first embodiment of the present invention.
  • the operation in any one of the processors 0 to 2 is shown.
  • this figure represents the operation of the processor 0, and the hardware resource is assumed to be the FPU.
  • the FPU register cannot be used
  • LP context switching is performed by the first transfer unit 251.
  • the FPU instruction is immediately executed by the FPU (S34).
  • S30, S31, and S32 are performed by hardware in the processor.
  • S34 is executed by the FPU.
  • S36 is performed by the first transfer unit 251 under the control of the first OS.
  • S41 is performed by the second transfer unit 252 under the control of the first OS.
  • FIG. 5 is a diagram illustrating an example of data managed by the third OS according to the first embodiment of this invention.
  • the table T1 in the figure is a table in which processor IDs (here, LPID) are associated with hardware resources to be used (here, FPU0 and FPU1).
  • the table T2 is a table in which an FPU number, a processor ID (LPID) that currently occupies the FPU, and a lock attribute (FL bit) are associated with each other.
  • the third OS always updates the tables T1 and T2 to the latest state, and manages the FPU in software.
  • the third OS refers to such a table, and uses (1) association of FPUs 0 and 1 with LPID (selection of FPU to be newly assigned to LP), (2) using current FPUs 0 and 1. (3) The lock attribute of the LP that currently uses FPUn is managed.
  • the third OS manages which FPUn each LP plans to use (manages FPUn scheduled to be used by each LP by software), and the LPFOSR shown in FIG. Which bits of LPFE0 and LPFE1 are set. That is, it is possible to manage which FPUn context is used in each LP.
  • the third OS manages the LPID that is currently using FPU0, 1, thereby managing which processor is using the current FPU0, 1 and is about to use it. Manage context return / evacuation as an atomic operation.
  • the third OS can perform LP lock management using FPUn by software, and manage FPUn lock attributes by software. As a result, the own LP can lock the occupancy state of the FPU or can be detached from other LPs.
  • FIG. 6 is a detailed flowchart showing the hardware resource switching operation in the first embodiment of the present invention.
  • the steps executed by the hardware of the processor, the steps executed by the first OS or the second OS, and the steps executed by the third OS are separated.
  • the operation in any one of the processors 0 to 3 is shown.
  • this figure represents the operation of the processor 0, and the hardware resource is assumed to be the FPU.
  • the first determination unit 215 uses the FE bit (first state information) in the PSR. ) Is true or false to determine whether or not the FPU register is unusable (S31), and the second determination unit 216 further includes LPFE0, 1 bit (second state information) Which bit is true is determined (S32).
  • the third OS shown in FIG. 3 executes the second exception interrupt process started by each second exception interrupt signal from the second determination unit 216, 226, 236 as a part of the operating system function. To do.
  • the third OS includes the hardware resource acquisition process, the hardware resource release wait process, and the like in order to support the second exception interrupt process.
  • the third OS when the hardware resource is not in use in a virtual processor belonging to an instruction preparation unit other than the instruction preparation unit to which the virtual processor that has generated the second exception interrupt signal is used (case 1) )
  • the first status information indicating true In the status register in the instruction preparation unit that has generated the second exception interrupt signal, the first status information indicating true and the second status information indicating the processor that has generated the second exception interrupt signal.
  • the first state information indicating true indicates that the extended context data of the currently executing program may be held in the hardware resource.
  • Case 1 is when it is determined in step S38b that the right to use FPU0 has been secured.
  • the third OS may include a management object such as MUTEX for exclusive control of the resource, and this management object may be used.
  • each hardware resource can be shared by a plurality of processors.
  • any hardware resource can be used by any processor. Therefore, the use efficiency of hardware resources can be improved. Since it is not necessary to provide hardware resources for each processor, it is sufficient to provide the minimum necessary number of hardware resources according to the required processing performance, and the circuit scale can be reduced or optimized.
  • An extended arithmetic unit such as an FPU or a hardware accelerator can be efficiently shared by a plurality of processors, and extension context data can be saved and restored to a minimum.
  • the processor system according to the present embodiment includes a single processor block that shares resources and performs host processing and media processing.
  • the processor block has the same function as that of the processor device of the first embodiment, and is further performed by a single processor device that shares resources and performs host processing and media processing.
  • the processor system according to the embodiment of the present invention provides different tag information to the host processing thread and the media processing thread, and divides resources of the processor system in association with the tag information. As a result, the processor system according to the embodiment of the present invention can improve the area efficiency and improve the performance guarantee and robustness.
  • FIG. 7 is a functional block diagram showing a basic configuration of the processor system 10 according to the second embodiment.
  • the processor system 10 is a system LSI that performs various signal processing related to the video / audio stream, and executes a plurality of threads using the external memory 15.
  • the processor system 10 is mounted on a digital television system, a DVD recorder, a digital camera, a mobile phone, and the like.
  • the processor system 10 includes a processor block 11, a stream I / O block 12, an AVIO (Audio Visual Input Output) block 13, and a memory IF block 14.
  • the processor block 11 is the same as the processor device described in the first embodiment. Hereinafter, the description of the same points will be omitted, and different points will be mainly described.
  • the processor block 11 is a processor that controls the entire processor system 10.
  • the processor block 11 controls the stream I / O block 12, the AVIO block 13, and the memory IF block 14 through the control bus 16, and the data bus 17 and the memory IF block. 14 to access the external memory 15.
  • the processor block 11 reads the image / audio data such as the compressed image / audio stream from the external memory 15 via the data bus 17 and the memory IF block 14, performs media processing such as compression or decompression, and then performs the data bus again. 17 and a circuit block for storing processed image data and audio data in the external memory 15 via the memory IF block 14.
  • the processor block 11 performs host processing that is non-real-time general-purpose (control-related) processing that does not depend on the video / audio output cycle (frame rate, etc.) and real-time general-purpose (media-related) that depends on the video / audio output cycle. And media processing that is processing).
  • the host processing controls the digital television system, and the media processing decompresses digital video.
  • the stream I / O block 12 reads stream data such as a compressed video / audio stream from storage devices and peripheral devices such as a network under the control of the processor block 11, and external memory via the data bus 18 and the memory IF block 14.
  • 15 is a circuit block that stores data in the memory 15 and performs stream transfer in the opposite direction. In this way, the stream I / O block 12 performs non-real-time IO processing that does not depend on the video / audio output cycle.
  • the AVIO block 13 reads image data, audio data, and the like from the external memory 15 through the data bus 19 and the memory IF block 14 under the control of the processor block 11, performs various graphic processing, etc. It is a circuit block that outputs an audio signal to an external display device, a speaker, or the like, or transfers data in the opposite direction. In this way, the AVIO block 13 performs real-time IO processing depending on the video / audio output cycle.
  • the memory IF block 14 requests data in parallel between the processor block 11, the stream I / O block 12, the AVIO block 13, and the memory IF block 14 and the external memory 15.
  • the circuit block is controlled as follows.
  • the memory IF block 14 secures a transfer band between the processor block 11, the stream I / O block 12, the AVIO block 13, and the memory IF block 14 and the external memory 15 in response to a request from the processor block 11. And guarantee the latency.
  • FIG. 8 is a functional block diagram showing the configuration of the processor block 11.
  • the processor block 11 includes an execution unit 101, a VMPC (virtual multiprocessor control unit) 102, a TLB (Translation Lookaside Buffer) 104, a physical address management unit 105, and an FPU (Floating Point number processing Unit: floating point arithmetic unit). ) 107, FPU allocation unit 108, cache memory 109, BCU 110, and interrupt control unit 111.
  • VMPC virtual multiprocessor control unit
  • TLB Translation Lookaside Buffer
  • FPU Floating Point number processing Unit: floating point arithmetic unit
  • the processor block 11 functions as a virtual multiprocessor (VMP: Virtual Multi Processor).
  • VMP Virtual Multi Processor
  • the virtual multiprocessor is generally a kind of instruction parallel processor that performs the functions of a plurality of logical processors (LPs) in a time division manner.
  • one LP practically corresponds to one context set in a register group of a physical processor (PP).
  • PP physical processor
  • TS Time Slot
  • TS Time Slot
  • the processor block 11 functions as a multi-thread pipeline processor (multi-thread processor).
  • the multi-thread pipeline processor can improve the processing efficiency by processing a plurality of threads at the same time and further processing the plurality of threads so as to fill a space in the execution pipeline.
  • Patent Document 4 a typical example of the configuration and operation of the multi-thread pipeline processor is disclosed in detail in Japanese Patent Application Laid-Open No. 2008-123045 (Patent Document 4), and detailed description thereof is omitted here.
  • the execution unit 101 executes a plurality of threads simultaneously.
  • the execution unit 101 includes a plurality of physical processors 121, a calculation control unit 122, and a calculation unit 123.
  • Each of the plurality of physical processors 121 includes a register. Each of these registers holds one or more contexts 124.
  • the context 124 corresponds to each of a plurality of threads (LP) and is control information and data information necessary for executing the corresponding thread.
  • Each physical processor 121 fetches and decodes an instruction in a thread (program), and issues a decoding result to the arithmetic control unit 122.
  • the computing unit 123 includes a plurality of computing units and executes a plurality of threads simultaneously.
  • the operation control unit 122 performs pipeline control in the multi-thread pipeline processor. Specifically, the arithmetic control unit 122 allocates a plurality of threads to the arithmetic unit included in the arithmetic unit 123 so as to fill a space in the execution pipeline, and then executes the thread.
  • the VMPC 102 controls virtual multithread processing.
  • the VMPC 102 includes a scheduler 126, a context memory 127, and a context control unit 128.
  • the scheduler 126 is a hardware scheduler that performs scheduling for determining the execution order of the plurality of threads and the PP for executing the threads according to the priority of the plurality of threads. Specifically, the scheduler 126 switches threads executed by the execution unit 101 by assigning or unassigning LPs to PPs.
  • the context memory 127 stores a plurality of contexts 124 respectively corresponding to a plurality of LPs. Note that the registers included in the context memory 127 or the plurality of physical processors 121 correspond to holding means of the present invention.
  • the context control unit 128 performs so-called context restoration and saving. Specifically, the context control unit 128 writes the context 124 held by the physical processor 121 that has been executed into the context memory 127. The context control unit 128 reads the context 124 of the thread to be executed from the context memory 127 and transfers the read context 124 to the physical processor 121 to which the LP corresponding to the thread is assigned.
  • FIG. 9 is a diagram showing the configuration of one context 124. Note that FIG. 9 does not show normal control information and normal data information necessary for executing a thread, and shows only information newly added to the context 124.
  • the context 124 includes a TVID (TLB access virtual identifier) 140, a PVID (physical memory protection virtual identifier) 141, and an MVID (memory access virtual identifier) 142.
  • TVID TLB access virtual identifier
  • PVID physical memory protection virtual identifier
  • MVID memory access virtual identifier
  • the TVID 140, PVID 141, and MVID 142 are tag information indicating whether each of a plurality of threads (LP) is a thread belonging to a host process or a thread belonging to a media process.
  • TVID 140 is used to set a plurality of virtual memory protection groups. For example, different TVIDs 140 are assigned to the host processing thread and the media processing thread, respectively.
  • the execution unit 101 can independently create page management information for the logical address space using the TVID 140.
  • PVID 141 is used to restrict access to the physical memory area.
  • MVID 142 is used for setting an access form to the memory IF block 14.
  • the memory IF block 14 uses this MVID 142 to determine whether to give priority to latency (response-oriented) or to give priority to bus bandwidth (performance guarantee).
  • FIG. 10 is a diagram schematically showing management of the logical address space in the processor system 10. As shown in FIG. 10, the processor system 10 is controlled by three layers of a user level, a supervisor level, and a virtual monitor level.
  • the user level is a hierarchy that performs control for each thread (LP).
  • the supervisor level is a hierarchy corresponding to an operating system (OS) that controls a plurality of threads.
  • OS operating system
  • the supervisor level includes a Linux kernel that is a host processing OS and a system manager that is a media processing OS.
  • the virtual monitor level is a hierarchy that controls a plurality of supervisor level OSs.
  • the logical address space using the TVID 140 is distinguished by a virtual monitor level OS (monitor program). That is, the processor system 10 manages the logical address space so that the logical address spaces used by a plurality of OSs do not interfere with each other.
  • the TVID 140, PVID 141, and MVID 142 of each context can be set only at this virtual monitor level.
  • the virtual monitor level OS divides the plurality of resources of the processor system 10 into a first resource associated with a thread belonging to host processing and a second resource associated with a thread belonging to media processing. It is.
  • the resources are a memory area (logical address space and physical address space) of the external memory 15, a memory area of the cache memory 109, a memory area of the TLB 104, and the FPU 107.
  • the designer can design an OS for host processing and media processing in the same manner as when host processing and media processing are executed by independent processors. .
  • the TLB 104 is a kind of cache memory, and holds an address conversion table 130 that is a part of a page table indicating a correspondence relationship between a logical address and a physical address.
  • the TLB 104 converts between a logical address and a physical address using the address conversion table 130.
  • FIG. 11 is a diagram showing the configuration of the address conversion table 130.
  • the address conversion table 130 includes a plurality of entries 150.
  • Each entry 150 includes a TLB tag unit 151 for identifying a logical address, and a TLB data unit 152 associated with the TLB tag unit 151.
  • the TLB tag unit 151 includes a VPN 153, a TVID 140, and a PID 154.
  • the TLB data unit 152 includes a PPN 155 and an Attribute 156.
  • VPN 153 is a user-level logical address, specifically a page number in the logical address space.
  • PID 154 is an ID for identifying a process using the data.
  • PPN 155 is a physical address associated with the TLB tag unit 151, and specifically, a page number in the physical address space.
  • Attribute 156 indicates an attribute of data associated with the TLB tag unit 151. Specifically, Attribute 156 indicates whether the data can be accessed, whether the data is stored in the cache memory 109, whether the data is privileged, and the like.
  • the TLB 104 manages a logical address space used by a plurality of threads (LP).
  • FIG. 12 is a diagram schematically showing the correspondence relationship of the logical addresses in the processor system 10.
  • the TLB 104 associates one physical address (PPN 155) with a set of a logical address (VPN 153), a PID 154, and a TV ID 140 for each process.
  • PPN 155 physical address
  • VPN 153 logical address
  • PID 154 PID 154
  • TV ID 140 TV ID 140
  • the supervisor level on the LP having the same TVID by associating one physical address with a set of logical address (VPN 153) and PID 154 for each process, the logical level of each process is set at the supervisor level.
  • the logical address can be associated with the physical address after distinguishing the addresses.
  • the TVID of the entry to be updated is set to the TVID set in the LP to be updated.
  • the TLB 104 associates one physical address (PPN155) with a set obtained by adding the TVID 140 to the logical address (VPN 153) and the PID 154 for each process. Accordingly, the TLB 104 can provide independent logical address spaces by setting different TVIDs for the host process and the media process at the virtual monitor level.
  • the TLB 104 includes an entry designation register 135.
  • the entry designation register 135 holds information for designating an entry 150 to be assigned to the TVID 140.
  • FIG. 13 is a diagram illustrating an example of data stored in the entry designation register 135. As illustrated in FIG. 13, the entry designation register 135 holds a correspondence relationship between the TVID 140 and the entry 150. The entry designation register 135 is set and updated by a virtual monitor level OS (monitor program).
  • OS monitor level OS
  • the TLB 104 determines the entry 150 to be used for each TVID 140 using the information set in the entry designation register 135. Specifically, when the TLB miss (the logical address (TLB tag unit 151) input from the LP does not hold in the address translation table 130), the TLB 104 replaces the data of the entry 150 corresponding to the TVID 140 of the LP. To do.
  • TLB miss the logical address (TLB tag unit 151) input from the LP does not hold in the address translation table 130
  • the TLB 104 replaces the data of the entry 150 corresponding to the TVID 140 of the LP. To do.
  • FIG. 14 is a diagram schematically showing the allocation state of the entry 150 in the TLB 104.
  • a plurality of entries 150 are shared by a plurality of LPs. Further, the TLB 104 uses the TVID 140 to share the entry 150 between LPs having the same TVID 140. For example, entry 0 to entry 2 are assigned to LP0 having TVID0, and entry 3 to entry 7 are assigned to LP1 and LP2 having TVID1. As a result, the TLB 104 can use entry 0 to entry 2 for threads belonging to the host process and entry 3 to entry 7 for threads belonging to the media process.
  • FIG. 15 is a flowchart showing the flow of processing by the TLB 104.
  • the TLB 104 first stores the same logical address as the logical address (VPN 153, TVID 140, and PID 154) input from the access source LP. It is determined whether or not (S101).
  • the TLB 104 updates the entry 150 assigned to the TVID 140 of the access source LP.
  • the TLB 104 updates the TV ID 140 of the access source LP and the entry 150 of the same TV ID 140 (S102).
  • the TLB 104 reads the correspondence relationship between the logical address and the physical address that missed the TLB from the page table stored in the external memory 15 or the like, and assigns the read correspondence relationship to the TVID 140 of the access source LP.
  • the stored entry 150 is stored.
  • the TLB 104 converts a logical address into a physical address using the updated correspondence relationship (S103).
  • the TLB 104 uses the correspondence relationship in which the TLB hit is used to set the logical address. Conversion to a physical address (S103).
  • the page table stored in the external memory 15 or the like is created in advance so that the physical address of the external memory 15 is assigned for each TVID 140 or PVID 141.
  • This page table is created and updated by, for example, a supervisor level or virtual monitor level OS.
  • the physical address management unit 105 uses the PVID 141 to protect access to the physical address space.
  • the physical address management unit 105 includes a plurality of physical memory protection registers 131, a protection violation register 132, and an error address register 133.
  • Each physical memory protection register 131 holds information indicating an LP that can access the physical address range for each physical address range.
  • FIG. 16 is a diagram showing a configuration of information held in one physical memory protection register 131.
  • the physical memory protection register 131 holds information including BASEADDR 161, PS 162, PN 163, PVID0WE to PVID3WE164, and PVID0RE to PVID3WE165.
  • BaseADDR 161, PS 162, and PN 163 are information for specifying a physical address range. Specifically, BASEADDR 161 is the upper 16 bits of the head address of the designated physical address range. PS162 indicates the page size. For example, 1 KB, 64 KB, 1 MB, or 64 MB is set as the page size. PN163 indicates the number of pages with the page size set in PS162.
  • PVID0WE to PVID3WE164 and PVID0RE to PVID3RE165 indicate the PVID 141 of LP that can be accessed in the physical address range specified by BASEADDR161, PS162, and PN163.
  • PVID0WE to PVID3WE164 are provided with one bit for each PVID141.
  • PVID0WE to PVID3WE164 indicate whether or not the LP to which the corresponding PVID 141 is assigned can write data in the designated physical address range.
  • PVID0RE to PVID3RE165 are provided with 1 bit for each PVID141.
  • PVID0RE to PVID3RE165 indicate whether or not the LP assigned with the corresponding PVID 141 can read data in the designated physical address range.
  • PVID 141 four types are assigned to a plurality of LPs, but two or more types of PVID 141 may be assigned to a plurality of LPs.
  • FIG. 17 is a diagram illustrating an example of a physical address space protected by the PVID 141.
  • the physical address management unit 105 includes four physical memory protection registers 131 (PMG0PR to PMG3PR).
  • PVID0 is assigned to the LP group for Linux (host processing)
  • PVID1 is assigned to the LP group for image processing among the LPs for media processing
  • PVID2 is assigned to the LP group for audio processing among the LPs for media processing.
  • the PVID 3 is assigned to the LP group of the System Manager (OS for media processing).
  • the physical address management unit 105 generates an exception interrupt when the LP accesses a physical address that is not permitted by the PVID 141 of the LP, and writes the access information in which an error has occurred in the protection violation register 132. In addition, the physical address of the access destination of the access that caused the error is written in the error address register 133.
  • FIG. 18 is a diagram showing a configuration of access information held in the protection violation register 132.
  • the access information held in the protection violation register 132 includes PVERR 167 and PVID 141.
  • the PVERR 167 indicates whether or not the error is a physical memory space protection violation (an error when the LP accesses a physical address that is not permitted by the PVID 141 of the LP).
  • PVID 141 is set to PVID 141 in which a physical memory space protection violation has occurred.
  • FIG. 19 is a diagram showing a configuration of information held in the error address register 133.
  • the error address register 133 holds the physical address (BEA [31: 0]) of the access destination of the access that caused the error.
  • the robustness of the system can be improved by protecting the physical address using the PVID 141. Specifically, at the time of debugging, the designer can easily determine which one of the image processing and the sound processing has caused the error from the physical address or PVID in which the error has occurred. Further, when debugging host processing, it is possible to debug a malfunction occurring at an address where image processing or the like cannot be written without doubting the malfunction of the image processing.
  • the FPU allocation unit 108 allocates a plurality of FPUs 107 to LPs.
  • the FPU allocation unit 108 includes an FPU allocation register 137.
  • FIG. 20 is a diagram illustrating an example of data stored in the FPU allocation register 137. As shown in FIG. 20, the FPU 107 is associated with the FPU allocation register 137 for each TVID 140. The FPU allocation register 137 is set and updated by an OS (monitor program) at the virtual monitor level.
  • OS monitoring program
  • FIG. 21 is a diagram schematically showing FPU 107 allocation processing by the FPU allocation unit 108.
  • a plurality of FPUs 107 are shared by a plurality of LPs. Further, the FPU allocation unit 108 uses the TVID 140 to share the FPU 107 between LPs having the same TVID 140. For example, the FPU allocation unit 108 allocates FPU0 to LP0 having TVID0, and allocates FPU1 to LP1 and LP2 having TVID1.
  • the LP executes a thread using the FPU 107 allocated by the FPU allocation unit 108.
  • the cache memory 109 is a memory that temporarily stores data used in the processor block 11. Further, the cache memory 109 uses independent and different data areas (way 168) for LPs having different TVIDs 140.
  • the cache memory 109 includes a way designation register 136.
  • FIG. 22A and 22B are diagrams showing examples of data stored in the way designation register 136.
  • FIG. 22A and 22B are diagrams showing examples of data stored in the way designation register 136.
  • a way 168 is associated with the way designation register 136 for each TVID 140.
  • the way designation register 136 is set and updated by an OS (monitor program) at the virtual monitor level.
  • a way 168 may be associated with each LP.
  • information on the way used by the LP is included in the context 124, and the virtual monitor level OS or the supervisor level OS refers to the context 124 and sets and updates the way designation register 136. To do.
  • FIG. 23 is a diagram schematically showing the way 168 allocation processing by the cache memory 109.
  • the cache memory 109 has a plurality of ways 168 (way 0 to way 7) as data storage units.
  • the cache memory 109 uses the TVID 140 to share the way 168 between LPs having the same TVID 140.
  • way0 to way1 are assigned to LP0 having TVID0
  • ways2 to way7 are assigned to LP1 and LP2 having TVID1.
  • the cache memory 109 caches thread data belonging to the host process in way0 to way1, and caches thread data belonging to the media process in way2 to way7.
  • the cache memory 109 can prevent the cache data from being driven out from each other between LPs having different TVIDs 140.
  • FIG. 24 is a flowchart showing the flow of processing by the cache memory 109.
  • the cache memory 109 stores the same address as the address (physical address) input from the access source LP. Is determined (S111).
  • the cache memory 109 caches the address and data input from the access source LP in the way 168 specified by the way specification register 136 (S112). ). Specifically, in the case of read access, the cache memory 109 reads data from the external memory 15 or the like, and stores the read data in the way 168 designated by the way designation register 136. In the case of write access, the cache memory 109 stores the data input from the access source LP in the way 168 specified by the way specification register 136.
  • step S111 when the same address as the address input from the access source LP is stored in step S111, that is, in the case of a cache hit (No in S111), the cache memory 109 updates (writes) the cache hit data. (At the time of access) or output to the access source LP (at the time of read access) (S113).
  • the BCU 110 controls data transfer between the processor block 11 and the memory IF block 14.
  • the interrupt control unit 111 performs interrupt detection, request, and permission.
  • the interrupt control unit 111 includes a plurality of interrupt control registers 134.
  • the interrupt control unit 111 includes 128 interrupt control registers 134.
  • the interrupt control unit 111 refers to the interrupt control register 134 and sends an interrupt to the thread (LP) corresponding to the interrupt factor of the generated interrupt.
  • an interrupt destination thread corresponding to the interrupt factor is set.
  • FIG. 25 is a diagram showing the configuration of one interrupt control register 134.
  • the interrupt control register 134 shown in FIG. 25 outputs a system interrupt 171 (SYSINT), an LP identifier 172 (LPID), an LP interrupt 173 (LPINT), and an HW event 174 (HWEVT) associated with the interrupt factor. Including.
  • SYSINT system interrupt 171
  • LPID LP identifier 172
  • LPINT LP interrupt 173
  • HWEVT HW event 174
  • the system interrupt 171 indicates whether or not the interrupt is a system interrupt (global interrupt).
  • the LP identifier 172 indicates the LP of the interrupt destination.
  • the LP interrupt 173 indicates whether the interrupt is an LP interrupt (local interrupt).
  • the HW event 174 indicates whether a hardware event is generated due to the interrupt factor.
  • the interrupt control unit 111 sends an interrupt to the LP that is currently executing the thread.
  • the interrupt control unit 111 sends an interrupt to the LP indicated by the LP identifier 172.
  • a hardware event is sent to the LP indicated by the LP identifier 172. The corresponding LP wakes up by this hardware event.
  • the system interrupt 171 and the LP identifier 172 can be rewritten only by a virtual monitor level OS (monitor program), and the LP interrupt 173 and the HW event 174 can be rewritten only by a virtual monitor level and supervisor level OS. is there.
  • FIG. 26 is a diagram schematically showing a state of memory access management in the processor system 10.
  • the MVID 142 is sent from the processor block 11 to the memory IF block 14.
  • the memory IF block 14 uses this MVID 142 to assign a bus bandwidth for each MVID 142 and then accesses the external memory 15 using the bus bandwidth assigned to the MVID 142 of the thread that requested access.
  • the memory IF block 14 includes a bus bandwidth specification register 138.
  • FIG. 27 is a diagram illustrating an example of data held in the bus bandwidth specification register 138 by the memory IF block 14.
  • different MVIDs 142 are assigned to Linux, which is host processing, audio processing (Audio) included in media processing, and image processing (Video) included in media processing.
  • the memory IF block 14 allocates a bus bandwidth for each MVID 142. Further, a priority order is determined for each MVID 142, and the external memory 15 is accessed based on the priority order.
  • the processor system 10 can achieve performance guarantees and real-time guarantees for a plurality of applications.
  • the memory IF is connected via a plurality of data buses.
  • the same control as when the block 14 and the processor block 11 are connected can be performed. That is, it is possible to perform the same control as when the bus is divided for a plurality of blocks.
  • Patent Document 5 A technique for securing the bus bandwidth and guaranteeing the latency with respect to access requests from a plurality of blocks is disclosed in detail in Japanese Patent Laid-Open No. 2004-246862 (Patent Document 5). Therefore, detailed description is omitted here.
  • the ratio of processing time between media processing and host processing can be arbitrarily set by using the functions of the TVID 140 and the conventional VMP.
  • the processing time ratio for each TVID 140 (the processing time ratio between media processing and host processing) is set in a register (not shown) included in the VMPC 102 by the OS at the virtual monitor level.
  • the VMPC 102 refers to the set processing time ratio and the TVID 140 of each thread, and switches the thread executed by the execution unit 101 so that the processing time ratio is satisfied.
  • FIG. 28 is a flowchart showing the flow of resource division processing by the monitor program.
  • the monitor program divides a plurality of threads into a plurality of groups by setting TVID 140, PVID 141, and MVID 142 of the plurality of contexts 124 (S121, S122, and S123).
  • the monitor program sets a correspondence relationship between the TVID 140 and the entry 150 in the entry designation register 135, whereby the first entry that associates the plurality of entries 150 of the TLB 104 with the host process and the second entry that associates with the media process. (S124).
  • the TLB 104 allocates an entry 150 to a thread belonging to the host process and a thread belonging to the media process.
  • the monitor program sets a correspondence relationship between the TVID 140 (or LP) and the way 168 in the way designation register 136, whereby the plurality of ways 168 included in the cache memory 109 are associated with the host process and the first way
  • the process is divided into second ways to be associated with processing (S125).
  • the TLB 104 assigns a way 168 to a thread belonging to the host process and a thread belonging to the media process.
  • the monitor program sets a correspondence relationship between the TVID 140 and the FPU 107 in the FPU allocation register 137, thereby dividing the plurality of FPUs 107 into a first FPU associated with the host process and a second FPU associated with the media process (S126). .
  • the FPU allocation unit 108 allocates the FPU 107 to the thread belonging to the host process and the thread belonging to the media process.
  • the monitor program also associates the bus bandwidth between the external memory 15 and the memory IF block 14 with the host processing by setting the correspondence relationship between the MVID 142 and the bus bandwidth in the bus bandwidth specification register 138.
  • the first bus bandwidth is divided into the second bus bandwidth associated with the media processing (S127).
  • the memory IF block 14 assigns the bus bandwidth to the thread belonging to the host process and the thread belonging to the media process. assign.
  • the monitor program creates a page table indicating the correspondence between physical addresses and logical addresses.
  • the monitor program sets a correspondence relationship between the PVID 141 and the physical address, so that the physical address space of the external memory 15 is associated with the host process, and the second physical address range is associated with the media process.
  • the first physical address range is assigned to the host processing thread
  • the second physical address range is assigned to the media processing thread (S128).
  • the monitor program protects the physical address by setting the corresponding relationship between the PVID 141 and the physical address in the physical memory protection register 131.
  • the monitor program sets the interrupt destination LP or the like in the interrupt control register 134 in correspondence with each interrupt factor (S129).
  • the monitor program can perform interrupt control independent of host processing and media processing.
  • the interrupt control unit 111 sends an interrupt to the thread corresponding to the interrupt factor.
  • each supervisor-level OS to which TVID 140 is assigned may determine a logical address corresponding to the assigned physical address and create a page table for each OS. This is possible and the present invention is not limited to this.
  • the processor system 10 can improve the area efficiency by including the single processor block 11 that shares resources and performs host processing and media processing. Further, the processor system 10 gives different tag information (TVID 140, PVID 141, and MVID 142) to the host processing thread and the media processing thread, and divides the resources of the processor system 10 in association with the tag information. As a result, the processor system 10 can allocate independent resources to the host process and the media process. Therefore, since there is no resource contention between the host process and the media process, the processor system 10 can improve performance guarantee and robustness.
  • tag information TVID 140, PVID 141, and MVID 142
  • the physical address management unit 105 generates an interrupt when each thread tries to access outside the designated physical address range using the PVID 141. Thereby, the processor system 10 can improve the robustness of the system.
  • the processor system 10 according to the present embodiment has been described above, but the present invention is not limited to this embodiment.
  • the processor block 11 performs two types of processing, that is, host processing and media processing, has been described, but three or more types of processing including other processing may be performed.
  • three or more types of TVIDs 140 respectively corresponding to the three or more types of processing are assigned to a plurality of threads.
  • PVID 141 and MVID 142 are not limited to the numbers described above, and may be plural.
  • TVID 140 three types of TVID 140, PVID 141, and MVID 142 have been described as tag information for grouping a plurality of threads.
  • the processor system 10 uses only one tag information (for example, TVID 140). Also good. That is, the processor system 10 may use the TVID 140 for physical address management and bus width control without using the PVID 141 and the MVID 142.
  • the processor system 10 may use two types of tag information, or may use four or more types of tag information.
  • the interrupt control register 134, the entry designation register 135, the way designation register 136, the FPU allocation register 137, and the page table are set and updated by the virtual monitor level OS (monitor program).
  • the supervisor level OS may set and update the interrupt control register 134, the entry specification register 135, the way specification register 136, the FPU allocation register 137, and the page table in accordance with an instruction from the monitor level OS.
  • the resource assigned to the supervisor level OS is notified to the supervisor level OS by the virtual monitor level OS, and the supervisor level OS uses the interrupt control register 134,
  • the entry specification register 135, the way specification register 136, the FPU allocation register 137, and the page table may be set and updated.
  • each processing unit included in the processor system 10 is typically realized as an LSI which is an integrated circuit. These may be individually made into one chip, or may be made into one chip so as to include a part or all of them.
  • LSI is used, but depending on the degree of integration, it may be called IC, system LSI, super LSI, or ultra LSI.
  • circuits are not limited to LSI, and may be realized by a dedicated circuit or a general-purpose processor.
  • An FPGA Field Programmable Gate Array
  • reconfigurable processor that can reconfigure the connection and setting of circuit cells inside the LSI may be used.
  • part or all of the functions of the processor system 10 according to the embodiment of the present invention may be realized by the execution unit 101 or the like executing a program.
  • the present invention may be the above program or a recording medium on which the above program is recorded.
  • the program can be distributed via a transmission medium such as the Internet.
  • the present invention can be applied to processor devices and multi-thread processor devices, and is particularly suitable for media processing processor devices and multi-thread processor devices mounted on digital televisions, DVD recorders, digital cameras, mobile phones, and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Advance Control (AREA)
  • Multi Processors (AREA)

Abstract

 本発明のプロセッサ装置は、複数のプロセッサ間でハードウェア資源(260、270)を共有するプロセッサ装置であって、前記ハードウェア資源内のレジスタに現在実行中の何れかのプログラムの拡張コンテキストデータが保持されているか否かを判定する第1判定部(215)と、前記ハードウェア資源内の拡張コンテキストデータなどのプロセッサに対応するかを判定する第2判定部(216)と、プロセッサ内のプログラム間で拡張コンテキストデータの退避と復帰とを行う第1転送部(251)と、プロセッサ間のプログラム間で拡張コンテキストデータの退避と復帰とを行う第2転送部(252)とを備える。

Description

プロセッサ装置、マルチスレッドプロセッサ装置
 プロセッサ装置のプログラムを切り替えながら実行する複数のプロセッサを有するプロセッサ装置およびマルチスレッドプロセッサ装置に関し、特にハードウェア資源を複数のプロセッサで共有するプロセッサ装置およびマルチスレッドプロセッサ装置に関する。
 近年のデジタル技術、動画像及び音声の圧縮伸張技術の急速な進展に伴い、デジタルテレビ、デジタルビデオレコーダ(DVDレコーダ等)、携帯電話、及び映像音声機器(ビデオカメラ等)に搭載されるプロセッサに、さらなる高性能化が求められている。
 例えば、高性能化を実現するプロセッサとしてマルチスレッドプロセッサが知られている(例えば、特許文献1参照)。このマルチスレッドプロセッサは、複数のスレッドを同時に実行することにより、処理効率を向上できる。また、マルチスレッドプロセッサは、複数のスレッドの実行において、資源の共有が可能となるので、複数のプロセッサを独立に設ける場合に比べて、プロセッサの面積効率を向上できる。
 一方、このようなプロセッサでは、リアルタイム性が要求されない制御関連のホスト処理と、リアルタイム性が要求される動画像の圧縮及び伸張処理等のメディア処理とが行われる。
 例えば、特許文献2記載の映像音声処理用集積回路は、ホスト処理を行うマイコンブロックと、メディア処理を行うメディア処理ブロックとをそれぞれ備える。
 また、FPU(浮動小数点演算装置:Floating Point number processing Unit)のコンテキスト切り替えを必要最小限にする技術としてレイジー・コンテキスト・スイッチ(Lazy context switch)という技術がある。この方法によれば、実行コンテキストで、FPU命令を実行することが必要になった時までFPUコンテキストの退避と復帰を遅らせて行う。つまり、通常のプロセッサのコンテキストの退避および復帰とは非同期に、FPUのコンテキスト切り換えを行い、その機会を必要最小限に抑える。
 FPUは多数のレジスタを有すること、時分割多重化されるプログラムにはFPUを使用しないプログラムも存在することから、上記方法は、FPUコンテキストの退避および復帰のオーバヘッドの低減を図っている。
特開2006-302261号公報 国際公開第2005/096168号 特開2003-271399号公報 特開2008-123045号公報 特開2004-246862号公報
 しかしながら、マルチプロセッサにおいてFPU等のハードウェア資源を利用する場合には、次の問題がある。
 プロセッサ毎にFPUを備えプロセッサ毎にレイジー・コンテキスト・スイッチを適用する場合には、回路規模が増大する。さらに、プロセッサ間でFPUの稼動率にばらつきが生じ、使用効率を向上できない。
 本発明は、複数のプロセッサでFPU等のハードウェア資源を共有し、使用効率を向上させるプロセッサ装置およびマルチスレッドプロセッサ装置を提供することを目的とする。
 上記の課題を解決するために本発明のプロセッサ装置は、複数のプログラムを切り替えながら実行する複数のプロセッサと、データを保持するレジスタを有し前記複数のプロセッサの命令実行を補完する1つ以上のハードウェア資源と、前記複数のプログラムのうち前記ハードウェア資源を利用する所定命令を含むプログラム毎に、前記ハードウェア資源内のレジスタデータのコピーである拡張コンテキストデータを記憶するメモリと、前記ハードウェア資源と前記メモリとの間で、拡張コンテキストデータの退避と復帰とを制御する制御部と、前記ハードウェア資源内に現在実行中のプログラムの拡張コンテキストデータが保持されている可能性があるか否かを判定する第1判定部と、前記ハードウェア資源内の拡張コンテキストデータが前記所定命令を実行しようとしたプロセッサに属するか否かを判定する第2判定部と、を備え、前記可能性があると前記第1判定部によって判定され、かつ、前記ハードウェア資源内の拡張コンテキストデータが、前記所定命令を実行しようとしたプロセッサに属すると前記第2判定部によって判定された場合に、前記制御部が拡張コンテキストデータの退避および復帰を行うことなく、前記ハードウェア資源は当該所定命令を実行する。
 この構成によれば、各ハードウェア資源を複数のプロセッサで共有することができる。つまり、どのプロセッサでも各ハードウェア資源を使用することができる。それゆえ、ハードウェア資源の使用効率を向上させることができる。ハードウェア資源をプロセッサ毎に備える必要がないので、必要な処理性能に応じた個数の必要最小限のハードウェア資源を備えればよく、回路規模を削減または最適化することができる。
 ここで、前記制御部は、前記第1判定部および前記第2判定部の判定結果に応じて、ハードウェア資源からメモリに拡張コンテキストデータを退避し、退避した拡張コンテキストデータと同じプロセッサに属するコンテキストデータを復帰する第1転送部と、前記第1判定部および前記第2判定部の判定結果に応じて、ハードウェア資源からメモリに拡張コンテキストデータを退避し、退避した拡張コンテキストデータとは異なるプロセッサに属する拡張コンテキストデータを復帰する第2転送部とを備えるようにしてもよい。
 ここで、前記ハードウェア資源は前記複数のプロセッサが実行できない拡張命令を実行する拡張演算ユニットであり、前記所定の命令は前記拡張命令であってもよい。
 この構成によれば、FPUやハードウェアアクセラレータ等の拡張演算ユニットを効率よく複数のプロセッサで共有することができ、拡張コンテキストデータの退避および復帰を最小限にすることができる。
 ここで、前記第1判定部は、複数のプロセッサのそれぞれに設けられたデータ判定部を含み、各データ判定部は、当該データ判定部に対応するプロセッサがプログラム中の前記所定命令を実行しようとしたとき、当該データ判定部に対応するプロセッサで現在実行中のプログラムの拡張コンテキストデータが前記ハードウェア資源内に保持されている可能性があるか否かを判定し、前記第2判定部は、複数のプロセッサのそれぞれに設けられたプロセッサ判定部を含み、各プロセッサ判定部は、前記ハードウェア資源内の拡張コンテキストデータが前記所定命令を実行しようとしたプロセッサに属するか否かを判定するようにしてもよい。
 この構成によれば、データ判定部およびプロセッサ判定部はプロセッサ毎に備えられるので、ハードウェア資源が現在実行中のプログラム(つまり所定命令を発行したプログラム)の拡張コンテキストデータを保持している場合には、他のプロセッサになんら影響を与えることなく、ハードウェア資源を使用することができる。
 ここで、前記複数のプロセッサのそれぞれは、状態レジスタを有し、各状態レジスタのデータのコピーは、プログラム毎のコンテキストデータに含まれ、各状態レジスタは、前記ハードウェア資源毎に、現在実行中のプログラムの拡張コンテキストデータが当該ハードウェア資源内に保持されている可能性があるか否かを示す第1状態情報と、前記ハードウェア資源毎に当該ハードウェア資源内に保持されている拡張コンテキストデータに対応するプロセッサを示す第2状態情報とを保持し、前記各データ判定部は、対応するプロセッサがプログラム中の前記所定命令を実行しようとしたとき、前記第1状態情報が真か偽かを判定し、偽であると判定したとき第1の例外割込み信号を発生する第1判定回路を含み、前記各プロセッサ判定部は、対応する前記第1判定回路が偽であると判定したとき、対応するプロセッサと前記第2状態情報が示すプロセッサとが一致するか否かを判定し、偽であると判定したとき第2の例外割込み信号を発生する第2判定回路を含み、前記ハードウェア資源は、前記第2判定回路が一致すると判定したとき、拡張コンテキストデータの退避および復帰を待つことなく、当該所定命令に従って即座に動作するとしてもよい。
 この構成によれば、データ判定部およびプロセッサ判定部はハードウェア(第1判定回路および第2判定回路)により構成されるので、ハードウェア資源が現在実行中のプログラム(つまり所定命令を発行したプログラム)の拡張コンテキストデータを保持している場合には、他のプロセッサになんら影響を与えることなく、かつ、高速にハードウェア資源を使用することができる。
 ここで、前記第1転送部は、プロセッサ毎に設けられた退避復帰部を含み、各退避復帰部は、前記第1の例外割り込み信号が発生した場合に前記ハードウェア資源から前記メモリに拡張コンテキストデータを退避し、前記メモリから前記ハードウェア資源に前記所定命令を実行しようとしたプロセッサの拡張コンテキストデータを復帰し、前記複数のプロセッサは、第1のプロセッサと第2のプロセッサとを含み、前記第1のプロセッサは第1のオペレーティングシステムを実行することによって複数のプログラムを時分割多重で実行し、前記第2のプロセッサは第1のオペレーティングシステムとは異なる第2のオペレーティングシステムを実行することによって複数のプログラムを時分割多重で実行し、前記第1のプロセッサ内の前記退避復帰部は、前記第1のプロセッサ内の前記第1判定回路が前記第1の例外割込み信号を発生したとき、前記第1のオペレーティングシステムによって起動され、前記第2のプロセッサ内の前記退避復帰部は、前記第2のプロセッサ内の前記第1判定回路が前記第1の例外割込み信号を発生したとき、第2のオペレーティングシステムによって起動されるようにしてもよい。
 この構成によれば、異なるオペレーティングシステム(以下OSと略す)を実行するプロセッサ間でハードウェア資源を共有することができる。プロセッサ内のプログラム間でハードウェア資源の拡張コンテキストデータの切り替えが必要な場合は、他のOSに影響を与えることなく、OS内で効率よく拡張コンテキストデータを切り替えることができる。
 ここで、前記複数のプロセッサの少なくとも1つは、前記第1のオペレーティングシステムと前記第2のオペレーティングシステムとを管理する第3のオペレーティングシステムを実行し、前記第2の転送部は、何れかの前記第2判定回路が前記第2の例外割込み信号を発生したとき、第3のオペレーティングシステムによって起動されるようにしてもよい。
 この構成によれば、異なるオペレーティングシステム(以下OSと略す)を実行するプロセッサ間でハードウェア資源を共有することができる。異なるOSを実行するプロセッサ間でハードウェア資源の拡張コンテキストデータの切り替えが必要な場合は、第3のOSの管理の下で、拡張コンテキストデータを切り替える。これにより、どのプロセッサ上のプログラムに対しても拡張コンテキストデータの切り替えが隠蔽されるので、従来のプログラムを容易に流用することができる。
 ここで、前記第3オペレーティングシステムは、何れかの前記第2判定回路が前記第2の例外割込み信号を発生したとき、当該ハードウェア資源が他のプロセッサの所定命令を実行中である場合は、当該ハードウェア資源が解放されるのを待ち、当該ハードウェア資源を確保した後に、前記第2の転送部を起動するようにしてもよい。
 この構成によれば、異なるOSのプロセッサ間で所定の命令が競合した場合(ハードウェア資源の使用が競合した場合)でも、第3のOSの管理の下で容易に調停することができる。
 ここで、前記第2転送部は、前記ハードウェア資源から前記メモリに前記他のプロセッサに対応する拡張コンテキストデータを退避する動作の開始から、前記メモリから前記ハードウェア資源に前記所定命令を実行しようとしたプロセッサの拡張コンテキストデータを復帰する動作の改良までをアトミックに行うようにしてもよい。
 この構成によれば、第2転送部は上記の退避開始から復帰完了までをアトミックに行うので、プログラム毎のコンテキストデータ(特に第1状態情報および第2状態情報)に矛盾を生じさせることなく、他のプロセッサからの干渉を受けることなく、異なるプロセッサ間でハードウェア資源を共有することができる。
 ここで、各プロセッサは、さらに、当該プロセッサが停止状態、待ち状態または休眠状態に遷移したとき、当該プロセッサに対応する第2状態情報をクリアするクリア回路を備えるようにしてもよい。
 この構成によれば、1つのプロセッサが停止状態、待ち状態または休眠状態に遷移したときに、クリア回路によって当該プロセッサが使用しているハードウェア資源を解放することができ、複数のプロセッサで共有されるハードウェア資源の使用効率を向上させる。
 ここで、前記各状態レジスタは、第2状態情報をロックするか否かを示す第3状態情報を保持し、前記第3オペレーティングシステムは、第3状態情報が第2状態情報をロックすることを示すとき、前記クリア回路による第2状態情報のクリアを禁止するようにしてもよい。
 この構成によれば、ハードウェア資源を使用するプロセッサが固定的である場合や、ハードウェア資源をあるプロセッサが優先して使用する場合に、プログラマが第3状態情報を「ロック」に設定することにより、ハードウェア資源を当該プロセッサに占有させ続けることができ、無駄な拡張コンテキストデータの退避および復帰を削減することができる。
 また、本発明のプロセッサ装置は、複数のスレッドを同時に実行することによって、複数のプログラムを切り替える複数の仮想プロセッサを備えるマルチスレッドプロセッサと、データを保持するレジスタを有し前記複数の仮想プロセッサの命令実行を補完する1つ以上のハードウェア資源と、前記複数のプログラムのうち前記ハードウェア資源を利用する所定命令を含むプログラム毎に、前記ハードウェア資源内のレジスタデータのコピーである拡張コンテキストデータを記憶するメモリと、前記ハードウェア資源と前記メモリとの間で、拡張コンテキストデータの退避と復帰とを制御する制御部と、前記ハードウェア資源内に現在実行中のプログラムの拡張コンテキストデータが保持されている可能性があるか否かを判定する第1判定部と、前記ハードウェア資源内の拡張コンテキストデータが前記所定命令を実行しようとしたプロセッサに属するか否かを判定する第2判定部と、を備え、前記可能性があると前記第1判定部によって判定され、かつ、前記ハードウェア資源内の拡張コンテキストデータが、前記所定命令を実行しようとしたプロセッサに属すると前記第2判定部によって判定された場合に、前記制御部が拡張コンテキストデータの退避および復帰を行うことなく、前記ハードウェア資源は当該所定命令を実行する構成であってもよい。
 この構成によれば、上記と同様の効果がある。
 ここで、前記制御部は、前記第1判定部および前記第2判定部の判定結果に応じて、ハードウェア資源からメモリに拡張コンテキストデータを退避し、退避した拡張コンテキストデータと同じプロセッサに属するコンテキストデータを復帰する第1転送部と、前記第1判定部および前記第2判定部の判定結果に応じて、ハードウェア資源からメモリに拡張コンテキストデータを退避し、退避した拡張コンテキストデータとは異なるプロセッサに属する拡張コンテキストデータを復帰する第2転送部とを備える構成としてもよい。
 ここで、前記複数の仮想プロセッサのそれぞれは、少なくとも1つのスレッドに対応し、前記マルチスレッドプロセッサは、スレッドの命令をフェッチおよび解読する複数の命令準備部と、前記複数の命令準備部により解読された命令であって、1以上のスレッドに対応する1以上の命令を同時に実行する実行部と、命令準備部毎に設けられた状態レジスタとを有し、前記制御部は、命令準備部毎に、現在のスレッドを他のスレッドに入れ替えることによって、前記複数の仮想プロセッサのうち実行中の仮想プロセッサと実行中でない仮想プロセッサとを入れ替え、各状態レジスタのデータのコピーは、仮想プロセッサ毎のコンテキストデータに含まれ、各状態レジスタは、前記ハードウェア資源毎に、現在実行中の仮想プロセッサの拡張コンテキストデータが当該ハードウェア資源内に保持されている可能性があるか否かを示す第1状態情報と、前記ハードウェア資源毎に当該ハードウェア資源内に保持されている拡張コンテキストデータに対応する仮想プロセッサを示す第2状態情報とを保持し、前記マルチスレッドプロセッサは、さらに、スレッドの入れ替えによって実行中の仮想プロセッサが実行中でなくなったときに、スレッドの入れ替えがあった命令準備部内の状態レジスタの第2状態情報をクリアするクリア回路を備える構成としてもよい。
 ここで、前記第1判定部は、前記複数の命令準備部のそれぞれに設けられたデータ判定部を含み、前記各データ判定部は、対応する命令準備部のスレッドが前記所定命令を実行しようとしたとき、前記第1状態情報が真か偽かを判定することによって、現在実行中のプログラムの拡張コンテキストデータが前記ハードウェア資源内に保持されている可能性があるか否かを判定し、前記第2判定部は、前記複数の命令準備部のそれぞれに設けられたプロセッサ判定部を含み、前記各プロセッサ判定部は、対応する命令準備部内の前記データ判定部が偽であると判定したとき、対応する命令準備部の仮想プロセッサと前記第2状態情報が示す仮想プロセッサとが一致するか否かを判定し、偽であると判定したとき第2の例外割込み信号を発生し、前記マルチスレッドプロセッサは、さらに、前記プロセッサ判定部からの第2の例外割込み信号によって起動される第2の例外割り込み処理を、オペレーティングシステムの一部の機能として実行し、前記オペレーティングシステムは、前記ハードウェア資源の獲得処理と、前記ハードウェア資源の解放を待つ待ち処理を含み、前記オペレーティングシステムは、前記第2の例外割り込み信号を発生させた仮想プロセッサの属する命令準備部以外の命令準備部に属する仮想プロセッサにおいて当該ハードウェア資源が使用中でない場合に、前記獲得処理として、前記第2の例外割り込み信号を発生させた命令準備部内の状態レジスタに、真を示す第1状態情報と、前記第2の例外割り込み信号を発生させた仮想プロセッサを示す第2状態情報とを設定し、前記第2の例外割り込み信号を発生させた仮想プロセッサの属する命令準備部以外の命令準備部において仮想プロセッサにおいて当該ハードウェア資源が使用中である場合に、前記待ち処理を実行する構成としてもよい。
 この構成によれば、ハードウェア資源(例えば、FPUやハードウェアアクセラレータ等の拡張演算ユニット)を複数のプロセッサで効率良く共有することができる。つまり、どのプロセッサでも各ハードウェア資源を使用することができる。それゆえ、ハードウェア資源の使用効率を向上させることができる。ハードウェア資源をプロセッサ毎に備える必要がないので、必要な処理性能に応じた個数の必要最小限のハードウェア資源を備えればよく、回路規模を削減または最適化することができる。
図1は、第1の実施の形態におけるプロセッサ装置の構成を示すブロック図である。 図2は、第1の実施の形態における状態レジスタ部内の第1~第3状態情報の一例を示す図である。 図3は、第1の実施の形態におけるプロセッサ装置におけるオペレーティングシステムについての説明図である。 図4は、第1の実施の形態におけるハードウェア資源切り替え動作を示すフローチャートである。 図5は、第1の実施の形態における第3のOSが管理するデータの一例を示す図である。 図6は、第1の実施の形態におけるハードウェア資源切り替え動作を示す詳細なフローチャートである。 図7は、第2の実施の形態に係るプロセッサシステムの構成を示すブロック図である。 図8は、第2の実施の形態に係るプロセッサブロックの構成を示すブロック図である。 図9は、第2の実施の形態に係るコンテキストの構成を示す図である。 図10は、第2の実施の形態に係る論理アドレス空間の管理を示す図である。 図11は、第2の実施の形態に係るアドレス管理テーブルの構成を示す図である。 図12は、第2の実施の形態における、論理アドレスの対応関係を示す図である。 図13は、第2の実施の形態に係るエントリ指定レジスタの構成を示す図である。 図14は、第2の実施の形態に係るTLBによるエントリの割り当て処理を示す図である。 図15は、第2の実施の形態に係るTLBによる処理の流れを示すフローチャートである。 図16は、第2の実施の形態に係る物理保護レジスタの構成を示す図である。 図17は、第2の実施の形態において、PVIDにより保護される物理アドレス空間を示す図である。 図18は、第2の実施の形態に係る保護違反レジスタの構成を示す図である。 図19は、第2の実施の形態に係るエラーアドレスレジスタの構成を示す図である。 図20は、第2の実施の形態に係るFPU割り当てレジスタの構成を示す図である。 図21は、第2の実施の形態に係るFPU割り当て部によるFPUの割り当て処理を示す図である。 図22Aは、第2の実施の形態に係るウェイ指定レジスタの構成を示す図である。 図22Bは、第2の実施の形態に係るウェイ指定レジスタの構成を示す図である。 図23は、第2の実施の形態に係るキャッシュメモリによるウェイの割り当て処理を模式的に示す図である。 図24は、第2の実施の形態に係るキャッシュメモリによる処理の流れを示すフローチャートである。 図25は、第2の実施の形態に係る割り込み制御レジスタの構成を示す図である。 図26は、第2の実施の形態に係るプロセッサシステムにおける、メモリアクセス管理を示す図である。 図27は、第2の実施の形態に係るメモリIFブロックによるバスバンド幅の割り当てを示す図である。 図28は、第2の実施の形態に係るプロセッサシステムにおける資源分割処理の流れを示すフローチャートである。
 (第1の実施の形態)
 本実施形態におけるプロセッサ装置は、複数のプロセッサ間でハードウェア資源を共有するプロセッサ装置であって、ハードウェア資源内のレジスタに現在実行中の何れかのプログラムの拡張コンテキストデータが保持されているか否かを判定する第1判定部と、前記ハードウェア資源内の拡張コンテキストデータが、どのプロセッサに対応するかを判定する第2判定部と、プロセッサ内のプログラム間で拡張コンテキストデータの退避と復帰とを行う第1転送部と、プロセッサ間のプログラム間で拡張コンテキストデータの退避と復帰とを行う第2転送部とを備える。
 図1は、本発明の第1の実施の形態におけるプロセッサ装置の構成を示すブロック図である。このプロセッサ装置は、命令準備部210、220および230と、実行パイプライン部240と、制御部250と、ハードウェア資源260および270と、メモリ310、320、330とを備える。
 命令準備部210、220、230および実行パイプライン部240は、マルチスレッドプロセッサを構成する。命令準備部210、220、230はそれぞれ独立にスレッド(プログラム)から命令をフェッチおよび解読し、解読結果を実行パイプライン部240に発行する。
 実行パイプライン部240は、複数の機能ユニット(ALU、ロード/ストアユニット、分岐処理ユニット、乗算器、除算器等)を備え、複数の命令解読結果のうち実行可能な命令を、複数の機能ユニットで同時に実行する。1つの命令準備部と実行パイプライン部240の組は、実質的に1つのプロセッサとして機能するので、仮想プロセッサまたは論理プロセッサと呼ぶ。つまり、命令準備部210、220、230および実行パイプライン部240は、3つの仮想プロセッサ0~2に相当する。各仮想プロセッサはプログラムを切り替えながら実行する。なお、命令準備部210、220、230および実行パイプライン部240の代わりに、独立に動作する複数の物理プロセッサを備えてもよい。以下では、3つの仮想プロセッサ0~2(論理プロセッサ)と3つの物理プロセッサとを特に区別する必要がない場合は、単にプロセッサ0~2と呼ぶ。
 メモリ310、320および330は3つのプロセッサに対応するアドレス空間を有する。メモリ310は、プログラム、プログラムの通常のコンテキストデータ311、ハードウェア資源の拡張コンテキストデータ312等を記憶する。メモリ320および330についても同様である。3つのメモリ310、320および330は、物理アドレス空間は1つで、3つの独立した仮想アドレス空間を有する。なお、3つのメモリ310、320および330は3つの独立した物理アドレス空間を有していてもよい。また、コンテキストデータ311、321および331を別のコンテキストデータ専用のメモリに格納しても良い。
 命令準備部210は、メモリ310から命令をフェッチする命令フェッチ部211と、フェッチされた命令を解読する命令解読部212と、状態レジスタ部213と、レジスタ部214と、第1判定部215と、第2判定部216とを備える。
 命令準備部220は、メモリ320から命令をフェッチする命令フェッチ部221と、フェッチされた命令を解読する命令解読部222と、状態レジスタ部223と、レジスタ部224と、第1判定部225と、第2判定部226とを備える。
 命令準備部230は、メモリ330から命令をフェッチする命令フェッチ部231と、フェッチされた命令を解読する命令解読部232と、状態レジスタ部233と、レジスタ部234と、第1判定部235と、第2判定部236とを備える。
 状態レジスタ部213およびレジスタ部214の各データは、実行中のプログラムのコンテキストデータを構成する。状態レジスタ部223およびレジスタ部224についても同様である。状態レジスタ部233およびレジスタ部234についても同様である。
 制御部250は、第1転送部251、第2転送部252を有し、ハードウェア資源260および270とメモリ310、320および330との間で、拡張コンテキストデータの退避と復帰とを制御する。
 ハードウェア資源260、270はそれぞれ、データを保持するレジスタ群261、271を有し、複数のプロセッサを補完する。各ハードウェア資源は、例えば、FPU(浮動小数点演算装置:Floating Point number processing Unit)、ハードウェアアクセラレータ、拡張演算ユニットなどでよい。FPUは、プログラム中の浮動小数点演算命令(以下、FPU命令と呼ぶ。)を実行する。ハードウェアアクセラレータは、プロセッサからコマンドを受けて、指定されたデータに対して積和演算、バタフライ演算、ブロックデータの量子化または逆量子化等を高速に実行する。拡張演算ユニットは、プロセッサが直接実行できない拡張命令(乗算命令、除算命令、拡張演算ユニットに専用の命令等)を実行する。
 レジスタ群261、271のそれぞれは、対応するハードウェア資源のコンテキスト(以下、拡張コンテキストデータと呼ぶ。)を保持する。各ハードウェア資源は、複数のプロセッサに共有される。ここで、拡張コンテキストデータは、各プロセッサにおけるプログラムのコンテキストデータの退避および復帰とは非同期に行われる。つまり、プロセッサが、ハードウェア資源を利用する所定命令(上記のFPU命令、コマンド、拡張命令)を実際に実行し、その拡張コンテキストデータを必要とする時にだけ、退避および復帰される。
 メモリ310は、複数のプロセッサによって時分割多重化されるプログラムのそれぞれのコンテキストデータ311と、複数のプログラムのうちハードウェア資源を利用する所定命令を含むプログラム毎に、前記ハードウェア資源内のレジスタデータのコピーである拡張コンテキストデータ312を記憶する。同様にメモリ320は、コンテキストデータ321、拡張コンテキストデータ322を記憶する。メモリ330は、コンテキストデータ331、拡張コンテキストデータ332を記憶する。
 第1判定部215は、命令準備部210に対応するプロセッサがプログラム中の所定命令を実行しようとしたとき、ハードウェア資源内のレジスタに現在実行中のプログラムの拡張コンテキストデータが保持されているか否かを判定する。
 第2判定部216は、ハードウェア資源内の拡張コンテキストデータが、当該所定命令を実行しようとするプロセッサに属するか否かを判定する。
 第1転送部251は、第1判定部215および第2判定部216の判定結果に応じて、ハードウェア資源からメモリ310、320、330の何れかに拡張コンテキストデータを退避し、退避した拡張コンテキストデータと同じプロセッサ(または同じメモリ)に属するコンテキストデータを復帰する。復帰後、ハードウェア資源260または270は、当該所定命令を実行する。
 第2転送部252は、第1判定部215および第2判定部216の判定結果に応じて、ハードウェア資源からメモリ310、320、330の何れかに拡張コンテキストデータを退避し、退避した拡張コンテキストデータとは異なるプロセッサ(または異なるメモリ)に属するコンテキストデータを復帰する。復帰後、ハードウェア資源260または270は、当該所定命令を実行する。
 ハードウェア資源260または270は、ハードウェア資源内のレジスタに現在実行中のプログラムの拡張コンテキストデータが保持されていると第1判定部215によって判定され、かつ、ハードウェア資源内の拡張コンテキストデータが、当該所定命令を実行しようとするプロセッサに属すると第2判定部216によって判定された場合は、拡張コンテキストデータの退避および復帰を待つことなく、当該所定命令を即座に実行する。
 以上の構成により、各ハードウェア資源260または270を複数のプロセッサで共有することができる。つまり、どのプロセッサでも各ハードウェア資源を使用することができる。それゆえ、ハードウェア資源の使用効率を向上させることができる。また、ハードウェア資源をプロセッサ毎に備える必要がないので、必要な処理性能に応じた個数の必要最小限のハードウェア資源を備えればよく、回路規模を削減または最適化することができる。
 図2は、本発明の第1の実施の形態における状態レジスタ部内の第1~第3状態情報の一例を示す図である。
 同図は、状態レジスタ部213、223または233の一部を示している。ここでは、状態レジスタ部213を代表として説明する。状態レジスタ部213は、PSR(Processor Status Register)と呼ばれるレジスタと、LPFOSR(Logical Processor FPU Operation Status Register)と呼ばれるレジスタとを含む。このうちPSR(Processor Status Register)は、プログラムのコンテキストデータ311に含まれる。LPFOSRは、プログラムのコンテキストデータ311に含まれるか、プログラムのコンテキストデータ311に含まれないで別途OSによって管理される。
 PSRは、現在実行中のプログラムの拡張コンテキストデータがハードウェア資源内に保持されている可能性があることを示す第1状態情報としてFE(FPU Enable)ビットを含む。
 LPFOSRは、ハードウェア資源内に保持されている拡張コンテキストデータに対応するプロセッサを示す第2状態情報としてLPFE0(Logical Processor FPU Enable 0)、LPFE1ビットを含む。LPFE0、LPFE1ビットは、排他的に何れか1ビットのみ”1”になるか、全て”0”になる。この例では、LPFE0ビットは、プロセッサ0に対応し、LPFE1ビットは、プロセッサ1および2に対応するものとする。LPFOSRは、さらに、第2状態情報をロックするか否かを示す第3状態情報(FLビット)を含む。
 つまり、実行中のプログラムのPSRのFEビットが、拡張コンテキストデータがハードウェア資源内に保持されている可能性があることを示していて、更に、そのプログラムを実行中のプロセッサが、ハードウェア資源内に保持されている拡張コンテキストデータに対応していることを、LPFE0または、LPFE1によって示されている場合に、そのプロセッサは、LPFE0または、LPFE1によって示されている、いずれかのハードウェア資源を使用することが可能になる。
 第1判定部215は、対応するプロセッサがプログラム中の前記所定命令を実行しようとしたとき、前記第1状態情報が真か偽かを判定し、偽であると判定したとき第1の例外割込み信号を発生する第1判定回路(データ判定部)を含む。
 第2判定部216は、対応する前記第1判定回路が偽であると判定したとき、対応するプロセッサと前記第2状態情報が示すプロセッサとが一致するか否かを判定し、偽であると判定したとき第2の例外割込み信号を発生する第2判定回路(プロセッサ判定部)を含む。第1および第2判定回路はハードウェアにて構成される。これにより、特に拡張コンテキストデータの入れ替えが不要な場合の処理を高速化する。
 図3は、本発明の第1の実施の形態におけるプロセッサ装置におけるオペレーティングシステムについての説明図である。
 同図においてプロセッサ0~2は、図1に示した3つの仮想プロセッサまたは3つの物理プロセッサに対応する。
 プロセッサ0は第1のオペレーティングシステム(以下OSと略す。)を実行することによって複数のプログラムを時分割多重で実行する。
 プロセッサ1および2は、第1のOSとは異なる第2のOSを実行することによって複数のプログラムを時分割多重で実行する。第1のOSは例えばLinux、第2のOSは例えばリアルタイムOSである。
 第1転送部251は、プロセッサ毎に設けられた退避復帰部251a、251b、251cを含む。各退避復帰部は、第1の例外割り込み信号が発生した場合に前記ハードウェア資源から前記メモリに拡張コンテキストデータを退避し、前記メモリから前記ハードウェア資源に前記所定命令を実行しようとしたプロセッサの拡張コンテキストデータを復帰し、プロセッサ0内の前記退避復帰部251aは、プロセッサ0内の第1判定部215が第1の例外割込み信号を発生したとき、第1のOSによって起動される。
 プロセッサ1および2の退避復帰部251b、251cは、プロセッサ1および2の第1判定部225、235が第1の例外割込み信号を発生したとき、第2のOSによって起動される。
 プロセッサ0~2のうちの少なくとも1つは、第1のOSと第2のOSとを管理する第3のOSを実行することによって、第2転送部252を制御する。すなわち、第2転送部252は、何れかの第2判定部が第2の例外割込み信号を発生したとき、第3のオペレーティングシステムによって起動される。起動された第2転送部252は、ハードウェア資源からメモリ310、320、330の何れかに他のプロセッサに属する拡張コンテキストデータを退避する動作の開始から、前記メモリから前記ハードウェア資源に前記所定命令を実行しようとしたプロセッサの拡張コンテキストデータを復帰する動作の完了までをアトミックに行う。これにより、プログラム毎のコンテキストデータ(特に第1状態情報および第2状態情報)に矛盾を生じさせることなく、他のプロセッサからの干渉を受けることなく、異なるプロセッサ間でハードウェア資源を共有することができる。
 さらに、第3のOSは、クリア部253を制御する。クリア部253は、プロセッサ毎に備えられたクリア回路の総称である。各クリア回路は、当該クリア回路に対応するプロセッサが停止状態、待ち状態または休眠状態に遷移したとき、当該プロセッサに対応する第2状態情報(LPFE0およびLPFE1ビット)をクリアする。これにより、当該プロセッサが使用しているハードウェア資源を解放することができ、複数のプロセッサで共有されるハードウェア資源の使用効率を向上させる。ただし、第3状態情報(FLビット)がセットされている場合(FL=1の場合)は、クリア回路の動作は禁止される。これにより、ハードウェア資源を使用するプロセッサが固定的である場合や、ハードウェア資源をあるプロセッサが優先して使用する場合に、プログラマが第3状態情報を「ロック」に設定することにより、ハードウェア資源を当該プロセッサに占有させ続けることができ、無駄な拡張コンテキストデータの退避および復帰を削減することができる。
 図4は、本発明の第1の実施の形態におけるハードウェア資源切り替え動作の概略を示すフローチャート図である。同図では、プロセッサ0~2のうちの何れか1つのプロセッサにおける動作を示している。ここでは、同図がプロセッサ0の動作を表し、ハードウェア資源がFPUであるものとして説明する。
 プロセッサ0がFPU命令の実行しようとしたとき(FPU命令の実行要求をプロセッサ0がハードウェアにより検出したとき)(S30)、FPUレジスタが使用不可能であるか否かを判定する(S31)。”FPUレジスタが使用不可能でない”というのは、FE=1、かつLPFE0=1(または、LPFE1=1)の場合であり、FPUレジスタには、FPU命令の実行要求を出したプロセッサ0のプログラムに属する拡張コンテキストデータが保持されていることを意味する。この判定は、第1判定回路および第2判定回路により、ほぼ遅延時間なく、なされる。この場合、LPFE0または、LPFE1のいずれか1を示している方に対応したFPUによってFPU命令が即座に実行される(S34)。
 さらに、”FPUレジスタが使用不可能である”場合は、FPUレジスタに他のプロセッサに属する拡張コンテキストデータが保持されているか否かを判定する(S32)。この判定は、第1判定回路および第2判定回路によりなされる。
 FPUレジスタに同じプロセッサ0に属する拡張コンテキストデータが保持されているが、現在プロセッサ0で実行中のプログラムの拡張コンテキストデータでない場合は、つまり、そのプロセッサのPSRのFEビットは1であるが、LPFOSRのLPFE1かLPFE0のいずれかが1の場合は、LP内コンテキスト切り替えを行う(S36)。LP(Logical Processor)内コンテキスト切り替えは、第1転送部251によってなされる。
 FPUレジスタに異なるプロセッサ1または2に属する拡張コンテキストデータが保持されている場合、つまりそのプロセッサのLPFOSRのLPFE1もLPFE0も0の場合は、LP間コンテキスト切り替えを行う(S41)。LP(Logical Processor)間コンテキスト切り替えは、第2転送部252によってなされる。
 LP内またはLP間コンテキスト切り替えの後、FPUによってFPU命令が即座に実行される(S34)。
 上記のうち、S30、S31、S32はプロセッサ内のハードウェアによって行われる。S34はFPUによって実行される。S36は第1のOSの制御の下で第1転送部251によって行われる。S41は、第1のOSの制御の下で第2転送部252によって行われる。
 図5は、本発明の第1の実施の形態における第3のOSが管理するデータの一例を示す図である。
 同図のテーブルT1は、プロセッサのID(ここではLPID)と、使用する予定のハードウェア資源(ここではFPU0、FPU1とする)とを対応付けたテーブルである。テーブルT2は、FPU番号と、現在FPUを占有しているプロセッサID(LPID)と、ロック属性(FLビット)とを対応付けたテーブルである。第3のOSは、テーブルT1、T2をそれぞれ常に最新の状態に更新し、ソフトウェア的にFPUを管理する。
 第3のOSは、このようなテーブルを参照し、(1)FPU0、1と、LPIDの対応付け(新たにLPに割り当てるべきFPUの選択)、(2)現在のFPU0、1を使用しているLPID、(3)現在FPUnを使用しているLPのロック属性の管理を行う。
 より具体的には、(1)第3のOSは、各LPが、どのFPUnを使用する予定かを管理(ソフトウェアにより各LPが使用する予定のFPUnを管理)し、図2に示したLPFOSR内のLPFE0、LPFE1のどのビットをセットするかを決定する。つまり、各LPでどのFPUnのコンテキストを使用するのかを管理可能である。
 (2)第3のOSは、現在FPU0、1を使用しているLPIDを管理することにより、現状のFPU0、1をどのプロセッサが使っていて、今から使おうとしているのかを管理し、LP間のコンテキスト復帰・退避をアトミック操作として管理する。
 (3)第3のOSは、ソフトウェアによりFPUnを使用するLPのロック管理をし、ソフトウェアによりFPUnのロック属性を管理可能である。これによりFPUの占有状態を自LPがロックしたり、他LPから取り外したりすることが可能になる。
 図6は、本発明の第1の実施の形態におけるハードウェア資源切り替え動作を示す詳細なフローチャート図である。同図では、プロセッサのハードウェアにより実行されるステップと、第1のOSまたは第2のOSにより実行されるステップと、第3のOSにより実行されるステップとを分けている。同図では、プロセッサ0~3のうちの何れか1つのプロセッサにおける動作を示している。ここでは、同図がプロセッサ0の動作を表し、ハードウェア資源がFPUであるものとして説明する。
 プロセッサ0がFPU命令を実行しようとしたとき(FPU命令の実行要求をプロセッサ0がハードウェアにより検出したとき)(S30)、第1判定部215は、PSR内のFEビット(第1の状態情報)が真か偽かを判定することにより、FPUレジスタが使用不可能であるか否かを判定し(S31)、さらに、第2判定部216は、LPFE0、1ビット(第2の状態情報)の何れのビットが真であるかを判定する(S32)。これにより、FE=1、かつLOFE0=1の場合は、FPUレジスタに、FPU命令の実行要求を出したプロセッサ0のプログラムに属する拡張コンテキストデータが保持されていることを意味する。この判定は、第1判定回路および第2判定回路により、ほぼ遅延時間なく、なされる。この場合、FPUによってFPU命令が即座に実行される(S33)。
 また、第1判定部215は、FE=0である場合(FPUレジスタが使用不可能である場合)、第1の例外割り込み信号を発生する(S34)。これにより、第1のOSまたは第2のOS(ここでは第1のOS)に制御が移ることになる。第1のOSは、FPU(ここではFPU0とする)を確保するためにFE=1にセットし(S35)、必要に応じてOS内でのFPUのコンテキストの退避復帰を行おうとする。FPU0内の拡張コンテキストデータが同じプロセッサに属すると第2判定部216が判定した場合は、FPU0からメモリ310に拡張コンテキストデータを退避し、メモリ310からFPU0に、現在実行中のFPU命令を実行しようとしたプログラムの拡張コンテキストデータを復帰し、(S36)、割り込み処理からリターンする(S37)。これにより、FPU命令を実行しようとしたプログラムは、何事もなかったかのようにS31(True)、S32(True)の判定を経る。これにより、FPU0はFPU命令を実行する。
 一方、第1のOSは、FE=1にセットし(S36)、FPU0内の拡張コンテキストデータを退避しようとするが、FPU0内の拡張コンテキストデータが他のプロセッサに属すると第2判定部216が判定した場合は、第2の例外割り込み信号が発生する(S38)。これにより、第3のOSに制御が遷移する。
 第2の例外割り込み信号を受けた第3のOSは、FPU0の使用権を確保するためにLPFE0=1をセットし、(S38a)、FPU0の使用権を確保できたか否かを判定し(S38b)、確保できた場合は、テーブルT2を参照して、現にFPU0を占有しているプロセッサ(FPU0-LPID)と、FPU命令を実行しようとしたプロセッサとが同じでないかどうかを判定し(S40)、同じでなければ、異なるプロセッサ間のコンテキスト入れ換えを行い(S41)、割り込み処理を抜ける(S42)。
 S38bにおいてFPU0を確保できない場合(LPFE0に1を書き込んだにもかかわらず、LPFE0=0の場合、つまり、他の物理プロセッサによって、FPU0が確保されている場合)は、第3のOSは、FPU0が解放されるまで待ち処理に入る(S39)。この待ち処理では、ポーリング、イベント待ち等により、解放されたかどうかをチェックすればよい。
 また、S40において現にFPU0を占有しているプロセッサ(FPU0-LPID)と、FPU命令を実行しようとしたプロセッサとが同じである場合は、コンテキスト入れ替えの必要がないので、そのまま割り込み処理を抜ける。このケースは、プロセッサ0で実行していたプログラムが、一旦休止状態、停止状態等になった場合に、FEビットがクリアされることによって起こり得る。
 上記の処理のうち、第2の例外割り込み信号を受けた第3のOSの処理についてさらに詳しく説明する。
 図3に示した第3のOSは、第2判定部216、226、236からの各第2の例外割込み信号によって起動される第2の例外割り込み処理を、オペレーティングシステムの一部の機能として実行する。第3のOSは、第2の例外割り込み処理のサポートのために、前記ハードウェア資源の獲得処理、前記ハードウェア資源の解放待ち処理等を含む。
 第3のOSは、獲得処理において、第2の例外割り込み信号を発生させた仮想プロセッサの属する命令準備部以外の命令準備部に属する仮想プロセッサおいて当該ハードウェア資源が使用中でない場合(ケース1)に、第2の例外割り込み信号を発生させた命令準備部内の状態レジスタに、真を示す第1状態情報と、前記第2の例外割り込み信号を発生させたプロセッサを示す第2状態情報とを設定する。真を示す第1の状態情報は、現在実行中のプログラムの拡張コンテキストデータがハードウェア資源内に保持されている可能性があることを示す。上記ステップS38bにおいて、FPU0の使用権を確保できたと判定される場合がこのケース1である。
 一方、第3のOSは、第2の例外割り込み信号を発生させた仮想プロセッサの属する命令準備部以外の命令準備部において仮想プロセッサにおいて当該ハードウェア資源が使用中である場合(ケース2)に、前記ハードウェア資源の解放を待つ待ち処理を実行する。上記ステップS38bにおいてFPU0の使用権を確保できないと判定され、ステップS39(待ち処理)に入る場合がこのケース2である。
 ステップS38bにおいてハードウェア資源を獲得する処理は、例えば、第3のOSが、資源を排他制御するためのMUTEX等の管理オブジェクトを備え、この管理オブジェクトを利用すればよい。
 以上説明してきたように、本実施の形態におけるプロセッサ装置によれば、各ハードウェア資源を複数のプロセッサで共有することができる。つまり、どのプロセッサでも各ハードウェア資源を使用することができる。それゆえ、ハードウェア資源の使用効率を向上させることができる。ハードウェア資源をプロセッサ毎に備える必要がないので、必要な処理性能に応じた個数の必要最小限のハードウェア資源を備えればよく、回路規模を削減または最適化することができる。FPUやハードウェアアクセラレータ等の拡張演算ユニットを効率よく複数のプロセッサで共有することができ、拡張コンテキストデータの退避および復帰を最小限にすることができる。
 (第2の実施の形態)
 本実施の形態では、第1の実施の形態で説明したプロセッサ装置をメディアプロセッサに適用する場合の構成について説明する。
 本実施の形態に係るプロセッサシステムは、資源を共用してホスト処理とメディア処理とを行う単一のプロセッサブロックを備える。プロセッサブロックは、第1の実施の形態のプロセッサ装置と同じ機能を有し、さらに、資源を共用してホスト処理とメディア処理とを行う単一のプロセッサ装置で行う。本発明の実施の形態に係るプロセッサシステムは、ホスト処理のスレッドとメディア処理のスレッドとに、異なるタグ情報を与えるとともに、プロセッサシステムが有する資源を当該タグ情報に対応付けて分割する。これにより、本発明の実施の形態に係るプロセッサシステムは、面積効率を向上できるとともに、性能の保証及び堅牢性を向上できる。
 まず、本発明の実施の形態に係るプロセッサシステムの構成を説明する。
 図7は、第2の実施の形態に係るプロセッサシステム10の基本構成を示す機能ブロック図である。
 このプロセッサシステム10は、映像音声ストリームに関する様々な信号処理を行うシステムLSIであり、外部メモリ15を用いて複数のスレッドを実行する。例えば、プロセッサシステム10は、デジタルテレビシステム、DVDレコーダ、デジタルカメラ及び携帯電話機等に搭載される。このプロセッサシステム10は、プロセッサブロック11と、ストリームI/Oブロック12と、AVIO(Audio Visual Input Output)ブロック13と、メモリIFブロック14とを備える。
 プロセッサブロック11は、第1の実施の形態で説明したプロセッサ装置と同じである。以下、同じ点は説明を省略して、異なる点を中心に説明する。
 プロセッサブロック11は、プロセッサシステム10全体を制御するプロセッサであり、制御バス16を介してストリームI/Oブロック12、AVIOブロック13、及びメモリIFブロック14を制御したり、データバス17及びメモリIFブロック14を介して外部メモリ15にアクセスしたりする。また、プロセッサブロック11は、データバス17及びメモリIFブロック14を介して外部メモリ15から圧縮画像音声ストリーム等の画像音声データを読み出し、圧縮又は伸張等のメディア処理を行った後に、再び、データバス17及びメモリIFブロック14を介して、処理後の画像データや音声データを外部メモリ15に格納する回路ブロックである。
 つまり、プロセッサブロック11は、映像音声の出力サイクル(フレームレート等)に依存しない非リアルタイムな汎用(制御関連の)処理であるホスト処理と、映像音声の出力サイクルに依存するリアルタイムな汎用(メディア関連の)処理であるメディア処理とを行う。
 例えば、プロセッサシステム10をデジタルテレビシステムに搭載する場合、ホスト処理は、当該デジタルテレビシステムの制御を行い、メディア処理は、デジタル映像の伸張を行う。
 ストリームI/Oブロック12は、プロセッサブロック11による制御の下で、蓄積メディア及びネットワーク等の周辺デバイスから圧縮画像音声ストリーム等のストリームデータを読み込み、データバス18及びメモリIFブロック14を介して外部メモリ15に格納したり、その逆方向のストリーム転送をしたりする回路ブロックである。このように、ストリームI/Oブロック12は、映像音声の出力サイクルに依存しない非リアルタイムなIO処理を行う。
 AVIOブロック13は、プロセッサブロック11による制御の下で、データバス19及びメモリIFブロック14を介して外部メモリ15から画像データ及び音声データ等を読み出し、各種グラフィック処理等を施した後に、画像信号及び音声信号として外部の表示装置やスピーカ等に出力したり、その逆方向のデータ転送をしたりする回路ブロックである。このように、AVIOブロック13は、映像音声の出力サイクルに依存するリアルタイムなIO処理を行う。
 メモリIFブロック14は、プロセッサブロック11による制御の下で、プロセッサブロック11、ストリームI/Oブロック12、AVIOブロック13、及びメモリIFブロック14と外部メモリ15との間で並列にデータ要求が行われるように制御する回路ブロックである。また、メモリIFブロック14は、プロセッサブロック11からの要求に応じて、プロセッサブロック11、ストリームI/Oブロック12、AVIOブロック13、及びメモリIFブロック14と外部メモリ15との間の転送帯域を確保するとともに、レイテンシ保証を行う。
 次に、プロセッサブロック11の詳細な構成を説明する。
 図8は、プロセッサブロック11の構成を示す機能ブロック図である。
 このプロセッサブロック11は、実行部101と、VMPC(仮想マルチプロセッサ制御部)102と、TLB(Translation Lookaside Buffer)104と、物理アドレス管理部105と、FPU(Floating Point number processing Unit:浮動小数点演算装置)107と、FPU割り当て部108と、キャッシュメモリ109と、BCU110と、割り込み制御部111とを備える。
 ここで、プロセッサブロック11は、仮想マルチプロセッサ(VMP:Virtual Multi Processor)として機能する。仮想マルチプロセッサとは、一般的に、複数の論理プロセッサ(LP:Logical Processor)の機能を時分割に演じる命令並列プロセッサの一種である。ここで一つのLPは、実体的には、物理プロセッサ(PP:Physical Processor)のレジスタ群に設定される一つのコンテキストに対応する。各LPに割り当てる時間単位(TS:Time Slot)の頻度を管理することによって、各LPによって実行されるアプリケーション間の負荷バランスを保つことができる。なお、VMPの構成及び動作については、その代表的な一例が特開2003-271399号公報(特許文献3)に詳しく開示されているので、ここでは詳細な説明を省略する。
 また、プロセッサブロック11は、マルチスレッドパイプライン型プロセッサ(マルチスレッドプロセッサ)として機能する。マルチスレッドパイプライン型プロセッサは、同時に複数のスレッドを処理し、さらに、実行パイプラインの空きを埋めるように複数のスレッドを処理することにより、処理効率を向上できる。なお、マルチスレッドパイプライン型プロセッサの構成及び動作については、その代表的な一例が特開2008-123045号公報(特許文献4)に詳しく開示されているので、ここでは詳細な説明を省略する。
 実行部101は、複数のスレッドを同時に実行する。この実行部101は、複数の物理プロセッサ121と、演算制御部122と、演算部123とを備える。
 複数の物理プロセッサ121は、それぞれ、レジスタを備える。このレジスタそれぞれは、1以上のコンテキスト124を保持する。ここで、コンテキスト124とは、複数のスレッド(LP)のそれぞれに対応し、対応するスレッドを実行するために必要な制御情報及びデータ情報等である。各物理プロセッサ121は、スレッド(プログラム)中の命令をフェッチおよび解読し、解読結果を演算制御部122に発行する。
 演算部123は、複数の演算器を備え、同時に複数のスレッドを実行する。
 演算制御部122は、マルチスレッドパイプライン型プロセッサにおけるパイプライン制御を行う。具体的には、演算制御部122は、実行パイプラインの空きを埋めるように複数のスレッドを、演算部123が備える演算器に割り当てたうえで実行させる。
 VMPC102は、仮想マルチスレッド処理を制御する。このVMPC102は、スケジューラ126と、コンテキストメモリ127と、コンテキスト制御部128とを備える。
 スケジューラ126は、複数のスレッドの優先度に従い、複数のスレッドの実行順序、及びスレッドを実行するPPを決定するスケジューリングを行うハードウェアスケジューラである。具体的には、スケジューラ126は、LPをPPにアサインする又はアンアサインすることにより、実行部101が実行するスレッドを切り替える。
 コンテキストメモリ127は、複数のLPにそれぞれ対応する複数のコンテキスト124を記憶する。なお、このコンテキストメモリ127又は複数の物理プロセッサ121が備えるレジスタが、本発明の保持手段に相当する。
 コンテキスト制御部128は、所謂コンテキストの復帰及び退避を行う。具体的には、コンテキスト制御部128は、実行が完了した物理プロセッサ121が保持するコンテキスト124をコンテキストメモリ127に書き込む。また、コンテキスト制御部128は、これから実行されるスレッドのコンテキスト124をコンテキストメモリ127から読み出し、読み出したコンテキスト124を当該スレッドに対応するLPがアサインされた物理プロセッサ121に転送する。
 図9は、一つのコンテキスト124の構成を示す図である。なお、図9にはスレッドを実行するために必要な通常の制御情報及び通常のデータ情報等は図示しておらず、新たにコンテキスト124に追加された情報のみを示している。
 図9に示すにように、コンテキスト124は、TVID(TLBアクセス仮想識別子)140と、PVID(物理メモリ保護仮想識別子)141と、MVID(メモリアクセス仮想識別子)142とを含む。
 このTVID140、PVID141及びMVID142は、複数のスレッド(LP)のそれぞれが、ホスト処理に属するスレッドか、メディア処理に属するスレッドかを示すタグ情報である。
 TVID140は、複数の仮想メモリ保護グループを設定するために用いられる。例えば、ホスト処理のスレッドと、メディア処理のスレッドとにそれぞれ異なるTVID140が付与される。実行部101は、このTVID140を用いて論理アドレス空間のページ管理情報をそれぞれ独立に作成することができる。
 PVID141は、物理メモリ領域のアクセスを制限するために用いられる。
 MVID142は、メモリIFブロック14へのアクセス形態を設定するために用いられる。メモリIFブロック14は、このMVID142を用いて、レイテンシ(応答性重視)を優先するか、バスバンド幅(性能保証)を優先するかを決定する。
 図10は、プロセッサシステム10における論理アドレス空間の管理を模式的に示す図である。図10に示すように、プロセッサシステム10は、ユーザレベル、スーパーバイザーレベル及び仮想モニタレベルの3つの階層により制御される。
 ここでユーザレベルは、スレッド(LP)ごとの制御を行う階層である。スーパーバイザーレベルは、複数のスレッドの制御を行うオペレーティングシステム(OS)に対応する階層である。例えば、図10に示すようにスーパーバイザーレベルには、ホスト処理のOSであるLinuxカーネルと、メディア処理のOSであるSystem Managerとが含まれる。
 仮想モニタレベルは、スーパーバイザーレベルの複数のOSを制御する階層である。具体的には、仮想モニタレベルのOS(モニタプログラム)により、TVID140を用いた論理アドレス空間の区別が行われる。つまり、プロセッサシステム10は、複数のOSが用いる論理アドレス空間が互いに干渉しないように、論理アドレス空間を管理する。たとえば、各コンテキストのTVID140、PVID141やMVID142は、この仮想モニタレベルでのみ設定することが出来るようにしている。
 また、仮想モニタレベルのOSは、プロセッサシステム10が有する複数の資源を、ホスト処理に属するスレッドに対応付ける第1資源と、メディア処理に属するスレッドに対応付ける第2資源とに分割する本発明の分離手段である。ここで資源とは、具体的には、外部メモリ15のメモリ領域(論理アドレス空間及び物理アドレス空間)、キャッシュメモリ109のメモリ領域、TLB104のメモリ領域、及びFPU107である。
 このように、仮想モニタレベルで、資源を分割することにより、設計者は、ホスト処理とメディア処理とが独立したプロセッサにより実行されている場合と同様に、ホスト処理及びメディア処理のOSを設計できる。
 TLB104は、一種のキャッシュメモリであり、論理アドレスと物理アドレスとの対応関係を示すページテーブルの一部であるアドレス変換テーブル130を保持する。このTLB104は、アドレス変換テーブル130を用いて、論理アドレスと物理アドレス間の変換を行う。
 図11は、アドレス変換テーブル130の構成を示す図である。
 図11に示すように、アドレス変換テーブル130は、複数のエントリ150を含む。各エントリ150は、論理アドレスを識別するためのTLBタグ部151と、当該TLBタグ部151に対応付けられたTLBデータ部152とを含む。TLBタグ部151は、VPN153と、TVID140と、PID154とを含む。TLBデータ部152は、PPN155と、Attribute156とを含む。
 VPN153は、ユーザレベルの論理アドレスであり、具体的には、論理アドレス空間のページNoである。
 PID154は、当該データを用いるプロセスを識別するためのIDである。
 PPN155は、当該TLBタグ部151に対応付けられた物理アドレスであり、具体的には、物理アドレス空間のページNoである。
 Attribute156は、当該TLBタグ部151に対応付けられたデータの属性を示す。具体的には、Attribute156は、当該データへのアクセスの可否、当該データをキャッシュメモリ109に格納するか格納しないか、当該データが特権を有するか否か等を示す。
 また、TLB104は、複数のスレッド(LP)が用いる論理アドレス空間の管理を行う。
 図12は、プロセッサシステム10における論理アドレスの対応関係を模式的に示す図である。上述したように、TLB104は、プロセスごとの論理アドレス(VPN153)とPID154とTVID140との組に対して、一つの物理アドレス(PPN155)を対応させる。このように、同じTVIDをもつLP上のスーパーバイザーレベルでは、プロセスごとの論理アドレス(VPN153)とPID154との組に対して一つの物理アドレスを対応付けることで、スーパーバイザーレベルにおいて、各プロセスの論理アドレスを区別したうえで、当該論理アドレスを物理アドレスと対応させることができる。
 ここで、TLB104の更新時に、更新されるエントリのTVIDは、更新を行うLPに設定されているTVIDが設定される。
 さらに、TLB104は、プロセスごとの論理アドレス(VPN153)とPID154とにTVID140を加えた組に対して、一つの物理アドレス(PPN155)を対応させる。これにより、TLB104は、仮想モニタレベルにおいて、ホスト処理とメディア処理とにそれぞれ異なるTVIDを設定することにより、独立した論理アドレス空間を与えることができる。
 また、このTLB104は、エントリ指定レジスタ135を備える。エントリ指定レジスタ135は、TVID140に割り当てるエントリ150を指定する情報を保持する。
 図13は、エントリ指定レジスタ135に格納されるデータの一例を示す図である。図13に示すように、エントリ指定レジスタ135は、TVID140とエントリ150との対応関係を保持する。また、エントリ指定レジスタ135は、仮想モニタレベルのOS(モニタプログラム)により設定及び更新される。
 TLB104は、エントリ指定レジスタ135に設定された情報を用いて、TVID140ごとに、使用するエントリ150を決定する。具体的には、TLB104は、TLBミス(LPから入力された論理アドレス(TLBタグ部151)をアドレス変換テーブル130に保持していない)場合、当該LPのTVID140に対応するエントリ150のデータをリプレースする。
 図14は、TLB104でのエントリ150の割り当て状態を模式的に示す図である。
 図14に示すように、複数のエントリ150が、複数のLPにより共有される。さらに、TLB104は、TVID140を用いて、同じTVID140を有するLP間で、エントリ150を共有させる。例えば、TVID0を有するLP0には、エントリ0~エントリ2が割り当てられ、TVID1を有するLP1及びLP2には、エントリ3~エントリ7が割り当てられる。これにより、TLB104は、ホスト処理に属するスレッドに対して、エントリ0~エントリ2を用い、メディア処理に属するスレッドに対してエントリ3~エントリ7を用いることができる。
 図15は、TLB104による処理の流れを示すフローチャートである。
 図15に示すように、LPからの外部メモリ15へのアクセスが発生した場合、まず、TLB104は、アクセス元のLPから入力された論理アドレス(VPN153、TVID140及びPID154)と同じ論理アドレスを格納しているか否かを判定する(S101)。
 格納していない場合、つまりTLBミスの場合(S101でYes)、TLB104は、アクセス元のLPのTVID140に割り当てられたエントリ150を更新する。言い換えると、TLB104は、アクセス元のLPのTVID140と、同一のTVID140のエントリ150を更新する(S102)。具体的には、TLB104は、外部メモリ15等に格納されているページテーブルから、TLBミスした論理アドレスと物理アドレスとの対応関係を読み出し、読み出した対応関係を、アクセス元のLPのTVID140に割り当てられたエントリ150に格納する。
 次に、TLB104は、更新した対応関係を用いて、論理アドレスを物理アドレスに変換する(S103)。
 一方、ステップS101で、LPから入力された論理アドレスと同じ論理アドレスを格納している場合、つまりTLBヒットの場合(S101でNo)、TLB104は、TLBヒットした対応関係を用いて、論理アドレスを物理アドレスに変換する(S103)。
 ここで、外部メモリ15等に格納されているページテーブルは、TVID140毎又はPVID141毎に、外部メモリ15の物理アドレスが割り当てられるように、予め作成されている。このページテーブルは、例えば、スーパーバイザーレベル、又は仮想モニタレベルのOSにより作成及び更新される。
 物理アドレス管理部105は、PVID141を用いて物理アドレス空間のアクセス保護を行う。この物理アドレス管理部105は、複数の物理メモリ保護レジスタ131と、保護違反レジスタ132と、エラーアドレスレジスタ133とを備える。
 各物理メモリ保護レジスタ131は、物理アドレス範囲ごとに、当該物理アドレス範囲にアクセス可能なLPを示す情報を保持する。
 図16は、一つの物理メモリ保護レジスタ131に保持される情報の構成を示す図である。図16に示すように、物理メモリ保護レジスタ131は、BASEADDR161と、PS162と、PN163と、PVID0WE~PVID3WE164と、PVID0RE~PVID3WE165とを含む情報を保持する。
 BASEADDR161、PS162、及びPN163は、物理アドレス範囲を指定する情報である。具体的には、BASEADDR161は、指定する物理アドレス範囲の先頭のアドレスの上位16ビットである。PS162はページサイズを示す。例えば、ページサイズとして、1KB、64KB、1MB又は64MBが設定される。PN163は、PS162に設定されたページサイズでのページ数を示す。
 PVID0WE~PVID3WE164及びPVID0RE~PVID3RE165は、BASEADDR161、PS162及びPN163で指定される物理アドレス範囲に、アクセス可能なLPのPVID141を示す。
 具体的には、PVID0WE~PVID3WE164は、それぞれPVID141ごとに1ビット設けられる。また、PVID0WE~PVID3WE164は、対応するPVID141が付与されたLPが、指定された物理アドレス範囲にデータを書き込み可能であるか否かを示す。
 PVID0RE~PVID3RE165は、それぞれPVID141ごとに1ビット設けられる。また、PVID0RE~PVID3RE165は、対応するPVID141が付与されたLPが、指定された物理アドレス範囲のデータを読み出し可能であるか否かを示す。
 なお、ここでは、4種類のPVID141が複数のLPに付与されるとするが、2種類以上のPVID141が複数のLPに付与されればよい。
 図17は、PVID141により保護される物理アドレス空間の一例を示す図である。また、ここでは物理アドレス管理部105は、4つの物理メモリ保護レジスタ131(PMG0PR~PMG3PR)を備えるとする。また、PVID0は、Linux(ホスト処理)のLP群に付与され、PVID1は、メディア処理のLPのうち画像処理のLP群に付与され、PVID2は、メディア処理のLPのうち音声処理のLP群に付与され、PVID3は、System Manager(メディア処理のOS)のLP群に付与される。
 また、物理アドレス管理部105は、LPが、当該LPのPVID141で許可されていない物理アドレスにアクセスした場合に例外割り込みを発生するとともに、保護違反レジスタ132に、エラーが発生したアクセス情報を書き込み、かつ、エラーアドレスレジスタ133に、エラーの要因となったアクセスのアクセス先の物理アドレスを書き込む。
 図18は、保護違反レジスタ132に保持されるアクセス情報の構成を示す図である。図18に示すように、保護違反レジスタ132に保持されるアクセス情報は、PVERR167と、PVID141とを含む。PVERR167は、当該エラーが、物理メモリ空間保護違反(LPが、当該LPのPVID141で許可されていない物理アドレスにアクセスしたエラー)であるか否を示す。PVID141は、物理メモリ空間保護違反が発生したPVID141が設定される。
 図19は、エラーアドレスレジスタ133に保持される情報の構成を示す図である。図16に示すように、エラーアドレスレジスタ133は、エラーの要因となったアクセスのアクセス先の物理アドレス(BEA[31:0])を保持する。
 以上のように、PVID141を用いて、物理アドレスを保護することにより、システムの堅牢性を向上できる。具体的には、デバッグ時において、エラーが発生した物理アドレスやPVIDから、設計者は、画像処理及び音声処理のうち、どちらの処理がエラーを起こしているかを容易に判別できる。また、ホスト処理のデバッグ時には、画像処理などが書き込めないアドレスで発生している誤動作について、画像処理の誤動作を疑うことなくデバッグすることが可能になる。
 FPU割り当て部108は、複数のFPU107をLPに割り当てる。このFPU割り当て部108は、FPU割り当てレジスタ137を備える。
 図20は、FPU割り当てレジスタ137に格納されるデータの一例を示す図である。図20に示すように、FPU割り当てレジスタ137に、TVID140ごとにFPU107が対応付けられる。また、FPU割り当てレジスタ137は、仮想モニタレベルのOS(モニタプログラム)により設定及び更新される。
 図21は、FPU割り当て部108によるFPU107の割り当て処理を模式的に示す図である。
 図21に示すように、複数のFPU107が、複数のLPにより共有される。さらに、FPU割り当て部108は、TVID140を用いて、同じTVID140を有するLP間で、FPU107を共有させる。例えば、FPU割り当て部108は、TVID0を有するLP0には、FPU0を割り当て、TVID1を有するLP1及びLP2には、FPU1を割り当てる。
 また、LPは、FPU割り当て部108により割り当てられたFPU107を用いて、スレッドを実行する。
 キャッシュメモリ109は、プロセッサブロック11で使用するデータを一時的に格納するメモリである。また、キャッシュメモリ109は、異なるTVID140を有するLPには、独立した異なるデータ領域(ウェイ168)を使用する。このキャッシュメモリ109は、ウェイ指定レジスタ136を備える。
 図22A及び図22Bは、ウェイ指定レジスタ136に格納されるデータの一例を示す図である。
 図22Aに示すように、ウェイ指定レジスタ136に、TVID140ごとにウェイ168が対応付けられる。また、ウェイ指定レジスタ136は、仮想モニタレベルのOS(モニタプログラム)により設定及び更新される。
 なお、図22Bに示すように、LPごとにウェイ168を対応付けてもよい。この場合、例えば、コンテキスト124内に、当該LPが使用するウェイの情報が含まれ、仮想モニタレベルのOS、又はスーパーバイザーレベルのOSは、コンテキスト124を参照し、ウェイ指定レジスタ136を設定及び更新する。
 図23は、キャッシュメモリ109によるウェイ168の割り当て処理を模式的に示す図である。
 図23に示すように、キャッシュメモリ109は、データ格納単位として、複数のウェイ168(way0~way7)を有する。このキャッシュメモリ109は、TVID140を用いて、同じTVID140を有するLP間で、ウェイ168を共有させる。例えば、TVID0を有するLP0には、way0~way1が割り当てられ、TVID1を有するLP1及びLP2には、way2~way7が割り当てられる。これにより、キャッシュメモリ109は、ホスト処理に属するスレッドのデータをway0~way1にキャッシュし、メディア処理に属するスレッドのデータをway2~way7にキャッシュする。
 このように、キャッシュメモリ109は、異なるTVID140を有するLP間で、キャッシュデータを互いに追い出しあわないようにできる。
 図24は、キャッシュメモリ109による処理の流れを示すフローチャートである。
 図24に示すように、LPからの外部メモリ15へのアクセスが発生した場合、まず、キャッシュメモリ109は、アクセス元のLPから入力されたアドレス(物理アドレス)と同じアドレスを格納しているか否かを判定する(S111)。
 格納していない場合、つまりキャッシュミスの場合(S111でYes)、キャッシュメモリ109は、ウェイ指定レジスタ136で指定されるウェイ168に、アクセス元のLPから入力されたアドレス及びデータをキャッシュする(S112)。具体的には、リードアクセスの場合、キャッシュメモリ109は、外部メモリ15等からデータを読み出し、読み出したデータを、ウェイ指定レジスタ136で指定されるウェイ168に格納する。また、ライトアクセスの場合、キャッシュメモリ109は、アクセス元のLPから入力されたデータを、ウェイ指定レジスタ136で指定されるウェイ168に格納する。
 一方、ステップS111で、アクセス元のLPから入力されたアドレスと同じアドレスを格納している場合、つまりキャッシュヒットの場合(S111でNo)、キャッシュメモリ109は、キャッシュヒットしたデータを、更新(ライトアクセス時)、又はアクセス元のLPに出力する(リードアクセス時)(S113)。
 BCU110は、プロセッサブロック11と、メモリIFブロック14との間のデータ転送を制御する。
 割り込み制御部111は、割り込みの検出、要求及び許可等を行う。この割り込み制御部111は、複数の割り込み制御レジスタ134を備える。例えば、割り込み制御部111は、128個の割り込み制御レジスタ134を備える。割り込み制御部111は、割り込み制御レジスタ134を参照し、発生した割り込みの割り込み要因に対応するスレッド(LP)に割り込みを送る。
 割り込み制御レジスタ134には、割り込み要因に対応する割り込み先のスレッドが設定される。
 図25は、一つの割り込み制御レジスタ134の構成を示す図である。図25に示す割り込み制御レジスタ134は、割り込み要因に対応付けられた、システム割り込み171(SYSINT)と、LP識別子172(LPID)と、LP割り込み173(LPINT)と、HWイベント174(HWEVT)とを含む。
 システム割り込み171は、当該割り込みがシステム割り込み(グローバル割り込み)であるか否かを示す。LP識別子172は、割り込み先のLPを示す。LP割り込み173は、当該割り込みがLP割り込み(ローカル割り込み)であるか否かを示す。HWイベント174は当該割り込み要因によりハードウェアイベントを発生させるか否かを示す。
 システム割り込みの場合、割り込み制御部111は、現在スレッドを実行中のLPに割り込みを送る。また、LP割り込みの場合、割り込み制御部111は、LP識別子172で示されるLPに対して、割り込みを送る。また、ハードウェアイベントの場合、LP識別子172で示されるLPに対してハードウェアイベントを送る。このハードウェアイベントにより、該当LPが起床する。
 また、システム割り込み171及びLP識別子172は、仮想モニタレベルのOS(モニタプログラム)のみが書き換え可能であり、LP割り込み173及びHWイベント174は、仮想モニタレベル及びスーパーバイザーレベルのOSのみが書き換え可能である。
 次に、プロセッサシステム10における、メモリアクセス管理について説明する。
 図26は、プロセッサシステム10における、メモリアクセス管理の状態を模式的に示す図である。図26に示すように、プロセッサブロック11からメモリIFブロック14にMVID142が送られる。メモリIFブロック14は、このMVID142を用いて、MVID142ごとに、バスバンド幅を割り当てたうえで、アクセス要求元のスレッドのMVID142に割り当てたバスバンド幅を用いて、外部メモリ15にアクセスを行う。
 また、メモリIFブロック14は、バスバンド幅指定レジスタ138を備える。
 図27は、メモリIFブロック14によるバスバンド幅指定レジスタ138が保持するデータの一例を示す図である。なお、図27において、ホスト処理であるLinuxと、メディア処理に含まれる音声処理(Audio)と、メディア処理に含まれる画像処理(Video)とにそれぞれ異なるMVID142が付与されている。
 図27に示すように、メモリIFブロック14は、MVID142ごとにバスバンド幅を割り当てる。また、MVID142ごとに優先順位を決定し、当該優先順位に基づき、外部メモリ15へのアクセスを行う。
 これにより、MVID142ごとに必要なバンド幅が確保されるとともに、要求したアクセスレイテンシが保証される。よって、プロセッサシステム10は、複数のアプリケーションの性能保証及びリアルタイム性の保証を達成することができる。
 また、MVID142を用いてバスバンド幅を分割することにより、メモリIFブロック14とプロセッサブロック11とが一つのデータバス17のみを介して接続されている場合でも、複数のデータバスを介してメモリIFブロック14とプロセッサブロック11とが接続されている場合と同様の制御を行うことができる。つまり、複数のブロックに対してバスを分割する場合と同様の制御を行うことができる。
 なお、複数のブロックからのアクセス要求に対して、バスバンド幅を確保しレイテンシを保証するための技術は、その代表的な一例が特開2004-246862号公報(特許文献5)に詳しく開示されているので、ここでは詳細な説明を省略する。
 また、プロセッサシステム10では、TVID140及び従来のVMPの機能を用いて、メディア処理とホスト処理との処理時間の割合を任意に設定できる。具体的には、例えば、仮想モニタレベルのOSにより、各TVID140に対する処理時間の割合(メディア処理とホスト処理との処理時間の割合)が、VMPC102が備えるレジスタ(図示せず)に設定される。VMPC102は、この設定された処理時間の割合と、各スレッドのTVID140とを参照し、当該処理時間の割合が満たされるように、実行部101が実行するスレッドを切り替える。
 次に、仮想モニタレベルのOS(モニタプログラム)による、資源分割処理について説明する。
 図28は、モニタプログラムによる、資源分割処理の流れを示すフローチャートである。
 まず、モニタプログラムは、複数のコンテキスト124の、TVID140、PVID141及びMVID142を設定することにより、複数のスレッドを複数のグループに分割する(S121、S122及びS123)。
 次に、モニタプログラムは、エントリ指定レジスタ135にTVID140とエントリ150と対応関係を設定することにより、TLB104が有する複数のエントリ150を、ホスト処理に対応付ける第1エントリと、メディア処理に対応付ける第2エントリとに分割する(S124)。
 このエントリ指定レジスタ135に設定された対応関係と、アクセス元のスレッドのTVID140とを参照して、TLB104は、ホスト処理に属するスレッドとメディア処理に属するスレッドとにエントリ150を割り当てる。
 また、モニタプログラムは、ウェイ指定レジスタ136にTVID140(又はLP)とウェイ168との対応関係を設定することにより、キャッシュメモリ109が有する複数のウェイ168を、ホスト処理に対応付ける第1ウェイと、メディア処理に対応付ける第2ウェイとに分割する(S125)。
 このウェイ指定レジスタ136に設定された対応関係と、アクセス元のスレッドのTVID140とを参照して、TLB104は、ホスト処理に属するスレッドとメディア処理に属するスレッドとにウェイ168を割り当てる。
 また、モニタプログラムは、FPU割り当てレジスタ137にTVID140とFPU107との対応関係を設定することにより、複数のFPU107を、ホスト処理に対応付ける第1FPUと、メディア処理に対応付ける第2FPUとに分割する(S126)。
 このFPU割り当てレジスタ137に設定された対応関係と、スレッドのTVID140とを参照して、FPU割り当て部108は、ホスト処理に属するスレッドとメディア処理に属するスレッドとにFPU107を割り当てる。
 また、モニタプログラムは、バスバンド幅指定レジスタ138に、MVID142とバスバンド幅との対応関係を設定することにより、外部メモリ15とメモリIFブロック14との間のバスバンド幅を、ホスト処理に対応付ける第1バスバンド幅と、メディア処理に対応付ける第2バスバンド幅とに分割する(S127)。
 このバスバンド幅指定レジスタ138に設定された対応関係と、アクセス元のスレッドのMVID142とを参照して、メモリIFブロック14は、ホスト処理に属するスレッドとメディア処理に属するスレッドとにバスバンド幅を割り当てる。
 また、モニタプログラムは、物理アドレスと論理アドレスとの対応関係を示すページテーブルを作成する。この際、モニタプログラムは、PVID141と物理アドレスとの対応関係を設定することにより、外部メモリ15の物理アドレス空間を、ホスト処理に対応付ける第1物理アドレス範囲と、メディア処理に対応付ける第2物理アドレス範囲とに分割するとともに、第1物理アドレス範囲をホスト処理のスレッドに割り当て、第2物理アドレス範囲をメディア処理のスレッドに割り当てる(S128)。また、モニタプログラムは、PVID141と物理アドレスとの当該対応関係を物理メモリ保護レジスタ131に設定することにより、物理アドレスの保護を行う。
 また、モニタプログラムは、割り込み制御レジスタ134に、各割り込み要因に対応させて、割り込み先のLP等を設定する(S129)。これにより、モニタプログラムは、ホスト処理とメディア処理とにそれぞれ独立した割り込み制御を行える。
 この割り込み制御レジスタ134に設定された対応関係と、割り込み要因とを参照して、割り込み制御部111は、当該割り込み要因に対応するスレッドに割り込みを送る。
 なお、モニタプログラムによる、各設定の順序は、図28に示す順序に限定されるものではない。
 なお、モニタプログラムでページテーブルを作成せずに、TVID140を割り当てられたスーパーバイザーレベルの各OSが、それぞれ割り当てられた、物理アドレスに対応する論理アドレスを決めて、それぞれページテーブルを作成することも可能であり、本発明はこれを限定するものではない。
 以上より、本実施の形態に係るプロセッサシステム10は、資源を共用してホスト処理とメディア処理とを行う単一のプロセッサブロック11を備えることにより、面積効率を向上できる。さらに、プロセッサシステム10は、ホスト処理のスレッドとメディア処理のスレッドとに、異なるタグ情報(TVID140、PVID141及びMVID142)を与えるとともに、プロセッサシステム10が有する資源を当該タグ情報に対応付けて分割する。これによりプロセッサシステム10は、ホスト処理とメディア処理とにそれぞれ独立した資源を割り当てることができる。よって、ホスト処理とメディア処理との間で資源の競合が生じないので、プロセッサシステム10は、性能の保障、及び堅牢性を向上できる。
 また、物理アドレス管理部105は、PVID141を用いて、各スレッドが指定された物理アドレス範囲以外にアクセスしようとした場合には、割り込みを発生する。これにより、プロセッサシステム10は、システムの堅牢性を向上できる。
 以上、本実施の形態に係るプロセッサシステム10について説明したが、本発明は、この実施の形態に限定されるものではない。
 例えば、上記説明では、プロセッサブロック11がホスト処理とメディア処理との2種類の処理を行う例を述べたが、それ以外の処理を含む3種類以上の処理を行ってもよい。この場合、当該3種類以上の処理にそれぞれ対応する3種類以上のTVID140が複数のスレッドに付与される。
 同様に、PVID141及びMVID142の種類も上述した数に限定されるものではなく、複数であればよい。
 また、上記説明において、複数のスレッドをグループ分けするためのタグ情報として、TVID140、PVID141及びMVID142の3種類を述べたが、プロセッサシステム10は、一つのタグ情報(例えば、TVID140)のみを用いてもよい。つまり、プロセッサシステム10は、PVID141及びMVID142を用いず、物理アドレスの管理及びバス幅の制御にも、TVID140を用いてもよい。また、プロセッサシステム10は、2種類のタグ情報を用いてもよいし、4種類以上のタグ情報を用いてもよい。
 また、上記説明では、割り込み制御レジスタ134、エントリ指定レジスタ135、ウェイ指定レジスタ136、FPU割り当てレジスタ137及びページテーブルは、仮想モニタレベルのOS(モニタプログラム)により設定及び更新されるとしたが、仮想モニタレベルのOSの指示により、スーパーバイザーレベルのOSが割り込み制御レジスタ134、エントリ指定レジスタ135、ウェイ指定レジスタ136、FPU割り当てレジスタ137及びページテーブルを設定及び更新してもよい。つまり、仮想モニタレベルのOSによりスーパーバイザーレベルOSに、当該スーパーバイザーレベルのOSに割り当てられた資源が通知され、当該スーパーバイザーレベルのOSは、通知された資源を用いるように割り込み制御レジスタ134、エントリ指定レジスタ135、ウェイ指定レジスタ136、FPU割り当てレジスタ137及びページテーブルを設定及び更新してもよい。
 また、上記実施の形態に係るプロセッサシステム10に含まれる各処理部は典型的には集積回路であるLSIとして実現される。これらは個別に1チップ化されてもよいし、一部又はすべてを含むように1チップ化されてもよい。
 ここでは、LSIとしたが、集積度の違いにより、IC、システムLSI、スーパーLSI、ウルトラLSIと呼称されることもある。
 また、集積回路化はLSIに限るものではなく、専用回路又は汎用プロセッサで実現してもよい。LSI製造後にプログラムすることが可能なFPGA(Field Programmable Gate Array)、又はLSI内部の回路セルの接続や設定を再構成可能なリコンフィギュラブル・プロセッサを利用してもよい。
 さらには、半導体技術の進歩又は派生する別技術によりLSIに置き換わる集積回路化の技術が登場すれば、当然、その技術を用いて各処理部の集積化を行ってもよい。バイオ技術の適用等が可能性として考えられる。
 また、本発明の実施の形態に係るプロセッサシステム10の機能の一部又は全てを、実行部101等がプログラムを実行することにより実現してもよい。
 さらに、本発明は上記プログラムであってもよいし、上記プログラムが記録された記録媒体であってもよい。また、上記プログラムは、インターネット等の伝送媒体を介して流通させることができるのは言うまでもない。
 また、上記実施の形態に係るプロセッサシステム10及びその変形例の機能のうち少なくとも一部を組み合わせてもよい。
 本発明は、プロセッサ装置およびマルチスレッドプロセッサ装置に適用でき、特に、デジタルテレビ、DVDレコーダ、デジタルカメラおよび携帯電話機等に搭載されるメディア処理用のプロセッサ装置およびマルチスレッドプロセッサ装置に適している。
 10 プロセッサシステム
 11 プロセッサブロック
 12 ストリームI/Oブロック
 13 AVIOブロック
 14 メモリIFブロック
 15 外部メモリ
 16 制御バス
 17、18、19 データバス
 101 実行部
 102 VMPC
 104 TLB
 105 物理アドレス管理部
 107 FPU
 108 FPU割り当て部
 109 キャッシュメモリ
 110 BCU
 111 割り込み制御部
 121 物理プロセッサ
 122 演算制御部
 123 演算部
 124 コンテキスト
 126 スケジューラ
 127 コンテキストメモリ
 128 コンテキスト制御部
 130 アドレス変換テーブル
 131 物理メモリ保護レジスタ
 132 保護違反レジスタ
 133 エラーアドレスレジスタ
 134 割り込み制御レジスタ
 135 エントリ指定レジスタ
 136 ウェイ指定レジスタ
 137 FPU割り当てレジスタ
 138 バスバンド幅指定レジスタ
 150 エントリ
 151 TLBタグ部
 152 TLBデータ部
 168 ウェイ
 171 システム割り込み
 172 LP識別子
 173 LP割り込み
 174 HWイベント
 210 命令準備部
 213、223、233  状態レジスタ部
 214 レジスタ部
 215、225、235  第1判定部
 216、226、236  第2判定部
 220 命令準備部
 230 命令準備部
 240 実行パイプライン部
 250 制御部
 251 第1転送部
 251a、251b、251c 退避復帰部
 252 第2転送部
 253 クリア部
 260、270 ハードウェア資源
 261、271 レジスタ群
 310、320、330  メモリ
 311 コンテキストデータ
 312 拡張コンテキストデータ

Claims (16)

  1.  複数のプログラムを切り替えながら実行する複数のプロセッサと、
     データを保持するレジスタを有し前記複数のプロセッサの命令実行を補完する1つ以上のハードウェア資源と、
     前記複数のプログラムのうち前記ハードウェア資源を利用する所定命令を含むプログラム毎に、前記ハードウェア資源内のレジスタデータのコピーである拡張コンテキストデータを記憶するメモリと、
     前記ハードウェア資源と前記メモリとの間で、拡張コンテキストデータの退避と復帰とを制御する制御部と、
     前記ハードウェア資源内に現在実行中のプログラムの拡張コンテキストデータが保持されている可能性があるか否かを判定する第1判定部と、
     前記ハードウェア資源内の拡張コンテキストデータが前記所定命令を実行しようとしたプロセッサに属するか否かを判定する第2判定部と
     を備え、
     前記可能性があると前記第1判定部によって判定され、かつ、前記ハードウェア資源内の拡張コンテキストデータが、前記所定命令を実行しようとしたプロセッサに属すると前記第2判定部によって判定された場合に、前記制御部が拡張コンテキストデータの退避および復帰を行うことなく、前記ハードウェア資源は当該所定命令を実行する
     プロセッサ装置。
  2.  前記制御部は、
     前記第1判定部および前記第2判定部の判定結果に応じて、ハードウェア資源からメモリに拡張コンテキストデータを退避し、退避した拡張コンテキストデータと同じプロセッサに属するコンテキストデータを復帰する第1転送部と、
     前記第1判定部および前記第2判定部の判定結果に応じて、ハードウェア資源からメモリに拡張コンテキストデータを退避し、退避した拡張コンテキストデータとは異なるプロセッサに属する拡張コンテキストデータを復帰する第2転送部と
     を備える
     請求項1記載のプロセッサ装置。
  3.  前記ハードウェア資源は前記複数のプロセッサが実行できない拡張命令を実行する拡張演算ユニットであり、前記所定の命令は前記拡張命令である
     請求項1記載のプロセッサ装置。
  4.  前記第1判定部は、複数のプロセッサのそれぞれに設けられたデータ判定部を含み、
     各データ判定部は、当該データ判定部に対応するプロセッサがプログラム中の前記所定命令を実行しようとしたとき、当該データ判定部に対応するプロセッサで現在実行中のプログラムの拡張コンテキストデータが前記ハードウェア資源内に保持されている可能性があるか否かを判定し、
     前記第2判定部は、複数のプロセッサのそれぞれに設けられたプロセッサ判定部を含み、
     各プロセッサ判定部は、前記ハードウェア資源内の拡張コンテキストデータが前記所定命令を実行しようとしたプロセッサに属するか否かを判定する
     請求項1記載のプロセッサ装置。
  5.  前記複数のプロセッサのそれぞれは、状態レジスタを有し、
     各状態レジスタのデータのコピーは、プログラム毎のコンテキストデータに含まれ、
     各状態レジスタは、前記ハードウェア資源毎に、現在実行中のプログラムの拡張コンテキストデータが当該ハードウェア資源内に保持されている可能性があるか否かを示す第1状態情報と、前記ハードウェア資源毎に当該ハードウェア資源内に保持されている拡張コンテキストデータに対応するプロセッサを示す第2状態情報とを保持し、
     前記各データ判定部は、対応するプロセッサがプログラム中の前記所定命令を実行しようとしたとき、前記第1状態情報が真か偽かを判定し、偽であると判定したとき第1の例外割込み信号を発生する第1判定回路を含み、
     前記各プロセッサ判定部は、対応する前記第1判定回路が偽であると判定したとき、対応するプロセッサと前記第2状態情報が示すプロセッサとが一致するか否かを判定し、偽であると判定したとき第2の例外割込み信号を発生する第2判定回路を含み、
     前記ハードウェア資源は、前記第2判定回路が一致すると判定したとき、拡張コンテキストデータの退避および復帰を待つことなく、当該所定命令に従って即座に動作する
     請求項4記載のプロセッサ装置。
  6.  前記制御部は、
     前記第1判定部および前記第2判定部の判定結果に応じて、ハードウェア資源からメモリに拡張コンテキストデータを退避し、退避した拡張コンテキストデータと同じプロセッサに属するコンテキストデータを復帰する第1転送部と、
     前記第1判定部および前記第2判定部の判定結果に応じて、ハードウェア資源からメモリに拡張コンテキストデータを退避し、退避した拡張コンテキストデータとは異なるプロセッサに属する拡張コンテキストデータを復帰する第2転送部と
     を備える
     請求項5記載のプロセッサ装置。
  7.  前記第1転送部は、プロセッサ毎に設けられた退避復帰部を含み、
     各退避復帰部は、前記第1の例外割り込み信号が発生した場合に前記ハードウェア資源から前記メモリに拡張コンテキストデータを退避し、前記メモリから前記ハードウェア資源に前記所定命令を実行しようとしたプロセッサの拡張コンテキストデータを復帰し、
     前記複数のプロセッサは、第1のプロセッサと第2のプロセッサとを含み、
     前記第1のプロセッサは第1のオペレーティングシステムを実行することによって複数のプログラムを時分割多重で実行し、
     前記第2のプロセッサは第1のオペレーティングシステムとは異なる第2のオペレーティングシステムを実行することによって複数のプログラムを時分割多重で実行し、
     前記第1のプロセッサ内の前記退避復帰部は、前記第1のプロセッサ内の前記第1判定回路が前記第1の例外割込み信号を発生したとき、前記第1のオペレーティングシステムによって起動され、
     前記第2のプロセッサ内の前記退避復帰部は、前記第2のプロセッサ内の前記第1判定回路が前記第1の例外割込み信号を発生したとき、第2のオペレーティングシステムによって起動される
     請求項6記載のプロセッサ装置。
  8.  前記複数のプロセッサの少なくとも1つは、前記第1のオペレーティングシステムと前記第2のオペレーティングシステムとを管理する第3のオペレーティングシステムを実行し、
     前記第2の転送部は、何れかの前記第2判定回路が前記第2の例外割込み信号を発生したとき、第3のオペレーティングシステムによって起動される
     請求項7記載のプロセッサ装置。
  9.  前記第3オペレーティングシステムは、何れかの前記第2判定回路が前記第2の例外割込み信号を発生したとき、当該ハードウェア資源が他のプロセッサの所定命令を実行中である場合は、当該ハードウェア資源が解放されるのを待ち、当該ハードウェア資源を確保した後に、前記第2の転送部を起動する
     請求項8記載のプロセッサ装置。
  10.  前記第2転送部は、前記ハードウェア資源から前記メモリに前記他のプロセッサに対応する拡張コンテキストデータを退避する動作の開始から、前記メモリから前記ハードウェア資源に前記所定命令を実行しようとしたプロセッサの拡張コンテキストデータを復帰する動作の改良までをアトミックに行う
     請求項8記載のプロセッサ装置。
  11.  各プロセッサは、さらに、当該プロセッサが停止状態、待ち状態または休眠状態に遷移したとき、当該プロセッサに対応する第2状態情報をクリアするクリア回路を備える
     請求項8記載のプロセッサ装置。
  12.  前記各状態レジスタは、第2状態情報をロックするか否かを示す第3状態情報を保持し、
     前記第3オペレーティングシステムは、第3状態情報が第2状態情報をロックすることを示すとき、前記クリア回路による第2状態情報のクリアを禁止する
     請求項11記載のプロセッサ装置。
  13.  複数のスレッドを同時に実行することによって、複数のプログラムを切り替える複数の仮想プロセッサを備えるマルチスレッドプロセッサと、
     データを保持するレジスタを有し前記複数の仮想プロセッサの命令実行を補完する1つ以上のハードウェア資源と、
     前記複数のプログラムのうち前記ハードウェア資源を利用する所定命令を含むプログラム毎に、前記ハードウェア資源内のレジスタデータのコピーである拡張コンテキストデータを記憶するメモリと、
     前記ハードウェア資源と前記メモリとの間で、拡張コンテキストデータの退避と復帰とを制御する制御部と、
     前記ハードウェア資源内に現在実行中のプログラムの拡張コンテキストデータが保持されている可能性があるか否かを判定する第1判定部と、
     前記ハードウェア資源内の拡張コンテキストデータが前記所定命令を実行しようとしたプロセッサに属するか否かを判定する第2判定部と
     を備え、
     前記可能性があると前記第1判定部によって判定され、かつ、前記ハードウェア資源内の拡張コンテキストデータが、前記所定命令を実行しようとしたプロセッサに属すると前記第2判定部によって判定された場合に、前記制御部が拡張コンテキストデータの退避および復帰を行うことなく、前記ハードウェア資源は当該所定命令を実行する
     マルチスレッドプロセッサ装置。
  14.  前記制御部は、
     前記第1判定部および前記第2判定部の判定結果に応じて、ハードウェア資源からメモリに拡張コンテキストデータを退避し、退避した拡張コンテキストデータと同じプロセッサに属するコンテキストデータを復帰する第1転送部と、
     前記第1判定部および前記第2判定部の判定結果に応じて、ハードウェア資源からメモリに拡張コンテキストデータを退避し、退避した拡張コンテキストデータとは異なるプロセッサに属する拡張コンテキストデータを復帰する第2転送部と
     を備える
     請求項13記載のマルチスレッドプロセッサ装置。
  15.  前記複数の仮想プロセッサのそれぞれは、少なくとも1つのスレッドに対応し、
     前記マルチスレッドプロセッサは、
     スレッドの命令をフェッチおよび解読する複数の命令準備部と、
     前記複数の命令準備部により解読された命令であって、1以上のスレッドに対応する1以上の命令を同時に実行する実行部と、
     命令準備部毎に設けられた状態レジスタと
     を有し、
     前記制御部は、命令準備部毎に、現在のスレッドを他のスレッドに入れ替えることによって、前記複数の仮想プロセッサのうち実行中の仮想プロセッサと実行中でない仮想プロセッサとを入れ替え、
     各状態レジスタのデータのコピーは、仮想プロセッサ毎のコンテキストデータに含まれ、
     各状態レジスタは、
     前記ハードウェア資源毎に、現在実行中の仮想プロセッサの拡張コンテキストデータが当該ハードウェア資源内に保持されている可能性があるか否かを示す第1状態情報と、
     前記ハードウェア資源毎に当該ハードウェア資源内に保持されている拡張コンテキストデータに対応する仮想プロセッサを示す第2状態情報とを保持し、
     前記マルチスレッドプロセッサは、さらに、
     スレッドの入れ替えによって実行中の仮想プロセッサが実行中でなくなったときに、スレッドの入れ替えがあった命令準備部内の状態レジスタの第2状態情報をクリアするクリア回路を備える
     請求項14記載のマルチスレッドプロセッサ装置。
  16.  前記第1判定部は、前記複数の命令準備部のそれぞれに設けられたデータ判定部を含み、
     前記各データ判定部は、対応する命令準備部のスレッドが前記所定命令を実行しようとしたとき、前記第1状態情報が真か偽かを判定することによって、現在実行中のプログラムの拡張コンテキストデータが前記ハードウェア資源内に保持されている可能性があるか否かを判定し、
     前記第2判定部は、前記複数の命令準備部のそれぞれに設けられたプロセッサ判定部を含み、
     前記各プロセッサ判定部は、対応する命令準備部内の前記データ判定部が偽であると判定したとき、対応する命令準備部の仮想プロセッサと前記第2状態情報が示す仮想プロセッサとが一致するか否かを判定し、偽であると判定したとき第2の例外割込み信号を発生し、
     前記マルチスレッドプロセッサは、さらに、
     前記プロセッサ判定部からの第2の例外割込み信号によって起動される第2の例外割り込み処理を、オペレーティングシステムの一部の機能として実行し、
     前記オペレーティングシステムは、前記ハードウェア資源の獲得処理と、前記ハードウェア資源の解放を待つ待ち処理を含み、
     前記オペレーティングシステムは、
     前記第2の例外割り込み信号を発生させた仮想プロセッサの属する命令準備部以外の命令準備部に属する仮想プロセッサおいて当該ハードウェア資源が使用中でない場合に、前記獲得処理として、前記第2の例外割り込み信号を発生させた命令準備部内の状態レジスタに、真を示す第1状態情報と、前記第2の例外割り込み信号を発生させた仮想プロセッサを示す第2状態情報とを設定し、
     前記第2の例外割り込み信号を発生させた仮想プロセッサの属する命令準備部以外の命令準備部において仮想プロセッサにおいて当該ハードウェア資源が使用中である場合に、前記待ち処理を実行する
     請求項15記載のマルチスレッドプロセッサ装置。
PCT/JP2009/003857 2009-02-24 2009-08-11 プロセッサ装置、マルチスレッドプロセッサ装置 WO2010097847A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN2009801575253A CN102334102B (zh) 2009-02-24 2009-08-11 处理器装置、多线程处理器装置
JP2011501354A JP5433676B2 (ja) 2009-02-24 2009-08-11 プロセッサ装置、マルチスレッドプロセッサ装置
US13/215,623 US8850168B2 (en) 2009-02-24 2011-08-23 Processor apparatus and multithread processor apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2009-041568 2009-02-24
JP2009041568 2009-02-24

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US13/215,623 Continuation US8850168B2 (en) 2009-02-24 2011-08-23 Processor apparatus and multithread processor apparatus

Publications (1)

Publication Number Publication Date
WO2010097847A1 true WO2010097847A1 (ja) 2010-09-02

Family

ID=42665075

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2009/003857 WO2010097847A1 (ja) 2009-02-24 2009-08-11 プロセッサ装置、マルチスレッドプロセッサ装置

Country Status (4)

Country Link
US (1) US8850168B2 (ja)
JP (1) JP5433676B2 (ja)
CN (1) CN102334102B (ja)
WO (1) WO2010097847A1 (ja)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014078072A (ja) * 2012-10-09 2014-05-01 Canon Inc 情報処理装置、情報処理方法およびプログラム
JPWO2013008326A1 (ja) * 2011-07-13 2015-02-23 富士通株式会社 ソフトウェア検証方法、およびソフトウェア検証システム
JP2016511493A (ja) * 2013-03-15 2016-04-14 クアルコム,インコーポレイテッド システムメモリ管理ユニットコンテキストを保存および復元するための方法および装置

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8615766B2 (en) * 2012-05-01 2013-12-24 Concurix Corporation Hybrid operating system
US9191435B2 (en) 2012-08-23 2015-11-17 TidalScale, Inc. Selective data migration or remapping of virtual processors to provide required data accessibility to processor cores
US9483185B2 (en) * 2014-12-16 2016-11-01 Intel Corporation Gradual context saving in a data storage device
US10372491B2 (en) 2015-03-23 2019-08-06 Intel Corporation Execution context migration method and apparatus
US10241706B2 (en) * 2016-05-20 2019-03-26 Renesas Electronics Corporation Semiconductor device and its memory access control method
GB2550903B (en) * 2016-05-27 2019-06-12 Arm Ip Ltd Context data control
US10620992B2 (en) 2016-08-29 2020-04-14 TidalScale, Inc. Resource migration negotiation
CN108009007B (zh) * 2016-10-27 2021-01-15 华为技术有限公司 轻量级线程的调度方法及协同管理器、vCPU调度器
US11023135B2 (en) 2017-06-27 2021-06-01 TidalScale, Inc. Handling frequently accessed pages
US10353826B2 (en) * 2017-07-14 2019-07-16 Arm Limited Method and apparatus for fast context cloning in a data processing system
US10489304B2 (en) 2017-07-14 2019-11-26 Arm Limited Memory address translation
US10467159B2 (en) 2017-07-14 2019-11-05 Arm Limited Memory node controller
US10534719B2 (en) 2017-07-14 2020-01-14 Arm Limited Memory system for a data processing network
US10565126B2 (en) 2017-07-14 2020-02-18 Arm Limited Method and apparatus for two-layer copy-on-write
US10613989B2 (en) 2017-07-14 2020-04-07 Arm Limited Fast address translation for virtual machines
US10592424B2 (en) 2017-07-14 2020-03-17 Arm Limited Range-based memory system
US10545840B1 (en) * 2017-07-26 2020-01-28 Amazon Technologies, Inc. Crash tolerant computer system
US10817347B2 (en) 2017-08-31 2020-10-27 TidalScale, Inc. Entanglement of pages and guest threads
US10884850B2 (en) 2018-07-24 2021-01-05 Arm Limited Fault tolerant memory system
CN113010281B (zh) * 2021-02-24 2024-04-02 厦门树冠科技有限公司 多相机检测***的线程处理方法、装置、存储介质和终端

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0484335A (ja) * 1990-07-27 1992-03-17 Fujitsu Ltd 仮想計算機制御方式
JPH05127926A (ja) * 1991-10-31 1993-05-25 Nec Corp タスク制御装置
JPH05165652A (ja) * 1991-12-16 1993-07-02 Fujitsu Ltd タスク切替え制御方法
JPH0887420A (ja) * 1994-09-09 1996-04-02 Internatl Business Mach Corp <Ibm> プロセス・スレッドを管理する方法および装置

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01217635A (ja) * 1988-02-26 1989-08-31 Fujitsu Ltd レジスタ退避方式
US6061711A (en) * 1996-08-19 2000-05-09 Samsung Electronics, Inc. Efficient context saving and restoring in a multi-tasking computing system environment
JP3813930B2 (ja) 2002-01-09 2006-08-23 松下電器産業株式会社 プロセッサ及びプログラム実行方法
TW200415476A (en) 2002-09-30 2004-08-16 Matsushita Electric Ind Co Ltd Resource management device
JP2004246862A (ja) 2002-09-30 2004-09-02 Matsushita Electric Ind Co Ltd リソース管理装置
CN101626475B (zh) 2004-04-01 2011-05-04 松下电器产业株式会社 影像再现装置、信息记录装置、影像处理设备及摄像装置
JP4241921B2 (ja) 2004-06-10 2009-03-18 株式会社日立製作所 計算機システム及びその資源割当て方法
JP4956891B2 (ja) * 2004-07-26 2012-06-20 富士通株式会社 演算処理装置,情報処理装置および演算処理装置の制御方法
JP4170364B2 (ja) * 2004-09-17 2008-10-22 松下電器産業株式会社 プロセッサ
TWI326428B (en) 2005-03-18 2010-06-21 Marvell World Trade Ltd Real-time control apparatus having a multi-thread processor
US8195922B2 (en) 2005-03-18 2012-06-05 Marvell World Trade, Ltd. System for dynamically allocating processing time to multiple threads
US20060212853A1 (en) 2005-03-18 2006-09-21 Marvell World Trade Ltd. Real-time control apparatus having a multi-thread processor
US7536517B2 (en) * 2005-07-29 2009-05-19 Microsoft Corporation Direct-update software transactional memory
US20070143582A1 (en) 2005-12-16 2007-06-21 Nvidia Corporation System and method for grouping execution threads
US8271994B2 (en) * 2006-02-11 2012-09-18 International Business Machines Corporation Reduced data transfer during processor context switching
JP2008123045A (ja) 2006-11-08 2008-05-29 Matsushita Electric Ind Co Ltd プロセッサ

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0484335A (ja) * 1990-07-27 1992-03-17 Fujitsu Ltd 仮想計算機制御方式
JPH05127926A (ja) * 1991-10-31 1993-05-25 Nec Corp タスク制御装置
JPH05165652A (ja) * 1991-12-16 1993-07-02 Fujitsu Ltd タスク切替え制御方法
JPH0887420A (ja) * 1994-09-09 1996-04-02 Internatl Business Mach Corp <Ibm> プロセス・スレッドを管理する方法および装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2013008326A1 (ja) * 2011-07-13 2015-02-23 富士通株式会社 ソフトウェア検証方法、およびソフトウェア検証システム
JP2014078072A (ja) * 2012-10-09 2014-05-01 Canon Inc 情報処理装置、情報処理方法およびプログラム
JP2016511493A (ja) * 2013-03-15 2016-04-14 クアルコム,インコーポレイテッド システムメモリ管理ユニットコンテキストを保存および復元するための方法および装置

Also Published As

Publication number Publication date
JPWO2010097847A1 (ja) 2012-08-30
CN102334102A (zh) 2012-01-25
US20120023311A1 (en) 2012-01-26
CN102334102B (zh) 2013-11-20
JP5433676B2 (ja) 2014-03-05
US8850168B2 (en) 2014-09-30

Similar Documents

Publication Publication Date Title
JP5433676B2 (ja) プロセッサ装置、マルチスレッドプロセッサ装置
JP5412504B2 (ja) マルチスレッドプロセッサ及びデジタルテレビシステム
US10558580B2 (en) Methods and apparatus for loading firmware on demand
KR100996753B1 (ko) 시퀀서 어드레스를 관리하기 위한 방법, 맵핑 관리자 및 멀티 시퀀서 멀티스레딩 시스템
JP4028444B2 (ja) スケジューリング方法およびリアルタイム処理システム
KR100591727B1 (ko) 스케줄링 방법과 이 방법을 실행하기 위한 프로그램을 기록한 기록매체 및 정보처리시스템
US9747218B2 (en) CPU security mechanisms employing thread-specific protection domains
JP3920818B2 (ja) スケジューリング方法および情報処理システム
US6438671B1 (en) Generating partition corresponding real address in partitioned mode supporting system
US7694304B2 (en) Mechanisms for dynamic configuration of virtual processor resources
JP4057989B2 (ja) スケジューリング方法および情報処理システム
US8386750B2 (en) Multiprocessor system having processors with different address widths and method for operating the same
WO2015169145A1 (zh) 内存管理方法和设备
US20080235477A1 (en) Coherent data mover
US7873961B2 (en) Supervisory operating system for running multiple child operating systems simultaneously and optimizing resource usage
JP2006318477A (ja) ロジカルパーティショニングされた処理環境におけるリソース管理のための方法および装置
US20170031729A1 (en) Generational Thread Scheduler
JP2005062956A (ja) スケジューリング方法および情報処理システム
US11256625B2 (en) Partition identifiers for page table walk memory transactions
JP2013161299A (ja) 情報処理装置、インタフェースアクセス方法
US11009841B2 (en) Initialising control data for a device
TWI831564B (zh) 可配置的記憶體系統及其記憶體管理方法
JP2011039666A (ja) バリア同期方法及び計算機

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 200980157525.3

Country of ref document: CN

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

Ref document number: 09840701

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2011501354

Country of ref document: JP

122 Ep: pct application non-entry in european phase

Ref document number: 09840701

Country of ref document: EP

Kind code of ref document: A1