OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [include/] [RspPacket.h] - Diff between revs 63 and 462

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 63 Rev 462
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
 
// RSP packet: definition
// RSP packet: definition
 
 
// Copyright (C) 2008  Embecosm Limited <info@embecosm.com>
// Copyright (C) 2008  Embecosm Limited <info@embecosm.com>
 
 
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
 
 
// This file is part of the cycle accurate model of the OpenRISC 1000 based
// This file is part of the cycle accurate model of the OpenRISC 1000 based
// system-on-chip, ORPSoC, built using Verilator.
// system-on-chip, ORPSoC, built using Verilator.
 
 
// This program is free software: you can redistribute it and/or modify it
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or (at your
// the Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
// option) any later version.
 
 
// This program is distributed in the hope that it will be useful, but WITHOUT
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
// License for more details.
// License for more details.
 
 
// You should have received a copy of the GNU Lesser General Public License
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
 
// $Id: RspPacket.h 326 2009-03-07 16:47:31Z jeremy $
// $Id: RspPacket.h 326 2009-03-07 16:47:31Z jeremy $
 
 
#ifndef RSP_PACKET__H
#ifndef RSP_PACKET__H
#define RSP_PACKET__H
#define RSP_PACKET__H
 
 
#include <iostream>
#include <iostream>
 
 
 
 
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//! Class for RSP packets
//! Class for RSP packets
 
 
//! Can't be null terminated, since it may include zero bytes
//! Can't be null terminated, since it may include zero bytes
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class RspPacket
class RspPacket {
{
 
public:
public:
 
 
  //! The data buffer. Allow direct access to avoid unnecessary copying.
        //! The data buffer. Allow direct access to avoid unnecessary copying.
  char *data;
        char *data;
 
 
  // Constructor and destructor
        // Constructor and destructor
  RspPacket (int  _bufSize);
         RspPacket(int _bufSize);
  ~RspPacket ();
        ~RspPacket();
 
 
  // Pack a constant string into a packet
        // Pack a constant string into a packet
  void  packStr (const char *str);      // For fixed packets
        void packStr(const char *str);  // For fixed packets
 
 
  // Accessors
        // Accessors
  int   getBufSize ();
        int getBufSize();
  int   getLen ();
        int getLen();
  void  setLen (int  _len);
        void setLen(int _len);
 
 
 
 
private:
private:
 
 
  //! The data buffer size
        //! The data buffer size
  int   bufSize;
        int bufSize;
 
 
  //! Number of chars in the data buffer (<= bufSize)
        //! Number of chars in the data buffer (<= bufSize)
  int   len;
        int len;
 
 
};
};
 
 
 
 
//! Stream output
//! Stream output
std::ostream &operator<< (std::ostream &s,
std::ostream & operator<<(std::ostream & s, RspPacket & p);
                          RspPacket    &p);
 
 
 
 
 
#endif  // RSP_PACKET_SC__H
#endif // RSP_PACKET_SC__H
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.