2012-04-12 21:08:20 -04:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2007-11-30 22:38:21 +00:00
|
|
|
//*************************************************************************
|
|
|
|
|
// DESCRIPTION: Verilator: Emit C++ for tree
|
|
|
|
|
//
|
2019-11-07 22:33:59 -05:00
|
|
|
// Code available from: https://verilator.org
|
2007-11-30 22:38:21 +00:00
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2022-01-01 08:26:40 -05:00
|
|
|
// Copyright 2003-2022 by Wilson Snyder. This program is free software; you
|
2020-03-21 11:24:24 -04:00
|
|
|
// can redistribute it and/or modify it under the terms of either the GNU
|
2009-05-04 17:07:57 -04:00
|
|
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
|
// Version 2.0.
|
2020-03-21 11:24:24 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2007-11-30 22:38:21 +00:00
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
2019-10-04 20:17:11 -04:00
|
|
|
|
2007-11-30 22:38:21 +00:00
|
|
|
#include "config_build.h"
|
|
|
|
|
#include "verilatedos.h"
|
|
|
|
|
|
|
|
|
|
#include "V3Global.h"
|
|
|
|
|
#include "V3EmitC.h"
|
|
|
|
|
#include "V3EmitCBase.h"
|
|
|
|
|
#include "V3Stats.h"
|
|
|
|
|
|
2018-10-14 13:43:24 -04:00
|
|
|
#include <map>
|
|
|
|
|
|
2007-11-30 22:38:21 +00:00
|
|
|
//######################################################################
|
|
|
|
|
|
2020-11-18 21:32:16 -05:00
|
|
|
class EmitCInlines final : EmitCBaseVisitor {
|
2007-11-30 22:38:21 +00:00
|
|
|
// STATE
|
|
|
|
|
|
|
|
|
|
// METHODS
|
|
|
|
|
|
|
|
|
|
// VISITORS
|
2020-08-15 10:03:34 -04:00
|
|
|
virtual void visit(AstCNew* nodep) override {
|
2020-06-09 19:20:16 -04:00
|
|
|
if (v3Global.opt.savable())
|
|
|
|
|
v3warn(E_UNSUPPORTED, "Unsupported: --savable with dynamic new");
|
2019-02-15 18:33:52 -05:00
|
|
|
iterateChildren(nodep);
|
|
|
|
|
}
|
2020-08-15 10:03:34 -04:00
|
|
|
virtual void visit(AstDumpCtl* nodep) override {
|
2020-03-01 21:39:23 -05:00
|
|
|
if (v3Global.opt.trace()) v3Global.needTraceDumper(true);
|
2020-05-14 23:03:00 +01:00
|
|
|
iterateChildren(nodep);
|
2019-12-09 19:17:52 -05:00
|
|
|
}
|
2007-11-30 22:38:21 +00:00
|
|
|
|
|
|
|
|
//---------------------------------------
|
2021-07-07 17:56:34 -04:00
|
|
|
virtual void visit(AstNode* nodep) override { iterateChildren(nodep); }
|
2020-04-04 08:31:14 -04:00
|
|
|
|
2007-11-30 22:38:21 +00:00
|
|
|
public:
|
2020-05-16 07:53:27 -04:00
|
|
|
explicit EmitCInlines(AstNetlist* nodep) { iterate(nodep); }
|
2007-11-30 22:38:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//######################################################################
|
|
|
|
|
// EmitC class functions
|
|
|
|
|
|
|
|
|
|
void V3EmitC::emitcInlines() {
|
2020-04-04 20:08:58 -04:00
|
|
|
UINFO(2, __FUNCTION__ << ": " << endl);
|
|
|
|
|
EmitCInlines(v3Global.rootp());
|
2007-11-30 22:38:21 +00:00
|
|
|
}
|