packet.hh revision 2381
12SN/A/*
211071SN/A * Copyright (c) 2003 The Regents of The University of Michigan
311071SN/A * All rights reserved.
411071SN/A *
511071SN/A * Redistribution and use in source and binary forms, with or without
611071SN/A * modification, are permitted provided that the following conditions are
711071SN/A * met: redistributions of source code must retain the above copyright
811071SN/A * notice, this list of conditions and the following disclaimer;
911071SN/A * redistributions in binary form must reproduce the above copyright
1011071SN/A * notice, this list of conditions and the following disclaimer in the
1111071SN/A * documentation and/or other materials provided with the distribution;
1211071SN/A * neither the name of the copyright holders nor the names of its
1311071SN/A * contributors may be used to endorse or promote products derived from
141762SN/A * this software without specific prior written permission.
152SN/A *
162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272SN/A */
282SN/A
292SN/A/**
302SN/A * @file
312SN/A * Declaration of the Packet Class, a packet is a transaction occuring
322SN/A * between a single level of the memory heirarchy (ie L1->L2).
332SN/A */
342SN/A
352SN/A#ifndef __MEM_PACKET_HH__
362SN/A#define __MEM_PACKET_HH__
372SN/A
382SN/A/**
392665SN/A * A Packet is the structure to handle requests between two levels
402665SN/A * of the memory system.  The Request is a global object that trancends
412665SN/A * all of the memory heirarchy, but at each levels interface a packet
422SN/A * is created to transfer data/requests.  For example, a request would
432SN/A * be used to initiate a request to go to memory/IOdevices, as the request
442SN/A * passes through the memory system several packets will be created.  One
452SN/A * will be created to go between the L1 and L2 caches and another to go to
462SN/A * the next level and so forth.
472SN/A *
4811263Sandreas.sandberg@arm.com * Packets are assumed to be returned in the case of a single response.  If
4911263Sandreas.sandberg@arm.com * the transaction has no response, then the consumer will delete the packet.
50146SN/A */
512SN/Astruct Packet
522SN/A{
532SN/A    /** The address of the request, could be virtual or physical (depending on
542SN/A        cache configurations). */
551954SN/A    Addr addr;
56146SN/A
578232SN/A    /** Flag structure to hold flags for this particular packet */
588232SN/A    uint64_t flags;
5911263Sandreas.sandberg@arm.com
6011263Sandreas.sandberg@arm.com    /** A pointer to the overall request. */
6111263Sandreas.sandberg@arm.com    RequestPtr req;
624762SN/A
638229SN/A    /** A virtual base opaque structure used to hold
641078SN/A        coherence status messages. */
651078SN/A    Coherence *coherence;  // virtual base opaque,
662SN/A                           // assert(dynamic_cast<Foo>) etc.
672SN/A
682SN/A    /** A virtual base opaque structure used to hold the senders state. */
694981SN/A    SenderState *senderState; // virtual base opaque,
704981SN/A                           // assert(dynamic_cast<Foo>) etc.
712SN/A
725034SN/A    /** A pointer to the data being transfered.  It can be differnt sizes
735034SN/A        at each level of the heirarchy so it belongs in the packet,
745034SN/A        not request*/
755034SN/A    PacketDataPtr data;
762SN/A
774981SN/A    /** Indicates the size of the request. */
784981SN/A    int size;
794981SN/A
802SN/A    /** A index of the source of the transaction. */
812SN/A    short src;
822SN/A
832SN/A    /** A index to the destination of the transaction. */
841435SN/A    short dest;
851435SN/A
862SN/A    /** The command of the transaction. */
871435SN/A    Command cmd;
881435SN/A
892SN/A    /** The result of the packet transaction. */
902SN/A    PacketResult result;
914981SN/A
924981SN/A    /** Accessor function that returns the source index of the packet. */
934981SN/A    short getSrc() const { return src; }
944981SN/A
954981SN/A    /** Accessor function that returns the destination index of
964981SN/A        the packet. */
974981SN/A    short getDest() const { return dest; }
984981SN/A};
994981SN/A
1004981SN/A#endif //__MEM_PACKET_HH
1014981SN/A