mirror of
https://github.com/verilator/verilator.git
synced 2024-12-28 18:27:34 +00:00
Internals: Standardize on template<typename
. No functional change.
This commit is contained in:
parent
f631587a20
commit
990ccd6763
@ -100,7 +100,7 @@ class VerilatedFstC;
|
||||
class VerilatedFstSc;
|
||||
class VerilatedScope;
|
||||
class VerilatedScopeNameMap;
|
||||
template <class, class>
|
||||
template <typename, typename>
|
||||
class VerilatedTrace;
|
||||
class VerilatedTraceBaseC;
|
||||
class VerilatedTraceConfig;
|
||||
@ -300,7 +300,7 @@ public:
|
||||
|
||||
private:
|
||||
// The following are for use by Verilator internals only
|
||||
template <class, class>
|
||||
template <typename, typename>
|
||||
friend class VerilatedTrace;
|
||||
// Run-time trace configuration requested by this model
|
||||
virtual std::unique_ptr<VerilatedTraceConfig> traceConfig() const;
|
||||
|
@ -71,7 +71,7 @@ public: // But only local to this file
|
||||
// This isn't in the header file for auto-magic conversion because it
|
||||
// inlines to too much code and makes compilation too slow.
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class VerilatedCoverItemSpec final : public VerilatedCovImpItem {
|
||||
private:
|
||||
// MEMBERS
|
||||
|
@ -300,7 +300,7 @@ inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, std::string& r
|
||||
VerilatedSerialize& operator<<(VerilatedSerialize& os, VerilatedContext* rhsp);
|
||||
VerilatedDeserialize& operator>>(VerilatedDeserialize& os, VerilatedContext* rhsp);
|
||||
|
||||
template <class T_Key, class T_Value>
|
||||
template <typename T_Key, typename T_Value>
|
||||
VerilatedSerialize& operator<<(VerilatedSerialize& os, VlAssocArray<T_Key, T_Value>& rhs) {
|
||||
os << rhs.atDefault();
|
||||
const uint32_t len = rhs.size();
|
||||
@ -312,7 +312,7 @@ VerilatedSerialize& operator<<(VerilatedSerialize& os, VlAssocArray<T_Key, T_Val
|
||||
}
|
||||
return os;
|
||||
}
|
||||
template <class T_Key, class T_Value>
|
||||
template <typename T_Key, typename T_Value>
|
||||
VerilatedDeserialize& operator>>(VerilatedDeserialize& os, VlAssocArray<T_Key, T_Value>& rhs) {
|
||||
os >> rhs.atDefault();
|
||||
uint32_t len = 0;
|
||||
|
@ -41,9 +41,9 @@
|
||||
// clang-format on
|
||||
|
||||
class VlThreadPool;
|
||||
template <class T_Buffer>
|
||||
template <typename T_Buffer>
|
||||
class VerilatedTraceBuffer;
|
||||
template <class T_Buffer>
|
||||
template <typename T_Buffer>
|
||||
class VerilatedTraceOffloadBuffer;
|
||||
|
||||
//=============================================================================
|
||||
@ -100,7 +100,7 @@ enum class VerilatedTraceSigType : uint8_t {
|
||||
// Offloaded tracing
|
||||
|
||||
// A simple synchronized first in first out queue
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class VerilatedThreadQueue final { // LCOV_EXCL_LINE // lcov bug
|
||||
private:
|
||||
mutable VerilatedMutex m_mutex; // Protects m_queue
|
||||
@ -202,7 +202,7 @@ public:
|
||||
|
||||
// T_Trace is the format-specific subclass of VerilatedTrace.
|
||||
// T_Buffer is the format-specific base class of VerilatedTraceBuffer.
|
||||
template <class T_Trace, class T_Buffer>
|
||||
template <typename T_Trace, typename T_Buffer>
|
||||
class VerilatedTrace VL_NOT_FINAL {
|
||||
public:
|
||||
using Buffer = VerilatedTraceBuffer<T_Buffer>;
|
||||
@ -442,7 +442,7 @@ public:
|
||||
|
||||
// T_Buffer is the format-specific base class of VerilatedTraceBuffer.
|
||||
// The format-specific hot-path methods use duck-typing via T_Buffer for performance.
|
||||
template <class T_Buffer>
|
||||
template <typename T_Buffer>
|
||||
class VerilatedTraceBuffer VL_NOT_FINAL : public T_Buffer {
|
||||
protected:
|
||||
// Type of the owner trace file
|
||||
@ -543,7 +543,7 @@ public:
|
||||
|
||||
// T_Buffer is the format-specific base class of VerilatedTraceBuffer.
|
||||
// The format-specific hot-path methods use duck-typing via T_Buffer for performance.
|
||||
template <class T_Buffer>
|
||||
template <typename T_Buffer>
|
||||
class VerilatedTraceOffloadBuffer final : public VerilatedTraceBuffer<T_Buffer> {
|
||||
using typename VerilatedTraceBuffer<T_Buffer>::Trace;
|
||||
|
||||
|
@ -309,7 +309,7 @@ public:
|
||||
size_t operator()() { return VL_MASK_I(31) & vl_rand64(); }
|
||||
};
|
||||
|
||||
template <class T_Value, uint64_t T_numValues>
|
||||
template <typename T_Value, uint64_t T_numValues>
|
||||
class VlRandC final {
|
||||
T_Value m_remaining = 0; // Number of values to pull before re-randomize
|
||||
T_Value m_lfsr = 1; // LFSR state
|
||||
@ -477,7 +477,7 @@ std::string VL_TO_STRING(const VlWide<T_Words>& obj) {
|
||||
//
|
||||
// Bound here is the maximum size() allowed, e.g. 1 + SystemVerilog bound
|
||||
// For dynamic arrays it is always zero
|
||||
template <class T_Value, size_t T_MaxSize = 0>
|
||||
template <typename T_Value, size_t T_MaxSize = 0>
|
||||
class VlQueue final {
|
||||
private:
|
||||
// TYPES
|
||||
@ -485,7 +485,7 @@ private:
|
||||
|
||||
public:
|
||||
using const_iterator = typename Deque::const_iterator;
|
||||
template <class Func>
|
||||
template <typename Func>
|
||||
using WithFuncReturnType = decltype(std::declval<Func>()(0, std::declval<T_Value>()));
|
||||
|
||||
private:
|
||||
@ -909,7 +909,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class T_Value, size_t T_MaxSize>
|
||||
template <typename T_Value, size_t T_MaxSize>
|
||||
std::string VL_TO_STRING(const VlQueue<T_Value, T_MaxSize>& obj) {
|
||||
return obj.to_string();
|
||||
}
|
||||
@ -919,7 +919,7 @@ std::string VL_TO_STRING(const VlQueue<T_Value, T_MaxSize>& obj) {
|
||||
// There are no multithreaded locks on this; the base variable must
|
||||
// be protected by other means
|
||||
//
|
||||
template <class T_Key, class T_Value>
|
||||
template <typename T_Key, typename T_Value>
|
||||
class VlAssocArray final {
|
||||
private:
|
||||
// TYPES
|
||||
@ -927,7 +927,7 @@ private:
|
||||
|
||||
public:
|
||||
using const_iterator = typename Map::const_iterator;
|
||||
template <class Func>
|
||||
template <typename Func>
|
||||
using WithFuncReturnType
|
||||
= decltype(std::declval<Func>()(std::declval<T_Key>(), std::declval<T_Value>()));
|
||||
|
||||
@ -1244,12 +1244,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class T_Key, class T_Value>
|
||||
template <typename T_Key, typename T_Value>
|
||||
std::string VL_TO_STRING(const VlAssocArray<T_Key, T_Value>& obj) {
|
||||
return obj.to_string();
|
||||
}
|
||||
|
||||
template <class T_Key, class T_Value>
|
||||
template <typename T_Key, typename T_Value>
|
||||
void VL_READMEM_N(bool hex, int bits, const std::string& filename,
|
||||
VlAssocArray<T_Key, T_Value>& obj, QData start, QData end) VL_MT_SAFE {
|
||||
VlReadMem rmem{hex, bits, filename, start, end};
|
||||
@ -1265,7 +1265,7 @@ void VL_READMEM_N(bool hex, int bits, const std::string& filename,
|
||||
}
|
||||
}
|
||||
|
||||
template <class T_Key, class T_Value>
|
||||
template <typename T_Key, typename T_Value>
|
||||
void VL_WRITEMEM_N(bool hex, int bits, const std::string& filename,
|
||||
const VlAssocArray<T_Key, T_Value>& obj, QData start, QData end) VL_MT_SAFE {
|
||||
VlWriteMem wmem{hex, bits, filename, start, end};
|
||||
@ -1287,9 +1287,8 @@ void VL_WRITEMEM_N(bool hex, int bits, const std::string& filename,
|
||||
/// This class may get exposed to a Verilated Model's top I/O, if the top
|
||||
/// IO has an unpacked array.
|
||||
|
||||
template <class T_Value, std::size_t T_Depth>
|
||||
struct VlUnpacked final {
|
||||
private:
|
||||
template <typename T_Value, std::size_t T_Depth>
|
||||
class VlUnpacked final {
|
||||
// TYPES
|
||||
using T_Key = IData; // Index type, for uniformity with other containers
|
||||
using Unpacked = T_Value[T_Depth];
|
||||
@ -1569,7 +1568,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
template <class T_Value, std::size_t T_Depth>
|
||||
template <typename T_Value, std::size_t T_Depth>
|
||||
std::string VL_TO_STRING(const VlUnpacked<T_Value, T_Depth>& obj) {
|
||||
return obj.to_string();
|
||||
}
|
||||
@ -2027,7 +2026,7 @@ public:
|
||||
#define VL_KEEP_THIS \
|
||||
VlClassRef<std::remove_pointer<decltype(this)>::type> __Vthisref { this }
|
||||
|
||||
template <class T> // T typically of type VlClassRef<x>
|
||||
template <typename T> // T typically of type VlClassRef<x>
|
||||
inline T VL_NULL_CHECK(T t, const char* filename, int linenum) {
|
||||
if (VL_UNLIKELY(!t)) Verilated::nullPointerError(filename, linenum);
|
||||
return t;
|
||||
|
@ -701,7 +701,7 @@ reverse_wrapper<T> reverse_view(const T& v) {
|
||||
// Object that is returned by this function is not considered
|
||||
// as MT_SAFE and any function call on this object still
|
||||
// needs to be `VL_MT_SAFE`.
|
||||
template <class T>
|
||||
template <typename T>
|
||||
T const& as_const(T& v) VL_MT_SAFE {
|
||||
return v;
|
||||
}
|
||||
|
@ -1745,7 +1745,7 @@ public:
|
||||
explicit VNUser(void* p) { m_u.up = p; }
|
||||
~VNUser() = default;
|
||||
// Casters
|
||||
template <class T>
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_pointer<T>::value, T>::type to() const VL_MT_SAFE {
|
||||
return reinterpret_cast<T>(m_u.up);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
template <class T_Node, class T_Data, int T_UserN>
|
||||
template <typename T_Node, typename T_Data, int T_UserN>
|
||||
class AstUserAllocatorBase VL_NOT_FINAL {
|
||||
static_assert(1 <= T_UserN && T_UserN <= 4, "Wrong user pointer number");
|
||||
static_assert(std::is_base_of<AstNode, T_Node>::value, "T_Node must be an AstNode type");
|
||||
@ -107,13 +107,13 @@ public:
|
||||
// User pointer allocator classes. T_Node is the type of node the allocator should be applied to
|
||||
// and is there for a bit of extra type safety. T_Data is the type of the data structure
|
||||
// managed by the allocator.
|
||||
template <class T_Node, class T_Data>
|
||||
template <typename T_Node, typename T_Data>
|
||||
class AstUser1Allocator final : public AstUserAllocatorBase<T_Node, T_Data, 1> {};
|
||||
template <class T_Node, class T_Data>
|
||||
template <typename T_Node, typename T_Data>
|
||||
class AstUser2Allocator final : public AstUserAllocatorBase<T_Node, T_Data, 2> {};
|
||||
template <class T_Node, class T_Data>
|
||||
template <typename T_Node, typename T_Data>
|
||||
class AstUser3Allocator final : public AstUserAllocatorBase<T_Node, T_Data, 3> {};
|
||||
template <class T_Node, class T_Data>
|
||||
template <typename T_Node, typename T_Data>
|
||||
class AstUser4Allocator final : public AstUserAllocatorBase<T_Node, T_Data, 4> {};
|
||||
|
||||
#endif // Guard
|
||||
|
@ -57,7 +57,7 @@ static bool isConst(const AstNode* nodep, uint64_t v) {
|
||||
return constp && constp->toUQuad() == v;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
static typename std::enable_if<std::is_integral<T>::value, bool>::type isPow2(T val) {
|
||||
return (val & (val - 1)) == 0;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
// Algorithms - common class
|
||||
// For internal use, most graph algorithms use this as a base class
|
||||
|
||||
template <class T_Graph = V3Graph> // Or sometimes const V3Graph
|
||||
template <typename T_Graph = V3Graph> // Or sometimes const V3Graph
|
||||
class GraphAlg VL_NOT_FINAL {
|
||||
protected:
|
||||
T_Graph* const m_graphp; // Graph we're operating upon
|
||||
|
@ -40,7 +40,7 @@
|
||||
// not generally safe. If you want a raw pointer compare, see
|
||||
// GraphStreamUnordered below.
|
||||
|
||||
template <class T_Compare>
|
||||
template <typename T_Compare>
|
||||
class GraphStream final {
|
||||
// TYPES
|
||||
class VxHolder final {
|
||||
|
@ -57,13 +57,13 @@ public:
|
||||
bool operator<(const V3Hash& rh) const { return m_value < rh.m_value; }
|
||||
|
||||
// '+' combines hashes
|
||||
template <class T>
|
||||
template <typename T>
|
||||
V3Hash operator+(T that) const {
|
||||
return V3Hash{combine(m_value, V3Hash{that}.m_value)};
|
||||
}
|
||||
|
||||
// '+=' combines in place
|
||||
template <class T>
|
||||
template <typename T>
|
||||
V3Hash& operator+=(T that) {
|
||||
return *this = *this + that;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ struct V3OptionParser::Impl final {
|
||||
class ActionCbCall; // Callback without argument for "-opt"
|
||||
class ActionCbFOnOff; // Callback for "-fopt" and "-fno-opt"
|
||||
class ActionCbOnOff; // Callback for "-opt" and "-no-opt"
|
||||
template <class T>
|
||||
template <typename T>
|
||||
class ActionCbVal; // Callback for "-opt val"
|
||||
class ActionCbPartialMatch; // Callback "-O3" for "-O"
|
||||
class ActionCbPartialMatchVal; // Callback "-debugi-V3Options 3" for "-debugi-"
|
||||
@ -171,7 +171,7 @@ V3OptionParser::ActionIfs* V3OptionParser::find(const char* optp) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class ACT, class ARG>
|
||||
template <typename ACT, typename ARG>
|
||||
V3OptionParser::ActionIfs& V3OptionParser::add(const std::string& opt, ARG arg) {
|
||||
UASSERT(!m_pimpl->m_isFinalized, "Cannot add after finalize() is called");
|
||||
std::unique_ptr<ACT> act{new ACT{std::move(arg)}};
|
||||
|
@ -65,7 +65,7 @@ private:
|
||||
|
||||
// METHODS
|
||||
ActionIfs* find(const char* optp) VL_MT_DISABLED;
|
||||
template <class ACT, class ARG>
|
||||
template <typename ACT, typename ARG>
|
||||
ActionIfs& add(const string& opt, ARG arg) VL_MT_DISABLED;
|
||||
// Returns true if strp starts with "-fno"
|
||||
static bool hasPrefixFNo(const char* strp) VL_MT_DISABLED;
|
||||
|
@ -186,7 +186,7 @@ struct SplitVarImpl VL_NOT_FINAL {
|
||||
|
||||
static const char* cannotSplitPackedVarReason(const AstVar* varp);
|
||||
|
||||
template <class T_ALWAYSLIKE>
|
||||
template <typename T_ALWAYSLIKE>
|
||||
void insertBeginCore(T_ALWAYSLIKE* ap, AstNodeStmt* stmtp, AstNodeModule* modp) {
|
||||
if (ap->isJustOneBodyStmt() && ap->stmtsp() == stmtp) {
|
||||
stmtp->unlinkFrBack();
|
||||
|
@ -22,7 +22,7 @@
|
||||
namespace vlstd {
|
||||
|
||||
// constexpr std::max with arguments passed by value (required by constexpr before C++14)
|
||||
template <class T>
|
||||
template <typename T>
|
||||
constexpr T max(T a, T b) {
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
@ -33,20 +33,20 @@
|
||||
//######################################################################
|
||||
// Global string-related functions
|
||||
|
||||
template <class T>
|
||||
template <typename T>
|
||||
std::string cvtToStr(const T& t) VL_PURE {
|
||||
std::ostringstream os;
|
||||
os << t;
|
||||
return os.str();
|
||||
}
|
||||
template <class T>
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_pointer<T>::value, std::string>::type
|
||||
cvtToHex(const T tp) VL_PURE {
|
||||
std::ostringstream os;
|
||||
os << static_cast<const void*>(tp);
|
||||
return os.str();
|
||||
}
|
||||
template <class T>
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_integral<T>::value, std::string>::type cvtToHex(const T t) {
|
||||
std::ostringstream os;
|
||||
os << std::hex << std::setw(sizeof(T) * 8 / 4) << std::setfill('0') << t;
|
||||
|
Loading…
Reference in New Issue
Block a user