2008-06-10 01:25:10 +00:00
|
|
|
|
// -*- C++ -*-
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//*************************************************************************
|
|
|
|
|
// DESCRIPTION: Verilator: Common headers
|
|
|
|
|
//
|
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
|
|
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2010-01-06 02:15:06 +00:00
|
|
|
|
// Copyright 2003-2010 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 _V3GLOBAL_H_
|
|
|
|
|
#define _V3GLOBAL_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 <string>
|
|
|
|
|
|
|
|
|
|
#include "V3Error.h"
|
|
|
|
|
#include "V3Options.h"
|
|
|
|
|
#include "V3Ast.h"
|
|
|
|
|
|
|
|
|
|
//======================================================================
|
|
|
|
|
// Statics
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//######################################################################
|
|
|
|
|
// V3 - The top level class for the entire program
|
|
|
|
|
|
|
|
|
|
class V3Global {
|
|
|
|
|
// Globals
|
|
|
|
|
AstNetlist* m_rootp; // Root of entire netlist
|
|
|
|
|
int m_debugFileNumber; // Number to append to debug files created
|
|
|
|
|
bool m_assertWidthsSame; // Tree should have width()==widthMin()
|
2009-12-03 11:55:29 +00:00
|
|
|
|
bool m_needHInlines; // Need __Inlines file
|
2010-01-17 20:10:37 +00:00
|
|
|
|
bool m_needHeavy; // Need verilatedheavy.h include
|
2009-12-03 11:55:29 +00:00
|
|
|
|
bool m_dpi; // Need __Dpi include files
|
2007-11-30 22:38:21 +00:00
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
|
public:
|
2007-11-30 22:38:21 +00:00
|
|
|
|
// Options
|
2006-08-26 11:35:28 +00:00
|
|
|
|
V3Options opt; // All options; let user see them directly
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// CREATORS
|
|
|
|
|
V3Global() {
|
|
|
|
|
m_rootp = new AstNetlist;
|
|
|
|
|
m_debugFileNumber = 0;
|
|
|
|
|
m_assertWidthsSame = false;
|
2007-11-30 22:38:21 +00:00
|
|
|
|
m_needHInlines = false;
|
2010-01-17 20:10:37 +00:00
|
|
|
|
m_needHeavy = false;
|
2009-12-03 11:55:29 +00:00
|
|
|
|
m_dpi = false;
|
2006-08-26 11:35:28 +00:00
|
|
|
|
}
|
|
|
|
|
void clear() {
|
|
|
|
|
if (m_rootp) m_rootp->deleteTree(); m_rootp=NULL;
|
|
|
|
|
}
|
|
|
|
|
// ACCESSORS (general)
|
|
|
|
|
AstNetlist* rootp() const { return m_rootp; }
|
|
|
|
|
bool assertWidthsSame() const { return m_assertWidthsSame; }
|
|
|
|
|
|
|
|
|
|
// METHODS
|
|
|
|
|
void readFiles();
|
|
|
|
|
void checkTree() { rootp()->checkTree(); }
|
|
|
|
|
void assertWidthsSame(bool flag) { m_assertWidthsSame = flag; }
|
|
|
|
|
string debugFilename(const string& nameComment, int newNumber=0) {
|
|
|
|
|
++m_debugFileNumber;
|
|
|
|
|
if (newNumber) m_debugFileNumber = newNumber;
|
|
|
|
|
char digits[100]; sprintf(digits, "%02d", m_debugFileNumber);
|
|
|
|
|
return opt.makeDir()+"/"+opt.prefix()+"_"+digits+"_"+nameComment;
|
|
|
|
|
}
|
2007-11-30 22:38:21 +00:00
|
|
|
|
bool needHInlines() const { return m_needHInlines; }
|
|
|
|
|
void needHInlines(bool flag) { m_needHInlines=flag; }
|
2010-01-17 20:10:37 +00:00
|
|
|
|
bool needHeavy() const { return m_needHeavy; }
|
|
|
|
|
void needHeavy(bool flag) { m_needHeavy=flag; }
|
2009-12-03 11:55:29 +00:00
|
|
|
|
bool dpi() const { return m_dpi; }
|
|
|
|
|
void dpi(bool flag) { m_dpi = flag; }
|
2006-08-26 11:35:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern V3Global v3Global;
|
|
|
|
|
|
|
|
|
|
//######################################################################
|
|
|
|
|
|
|
|
|
|
#endif // guard
|
|
|
|
|
|