31 #ifndef __ARCH_MIPS_MT_HH__
32 #define __ARCH_MIPS_MT_HH__
67 return vpeCtrl.targTC;
74 if (tc->status() == TC::Active) {
83 warn(
"%i: Halting thread %i in %s @ PC %x, setting restart PC to %x",
84 curTick(), tc->threadId(), tc->getCpuPtr()->name(),
93 if (tc->status() != TC::Active) {
98 tc->pcState(restartPC);
101 warn(
"%i: Restoring thread %i in %s @ PC %x",
102 curTick(), tc->threadId(), tc->getCpuPtr()->name(), restartPC);
111 int num_threads = mvpConf.ptc + 1;
114 for (
ThreadID tid = 0; tid < num_threads && success == 0; tid++) {
115 TCBindReg tidTCBind =
119 if (tidTCBind.curVPE == tcBind.curVPE) {
121 TCStatusReg tidTCStatus =
125 TCHaltReg tidTCHalt =
128 if (tidTCStatus.da == 1 && tidTCHalt.h == 0 &&
129 tidTCStatus.a == 0 && success == 0) {
133 tc->setRegOtherThread(Rd_bits, Rt, tid);
139 tidTCStatus.rnst = 0;
147 tidTCStatus.tksu = status.ksu;
149 tidTCStatus.asid = tcStatus.asid;
159 std::cerr <<
"Bad VPEs" << std::endl;
164 VPEControlReg vpeControl =
166 vpeControl.excpt = 1;
168 fault = std::make_shared<ThreadFault>();
179 ThreadID num_threads = mvpConf0.ptc + 1;
186 for (
ThreadID tid = 0; tid < num_threads; tid++) {
187 TCStatusReg tidTCStatus =
190 TCHaltReg tidTCHalt =
193 TCBindReg tidTCBind =
197 if (tidTCBind.curVPE == tcBind.curVPE &&
198 tidTCBind.curTC == tcBind.curTC &&
199 tidTCStatus.da == 1 &&
201 tidTCStatus.a == 1) {
210 warn(
"%i: Deactivating Hardware Thread Context #%i",
213 }
else if (src_reg > 0) {
214 if (src_reg && !yield_mask != 0) {
216 vpeControl.excpt = 2;
218 fault = std::make_shared<ThreadFault>();
221 }
else if (src_reg != -2) {
223 VPEControlReg vpeControl =
226 if (vpeControl.ysi == 1 && tcStatus.dt == 1 ) {
227 vpeControl.excpt = 4;
228 fault = std::make_shared<ThreadFault>();
233 return src_reg & yield_mask;
248 status.cu = tcStatus.tcu;
249 status.mx = tcStatus.tmx;
250 status.ksu = tcStatus.tksu;
266 tcStatus.tcu = status.cu;
267 tcStatus.tmx = status.mx;
268 tcStatus.tksu = status.ksu;
void updateStatusView(TC *tc)
void restoreThread(TC *tc)
void updateTCStatusView(TC *tc)
Tick curTick()
The current simulated tick.
unsigned getVirtProcNum(TC *tc)
unsigned getTargetThread(TC *tc)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
int yieldThread(TC *tc, Fault &fault, int src_reg, uint32_t yield_mask)
void forkThread(TC *tc, Fault &fault, int Rd_bits, int Rs, int Rt)
int16_t ThreadID
Thread index/ID type.
std::shared_ptr< FaultBase > Fault