2012-04-13 01:08:20 +00:00
|
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//*************************************************************************
|
|
|
|
|
// DESCRIPTION: Verilator: Propagate constants across AST
|
|
|
|
|
//
|
2008-04-25 12:14:27 +00:00
|
|
|
|
// Code available from: http://www.veripool.org/verilator
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2019-01-04 00:17:22 +00:00
|
|
|
|
// Copyright 2003-2019 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 _V3CONST_H_
|
|
|
|
|
#define _V3CONST_H_ 1
|
2018-10-14 17:43:24 +00:00
|
|
|
|
|
2006-12-18 19:20:45 +00:00
|
|
|
|
#include "config_build.h"
|
|
|
|
|
#include "verilatedos.h"
|
2018-10-14 17:43:24 +00:00
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
|
#include "V3Error.h"
|
|
|
|
|
#include "V3Ast.h"
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
|
|
class V3Const {
|
|
|
|
|
public:
|
2009-10-15 00:13:04 +00:00
|
|
|
|
static AstNode* constifyParamsEdit(AstNode* nodep);
|
2012-04-20 02:53:52 +00:00
|
|
|
|
static AstNode* constifyGenerateParamsEdit(AstNode* nodep);
|
2010-12-29 02:23:16 +00:00
|
|
|
|
// Only do constant pushing, without removing dead logic
|
|
|
|
|
static void constifyAllLive(AstNetlist* nodep);
|
2006-08-26 11:35:28 +00:00
|
|
|
|
// Everything that's possible
|
|
|
|
|
static void constifyAll(AstNetlist* nodep);
|
|
|
|
|
// Also, warn
|
2006-10-05 00:45:39 +00:00
|
|
|
|
static void constifyAllLint(AstNetlist* nodep);
|
2006-08-26 11:35:28 +00:00
|
|
|
|
// C++ datatypes
|
2006-10-05 00:45:39 +00:00
|
|
|
|
static void constifyCpp(AstNetlist* nodep);
|
2006-08-26 11:35:28 +00:00
|
|
|
|
// Only the current node and lower
|
2009-10-15 00:13:04 +00:00
|
|
|
|
// Return new node that may have replaced nodep
|
|
|
|
|
static AstNode* constifyEdit(AstNode* nodep);
|
2009-01-07 14:37:59 +00:00
|
|
|
|
// Only the current node and lower, with special SenTree optimization
|
2009-10-15 00:13:04 +00:00
|
|
|
|
// Return new node that may have replaced nodep
|
|
|
|
|
static AstNode* constifyExpensiveEdit(AstNode* nodep);
|
2006-08-26 11:35:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2019-05-19 20:13:13 +00:00
|
|
|
|
#endif // Guard
|