packet.cc (3607:7b7dd28784c4) | packet.cc (3918:1f9a98d198e8) |
---|---|
1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 22 unchanged lines hidden (view full) --- 31 32/** 33 * @file 34 * Definition of the Packet Class, a packet is a transaction occuring 35 * between a single level of the memory heirarchy (ie L1->L2). 36 */ 37 38#include <iostream> | 1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 22 unchanged lines hidden (view full) --- 31 32/** 33 * @file 34 * Definition of the Packet Class, a packet is a transaction occuring 35 * between a single level of the memory heirarchy (ie L1->L2). 36 */ 37 38#include <iostream> |
39 | 39#include <cstring> |
40#include "base/misc.hh" 41#include "base/trace.hh" 42#include "mem/packet.hh" 43 44static const std::string ReadReqString("ReadReq"); 45static const std::string WriteReqString("WriteReq"); 46static const std::string WriteReqNoAckString("WriteReqNoAck|Writeback"); 47static const std::string ReadRespString("ReadResp"); --- 130 unchanged lines hidden (view full) --- 178 179 // this packet can't solve our problem, continue on 180 if (!timing->hasData()) 181 return true; 182 183 if (func->isRead()) { 184 if (funcStart >= timingStart && funcEnd <= timingEnd) { 185 func->allocate(); | 40#include "base/misc.hh" 41#include "base/trace.hh" 42#include "mem/packet.hh" 43 44static const std::string ReadReqString("ReadReq"); 45static const std::string WriteReqString("WriteReq"); 46static const std::string WriteReqNoAckString("WriteReqNoAck|Writeback"); 47static const std::string ReadRespString("ReadResp"); --- 130 unchanged lines hidden (view full) --- 178 179 // this packet can't solve our problem, continue on 180 if (!timing->hasData()) 181 return true; 182 183 if (func->isRead()) { 184 if (funcStart >= timingStart && funcEnd <= timingEnd) { 185 func->allocate(); |
186 memcpy(func->getPtr | 186 std::memcpy(func->getPtr<uint8_t>(), timing->getPtr<uint8_t>() + |
187 funcStart - timingStart, func->getSize()); 188 func->result = Packet::Success; 189 func->flags |= SATISFIED; 190 return false; 191 } else { 192 // In this case the timing packet only partially satisfies the 193 // requset, so we would need more information to make this work. 194 // Like bytes valid in the packet or something, so the request could 195 // continue and get this bit of possibly newer data along with the 196 // older data not written to yet. 197 panic("Timing packet only partially satisfies the functional" 198 "request. Now what?"); 199 } 200 } else if (func->isWrite()) { 201 if (funcStart >= timingStart) { | 187 funcStart - timingStart, func->getSize()); 188 func->result = Packet::Success; 189 func->flags |= SATISFIED; 190 return false; 191 } else { 192 // In this case the timing packet only partially satisfies the 193 // requset, so we would need more information to make this work. 194 // Like bytes valid in the packet or something, so the request could 195 // continue and get this bit of possibly newer data along with the 196 // older data not written to yet. 197 panic("Timing packet only partially satisfies the functional" 198 "request. Now what?"); 199 } 200 } else if (func->isWrite()) { 201 if (funcStart >= timingStart) { |
202 memcpy(timing->getPtr | 202 std::memcpy(timing->getPtr<uint8_t>() + (funcStart - timingStart), |
203 func->getPtr<uint8_t>(), 204 (std::min(funcEnd, timingEnd) - funcStart) + 1); 205 } else { // timingStart > funcStart | 203 func->getPtr<uint8_t>(), 204 (std::min(funcEnd, timingEnd) - funcStart) + 1); 205 } else { // timingStart > funcStart |
206 memcpy(timing->getPtr | 206 std::memcpy(timing->getPtr<uint8_t>(), |
207 func->getPtr<uint8_t>() + (timingStart - funcStart), 208 (std::min(funcEnd, timingEnd) - timingStart) + 1); 209 } 210 // we always want to keep going with a write 211 return true; 212 } else 213 panic("Don't know how to handle command type %#x\n", 214 func->cmdToIndex()); --- 43 unchanged lines hidden --- | 207 func->getPtr<uint8_t>() + (timingStart - funcStart), 208 (std::min(funcEnd, timingEnd) - timingStart) + 1); 209 } 210 // we always want to keep going with a write 211 return true; 212 } else 213 panic("Don't know how to handle command type %#x\n", 214 func->cmdToIndex()); --- 43 unchanged lines hidden --- |