// Fault fault = xc->read(memReq,data);
// Not sure what to check for no fault...
if (data_read_pkt->result == Success) {
- data = data_read_pkt->get<T>();
- memcpy(&data, data_read_pkt->data, sizeof(T));
- data = gtoh(data);
++ data = gtoh(data_read_pkt->get<T>());
}
if (traceData) {
// Need to find a way to not duplicate code above.
if (data_read_pkt->result == Success) {
- data = data_read_pkt->get<T>();
- memcpy(&data, data_read_pkt->data, sizeof(T));
- data = gtoh(data);
++ data = gtoh(data_read_pkt->get<T>());
}
if (traceData) {
data_write_pkt = new Packet;
data_write_pkt->cmd = Write;
data_write_pkt->req = data_write_req;
- data_write_pkt->data = new uint8_t[64];
+ T hostData = htog(data);
- memcpy(data_write_pkt->data, &hostData, sizeof(T));
+ data_write_pkt->allocate();
- data_write_pkt->set(data);
++ data_write_pkt->set(hostData);
#else
data_write_pkt->reset();
- data_write_pkt->data = (uint8_t *)&data;
+ data = htog(data);
+ data_write_pkt->dataStatic(&data);
#endif
data_write_pkt->addr = data_write_req->getPaddr();
data_write_pkt->size = sizeof(T);