Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / api / memsync / src / MemorySyncMessage.cc
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T2 Processor File: MemorySyncMessage.cc
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License version 2 as published by the Free Software Foundation.
//
// The above named program is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this work; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
// ========== Copyright Header End ============================================
/************************************************************************
**
** Copyright (C) 2002, Sun Microsystems, Inc.
**
** Sun considers its source code as an unpublished, proprietary
** trade secret and it is available only under strict license provisions.
** This copyright notice is placed here only to protect Sun in the event
** the source is deemed a published work. Disassembly, decompilation,
** or other means of reducing the object code to human readable form
** is prohibited by the license agreement under which this code is
** provided to the user or company in possession of this copy."
**
*************************************************************************/
#include "MemorySyncMessage.h"
#include <sstream>
#include <unistd.h>
#include "MemorySync.h"
using namespace std;
////////////////////////////////////////////////
uint64_t MemorySyncMessage::rtlCycle = 0;
int MemorySyncMessage::debugLevel = 0;
int MemorySyncMessage::skipCallback = 0;
// static function
string
MemorySyncMessage::dumpBuffers()
{
return MemorySync::dumpBuffers();
}
MemorySyncMessage::MemorySyncMessage()
{
// Replace the following line with your function body.
}
////////////////////////////////////////////////
MemorySyncMessage::MemorySyncMessage( const MemorySyncMessage & orig )
{
// Replace the following line with your function body.
}
////////////////////////////////////////////////
MemorySyncMessage::~MemorySyncMessage()
{
// Replace the following line with your function body.
}
////////////////////////////////////////////////
const MemorySyncMessage &
MemorySyncMessage::operator=( const MemorySyncMessage & rhs )
{
// Replace the following line with your function body.
return *this;
}
////////////////////////////////////////////////
bool
MemorySyncMessage::operator==( const MemorySyncMessage & rhs ) const
{
// Replace the following line with your function body.
return false;
}
////////////////////////////////////////////////
string
MemorySyncMessage::toString() const
{
ostringstream os;
// Replace the following line with your function body.
return os.str();
}
void
MemorySyncMessage::error (const char *fmt, ...) {
char format[500];
va_list args;
va_start(args, fmt);
sprintf(format, "\n@%lld MSync ERROR: %s\n",
rtlCycle, fmt);
vfprintf(stdout, format, args);
fflush(stdout);
// write the error message to RTL testbench, so that it can show in
// the right place in sims.log and vcs.log
sprintf(format, "\nMSync-info> @%lld MSYNC ERROR: %s\n",
rtlCycle, fmt);
if (MemorySync::msyncObj->socket)
{
MemorySync::msyncObj->socket->write_err(format, args);
// if pli-socket condition is bad, we should not process pli commands any further
MemorySync::msyncObj->socket->pli_stop();
}
va_end(args);
}
void
MemorySyncMessage::debug (uint level, const char *fmt, ...)
{
char format[500];
va_list args;
if (debugLevel < level)
return;
va_start(args, fmt);
sprintf(format, "@%lld MSync: %s\n",
rtlCycle, fmt);
vfprintf(stdout, format, args);
va_end(args);
}
void
MemorySyncMessage::warning (const char *fmt, ...) {
char format[500];
va_list args;
va_start(args, fmt);
sprintf(format, "\n@%lld MSync WARNING: %s\n",
rtlCycle, fmt);
vfprintf(stdout, format, args);
// write the warning message to RTL testbench, so that it can show in
// the right place in sims.log and vcs.log
sprintf(format, "\nMSync-info> @%lld MSYNC WARNING: %s\n",
rtlCycle, fmt);
if (MemorySync::msyncObj->socket)
{
MemorySync::msyncObj->socket->write_err(format, args);
}
va_end(args);
}