COP0 010000 |
MFMC0 01011 |
rt |
1 00001 |
15 01111 |
sc 0 |
0 00 |
1 001 |
6 |
5 |
5 |
5 |
5 |
1 |
2 |
3 |
DMT rt |
MIPS MT |
Disable Multi-Threaded Execution |
Disable Multi-Threaded Execution.
To return the previous value ofthe VPEControlregister(see Section 6.5) and disable multi-threaded execution.If
DMT is specifie without an argument, GPR r0 is implied, which discards the previous value of the VPEControl register.
GPR[rt] = VPEControl; VPEControlTE = 0
The current value ofthe VPEControlregisteris loaded into generalregisterrt. The Threads Enable (TE) bitin the register is then cleared, suspending concurrent execution of instruction streams other than that which
VPEControl
issues the DMT. This is independent of any per-TC halted state.
If access to Coprocessor 0 is not enabled, a Coprocessor Unusable Exception is signaled.
In implementations that do notimplementthe MT Module,this instruction results in a Reserved Instruction Exception.
This operation specificatiois for the general multi-threading enable/disable operation, with the sc (set/clear) fielas a variable. The individual instructions EMT and DMT have a specific alue for the sc field
data = VPEControl GPR[rt] = data VPEControlTE = sc
Coprocessor Unusable
Reserved Instruction (Implementations that do not include the MT Module )
The effects of this instruction are identical to those accomplished by the sequence of reading VPEControl into a GPR, clearing the TE bit to create a temporary value in a second GPR, and writing that value back to VPEControl. Unlike the multiple instruction sequence, however, the DMT instruction does not consume a temporary register, and cannot be aborted by an interrupt or exception.
The effect of a DMT instruction may not be instantaneous. An instruction hazard barrier, e.g., JR.HB,is required to guarantee that all other threads have been suspended. If a DMT instruction is followed in the same instruction stream by an MFC0 or MFTR from the VPEControl register, a JALR.HB, JR.HB, EHB, or ERET instruction must be issued between the DMT and the read of VPEControl to guarantee that the new state of TE will be accessed by the read.
COP0 010000 |
MFMC0 01011 |
rt |
0 00000 |
0 00000 |
sc 0 |
0 00 |
1 001 |
6 |
5 |
5 |
5 |
5 |
1 |
2 |
3 |
DVPE rt |
MIPS MT |
Disable Virtual Processor Execution |
Disable Virtual Processor Execution.
To return the previous value of the MVPControl register (see Section 6.2) and disable multi-VPE execution. If DVPE is specified without an a gument, GPR r0 is implied, which discards the previous value of the MVPControl register.
GPR[rt] = MVPControl; MVPControlEVP = 0
The current value of the MVPControl register is loaded into general register rt. The Enable Virtual Processors (EVP) bit in the MVPControl register is then cleared, suspending concurrent execution of instruction streams other than the instruction stream that issues the DVPE.
If access to Coprocessor 0 is not enabled, a Coprocessor Unusable Exception is signaled.
If the VPE executing the instruction is not a Master VPE, with the MVP bit of the VPEConf0 register set, the EVP bit is unchanged by the instruction.
In implementations that do notimplementthe MT Module,this instruction results in a Reserved Instruction Exception.
This operation specificatiois for the general VPE enable/disable operation, with the sc (set/clear) fielas a variable.
The individual instructions EVPE and DVPE have a specific alue for the sc field
data = MVPControl GPR[rt] = data if(VPEConf0MVP = 1) then MVPControlEVP = sc endif
Coprocessor Unusable
Reserved Instruction (Implementations that do not include the MT Module )
The effects of this instruction are identical to those accomplished by the sequence of reading MVPControl into a GPR, clearing the EVP bit to create a temporary value in a second GPR, and writing that value back to MVPControl. Unlike the multiple instruction sequence, however, the DVPE instruction does not consume a temporary register, and cannot be aborted by an interrupt or exception, nor by the scheduling of a different instruction stream.
The effect of a DVPE instruction may not be instantaneous. An instruction hazard barrier, e.g., JR.HB, is required to guarantee that all other TCs have been suspended.
If a DVPE instruction is followed in the same instruction stream by an MFC0 or MFTR from the MVPControl register, a JALR.HB, JR.HB, EHB, or ERET instruction must be issued between the DVPE and the read of MVPControl to guarantee that the new state of EVP will be accessed by the read.
COP0 010000 |
MFMC0 01011 |
rt |
1 00001 |
15 01111 |
sc 1 |
0 00 |
1 001 |
6 |
5 |
5 |
5 |
5 |
1 |
2 |
3 |
EMT rt |
MIPS MT |
Enable Multi-Threaded Execution |
To return the previous value of the VPEControl register (see Section 6.5) and to enable multi-threaded execution. If
EMT is specifie without an argument, GPR r0 is implied, which discards the previous value of the VPEControl register.
GPR[rt] = VPEControl; VPEControlTE = 1
The current value ofthe VPEControlregisteris loaded into generalregister rt. The Threads Enable (TE) bitin the
VPEControl register is then set, allowing multiple instruction streams to execute concurrently.
If access to Coprocessor 0 is not enabled, a Coprocessor Unusable Exception is signaled.
In implementations that do not implement the MT Module, this instruction results in a Reserved Instruction Exception.
This operation specificatiois for the general multi-threading enable/disable operation, with the sc (set/clear) fielas a variable. The individual instructions EMT and DMT have a specific alue for the sc field
data = VPEControl GPR[rt] = data VPEControlTE = sc
Coprocessor Unusable
Reserved Instruction (Implementations that do not include the MT Module)
The effects of this instruction are identical to those accomplished by the sequence of reading VPEControl into a GPR, setting the TE bit to create a temporary value in a second GPR, and writing that value back to VPEControl. Unlike the multiple instruction sequence, however, the EMT instruction does not consume a temporary register, and cannot be aborted by an interrupt or exception.
If an EMT instruction is followed in the same instruction stream by an MFC0 or MFTR from the VPEControl register, a JALR.HB, JR.HB, EHB, or ERET instruction must be issued between the EMT and the read of VPEControl to guarantee that the new state of TE will be accessed by the read.
COP0 010000 |
MFMC0 01011 |
rt |
0 00000 |
0 00000 |
sc 1 |
0 00 |
1 001 |
6 |
5 |
5 |
5 |
5 |
1 |
2 |
3 |
EVPE rt |
MIPS MT |
Enable Virtual Processor Execution |
Enable Virtual Processor Execution
To return the previous value of the MVPControl register (see Section 6.2) and enable multi-VPE execution. If EVPE is specified without an a gument, GPR r0 is implied, which discards the previous value of the MVPControl register.
GPR[rt] = MVPControl; MVPControlEVP = 1
The current value of the MVPControl register is loaded into general register rt. The Enable Virtual Processors (EVP) bit in the MVPControl register is then set, enabling concurrent execution of instruction streams on all non-inhibited
Virtual Processing Elements (VPEs) on a processor.
If access to Coprocessor 0 is not enabled, a Coprocessor Unusable Exception is signaled.
If the VPE executing the instruction is not a Master VPE, with the MVP bit of the VPEConf0 register set, the EVP bit is unchanged by the instruction.
In implementations that do notimplementthe MT Module,this instruction results in a Reserved Instruction Exception.
This operation specificatiois for the general VPE enable/disable operation, with the sc (set/clear) fielas a variable.
The individual instructions EVPE and DVPE have a specific alue for the sc field
data = MVPControl GPR[rt] = data if(VPEConf0MVP = 1) then MVPControlEVP = sc endif
Coprocessor Unusable
Reserved Instruction (Implementations that do not include the MT Module )
The effects of this instruction are identical to those accomplished by the sequence of reading MVPControl into a GPR, setting the EVP bit to create a temporary value in a second GPR, and writing that value back to MVPControl. Unlike the multiple instruction sequence, however, the EVPE instruction does not consume a temporary register, and cannot be aborted by an interrupt or exception, nor by the scheduling of a different instruction stream.
If an EVPE instruction is followed in the same instruction stream by an MFC0 or MFTR from the MVPControl register, a JALR.HB, JR.HB, EHB, or ERET instruction must be issued between the EVPE and the read of MVPControl to guarantee that the new state of EVP will be accessed by the read.
SPECIAL3 011111 |
rs |
rt |
rd |
0 00000 |
FORK 001000 |
6 |
5 |
5 |
5 |
5 |
6 |
FORK rd, rs, rt |
MIPS MT |
Allocate and Schedule a New Thread |
Allocate and Schedule a New Thread
To cause a thread context to be allocated and associated with a new instruction stream.
Description: NewThread's GPR[rd] = GPR[rt], NewThread's TCRestart = GPR[rs]
The FORK instruction causes a free dynamically allocatable thread context (TC) to be allocated and activated on the issuing VPE. It takes two operand values from GPRs. The rs value is used as the starting fetch address and execution mode for the new thread. The rt value is copied into GPR rd of the new TC. The TCStatus register of the new TC is set up as a function of the FORKing TC as described in Section 6.12. If theUserLocal register is implemented, the
UserLocal value ofthe FORKing TC is also copied to the new TC. The newly allocated TC will begin executing instructions according to the implemented scheduling policy if and when multi-threaded execution is otherwise enabled.
If no free, non-halted, dynamically allocatable TC is available forthe fork, a Thread Exception is raised forthe
FORK instruction, with the VPEControl.EXCPT CP0 register field set to 1 to indicate the Thread O erfl w case.
Processors which implement only a single TC per VPE may implement FORK by simply raising the Thread Exception and indicating the Overfl w.
Any exceptions associated with the virtual address passed in rs will be taken by the new thread of execution.
success = 0 for t in 0...MVPConf0PTC if TC[t].TCBindCurVPE = TCBindCurVPE then if (TC[t].TCStatusDA = 1) and (TC[t].TCHaltH = 0) and (TC[t].TCStatusA = 0) and (success = 0) then TC[t].TCRestart = GPR[rs] TC[t].GPR[rd] = GPR[rt] if (Config3ULRI = 1) then TC[t].UserLocal = UserLocal endif activated = 1 priorcu = TC[t].TCStatusTCU3..TCU0 priormx = TC[t].TCStatusTMX priorixmt = TC[t].TCStatusIXMT TC[t].TCStatus = priorcu || priormx || StatusFR || 05 || 1 || ImpDep4 || 1 || 0 || activated|| StatusKSU || priorixmt || 02 || TCStatusTASID success = 1 endif endif endfor if success = 0 VPEControlEXCPT = 1 SignalException(Thread) endif
Reserved Instruction
Thread
COP0 010000 |
MFTR 01000 |
rt |
rd |
rx |
u |
h |
0 |
sel |
6 |
5 |
5 |
5 |
5 |
1 |
1 |
1 |
3 |
MFTR rd, rt, u, sel, h |
MIPS MT |
Move from Thread Context |
Move from Thread Context
To move the contents of a register within a targeted thread context or VPE into a general register of the current thread.
GPR[rd] = TC[VPEControlTargTC][u,rt,sel,h]
The contents of the register specifieareloaded into general register rd. The target context to be read is determined by the value of the TargTC fiel of the CP0 VPEControl register (see Section 6.5). The register to be read within the selected context is determined by the value in the rt operand register, in conjunction with the u and sel bits of the MFTR instruction
An MFTR instruction where the target TC is not in a Halted state (i.e., TCHalt.H is not set), or where a TC other than the one issuing the MFTR is active in the target VPE on a reference to a per-VPE CP0 register, may result in an
UNSTABLE value.
If the target TC is blocked but not halted,then the thread issuing the MFTR instrution may be blocked indefinitel.
Thisis dueto thetarget TC waiting on an externaleventthat may never happen.Itisrecommended thatthe
TCStatusRNST bit of the target TC be checked before issuing the MFTR instruction.
In any implementation with Floating-Point-Unit, if TCStatusTFR is set so the effective FPR width matches the GPR width, a MFTR instruction targetting one of the FPRs with h=1 will cause UNPREDICTABLE results.
if VPEConf0MVP = 0 and ( TC[VPEControlTargTC].TCBindCurVPE != TCBindCurVPE ) then data = -1 else if VPEControlTargTC > MVPConf0PTC then data = -1 else if u = 0 then data = TC[VPEControlTargTC].CPR[0,rt,sel] else if h = 1 then topbit = 63 bottombit = 32 else topbit = 31 bottombit = 0 endifcase sel 0: data = TC[VPEControlTargTC].GPR[rt] 1: case rt 0: data = TC[VPEControlTargTC].Lo 1: data = TC[VPEControlTargTC].Hi 2: data = TC[VPEControlTargTC].ACX 4: data = TC[VPEControlTargTC].DSPLo[1] 5: data = TC[VPEControlTargTC].DSPHi[1] 6: data = TC[VPEControlTargTC].DSPACX[1] 8: data = TC[VPEControlTargTC].DSPLo[2] 9: data = TC[VPEControlTargTC].DSPHI[2] 10:data = TC[VPEControlTargTC].DSPACX[2] 12 data = TC[VPEControlTargTC].DSPLo[3] 13:data = TC[VPEControlTargTC].DSPHi[3] 14:data = TC[VPEControlTargTC].DSPACX[3] 16:data = TC[VPEControlTargTC].DSPControl otherwise: data = UNPREDICTABLE 2: if ( ( ConfigAT = 0 and StatusFR = 0) or ( ConfigAT = 1 or ConfigAT = 2) ) // GPR and FPR widths match if (h = 0 ) data = TC[VPEControlTargTC].FPR[rt] else UNPREDICTABLE endif elseif (ConfigAT = 0 and StatusFR = 1) // 32-bit GPRs and 64-bit FPRs data = TC[VPEControlTargTC].FPR[rt]topbit..bottombit endif 3: data = TC[VPEControlTargTC].FPCR[rt] 4: data = TC[VPEControlTargTC].CP2CPR[rx||rt]topbit..bottombit 5: data = TC[VPEControlTargTC].CP2CCR[rx||rt]topbit..bottombit otherwise: data = UNPREDICTABLE endif if h = 1 then data = data63..32 endif GPR[rd] = data31..0
Coprocessor Unusable
Reserved Instruction
COP0 010000 |
MTTR 01100 |
rt |
rd |
rx |
u |
h |
0 0 |
sel |
6 |
5 |
5 |
5 |
5 |
1 |
1 |
1 |
3 |
MTTR rt, rd, u, sel, h |
MIPS MT |
Move to Thread Context |
Move to Thread Context
To move the contents of a general register of the current thread into a register within a targeted thread context.
TC[VPEControlTargTC][u,rd,sel,h] = GPR[rt]
The contents of the rt register specifieare written into a register of an arbitrary thread context (TC) or virtual processor (VPE).
The target contextto be written is determined by the value of the TargTC fielof the CP0 VPEControl register (see
Section 6.5). The registerto be written within the selected contextis determined by the value in the rd operand register, in conjunction with the u and sel bits of the MTTR instruction.
The effect on a TC that is not in a Halted state (i.e., TCHalt.H is 0) of an MTTR instruction targeting that TC may be transient and unstable, but MTTRs setting a TCHalt H bit are always effective until overridden by another MTTR.
Processor state following an MTTR instruction modifying a per-VPE CP0 registeris UNPREDICTABLE if a TC other than the one issuing the MTTR is concurrently active on the targeted VPE.
If the target TC is blocked but not halted,then the thread issuing the MTTR instrution may be blocked indefinitel.
Thisis dueto thetarget TC waiting on an externaleventthat may never happen.Itisrecommended thatthe
TCStatusRNST bit of the target TC be checked before issuing the MtTR instruction.
In any implementation with Floating-Point-Unit, if TCStatusTFR is set so the effective FPR width matches the GPR width, a MFTR instruction targetting one of the FPRs with h=1 will cause UNPREDICTABLE results.
if VPEConf0MVP = 0 and ( TC[VPEControlTargTC].TCBindCurVPE != TCBindCurVPE ) then NOOP else if VPEControlTargTC > MVPConf0PTC then NOOP else if h = 1 then topbit = 63 bottombit = 32 else topbit = 31 bottombit = 0 endif if u = 0 then TC[VPEControlTargTC].CPR[0,rd,sel]topbit..bottombit = GPR[rt] else case sel 0: TC[VPEControlTargTC].GPR[rd] = GPR[rt] 1: case rd 0: TC[VPEControlTargTC].Lo = GPR[rt] 1: TC[VPEControlTargTC].Hi = GPR[rt] 2: TC[VPEControlTargTC].ACX = GPR[rt] 4: TC[VPEControlTargTC].DSPLo[1] = GPR[rt] 5: TC[VPEControlTargTC].DSPHi[1] = GPR[rt] 6: TC[VPEControlTargTC].DSPACX[1] = GPR[rt] 8: TC[VPEControlTargTC].DSPLo[2] = GPR[rt] 9: TC[VPEControlTargTC].DSPHi[2] = GPR[rt] 10:TC[VPEControlTargTC].DSPACX[2] = GPR[rt] 12:TC[VPEControlTargTC].DSPLo[3] = GPR[rt] 13:TC[VPEControlTargTC].DSPHi[3] = GPR[rt] 14:TC[VPEControlTargTC].DSPACX[3] = GPR[rt] 16:TC[VPEControlTargTC].DSPControl = GPR[rt] otherwise: UNPREDICTABLE 2: if ( ( ConfigAT = 0 and StatusFR = 0) or ( ConfigAT = 1 or ConfigAT = 2) ) // GPR and FPR widths match if (h = 0) TC[VPEControlTargTC].FPR[rd] = GPR[rt] else UNPREDICTABLE endif elseif (ConfigAT = 0 and StatusFR = 1) // 32-bit GPRs and 64-bit FPRs TC[VPEControlTargTC].FPR[rd]topbit..bottombit = GPR[rt] endif 3: TC[VPEControlTargTC].FPCR[rd] = GPR[rt] 4: TC[VPEControlTargTC].CP2CPR[rx||rd]topbit..bottombit = GPR[rt] 5: TC[VPEControlTargTC].CP2CCR[rx||rd]topbit..bottombit = GPR[rt] otherwise: UNPREDICTABLE endif endif
Coprocessor Unusable
Reserved Instruction
SPECIAL3 011111 |
rs |
0 00000 |
rd |
0 00000 |
YIELD 001001 |
6 |
5 |
5 |
5 |
5 |
6 |
YIELD rd, rs |
MIPS MT |
Conditionally Deschedule or Deallocate the Current Thread |
Conditionally Deschedule or Deallocate the Current Thread
To suspend the current thread of execution, and conditionally deallocate the associated thread context.
The YIELD instruction takes a single input operand value from a GPR rs. This value is a descriptor of the circumstances under which the issuing thread should be rescheduled.
If GPR rs is zero, the thread is not to be rescheduled at all, and it is instead deallocated and its associated TC storage freed for allocation by a subsequent FORK issued by some other thread.
If GPR rs is negative one (-1), the thread remains eligible for scheduling at the next opportunity, but invokes the processor's scheduling logic and relinquishes the CPU for any other threads which ought to execute firs according to the implemented scheduling policy.
If GPR rs is negative two (-2), the processor's scheduling logic is not invoked, and the only effect of the instruction is to retrieve the rd value (see below).
All other negative values of the rs register are reserved for future architectural definition by MIPS
Positive values of rs are treated as a vector of YIELD qualiier (YQ) bits which describe an implementation-dependent set of external or internal core signal conditions under which the YIELDing thread is to be rescheduled. Up to 31 bits of YIELD qualifie state may be supported by a processor, but implementations may provide fewer. To be usable, a YIELD qualifier bit must be enabled in th
YQMask register (see Section 6.8).
If no set bit of rs matches with a set, enabled YQ bit,the TC is blocked until one or more active bits of enabled YQ input match corresponding rs bits. If and when one or more bits match, the TC resumes a running state, and may be rescheduled for execution in accordance with the thread scheduling policy in effect.
The rd output operand specifiea GPR which is to receive a result value. This result contains the bit vector of YQ inputs values enabled by the YQMask register at the time the YIELD completes. Thus, any YQ state that can be waited upon by a YIELD with a positive rs value can also be polled via a YIELD with an rs value of -1 or -2. The value of any rd bits which do not correspond to set bits in the YQMask register is implementation-dependent, typically 0. A zero value of the rd operand field, selecting GPR 0, indicates that no result alue is desired.
If a positive rs value includes a set bit that is not also set in the YQMask register, a Thread exception is raised for the
YIELD instruction, with the EXCPT field of thVPEControl register set to 2 to indicate the Invalid Qualifier case
If no non-halted dynamically allocatable TC would be activated after a YIELD whose rs value is 0, a Thread exception is raised for the YIELD instruction, with the EXCPT fiel of the VPEControl register set to 0 to indicate the
Thread Underfl w case.
If the processor's scheduling logic would be invoked as a consequence of an otherwise unexceptional YIELD, one whose rs value is 0 (excluding the Underfl w case), -1, or positive (excluding the Invalid Qualifie case), and both the
YSI bit of VPEControl and the DT bit of TCStatus are set, a Thread exception is raised for the YIELD instruction, with
the VPEControl EXCPT field set to 4 to indicate the YIELD Scheduler case
If multi-threaded operation is unsupported, a Reserved Instruction Exception is raised for the YIELD instruction.
Processor behavior is UNPREDICTABLE if a YIELD instruction is placed in a branch or jump delay slot.
if GPR[rs] = 0 then ok = 0 for t in 0...MVPConf0PTC if (TC[t].TCBindCurVPE = TCBindCurVPE ) and (TC[t].TCBindCurTC != TCBindCurTC ) and (TC[t].TCStatusDA = 1) and (TC[t].TCHaltH = 0) and (TC[t].TCStatusA = 1) then ok = 1 endif endfor if ok = 1 then TCStatusA = 0 else VPEControlEXCPT = 0 SignalException(Thread) endif else if GPR[rs] > 0 then if (GPR[rs] and (not YQMask)) != 0 then VPEControlEXCPT = 2 SignalException(Thread) else SetThreadRescheduleCondition(GPR[rs] and YQMask) endif endif if GPR[rs] != -2 then if (VPEControlYSI = 1) and (TCStatusDT = 1) then VPEControlEXCPT = 4 SignalException(Thread) else ScheduleOtherThreads() endif endif if rd != 0 then GPR[rd] = GetThreadRescheduleCondition() endif
Reserved Instruction
Thread