2012-04-13 01:08:20 +00:00
|
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2010-01-17 20:10:37 +00:00
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2018-01-02 23:05:06 +00:00
|
|
|
|
// Copyright 2010-2018 by Wilson Snyder. This program is free software; you can
|
2010-01-17 20:10:37 +00:00
|
|
|
|
// redistribute it and/or modify it under the terms of either the GNU
|
|
|
|
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
|
|
|
|
// Version 2.0.
|
|
|
|
|
//
|
|
|
|
|
// Verilator 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.
|
|
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
///
|
|
|
|
|
/// \file
|
|
|
|
|
/// \brief Verilator: String include for all Verilated C files
|
|
|
|
|
///
|
2017-10-10 11:18:01 +00:00
|
|
|
|
/// This file is included automatically by Verilator at the top of
|
|
|
|
|
/// all C++ files it generates. It is used when strings or other
|
|
|
|
|
/// heavyweight types are required; these contents are not part of
|
|
|
|
|
/// verilated.h to save compile time when such types aren't used.
|
2010-01-17 20:10:37 +00:00
|
|
|
|
///
|
|
|
|
|
/// Code available from: http://www.veripool.org/verilator
|
|
|
|
|
///
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
|
|
|
|
|
|
2010-01-24 13:38:17 +00:00
|
|
|
|
#ifndef _VERILATED_HEAVY_H_
|
|
|
|
|
#define _VERILATED_HEAVY_H_ 1 ///< Header Guard
|
2010-01-17 20:10:37 +00:00
|
|
|
|
|
|
|
|
|
#include "verilated.h"
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
//======================================================================
|
2010-01-18 00:13:44 +00:00
|
|
|
|
// Conversion functions
|
2010-01-17 20:10:37 +00:00
|
|
|
|
|
2017-10-27 00:05:42 +00:00
|
|
|
|
extern std::string VL_CVT_PACK_STR_NW(int lwords, WDataInP lwp) VL_MT_SAFE;
|
|
|
|
|
inline std::string VL_CVT_PACK_STR_NQ(QData lhs) VL_PURE {
|
2017-06-06 00:04:09 +00:00
|
|
|
|
WData lw[2]; VL_SET_WQ(lw, lhs);
|
2010-01-17 20:10:37 +00:00
|
|
|
|
return VL_CVT_PACK_STR_NW(2, lw);
|
|
|
|
|
}
|
2017-10-27 00:05:42 +00:00
|
|
|
|
inline std::string VL_CVT_PACK_STR_NN(const std::string& lhs) VL_PURE {
|
2013-08-15 01:37:13 +00:00
|
|
|
|
return lhs;
|
|
|
|
|
}
|
2017-10-27 00:05:42 +00:00
|
|
|
|
inline std::string VL_CVT_PACK_STR_NI(IData lhs) VL_PURE {
|
2017-06-06 00:04:09 +00:00
|
|
|
|
WData lw[1]; lw[0] = lhs;
|
2010-01-17 20:10:37 +00:00
|
|
|
|
return VL_CVT_PACK_STR_NW(1, lw);
|
|
|
|
|
}
|
2017-10-27 00:05:42 +00:00
|
|
|
|
inline std::string VL_CONCATN_NNN(const std::string& lhs, const std::string& rhs) VL_PURE {
|
2014-11-28 20:01:50 +00:00
|
|
|
|
return lhs+rhs;
|
|
|
|
|
}
|
2017-10-27 00:05:42 +00:00
|
|
|
|
inline std::string VL_REPLICATEN_NNQ(int,int,int, const std::string& lhs, IData rep) VL_PURE {
|
2017-09-23 11:32:37 +00:00
|
|
|
|
std::string out; out.reserve(lhs.length() * rep);
|
2017-06-06 00:16:51 +00:00
|
|
|
|
for (unsigned times=0; times<rep; ++times) out += lhs;
|
2014-11-28 20:01:50 +00:00
|
|
|
|
return out;
|
|
|
|
|
}
|
2018-03-10 21:32:04 +00:00
|
|
|
|
inline std::string VL_REPLICATEN_NNI(int obits,int lbits,int rbits,
|
|
|
|
|
const std::string& lhs, IData rep) VL_PURE {
|
2014-11-28 20:01:50 +00:00
|
|
|
|
return VL_REPLICATEN_NNQ(obits,lbits,rbits,lhs,rep);
|
|
|
|
|
}
|
2010-01-17 20:10:37 +00:00
|
|
|
|
|
2017-12-08 00:57:11 +00:00
|
|
|
|
inline IData VL_LEN_IN(const std::string& ld) { return ld.length(); }
|
|
|
|
|
|
2017-10-27 00:05:42 +00:00
|
|
|
|
extern IData VL_FOPEN_NI(const std::string& filename, IData mode) VL_MT_SAFE;
|
2018-03-12 20:44:01 +00:00
|
|
|
|
extern void VL_READMEM_N(bool hex, int width, int depth, int array_lsb,
|
|
|
|
|
const std::string& ofilename,
|
|
|
|
|
void* memp, IData start, IData end) VL_MT_SAFE;
|
|
|
|
|
extern void VL_WRITEMEM_N(bool hex, int width, int depth, int array_lsb,
|
|
|
|
|
const std::string& ofilename,
|
|
|
|
|
const void* memp, IData start, IData end) VL_MT_SAFE;
|
2017-10-27 00:05:42 +00:00
|
|
|
|
extern IData VL_SSCANF_INX(int lbits, const std::string& ld, const char* formatp, ...) VL_MT_SAFE;
|
2018-02-08 00:31:21 +00:00
|
|
|
|
extern void VL_SFORMAT_X(int obits_ignored, std::string& output, const char* formatp, ...) VL_MT_SAFE;
|
2017-10-27 00:05:42 +00:00
|
|
|
|
extern std::string VL_SFORMATF_NX(const char* formatp, ...) VL_MT_SAFE;
|
|
|
|
|
extern IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rdp) VL_MT_SAFE;
|
|
|
|
|
inline IData VL_VALUEPLUSARGS_INI(int rbits, const std::string& ld, IData& rdr) VL_MT_SAFE {
|
2017-07-06 23:01:35 +00:00
|
|
|
|
WData rwp[2]; // WData must always be at least 2
|
2017-05-19 02:41:43 +00:00
|
|
|
|
IData got = VL_VALUEPLUSARGS_INW(rbits,ld,rwp);
|
|
|
|
|
if (got) rdr = rwp[0];
|
|
|
|
|
return got;
|
|
|
|
|
}
|
2017-10-27 00:05:42 +00:00
|
|
|
|
inline IData VL_VALUEPLUSARGS_INQ(int rbits, const std::string& ld, QData& rdr) VL_MT_SAFE {
|
2017-06-06 00:04:09 +00:00
|
|
|
|
WData rwp[2];
|
2017-05-19 02:41:43 +00:00
|
|
|
|
IData got = VL_VALUEPLUSARGS_INW(rbits,ld,rwp);
|
|
|
|
|
if (got) rdr = VL_SET_QW(rwp);
|
|
|
|
|
return got;
|
|
|
|
|
}
|
2017-10-27 00:05:42 +00:00
|
|
|
|
extern IData VL_VALUEPLUSARGS_INN(int, const std::string& ld, std::string& rdr) VL_MT_SAFE;
|
2010-01-18 00:13:44 +00:00
|
|
|
|
|
2010-01-17 20:10:37 +00:00
|
|
|
|
#endif // Guard
|