2008-06-10 01:25:10 +00:00
|
|
|
|
// -*- C++ -*-
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//*************************************************************************
|
|
|
|
|
// DESCRIPTION: Verilator: Language rules
|
|
|
|
|
//
|
2008-04-25 12:14:27 +00:00
|
|
|
|
// Code available from: http://www.veripool.org/verilator
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//
|
|
|
|
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
|
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2011-01-01 23:21:19 +00:00
|
|
|
|
// Copyright 2005-2011 by Wilson Snyder. This program is free software; you can
|
2006-08-26 11:35:28 +00:00
|
|
|
|
// redistribute it and/or modify it under the terms of either the GNU
|
2009-05-04 21:07:57 +00:00
|
|
|
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
|
// Version 2.0.
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//
|
|
|
|
|
// 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.
|
|
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
|
|
|
|
|
#ifndef _V3LANGUAGEWORDS_H_
|
|
|
|
|
#define _V3LANGUAGEWORDS_H_ 1
|
2006-12-18 19:20:45 +00:00
|
|
|
|
#include "config_build.h"
|
|
|
|
|
#include "verilatedos.h"
|
2006-08-26 11:35:28 +00:00
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
|
|
class V3LanguageWords {
|
|
|
|
|
// List of common reserved keywords
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
map<string,string> m_kwdMap; // List of keywords, and what language applies
|
|
|
|
|
|
|
|
|
|
void addKwd(const string& kwd, const string& why) {
|
|
|
|
|
m_kwdMap.insert(make_pair(kwd,why));
|
|
|
|
|
}
|
|
|
|
|
public:
|
|
|
|
|
string isKeyword(const string& kwd) {
|
|
|
|
|
map<string,string>::iterator iter = m_kwdMap.find(kwd);
|
|
|
|
|
if (iter == m_kwdMap.end()) return "";
|
|
|
|
|
return iter->second;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
V3LanguageWords() {
|
|
|
|
|
// C++ keywords
|
|
|
|
|
addKwd("asm", "C++ reserved word");
|
|
|
|
|
addKwd("auto", "C++ reserved word");
|
|
|
|
|
addKwd("catch", "C++ reserved word");
|
|
|
|
|
addKwd("cdecl", "C++ reserved word");
|
|
|
|
|
addKwd("char", "C++ reserved word");
|
|
|
|
|
addKwd("const_cast", "C++ reserved word");
|
|
|
|
|
addKwd("delete", "C++ reserved word");
|
|
|
|
|
addKwd("double", "C++ reserved word");
|
|
|
|
|
addKwd("dynamic_cast", "C++ reserved word");
|
|
|
|
|
addKwd("explicit", "C++ reserved word");
|
|
|
|
|
addKwd("far", "C++ reserved word");
|
|
|
|
|
addKwd("float", "C++ reserved word");
|
|
|
|
|
addKwd("friend", "C++ reserved word");
|
|
|
|
|
addKwd("goto", "C++ reserved word");
|
|
|
|
|
addKwd("huge", "C++ reserved word");
|
|
|
|
|
addKwd("inline", "C++ reserved word");
|
|
|
|
|
addKwd("interrupt", "C++ reserved word");
|
|
|
|
|
addKwd("long", "C++ reserved word");
|
|
|
|
|
addKwd("mutable", "C++ reserved word");
|
|
|
|
|
addKwd("near", "C++ reserved word");
|
|
|
|
|
addKwd("operator", "C++ reserved word");
|
|
|
|
|
addKwd("pascal", "C++ reserved word");
|
|
|
|
|
addKwd("private", "C++ reserved word");
|
|
|
|
|
addKwd("public", "C++ reserved word");
|
|
|
|
|
addKwd("register", "C++ reserved word");
|
|
|
|
|
addKwd("reinterpret_cast ", "C++ reserved word");
|
|
|
|
|
addKwd("restrict", "C++ reserved word");
|
|
|
|
|
addKwd("short", "C++ reserved word");
|
|
|
|
|
addKwd("sizeof", "C++ reserved word");
|
|
|
|
|
addKwd("static_cast", "C++ reserved word");
|
|
|
|
|
addKwd("switch", "C++ reserved word");
|
|
|
|
|
addKwd("template", "C++ reserved word");
|
|
|
|
|
addKwd("throw", "C++ reserved word");
|
|
|
|
|
addKwd("try", "C++ reserved word");
|
|
|
|
|
addKwd("typeid", "C++ reserved word");
|
|
|
|
|
addKwd("typename", "C++ reserved word");
|
|
|
|
|
addKwd("unsigned", "C++ reserved word");
|
|
|
|
|
addKwd("using", "C++ reserved word");
|
|
|
|
|
addKwd("volatile", "C++ reserved word");
|
|
|
|
|
// C++
|
|
|
|
|
addKwd("NULL", "C++ common word");
|
|
|
|
|
addKwd("abort", "C++ common word");
|
|
|
|
|
addKwd("bit_vector", "C++ common word");
|
|
|
|
|
addKwd("bool", "C++ common word");
|
|
|
|
|
addKwd("complex", "C++ common word");
|
|
|
|
|
addKwd("const_iterator", "C++ common word");
|
|
|
|
|
addKwd("const_reference ", "C++ common word");
|
|
|
|
|
addKwd("deque", "C++ common word");
|
|
|
|
|
addKwd("false", "C++ common word");
|
|
|
|
|
addKwd("iterator", "C++ common word");
|
|
|
|
|
addKwd("list", "C++ common word");
|
|
|
|
|
addKwd("map", "C++ common word");
|
|
|
|
|
addKwd("multimap", "C++ common word");
|
|
|
|
|
addKwd("multiset", "C++ common word");
|
|
|
|
|
addKwd("queue", "C++ common word");
|
|
|
|
|
addKwd("reference", "C++ common word");
|
|
|
|
|
addKwd("set", "C++ common word");
|
|
|
|
|
addKwd("stack", "C++ common word");
|
|
|
|
|
addKwd("true", "C++ common word");
|
|
|
|
|
addKwd("type_info", "C++ common word");
|
|
|
|
|
addKwd("uint16_t", "C++ common word");
|
|
|
|
|
addKwd("uint32_t", "C++ common word");
|
|
|
|
|
addKwd("uint8_t", "C++ common word");
|
|
|
|
|
addKwd("vector", "C++ common word");
|
|
|
|
|
// SystemC
|
|
|
|
|
addKwd("sc_clock", "SystemC common word");
|
|
|
|
|
addKwd("sc_in", "SystemC common word");
|
|
|
|
|
addKwd("sc_inout", "SystemC common word");
|
|
|
|
|
addKwd("sc_out", "SystemC common word");
|
|
|
|
|
addKwd("sc_signal", "SystemC common word");
|
2008-12-03 15:11:28 +00:00
|
|
|
|
addKwd("sensitive", "SystemC common word");
|
2006-08-26 11:35:28 +00:00
|
|
|
|
addKwd("sensitive_neg", "SystemC common word");
|
|
|
|
|
addKwd("sensitive_pos", "SystemC common word");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // Guard
|
|
|
|
|
|
|
|
|
|
|