b2Vec2 BodyGene::calcVertex(const b2Vec2& centerVertex, const b2Vec2& vertex2, float32 angle, float32 length) const { b2Vec2 rotatePoint = calcPoint(centerVertex, vertex2, angle); rotatePoint.x += centerVertex.x; rotatePoint.y += centerVertex.y; b2Vec2 line = calcLine(centerVertex, rotatePoint); return calcPointInLine(line, centerVertex, length, isOnRight(centerVertex, rotatePoint)); }
void LMVCache::combineInit(PAddr paddr, HVersion *verDup, const VMemState *state) { I(verDup); VMemPushLineReq *askReq = VMemPushLineReq::createAskPushLine(this ,verDup ,paddr ,state); I(askReq->getVersion()); askReq->incPendingMsg(); I(askReq->getType() == VAskPushLine); cMap[calcLine(paddr)] = askReq; // Combine All // combine all the safe???? add by hr ulong index = calcIndex4PAddr(paddr); for(ulong i=0; i < cache->getAssoc(); i++) { CacheLine *cl = cache->getPLine(index+i); if (cl->isInvalid()) continue; if (cl->accessLine()) { wrLVIDEnergy->inc(); continue; } if (!cl->isHit(paddr)) continue; #if TS_WRITE if(!cl->isSafe()) continue; #endif askReq->getState()->combineStateFrom(cl); cl->invalidate(); wrLVIDEnergy->inc(); } // I guess that , here, the LMVCache actively request the safe cacheline form the upper // level FMVCache. add by hr I(askReq->getVersion()); vbus->askPushLine(askReq); }
dxfbezier2linesClass::dxfbezier2linesClass(string file_name, int st, double textLengte) { n=0; res = 50000; text_lengte = textLengte; //strcpy(file,file_name); aantal_punten = st; char *cstr = new char[file_name.length() + 1]; strcpy(cstr, file_name .c_str()); DL_Dxf* dxf = new DL_Dxf(); if (!dxf->in(cstr, this)) // if file open failed { std::cerr << file_name << " could not be opened.\n"; exit(1); } delete dxf; calcLine(); Scale(); // char* file="twee.dxf" }
void LMVCache::combinePushLine(const VMemPushLineReq *pushReq) { // Steps: // // 1-Add to VCR if dirty and safe // // 2-Check that non of the local cache lines become safe meanwhile // // 3-Decrease # pending request if required // // 4-If last request arrived. Place it on the cache (if possible) I(pushReq); combWriteEnergy->inc(); PAddr paddr = pushReq->getPAddr(); I(paddr); I(pushReq->getType() == VPushLine); CombineMap::iterator it = cMap.find(calcLine(paddr)); I(it != cMap.end()); VMemPushLineReq *askPushReq = it->second; I(askPushReq->getType() == VAskPushLine); if (pushReq->getStateRef()->isDirty() && pushReq->getVersionRef()->isSafe()) { // This is a simple implementation of the VCR (Version Combine // Register). Real hardware would require a VCR. Combines can not // be done using the wrmask because store bytes can not write the // whole word. As a result, wrmask is a superset of the writing // bytes, not the correct set. I do not model that here because it // would not affect performance, just complexity. // FIXME: add VCR energy if (*(askPushReq->getVersionRef()) < *(pushReq->getVersionRef())) askPushReq->changeVersion(pushReq->getVersionDuplicate()); askPushReq->getState()->combineStateFrom(pushReq->getStateRef()); // why the conbine is done to askPushReq, not the cacheline??? add by hr } // Maybe we left an address on the case (not safe), and now it has // become safe. We should add it to the VCR ulong index = calcIndex4PAddr(paddr); for(ulong i=0; i < cache->getAssoc(); i++) { CacheLine *cl = cache->getPLine(index+i); if (cl->isInvalid()) continue; if (cl->accessLine()) { wrLVIDEnergy->inc(); continue; } if (!cl->isHit(paddr)) continue; #if TS_WRITE if(!cl->isSafe()) continue; #endif askPushReq->getState()->combineStateFrom(cl); cl->invalidate(); wrLVIDEnergy->inc(); } // when the pushReq is caused by the displace() in allocateLine() in FMVCache, // and it will return here. add by hr if (!pushReq->getAskPushReq()) return; I(pushReq->getAskPushReq() == askPushReq); askPushReq->decPendingMsg(); if (askPushReq->hasPendingMsg()) return; // combineEnd cMap.erase(it); #if TS_WRITE writeMemory(paddr); #endif askPushReq->destroy(); }
bool LMVCache::isCombining(PAddr paddr) const { CombineMap::const_iterator it = cMap.find(calcLine(paddr)); return it != cMap.end(); }