2012-11-14 01:12:23 +00:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
|
|
|
//*************************************************************************
|
|
|
|
// DESCRIPTION: Verilator: Language code class
|
|
|
|
//
|
2019-11-08 03:33:59 +00:00
|
|
|
// Code available from: https://verilator.org
|
2012-11-14 01:12:23 +00:00
|
|
|
//
|
|
|
|
//*************************************************************************
|
|
|
|
//
|
2019-01-04 00:17:22 +00:00
|
|
|
// Copyright 2003-2019 by Wilson Snyder. This program is free software; you can
|
2012-11-14 01:12:23 +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.
|
|
|
|
//
|
|
|
|
//*************************************************************************
|
2019-10-05 00:17:11 +00:00
|
|
|
|
2012-11-14 01:12:23 +00:00
|
|
|
#ifndef _V3LANGCODE_H_
|
|
|
|
#define _V3LANGCODE_H_ 1
|
|
|
|
|
|
|
|
#include "config_build.h"
|
|
|
|
#include "verilatedos.h"
|
2018-10-14 15:10:11 +00:00
|
|
|
|
2012-11-14 01:12:23 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
//######################################################################
|
|
|
|
//! Class for the different languages supported.
|
|
|
|
//! A separate file, since used both in V3Options (globally) and FileLine 9per
|
|
|
|
//! file).
|
|
|
|
class V3LangCode {
|
|
|
|
public:
|
|
|
|
enum en {
|
2019-05-19 20:13:13 +00:00
|
|
|
L_ERROR, // Must be first.
|
|
|
|
L1364_1995,
|
|
|
|
L1364_2001,
|
|
|
|
L1364_2005,
|
|
|
|
L1800_2005,
|
|
|
|
L1800_2009,
|
|
|
|
L1800_2012,
|
|
|
|
L1800_2017,
|
|
|
|
// ***Add new elements below also***
|
|
|
|
_ENUM_END
|
2012-11-14 01:12:23 +00:00
|
|
|
};
|
|
|
|
const char* ascii() const {
|
2019-05-19 20:13:13 +00:00
|
|
|
const char* const names[] = {
|
|
|
|
// These must match the `begin_keywords values.
|
|
|
|
" ERROR",
|
|
|
|
"1364-1995",
|
|
|
|
"1364-2001",
|
|
|
|
"1364-2005",
|
|
|
|
"1800-2005",
|
|
|
|
"1800-2009",
|
|
|
|
"1800-2012",
|
|
|
|
"1800-2017"
|
|
|
|
};
|
|
|
|
return names[m_e];
|
2012-11-14 01:12:23 +00:00
|
|
|
};
|
2018-03-13 02:26:34 +00:00
|
|
|
static V3LangCode mostRecent() { return V3LangCode(L1800_2017); }
|
|
|
|
bool systemVerilog() const { return m_e == L1800_2005 || m_e == L1800_2009
|
2019-05-19 20:13:13 +00:00
|
|
|
|| m_e == L1800_2012 || m_e == L1800_2017; }
|
2012-11-14 01:12:23 +00:00
|
|
|
bool legal() const { return m_e != L_ERROR; }
|
|
|
|
//
|
|
|
|
enum en m_e;
|
2018-08-25 13:52:45 +00:00
|
|
|
inline V3LangCode() : m_e(L_ERROR) {}
|
2015-10-04 02:33:06 +00:00
|
|
|
// cppcheck-suppress noExplicitConstructor
|
2018-08-25 13:52:45 +00:00
|
|
|
inline V3LangCode(en _e) : m_e(_e) {}
|
|
|
|
explicit V3LangCode(const char* textp);
|
|
|
|
explicit inline V3LangCode(int _e) : m_e(static_cast<en>(_e)) {}
|
|
|
|
operator en() const { return m_e; }
|
2012-11-14 01:12:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//######################################################################
|
|
|
|
|
2019-05-19 20:13:13 +00:00
|
|
|
#endif // guard
|