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
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2026-01-26 20:24:34 -05:00
|
|
|
// This program is free software; you can 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.
|
|
|
|
|
// SPDX-FileCopyrightText: 2003-2026 Wilson Snyder
|
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
|
|
|
|
2023-10-18 06:37:46 -04:00
|
|
|
#include "V3PchAstMT.h"
|
|
|
|
|
|
2007-11-30 22:38:21 +00:00
|
|
|
#include "V3EmitC.h"
|
|
|
|
|
#include "V3EmitCBase.h"
|
|
|
|
|
#include "V3Stats.h"
|
|
|
|
|
|
2018-10-14 13:43:24 -04:00
|
|
|
#include <map>
|
|
|
|
|
|
2022-09-18 20:53:42 +01:00
|
|
|
VL_DEFINE_DEBUG_FUNCTIONS;
|
|
|
|
|
|
2007-11-30 22:38:21 +00:00
|
|
|
//######################################################################
|
|
|
|
|
|
2023-03-18 12:17:25 -04:00
|
|
|
class EmitCInlines final : EmitCBaseVisitorConst {
|
2007-11-30 22:38:21 +00:00
|
|
|
// STATE
|
|
|
|
|
|
|
|
|
|
// METHODS
|
|
|
|
|
|
|
|
|
|
// VISITORS
|
2022-09-16 11:22:11 +01:00
|
|
|
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");
|
2023-03-18 12:17:25 -04:00
|
|
|
iterateChildrenConst(nodep);
|
2019-02-15 18:33:52 -05:00
|
|
|
}
|
2022-09-16 11:22:11 +01:00
|
|
|
void visit(AstDumpCtl* nodep) override {
|
2020-03-01 21:39:23 -05:00
|
|
|
if (v3Global.opt.trace()) v3Global.needTraceDumper(true);
|
2023-03-18 12:17:25 -04:00
|
|
|
iterateChildrenConst(nodep);
|
2019-12-09 19:17:52 -05:00
|
|
|
}
|
2022-12-04 17:30:51 -05:00
|
|
|
void visit(AstNodeDistBiop* nodep) override {
|
|
|
|
|
v3Global.setUsesProbDist();
|
2023-03-18 12:17:25 -04:00
|
|
|
iterateChildrenConst(nodep);
|
2022-12-04 17:30:51 -05:00
|
|
|
}
|
|
|
|
|
void visit(AstNodeDistTriop* nodep) override {
|
|
|
|
|
v3Global.setUsesProbDist();
|
2023-03-18 12:17:25 -04:00
|
|
|
iterateChildrenConst(nodep);
|
2022-12-04 17:30:51 -05:00
|
|
|
}
|
2007-11-30 22:38:21 +00:00
|
|
|
|
|
|
|
|
//---------------------------------------
|
2023-03-18 12:17:25 -04:00
|
|
|
void visit(AstNode* nodep) override { iterateChildrenConst(nodep); }
|
2020-04-04 08:31:14 -04:00
|
|
|
|
2007-11-30 22:38:21 +00:00
|
|
|
public:
|
2023-03-18 12:17:25 -04:00
|
|
|
explicit EmitCInlines(AstNetlist* nodep) { iterateConst(nodep); }
|
2007-11-30 22:38:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//######################################################################
|
|
|
|
|
// EmitC class functions
|
|
|
|
|
|
|
|
|
|
void V3EmitC::emitcInlines() {
|
2025-05-22 20:29:32 -04:00
|
|
|
UINFO(2, __FUNCTION__ << ":");
|
2023-03-18 19:28:48 -04:00
|
|
|
{ EmitCInlines{v3Global.rootp()}; }
|
2007-11-30 22:38:21 +00:00
|
|
|
}
|