Remove "using namespace std" from compiler header files and fix the fallout.

(cherry picked from commit ecbbb60fb6)
This commit is contained in:
Martin Whitaker 2021-11-04 16:12:04 +00:00
parent 9ac6154068
commit 52b099feae
121 changed files with 958 additions and 841 deletions

View File

@ -1,7 +1,7 @@
#ifndef IVL_AStatement_H #ifndef IVL_AStatement_H
#define IVL_AStatement_H #define IVL_AStatement_H
/* /*
* Copyright (c) 2008-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -42,7 +42,7 @@ class AContrib : public Statement {
AContrib(PExpr*lval, PExpr*rval); AContrib(PExpr*lval, PExpr*rval);
~AContrib(); ~AContrib();
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
private: private:
@ -68,10 +68,10 @@ class AProcess : public LineInfo {
ivl_process_type_t type() const { return type_; } ivl_process_type_t type() const { return type_; }
Statement*statement() { return statement_; } Statement*statement() { return statement_; }
map<perm_string,PExpr*> attributes; std::map<perm_string,PExpr*> attributes;
// Dump the analog process // Dump the analog process
void dump(ostream&out, unsigned ind) const; void dump(std::ostream&out, unsigned ind) const;
private: private:
ivl_process_type_t type_; ivl_process_type_t type_;

10
HName.h
View File

@ -1,7 +1,7 @@
#ifndef IVL_HName_H #ifndef IVL_HName_H
#define IVL_HName_H #define IVL_HName_H
/* /*
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -36,7 +36,7 @@
class hname_t { class hname_t {
friend ostream& operator<< (ostream&out, const hname_t&that); friend std::ostream& operator<< (std::ostream&out, const hname_t&that);
public: public:
hname_t (); hname_t ();
@ -92,14 +92,14 @@ inline size_t hname_t::has_numbers() const
return number_.size(); return number_.size();
} }
extern ostream& operator<< (ostream&, const hname_t&); extern std::ostream& operator<< (std::ostream&, const hname_t&);
inline bool operator != (const hname_t&l, const hname_t&r) inline bool operator != (const hname_t&l, const hname_t&r)
{ return ! (l == r); } { return ! (l == r); }
inline ostream& operator<< (ostream&out, const list<hname_t>&ll) inline std::ostream& operator<< (std::ostream&out, const std::list<hname_t>&ll)
{ {
list<hname_t>::const_iterator cur = ll.begin(); std::list<hname_t>::const_iterator cur = ll.begin();
out << *cur; out << *cur;
++ cur; ++ cur;
while (cur != ll.end()) { while (cur != ll.end()) {

View File

@ -24,6 +24,8 @@
# include "PWire.h" # include "PWire.h"
# include <cassert> # include <cassert>
using namespace std;
list<Module::named_expr_t> Module::user_defparms; list<Module::named_expr_t> Module::user_defparms;
/* n is a permallocated string. */ /* n is a permallocated string. */

View File

@ -64,7 +64,7 @@ class Module : public PScopeExtra, public PNamedItem {
public: public:
struct port_t { struct port_t {
perm_string name; perm_string name;
vector<PEIdent*> expr; std::vector<PEIdent*> expr;
}; };
public: public:
@ -97,15 +97,15 @@ class Module : public PScopeExtra, public PNamedItem {
/* specparams are simpler than other parameters, in that they /* specparams are simpler than other parameters, in that they
can have a range, but not an explicit type. The restrictions can have a range, but not an explicit type. The restrictions
are enforced by the parser. */ are enforced by the parser. */
map<perm_string,param_expr_t*>specparams; std::map<perm_string,param_expr_t*>specparams;
/* The module also has defparam assignments which don't create /* The module also has defparam assignments which don't create
new parameters within the module, but may be used to set new parameters within the module, but may be used to set
values within this module (when instantiated) or in other values within this module (when instantiated) or in other
instantiated modules. */ instantiated modules. */
typedef pair<pform_name_t,PExpr*> named_expr_t; typedef std::pair<pform_name_t,PExpr*> named_expr_t;
list<named_expr_t>defparms; std::list<named_expr_t>defparms;
static list<named_expr_t>user_defparms; static std::list<named_expr_t>user_defparms;
/* Parameters may be overridden at instantiation time; /* Parameters may be overridden at instantiation time;
the overrides do not contain explicit parameter names, the overrides do not contain explicit parameter names,
@ -113,17 +113,17 @@ class Module : public PScopeExtra, public PNamedItem {
appear in the instantiated module. Therefore a appear in the instantiated module. Therefore a
list of names in module-order is needed to pass from list of names in module-order is needed to pass from
a parameter-index to its name. */ a parameter-index to its name. */
list<perm_string> param_names; std::list<perm_string> param_names;
/* This is an array of port descriptors, which is in turn a /* This is an array of port descriptors, which is in turn a
named array of PEident pointers. */ named array of PEident pointers. */
vector<port_t*> ports; std::vector<port_t*> ports;
map<perm_string,PExpr*> attributes; std::map<perm_string,PExpr*> attributes;
/* The module has a list of generate schemes that appear in /* The module has a list of generate schemes that appear in
the module definition. These are used at elaboration time. */ the module definition. These are used at elaboration time. */
list<PGenerate*> generate_schemes; std::list<PGenerate*> generate_schemes;
/* Nested modules are placed here, and are not elaborated /* Nested modules are placed here, and are not elaborated
unless they are instantiated, implicitly or explicitly. */ unless they are instantiated, implicitly or explicitly. */
@ -132,9 +132,9 @@ class Module : public PScopeExtra, public PNamedItem {
/* An interface can contain one or more named modport lists. /* An interface can contain one or more named modport lists.
The parser will ensure these don't appear in modules or The parser will ensure these don't appear in modules or
program blocks. */ program blocks. */
map<perm_string,PModport*> modports; std::map<perm_string,PModport*> modports;
list<PSpecPath*> specify_paths; std::list<PSpecPath*> specify_paths;
// The mod_name() is the name of the module type. // The mod_name() is the name of the module type.
perm_string mod_name() const { return pscope_name(); } perm_string mod_name() const { return pscope_name(); }
@ -142,7 +142,7 @@ class Module : public PScopeExtra, public PNamedItem {
void add_gate(PGate*gate); void add_gate(PGate*gate);
unsigned port_count() const; unsigned port_count() const;
const vector<PEIdent*>& get_port(unsigned idx) const; const std::vector<PEIdent*>& get_port(unsigned idx) const;
unsigned find_port(const char*name) const; unsigned find_port(const char*name) const;
// Return port name ("" for undeclared port) // Return port name ("" for undeclared port)
@ -150,12 +150,12 @@ class Module : public PScopeExtra, public PNamedItem {
PGate* get_gate(perm_string name); PGate* get_gate(perm_string name);
const list<PGate*>& get_gates() const; const std::list<PGate*>& get_gates() const;
void dump(ostream&out) const; void dump(std::ostream&out) const;
bool elaborate(Design*, NetScope*scope) const; bool elaborate(Design*, NetScope*scope) const;
typedef map<perm_string,PExpr*> replace_t; typedef std::map<perm_string,PExpr*> replace_t;
bool elaborate_scope(Design*, NetScope*scope, const replace_t&rep); bool elaborate_scope(Design*, NetScope*scope, const replace_t&rep);
bool elaborate_sig(Design*, NetScope*scope) const; bool elaborate_sig(Design*, NetScope*scope) const;
@ -163,8 +163,8 @@ class Module : public PScopeExtra, public PNamedItem {
SymbolType symbol_type() const; SymbolType symbol_type() const;
private: private:
void dump_specparams_(ostream&out, unsigned indent) const; void dump_specparams_(std::ostream&out, unsigned indent) const;
list<PGate*> gates_; std::list<PGate*> gates_;
private: // Not implemented private: // Not implemented
Module(const Module&); Module(const Module&);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2017 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -26,6 +26,8 @@
# include "verinum.h" # include "verinum.h"
# include "netmisc.h" # include "netmisc.h"
using namespace std;
PDelays::PDelays() PDelays::PDelays()
{ {
delete_flag_ = true; delete_flag_ = true;

View File

@ -1,7 +1,7 @@
#ifndef IVL_PDelays_H #ifndef IVL_PDelays_H
#define IVL_PDelays_H #define IVL_PDelays_H
/* /*
* Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -24,12 +24,6 @@
# include <list> # include <list>
# include <iostream> # include <iostream>
#ifdef __GNUC__
#if __GNUC__ > 2
using namespace std;
#endif
#endif
class Design; class Design;
class NetScope; class NetScope;
class NetExpr; class NetExpr;
@ -49,7 +43,7 @@ class PDelays {
this object takes ownership of the expressions, and will this object takes ownership of the expressions, and will
delete it in the destructor. */ delete it in the destructor. */
void set_delay(PExpr*); void set_delay(PExpr*);
void set_delays(const list<PExpr*>*del, bool delete_flag=true); void set_delays(const std::list<PExpr*>*del, bool delete_flag=true);
unsigned delay_count() const; unsigned delay_count() const;
@ -59,7 +53,7 @@ class PDelays {
NetExpr*&decay_time, NetExpr*&decay_time,
bool as_nets_flag =false) const; bool as_nets_flag =false) const;
void dump_delays(ostream&out) const; void dump_delays(std::ostream&out) const;
private: private:
PExpr* delay_[3]; PExpr* delay_[3];
@ -70,6 +64,6 @@ class PDelays {
PDelays& operator= (const PDelays&); PDelays& operator= (const PDelays&);
}; };
ostream& operator << (ostream&o, const PDelays&); std::ostream& operator << (std::ostream&o, const PDelays&);
#endif /* IVL_PDelays_H */ #endif /* IVL_PDelays_H */

View File

@ -30,6 +30,8 @@
# include "util.h" # include "util.h"
# include <typeinfo> # include <typeinfo>
using namespace std;
PExpr::PExpr() PExpr::PExpr()
{ {
expr_type_ = IVL_VT_NO_TYPE; expr_type_ = IVL_VT_NO_TYPE;

52
PExpr.h
View File

@ -60,7 +60,7 @@ class PExpr : public LineInfo {
PExpr(); PExpr();
virtual ~PExpr(); virtual ~PExpr();
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
// This method tests whether the expression contains any identifiers // This method tests whether the expression contains any identifiers
// that have not been previously declared in the specified scope or // that have not been previously declared in the specified scope or
@ -202,7 +202,7 @@ class PExpr : public LineInfo {
PExpr& operator= (const PExpr&); PExpr& operator= (const PExpr&);
}; };
ostream& operator << (ostream&, const PExpr&); std::ostream& operator << (std::ostream&, const PExpr&);
class PEAssignPattern : public PExpr { class PEAssignPattern : public PExpr {
public: public:
@ -230,11 +230,11 @@ class PEAssignPattern : public PExpr {
class PEConcat : public PExpr { class PEConcat : public PExpr {
public: public:
PEConcat(const list<PExpr*>&p, PExpr*r =0); explicit PEConcat(const std::list<PExpr*>&p, PExpr*r =0);
~PEConcat(); ~PEConcat();
virtual verinum* eval_const(Design*des, NetScope*sc) const; virtual verinum* eval_const(Design*des, NetScope*sc) const;
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type); virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type);
@ -261,7 +261,7 @@ class PEConcat : public PExpr {
NetNet* elaborate_lnet_common_(Design*des, NetScope*scope, NetNet* elaborate_lnet_common_(Design*des, NetScope*scope,
bool bidirectional_flag) const; bool bidirectional_flag) const;
private: private:
vector<PExpr*>parms_; std::vector<PExpr*>parms_;
std::valarray<width_mode_t>width_modes_; std::valarray<width_mode_t>width_modes_;
PExpr*repeat_; PExpr*repeat_;
@ -289,7 +289,7 @@ class PEEvent : public PExpr {
edge_t type() const; edge_t type() const;
PExpr* expr() const; PExpr* expr() const;
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
virtual bool has_aa_term(Design*des, NetScope*scope) const; virtual bool has_aa_term(Design*des, NetScope*scope) const;
@ -322,7 +322,7 @@ class PEFNumber : public PExpr {
unsigned expr_wid, unsigned expr_wid,
unsigned flags) const; unsigned flags) const;
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
private: private:
verireal*value_; verireal*value_;
@ -340,7 +340,7 @@ class PEIdent : public PExpr {
// current identifier. // current identifier.
void append_name(perm_string); void append_name(perm_string);
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type); virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type);
@ -540,7 +540,7 @@ class PENewArray : public PExpr {
explicit PENewArray (PExpr*s, PExpr*i); explicit PENewArray (PExpr*s, PExpr*i);
~PENewArray(); ~PENewArray();
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
virtual unsigned test_width(Design*des, NetScope*scope, virtual unsigned test_width(Design*des, NetScope*scope,
width_mode_t&mode); width_mode_t&mode);
virtual NetExpr*elaborate_expr(Design*des, NetScope*scope, virtual NetExpr*elaborate_expr(Design*des, NetScope*scope,
@ -564,7 +564,7 @@ class PENewClass : public PExpr {
~PENewClass(); ~PENewClass();
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
// Class objects don't have a useful width, but the expression // Class objects don't have a useful width, but the expression
// is IVL_VT_CLASS. // is IVL_VT_CLASS.
virtual unsigned test_width(Design*des, NetScope*scope, virtual unsigned test_width(Design*des, NetScope*scope,
@ -589,7 +589,7 @@ class PENewCopy : public PExpr {
explicit PENewCopy(PExpr*src); explicit PENewCopy(PExpr*src);
~PENewCopy(); ~PENewCopy();
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
// Class objects don't have a useful width, but the expression // Class objects don't have a useful width, but the expression
// is IVL_VT_CLASS. // is IVL_VT_CLASS.
virtual unsigned test_width(Design*des, NetScope*scope, virtual unsigned test_width(Design*des, NetScope*scope,
@ -609,7 +609,7 @@ class PENull : public PExpr {
explicit PENull(); explicit PENull();
~PENull(); ~PENull();
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
virtual unsigned test_width(Design*des, NetScope*scope, virtual unsigned test_width(Design*des, NetScope*scope,
width_mode_t&mode); width_mode_t&mode);
virtual NetExpr*elaborate_expr(Design*des, NetScope*scope, virtual NetExpr*elaborate_expr(Design*des, NetScope*scope,
@ -627,7 +627,7 @@ class PENumber : public PExpr {
const verinum& value() const; const verinum& value() const;
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
virtual unsigned test_width(Design*des, NetScope*scope, virtual unsigned test_width(Design*des, NetScope*scope,
width_mode_t&mode); width_mode_t&mode);
@ -661,8 +661,8 @@ class PEString : public PExpr {
explicit PEString(char*s); explicit PEString(char*s);
~PEString(); ~PEString();
string value() const; std::string value() const;
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
virtual unsigned test_width(Design*des, NetScope*scope, virtual unsigned test_width(Design*des, NetScope*scope,
width_mode_t&mode); width_mode_t&mode);
@ -683,7 +683,7 @@ class PETypename : public PExpr {
explicit PETypename(data_type_t*data_type); explicit PETypename(data_type_t*data_type);
~PETypename(); ~PETypename();
virtual void dump(ostream&) const; virtual void dump(std::ostream&) const;
virtual unsigned test_width(Design*des, NetScope*scope, virtual unsigned test_width(Design*des, NetScope*scope,
width_mode_t&mode); width_mode_t&mode);
virtual NetExpr*elaborate_expr(Design*des, NetScope*scope, virtual NetExpr*elaborate_expr(Design*des, NetScope*scope,
@ -701,7 +701,7 @@ class PEUnary : public PExpr {
explicit PEUnary(char op, PExpr*ex); explicit PEUnary(char op, PExpr*ex);
~PEUnary(); ~PEUnary();
virtual void dump(ostream&out) const; virtual void dump(std::ostream&out) const;
virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type); virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type);
@ -733,7 +733,7 @@ class PEBinary : public PExpr {
explicit PEBinary(char op, PExpr*l, PExpr*r); explicit PEBinary(char op, PExpr*l, PExpr*r);
~PEBinary(); ~PEBinary();
virtual void dump(ostream&out) const; virtual void dump(std::ostream&out) const;
virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type); virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type);
@ -858,7 +858,7 @@ class PETernary : public PExpr {
explicit PETernary(PExpr*e, PExpr*t, PExpr*f); explicit PETernary(PExpr*e, PExpr*t, PExpr*f);
~PETernary(); ~PETernary();
virtual void dump(ostream&out) const; virtual void dump(std::ostream&out) const;
virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type); virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type);
@ -890,7 +890,7 @@ class PETernary : public PExpr {
*/ */
class PECallFunction : public PExpr { class PECallFunction : public PExpr {
public: public:
explicit PECallFunction(const pform_name_t&n, const vector<PExpr *> &parms); explicit PECallFunction(const pform_name_t&n, const std::vector<PExpr *> &parms);
// Call function defined in package. // Call function defined in package.
explicit PECallFunction(PPackage*pkg, perm_string n, const std::vector<PExpr *> &parms); explicit PECallFunction(PPackage*pkg, perm_string n, const std::vector<PExpr *> &parms);
explicit PECallFunction(PPackage*pkg, perm_string n, const std::list<PExpr *> &parms); explicit PECallFunction(PPackage*pkg, perm_string n, const std::list<PExpr *> &parms);
@ -899,16 +899,16 @@ class PECallFunction : public PExpr {
explicit PECallFunction(PPackage*pkg, const pform_name_t&n, const std::vector<PExpr *> &parms); explicit PECallFunction(PPackage*pkg, const pform_name_t&n, const std::vector<PExpr *> &parms);
// Call of system function (name is not hierarchical) // Call of system function (name is not hierarchical)
explicit PECallFunction(perm_string n, const vector<PExpr *> &parms); explicit PECallFunction(perm_string n, const std::vector<PExpr *> &parms);
explicit PECallFunction(perm_string n); explicit PECallFunction(perm_string n);
// std::list versions. Should be removed! // std::list versions. Should be removed!
explicit PECallFunction(const pform_name_t&n, const list<PExpr *> &parms); explicit PECallFunction(const pform_name_t&n, const std::list<PExpr *> &parms);
explicit PECallFunction(perm_string n, const list<PExpr *> &parms); explicit PECallFunction(perm_string n, const std::list<PExpr *> &parms);
~PECallFunction(); ~PECallFunction();
virtual void dump(ostream &) const; virtual void dump(std::ostream &) const;
virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type); virtual void declare_implicit_nets(LexicalScope*scope, NetNet::Type type);
@ -975,7 +975,7 @@ class PECastSize : public PExpr {
explicit PECastSize(PExpr*size, PExpr*base); explicit PECastSize(PExpr*size, PExpr*base);
~PECastSize(); ~PECastSize();
void dump(ostream &out) const; void dump(std::ostream &out) const;
virtual NetExpr*elaborate_expr(Design*des, NetScope*scope, virtual NetExpr*elaborate_expr(Design*des, NetScope*scope,
unsigned expr_wid, unsigned expr_wid,
@ -998,7 +998,7 @@ class PECastType : public PExpr {
explicit PECastType(data_type_t*target, PExpr*base); explicit PECastType(data_type_t*target, PExpr*base);
~PECastType(); ~PECastType();
void dump(ostream &out) const; void dump(std::ostream &out) const;
virtual NetExpr*elaborate_expr(Design*des, NetScope*scope, virtual NetExpr*elaborate_expr(Design*des, NetScope*scope,
ivl_type_t type, unsigned flags) const; ivl_type_t type, unsigned flags) const;

View File

@ -23,6 +23,8 @@
# include <cassert> # include <cassert>
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
PFunction::PFunction(perm_string name, LexicalScope*parent, bool is_auto__) PFunction::PFunction(perm_string name, LexicalScope*parent, bool is_auto__)
: PTaskFunc(name, parent), statement_(0) : PTaskFunc(name, parent), statement_(0)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -24,6 +24,8 @@
# include "verinum.h" # include "verinum.h"
# include <cassert> # include <cassert>
using namespace std;
void PGate::set_pins_(list<PExpr*>*pins) void PGate::set_pins_(list<PExpr*>*pins)
{ {
assert(pins); assert(pins);

48
PGate.h
View File

@ -1,7 +1,7 @@
#ifndef IVL_PGate_H #ifndef IVL_PGate_H
#define IVL_PGate_H #define IVL_PGate_H
/* /*
* Copyright (c) 1998-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -50,13 +50,13 @@ class Module;
class PGate : public PNamedItem { class PGate : public PNamedItem {
public: public:
explicit PGate(perm_string name, list<PExpr*>*pins, explicit PGate(perm_string name, std::list<PExpr*>*pins,
const list<PExpr*>*del); const std::list<PExpr*>*del);
explicit PGate(perm_string name, list<PExpr*>*pins, explicit PGate(perm_string name, std::list<PExpr*>*pins,
PExpr*del); PExpr*del);
explicit PGate(perm_string name, list<PExpr*>*pins); explicit PGate(perm_string name, std::list<PExpr*>*pins);
virtual ~PGate(); virtual ~PGate();
@ -81,9 +81,9 @@ class PGate : public PNamedItem {
void strength0(ivl_drive_t); void strength0(ivl_drive_t);
void strength1(ivl_drive_t); void strength1(ivl_drive_t);
map<perm_string,PExpr*> attributes; std::map<perm_string,PExpr*> attributes;
virtual void dump(ostream&out, unsigned ind =4) const; virtual void dump(std::ostream&out, unsigned ind =4) const;
virtual void elaborate(Design*des, NetScope*scope) const; virtual void elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*sc) const; virtual void elaborate_scope(Design*des, NetScope*sc) const;
virtual bool elaborate_sig(Design*des, NetScope*scope) const; virtual bool elaborate_sig(Design*des, NetScope*scope) const;
@ -91,19 +91,19 @@ class PGate : public PNamedItem {
SymbolType symbol_type() const; SymbolType symbol_type() const;
protected: protected:
const vector<PExpr*>& get_pins() const { return pins_; } const std::vector<PExpr*>& get_pins() const { return pins_; }
void dump_pins(ostream&out) const; void dump_pins(std::ostream&out) const;
void dump_delays(ostream&out) const; void dump_delays(std::ostream&out) const;
private: private:
perm_string name_; perm_string name_;
PDelays delay_; PDelays delay_;
vector<PExpr*>pins_; std::vector<PExpr*>pins_;
ivl_drive_t str0_, str1_; ivl_drive_t str0_, str1_;
void set_pins_(list<PExpr*>*pins); void set_pins_(std::list<PExpr*>*pins);
private: // not implemented private: // not implemented
PGate(const PGate&); PGate(const PGate&);
@ -117,11 +117,11 @@ class PGate : public PNamedItem {
class PGAssign : public PGate { class PGAssign : public PGate {
public: public:
explicit PGAssign(list<PExpr*>*pins); explicit PGAssign(std::list<PExpr*>*pins);
explicit PGAssign(list<PExpr*>*pins, list<PExpr*>*dels); explicit PGAssign(std::list<PExpr*>*pins, std::list<PExpr*>*dels);
~PGAssign(); ~PGAssign();
void dump(ostream&out, unsigned ind =4) const; void dump(std::ostream&out, unsigned ind =4) const;
virtual void elaborate(Design*des, NetScope*scope) const; virtual void elaborate(Design*des, NetScope*scope) const;
virtual bool elaborate_sig(Design*des, NetScope*scope) const; virtual bool elaborate_sig(Design*des, NetScope*scope) const;
@ -150,10 +150,10 @@ class PGBuiltin : public PGate {
public: public:
explicit PGBuiltin(Type t, perm_string name, explicit PGBuiltin(Type t, perm_string name,
list<PExpr*>*pins, std::list<PExpr*>*pins,
list<PExpr*>*del); std::list<PExpr*>*del);
explicit PGBuiltin(Type t, perm_string name, explicit PGBuiltin(Type t, perm_string name,
list<PExpr*>*pins, std::list<PExpr*>*pins,
PExpr*del); PExpr*del);
~PGBuiltin(); ~PGBuiltin();
@ -161,7 +161,7 @@ class PGBuiltin : public PGate {
const char * gate_name() const; const char * gate_name() const;
void set_range(PExpr*msb, PExpr*lsb); void set_range(PExpr*msb, PExpr*lsb);
virtual void dump(ostream&out, unsigned ind =4) const; virtual void dump(std::ostream&out, unsigned ind =4) const;
virtual void elaborate(Design*, NetScope*scope) const; virtual void elaborate(Design*, NetScope*scope) const;
virtual bool elaborate_sig(Design*des, NetScope*scope) const; virtual bool elaborate_sig(Design*des, NetScope*scope) const;
@ -197,7 +197,7 @@ class PGModule : public PGate {
// If the binding of ports is by position, this constructor // If the binding of ports is by position, this constructor
// builds everything all at once. // builds everything all at once.
explicit PGModule(perm_string type, perm_string name, explicit PGModule(perm_string type, perm_string name,
list<PExpr*>*pins); std::list<PExpr*>*pins);
// If the binding of ports is by name, this constructor takes // If the binding of ports is by name, this constructor takes
// the bindings and stores them for later elaboration. // the bindings and stores them for later elaboration.
@ -212,16 +212,16 @@ class PGModule : public PGate {
// Parameter overrides can come as an ordered list, or a set // Parameter overrides can come as an ordered list, or a set
// of named expressions. // of named expressions.
void set_parameters(list<PExpr*>*o); void set_parameters(std::list<PExpr*>*o);
void set_parameters(named<PExpr*>*pa, unsigned npa); void set_parameters(named<PExpr*>*pa, unsigned npa);
// Modules can be instantiated in ranges. The parser uses this // Modules can be instantiated in ranges. The parser uses this
// method to pass the range to the pform. // method to pass the range to the pform.
void set_range(PExpr*msb, PExpr*lsb); void set_range(PExpr*msb, PExpr*lsb);
map<perm_string,PExpr*> attributes; std::map<perm_string,PExpr*> attributes;
virtual void dump(ostream&out, unsigned ind =4) const; virtual void dump(std::ostream&out, unsigned ind =4) const;
virtual void elaborate(Design*, NetScope*scope) const; virtual void elaborate(Design*, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*sc) const; virtual void elaborate_scope(Design*des, NetScope*sc) const;
virtual bool elaborate_sig(Design*des, NetScope*scope) const; virtual bool elaborate_sig(Design*des, NetScope*scope) const;
@ -233,7 +233,7 @@ class PGModule : public PGate {
private: private:
Module*bound_type_; Module*bound_type_;
perm_string type_; perm_string type_;
list<PExpr*>*overrides_; std::list<PExpr*>*overrides_;
named<PExpr*>*pins_; named<PExpr*>*pins_;
unsigned npins_; unsigned npins_;

View File

@ -21,6 +21,8 @@
# include "PWire.h" # include "PWire.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
PGenerate::PGenerate(LexicalScope*parent, unsigned id) PGenerate::PGenerate(LexicalScope*parent, unsigned id)
: LexicalScope(parent), id_number(id) : LexicalScope(parent), id_number(id)
{ {

View File

@ -86,18 +86,18 @@ class PGenerate : public PNamedItem, public LexicalScope {
std::valarray<PExpr*> item_test; std::valarray<PExpr*> item_test;
// defparam assignments found in this scope. // defparam assignments found in this scope.
typedef pair<pform_name_t,PExpr*> named_expr_t; typedef std::pair<pform_name_t,PExpr*> named_expr_t;
list<named_expr_t>defparms; std::list<named_expr_t>defparms;
list<PGate*> gates; std::list<PGate*> gates;
void add_gate(PGate*); void add_gate(PGate*);
// Tasks instantiated within this scheme. // Tasks instantiated within this scheme.
map<perm_string,PTask*> tasks; std::map<perm_string,PTask*> tasks;
map<perm_string,PFunction*>funcs; std::map<perm_string,PFunction*>funcs;
// Generate schemes can contain further generate schemes. // Generate schemes can contain further generate schemes.
list<PGenerate*> generate_schemes; std::list<PGenerate*> generate_schemes;
// PGenerate*parent; // PGenerate*parent;
// This method is called by the elaboration of a module to // This method is called by the elaboration of a module to
@ -110,7 +110,7 @@ class PGenerate : public PNamedItem, public LexicalScope {
bool elaborate_sig(Design*des, NetScope*container) const; bool elaborate_sig(Design*des, NetScope*container) const;
bool elaborate(Design*des, NetScope*container) const; bool elaborate(Design*des, NetScope*container) const;
void dump(ostream&out, unsigned indent) const; void dump(std::ostream&out, unsigned indent) const;
SymbolType symbol_type() const; SymbolType symbol_type() const;
@ -125,7 +125,7 @@ class PGenerate : public PNamedItem, public LexicalScope {
void elaborate_subscope_direct_(Design*des, NetScope*scope); void elaborate_subscope_direct_(Design*des, NetScope*scope);
// These are the scopes created by generate_scope. // These are the scopes created by generate_scope.
list<NetScope*>scope_list_; std::list<NetScope*>scope_list_;
// internal function called on each scope generated by this scheme. // internal function called on each scope generated by this scheme.
bool elaborate_sig_(Design*des, NetScope*scope) const; bool elaborate_sig_(Design*des, NetScope*scope) const;
bool elaborate_sig_direct_(Design*des, NetScope*scope) const; bool elaborate_sig_direct_(Design*des, NetScope*scope) const;

View File

@ -1,7 +1,7 @@
#ifndef IVL_PModport_H #ifndef IVL_PModport_H
#define IVL_PModport_H #define IVL_PModport_H
/* /*
* Copyright (c) 2015-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 2015-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -38,8 +38,8 @@ class PModport : public PNamedItem {
perm_string name() const { return name_; } perm_string name() const { return name_; }
typedef pair <NetNet::PortType,PExpr*> simple_port_t; typedef std::pair <NetNet::PortType,PExpr*> simple_port_t;
map<perm_string,simple_port_t> simple_ports; std::map<perm_string,simple_port_t> simple_ports;
SymbolType symbol_type() const; SymbolType symbol_type() const;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -19,6 +19,8 @@
# include "PScope.h" # include "PScope.h"
using namespace std;
bool LexicalScope::var_init_needs_explicit_lifetime() const bool LexicalScope::var_init_needs_explicit_lifetime() const
{ {
return false; return false;

View File

@ -112,30 +112,30 @@ class LexicalScope {
SymbolType symbol_type() const; SymbolType symbol_type() const;
}; };
map<perm_string,param_expr_t*>parameters; std::map<perm_string,param_expr_t*>parameters;
map<perm_string,param_expr_t*>localparams; std::map<perm_string,param_expr_t*>localparams;
// Defined types in the scope. // Defined types in the scope.
map<perm_string,data_type_t*>typedefs; std::map<perm_string,data_type_t*>typedefs;
// Named events in the scope. // Named events in the scope.
map<perm_string,PEvent*>events; std::map<perm_string,PEvent*>events;
// Nets and variables (wires) in the scope // Nets and variables (wires) in the scope
map<perm_string,PWire*>wires; std::map<perm_string,PWire*>wires;
PWire* wires_find(perm_string name); PWire* wires_find(perm_string name);
// Genvars in the scope. These will only be present in module // Genvars in the scope. These will only be present in module
// scopes, but are listed here to allow them to be found when // scopes, but are listed here to allow them to be found when
// creating implicit nets. // creating implicit nets.
map<perm_string,LineInfo*> genvars; std::map<perm_string,LineInfo*> genvars;
// Variable initializations in this scope // Variable initializations in this scope
vector<Statement*> var_inits; std::vector<Statement*> var_inits;
// Behaviors (processes) in this scope // Behaviors (processes) in this scope
list<PProcess*> behaviors; std::list<PProcess*> behaviors;
list<AProcess*> analog_behaviors; std::list<AProcess*> analog_behaviors;
// Enumeration sets. // Enumeration sets.
std::set<enum_type_t*> enum_sets; std::set<enum_type_t*> enum_sets;
@ -150,19 +150,19 @@ class LexicalScope {
virtual bool var_init_needs_explicit_lifetime() const; virtual bool var_init_needs_explicit_lifetime() const;
protected: protected:
void dump_typedefs_(ostream&out, unsigned indent) const; void dump_typedefs_(std::ostream&out, unsigned indent) const;
void dump_parameters_(ostream&out, unsigned indent) const; void dump_parameters_(std::ostream&out, unsigned indent) const;
void dump_localparams_(ostream&out, unsigned indent) const; void dump_localparams_(std::ostream&out, unsigned indent) const;
void dump_enumerations_(ostream&out, unsigned indent) const; void dump_enumerations_(std::ostream&out, unsigned indent) const;
void dump_events_(ostream&out, unsigned indent) const; void dump_events_(std::ostream&out, unsigned indent) const;
void dump_wires_(ostream&out, unsigned indent) const; void dump_wires_(std::ostream&out, unsigned indent) const;
void dump_var_inits_(ostream&out, unsigned indent) const; void dump_var_inits_(std::ostream&out, unsigned indent) const;
bool elaborate_var_inits_(Design*des, NetScope*scope) const; bool elaborate_var_inits_(Design*des, NetScope*scope) const;
@ -233,9 +233,9 @@ class PScopeExtra : public PScope {
bool time_prec_is_local; bool time_prec_is_local;
protected: protected:
void dump_classes_(ostream&out, unsigned indent) const; void dump_classes_(std::ostream&out, unsigned indent) const;
void dump_tasks_(ostream&out, unsigned indent) const; void dump_tasks_(std::ostream&out, unsigned indent) const;
void dump_funcs_(ostream&out, unsigned indent) const; void dump_funcs_(std::ostream&out, unsigned indent) const;
}; };
#endif /* IVL_PScope_H */ #endif /* IVL_PScope_H */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -21,6 +21,8 @@
# include "PTask.h" # include "PTask.h"
# include <cassert> # include <cassert>
using namespace std;
PTaskFunc::PTaskFunc(perm_string n, LexicalScope*p) PTaskFunc::PTaskFunc(perm_string n, LexicalScope*p)
: PScope(n,p), this_type_(0), ports_(0) : PScope(n,p), this_type_(0), ports_(0)
{ {

View File

@ -97,7 +97,7 @@ class PTask : public PTaskFunc {
bool is_auto() const { return is_auto_; }; bool is_auto() const { return is_auto_; };
void dump(ostream&, unsigned) const; void dump(std::ostream&, unsigned) const;
SymbolType symbol_type() const; SymbolType symbol_type() const;
@ -148,7 +148,7 @@ class PFunction : public PTaskFunc {
bool is_auto() const { return is_auto_; }; bool is_auto() const { return is_auto_; };
void dump(ostream&, unsigned) const; void dump(std::ostream&, unsigned) const;
SymbolType symbol_type() const; SymbolType symbol_type() const;

10
PUdp.h
View File

@ -1,7 +1,7 @@
#ifndef IVL_PUdp_H #ifndef IVL_PUdp_H
#define IVL_PUdp_H #define IVL_PUdp_H
/* /*
* Copyright (c) 1998-2014 Stephen Williams (steve@picturel.com) * Copyright (c) 1998-2021 Stephen Williams (steve@picturel.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -53,20 +53,20 @@ class PUdp : public LineInfo {
public: public:
explicit PUdp(perm_string n, unsigned nports); explicit PUdp(perm_string n, unsigned nports);
svector<string>ports; svector<std::string>ports;
unsigned find_port(const char*name); unsigned find_port(const char*name);
bool sequential; bool sequential;
svector<string>tinput; svector<std::string>tinput;
svector<char> tcurrent; svector<char> tcurrent;
svector<char> toutput; svector<char> toutput;
verinum::V initial; verinum::V initial;
map<string,PExpr*> attributes; std::map<std::string,PExpr*> attributes;
void dump(ostream&out) const; void dump(std::ostream&out) const;
perm_string name_; perm_string name_;
private: private:

View File

@ -22,6 +22,8 @@
# include "PExpr.h" # include "PExpr.h"
# include <cassert> # include <cassert>
using namespace std;
PWire::PWire(perm_string n, PWire::PWire(perm_string n,
NetNet::Type t, NetNet::Type t,
NetNet::PortType pt, NetNet::PortType pt,

View File

@ -1,7 +1,7 @@
#ifndef IVL_PWire_H #ifndef IVL_PWire_H
#define IVL_PWire_H #define IVL_PWire_H
/* /*
* Copyright (c) 1998-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -28,7 +28,7 @@
#ifdef HAVE_IOSFWD #ifdef HAVE_IOSFWD
# include <iosfwd> # include <iosfwd>
#else #else
class ostream; # include <iostream>
#endif #endif
class PExpr; class PExpr;
@ -87,10 +87,10 @@ class PWire : public PNamedItem {
void set_discipline(ivl_discipline_t); void set_discipline(ivl_discipline_t);
ivl_discipline_t get_discipline(void) const; ivl_discipline_t get_discipline(void) const;
map<perm_string,PExpr*> attributes; std::map<perm_string,PExpr*> attributes;
// Write myself to the specified stream. // Write myself to the specified stream.
void dump(ostream&out, unsigned ind=4) const; void dump(std::ostream&out, unsigned ind=4) const;
NetNet* elaborate_sig(Design*, NetScope*scope) const; NetNet* elaborate_sig(Design*, NetScope*scope) const;

View File

@ -23,6 +23,8 @@
# include "PExpr.h" # include "PExpr.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
Statement::~Statement() Statement::~Statement()
{ {
} }

View File

@ -61,9 +61,9 @@ class PProcess : public LineInfo {
ivl_process_type_t type() const { return type_; } ivl_process_type_t type() const { return type_; }
Statement*statement() { return statement_; } Statement*statement() { return statement_; }
map<perm_string,PExpr*> attributes; std::map<perm_string,PExpr*> attributes;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
ivl_process_type_t type_; ivl_process_type_t type_;
@ -81,12 +81,12 @@ class Statement : virtual public LineInfo {
Statement() { } Statement() { }
virtual ~Statement() =0; virtual ~Statement() =0;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
map<perm_string,PExpr*> attributes; std::map<perm_string,PExpr*> attributes;
}; };
/* /*
@ -139,7 +139,7 @@ class PAssign : public PAssign_ {
explicit PAssign(PExpr*lval, PExpr*ex, bool is_constant); explicit PAssign(PExpr*lval, PExpr*ex, bool is_constant);
~PAssign(); ~PAssign();
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
private: private:
@ -155,7 +155,7 @@ class PAssignNB : public PAssign_ {
explicit PAssignNB(PExpr*lval, PExpr*cnt, PEventStatement*de, PExpr*ex); explicit PAssignNB(PExpr*lval, PExpr*cnt, PEventStatement*de, PExpr*ex);
~PAssignNB(); ~PAssignNB();
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
private: private:
@ -200,7 +200,7 @@ class PBlock : public PScope, public Statement, public PNamedItem {
// block. // block.
void push_statement_front(Statement*that); void push_statement_front(Statement*that);
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
@ -215,14 +215,14 @@ class PBlock : public PScope, public Statement, public PNamedItem {
class PCallTask : public Statement { class PCallTask : public Statement {
public: public:
explicit PCallTask(PPackage*pkg, const pform_name_t&n, const list<PExpr*>&parms); explicit PCallTask(PPackage*pkg, const pform_name_t&n, const std::list<PExpr*>&parms);
explicit PCallTask(const pform_name_t&n, const list<PExpr*>&parms); explicit PCallTask(const pform_name_t&n, const std::list<PExpr*>&parms);
explicit PCallTask(perm_string n, const list<PExpr*>&parms); explicit PCallTask(perm_string n, const std::list<PExpr*>&parms);
~PCallTask(); ~PCallTask();
const pform_name_t& path() const; const pform_name_t& path() const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
private: private:
@ -256,14 +256,14 @@ class PCallTask : public Statement {
PPackage*package_; PPackage*package_;
pform_name_t path_; pform_name_t path_;
vector<PExpr*> parms_; std::vector<PExpr*> parms_;
}; };
class PCase : public Statement { class PCase : public Statement {
public: public:
struct Item { struct Item {
list<PExpr*>expr; std::list<PExpr*>expr;
Statement*stat; Statement*stat;
}; };
@ -273,7 +273,7 @@ class PCase : public Statement {
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
ivl_case_quality_t quality_; ivl_case_quality_t quality_;
@ -294,7 +294,7 @@ class PCAssign : public Statement {
~PCAssign(); ~PCAssign();
virtual NetCAssign* elaborate(Design*des, NetScope*scope) const; virtual NetCAssign* elaborate(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
PExpr*lval_; PExpr*lval_;
@ -308,11 +308,11 @@ class PCAssign : public Statement {
*/ */
class PChainConstructor : public Statement { class PChainConstructor : public Statement {
public: public:
explicit PChainConstructor(const list<PExpr*>&parms); explicit PChainConstructor(const std::list<PExpr*>&parms);
~PChainConstructor(); ~PChainConstructor();
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
inline const std::vector<PExpr*>& chain_args(void) const inline const std::vector<PExpr*>& chain_args(void) const
{ return parms_; } { return parms_; }
@ -330,7 +330,7 @@ class PCondit : public Statement {
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
PExpr*expr_; PExpr*expr_;
@ -349,7 +349,7 @@ class PDeassign : public Statement {
~PDeassign(); ~PDeassign();
virtual NetDeassign* elaborate(Design*des, NetScope*scope) const; virtual NetDeassign* elaborate(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
PExpr*lval_; PExpr*lval_;
@ -361,7 +361,7 @@ class PDelayStatement : public Statement {
PDelayStatement(PExpr*d, Statement*st); PDelayStatement(PExpr*d, Statement*st);
~PDelayStatement(); ~PDelayStatement();
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
@ -381,7 +381,7 @@ class PDisable : public Statement {
explicit PDisable(const pform_name_t&sc); explicit PDisable(const pform_name_t&sc);
~PDisable(); ~PDisable();
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
private: private:
@ -397,7 +397,7 @@ class PDoWhile : public Statement {
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
PExpr*cond_; PExpr*cond_;
@ -426,10 +426,10 @@ class PEventStatement : public Statement {
void set_statement(Statement*st); void set_statement(Statement*st);
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
// Call this with a NULL statement only. It is used to print // Call this with a NULL statement only. It is used to print
// the event expression for inter-assignment event controls. // the event expression for inter-assignment event controls.
virtual void dump_inline(ostream&out) const; virtual void dump_inline(std::ostream&out) const;
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
@ -449,7 +449,7 @@ class PEventStatement : public Statement {
bool always_sens_; bool always_sens_;
}; };
ostream& operator << (ostream&o, const PEventStatement&obj); std::ostream& operator << (std::ostream&o, const PEventStatement&obj);
class PForce : public Statement { class PForce : public Statement {
@ -458,7 +458,7 @@ class PForce : public Statement {
~PForce(); ~PForce();
virtual NetForce* elaborate(Design*des, NetScope*scope) const; virtual NetForce* elaborate(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
PExpr*lval_; PExpr*lval_;
@ -473,7 +473,7 @@ class PForeach : public Statement {
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
NetProc* elaborate_static_array_(Design*des, NetScope*scope, NetProc* elaborate_static_array_(Design*des, NetScope*scope,
@ -493,7 +493,7 @@ class PForever : public Statement {
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
Statement*statement_; Statement*statement_;
@ -509,7 +509,7 @@ class PForStatement : public Statement {
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
PExpr* name1_; PExpr* name1_;
@ -537,7 +537,7 @@ class PRepeat : public Statement {
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
PExpr*expr_; PExpr*expr_;
@ -551,7 +551,7 @@ class PRelease : public Statement {
~PRelease(); ~PRelease();
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
PExpr*lval_; PExpr*lval_;
@ -581,7 +581,7 @@ class PTrigger : public Statement {
~PTrigger(); ~PTrigger();
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
PPackage*package_; PPackage*package_;
@ -597,7 +597,7 @@ class PWhile : public Statement {
virtual NetProc* elaborate(Design*des, NetScope*scope) const; virtual NetProc* elaborate(Design*des, NetScope*scope) const;
virtual void elaborate_scope(Design*des, NetScope*scope) const; virtual void elaborate_scope(Design*des, NetScope*scope) const;
virtual void elaborate_sig(Design*des, NetScope*scope) const; virtual void elaborate_sig(Design*des, NetScope*scope) const;
virtual void dump(ostream&out, unsigned ind) const; virtual void dump(std::ostream&out, unsigned ind) const;
private: private:
PExpr*cond_; PExpr*cond_;

View File

@ -147,7 +147,7 @@ extern unsigned long array_size_limit;
extern const char*basedir; extern const char*basedir;
/* This is an ordered list of library suffixes to search. */ /* This is an ordered list of library suffixes to search. */
extern list<const char*>library_suff; extern std::list<const char*>library_suff;
extern int build_library_index(const char*path, bool key_case_sensitive); extern int build_library_index(const char*path, bool key_case_sensitive);
/* This is the generation of Verilog that the compiler is asked to /* This is the generation of Verilog that the compiler is asked to
@ -244,14 +244,14 @@ extern int lexor_keyword_mask;
/* This is the string to use to invoke the preprocessor. */ /* This is the string to use to invoke the preprocessor. */
extern char*ivlpp_string; extern char*ivlpp_string;
extern map<perm_string,unsigned> missing_modules; extern std::map<perm_string,unsigned> missing_modules;
/* Files that are library files are in this map. The lexor compares /* Files that are library files are in this map. The lexor compares
file names as it processes `line directives, and if the file name file names as it processes `line directives, and if the file name
matches an entry in this table, it will turn on the matches an entry in this table, it will turn on the
library_active_flag so that modules know that they are in a library_active_flag so that modules know that they are in a
library. */ library. */
extern map<perm_string,bool> library_file_map; extern std::map<perm_string,bool> library_file_map;
/* /*
* the lex_strings are perm_strings made up of tokens from the source * the lex_strings are perm_strings made up of tokens from the source

View File

@ -1,7 +1,7 @@
#ifndef IVL_config_H /* -*- c++ -*- */ #ifndef IVL_config_H /* -*- c++ -*- */
#define IVL_config_H #define IVL_config_H
/* /*
* Copyright (c) 2001-2015 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -19,14 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#if defined(__cplusplus)
# if !defined(__GNUC__)
using namespace std;
# elif (__GNUC__ == 3)
using namespace std;
# endif
#endif
# undef NEED_LU # undef NEED_LU
# undef NEED_TU # undef NEED_TU
# undef WLU # undef WLU

View File

@ -28,6 +28,7 @@
# include "compiler.h" # include "compiler.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
/* /*
* The cprop function below invokes constant propagation where * The cprop function below invokes constant propagation where

View File

@ -35,6 +35,8 @@
# include "ivl_assert.h" # include "ivl_assert.h"
# include "PExpr.h" # include "PExpr.h"
using namespace std;
static ostream& operator<< (ostream&o, NetBlock::Type t) static ostream& operator<< (ostream&o, NetBlock::Type t)
{ {
switch (t) { switch (t) {

View File

@ -1,7 +1,7 @@
#ifndef IVL_discipline_H #ifndef IVL_discipline_H
#define IVL_discipline_H #define IVL_discipline_H
/* /*
* Copyright (c) 2008-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -69,9 +69,9 @@ class ivl_discipline_s : public LineInfo {
ivl_discipline_s& operator = (const ivl_discipline_s&); ivl_discipline_s& operator = (const ivl_discipline_s&);
}; };
extern map<perm_string,ivl_nature_t> natures; extern std::map<perm_string,ivl_nature_t> natures;
extern map<perm_string,ivl_discipline_t> disciplines; extern std::map<perm_string,ivl_discipline_t> disciplines;
// Map access function name to the nature that it accesses. // Map access function name to the nature that it accesses.
extern map<perm_string,ivl_nature_t> access_function_nature; extern std::map<perm_string,ivl_nature_t> access_function_nature;
#endif /* IVL_discipline_H */ #endif /* IVL_discipline_H */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -24,6 +24,8 @@
# include <cstdlib> # include <cstdlib>
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
NetEAccess* NetEAccess::dup_expr() const NetEAccess* NetEAccess::dup_expr() const
{ {
NetEAccess*tmp = new NetEAccess(branch_, nature_); NetEAccess*tmp = new NetEAccess(branch_, nature_);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2003 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -29,6 +29,8 @@
# include "netmisc.h" # include "netmisc.h"
# include <iostream> # include <iostream>
using namespace std;
NetNet* PExpr::elaborate_anet(Design*des, NetScope*scope) const NetNet* PExpr::elaborate_anet(Design*des, NetScope*scope) const
{ {
cerr << get_line() << ": error: Invalid expression on left side " cerr << get_line() << ": error: Invalid expression on left side "
@ -163,4 +165,3 @@ NetNet* PEIdent::elaborate_anet(Design*des, NetScope*scope) const
return sig; return sig;
} }

View File

@ -41,6 +41,8 @@
# include "util.h" # include "util.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
bool type_is_vectorable(ivl_variable_type_t type) bool type_is_vectorable(ivl_variable_type_t type)
{ {
switch (type) { switch (type) {

View File

@ -36,6 +36,8 @@
# include <climits> # include <climits>
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
/* /*
* These methods generate a NetAssign_ object for the l-value of the * These methods generate a NetAssign_ object for the l-value of the
* assignment. This is common code for the = and <= statements. * assignment. This is common code for the = and <= statements.

View File

@ -32,6 +32,8 @@
# include <iostream> # include <iostream>
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
/* /*
* The concatenation is also OK an an l-value. This method elaborates * The concatenation is also OK an an l-value. This method elaborates
* it as a structural l-value. The return values is the *input* net of * it as a structural l-value. The return values is the *input* net of

View File

@ -54,6 +54,7 @@
# include <cassert> # include <cassert>
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
void set_scope_timescale(Design*des, NetScope*scope, PScope*pscope) void set_scope_timescale(Design*des, NetScope*scope, PScope*pscope)
{ {

View File

@ -51,6 +51,7 @@
# include "compiler.h" # include "compiler.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
// Implemented in elab_scope.cc // Implemented in elab_scope.cc
extern void set_scope_timescale(Design*des, NetScope*scope, PScope*pscope); extern void set_scope_timescale(Design*des, NetScope*scope, PScope*pscope);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008-2012 Stephen Williams (steve@icarus.com) * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -26,6 +26,8 @@
# include <typeinfo> # include <typeinfo>
using namespace std;
NetProc* AContrib::elaborate(Design*des, NetScope*scope) const NetProc* AContrib::elaborate(Design*des, NetScope*scope) const
{ {
NetExpr*lval = elab_and_eval(des, scope, lval_, -1); NetExpr*lval = elab_and_eval(des, scope, lval_, -1);

View File

@ -33,6 +33,8 @@
# include <cassert> # include <cassert>
# include <cstring> # include <cstring>
using namespace std;
bool NetNode::emit_node(struct target_t*) const bool NetNode::emit_node(struct target_t*) const
{ {
cerr << "EMIT: Gate type? " << typeid(*this).name() << endl; cerr << "EMIT: Gate type? " << typeid(*this).name() << endl;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -27,6 +27,8 @@
# include "netmisc.h" # include "netmisc.h"
# include "compiler.h" # include "compiler.h"
using namespace std;
verinum* PExpr::eval_const(Design*, NetScope*) const verinum* PExpr::eval_const(Design*, NetScope*) const
{ {
return 0; return 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -24,6 +24,8 @@
# include <iostream> # include <iostream>
# include <cassert> # include <cassert>
using namespace std;
/* /*
* The evaluate_attributes function evaluates the attribute * The evaluate_attributes function evaluates the attribute
* expressions from the map, and returns a table in a form suitable * expressions from the map, and returns a table in a form suitable

View File

@ -29,6 +29,8 @@
# include "ivl_assert.h" # include "ivl_assert.h"
# include "netmisc.h" # include "netmisc.h"
using namespace std;
NetExpr* NetExpr::eval_tree() NetExpr* NetExpr::eval_tree()
{ {
return 0; return 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016 Martin Whitaker (icarus@martin-whitaker.me.uk) * Copyright (c) 2016-2021 Martin Whitaker (icarus@martin-whitaker.me.uk)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -26,6 +26,7 @@
# include "compiler.h" # include "compiler.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
/* /*
* The exposenodes functor is primarily provided for use by the vlog95 * The exposenodes functor is primarily provided for use by the vlog95

View File

@ -28,6 +28,8 @@
# include "netmisc.h" # include "netmisc.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
static NetNet* convert_to_real_const(Design*des, NetScope*scope, NetEConst*expr) static NetNet* convert_to_real_const(Design*des, NetScope*scope, NetEConst*expr)
{ {
verireal vrl(expr->value().as_double()); verireal vrl(expr->value().as_double());

View File

@ -1,7 +1,7 @@
#ifndef IVL_ivl_assert_H #ifndef IVL_ivl_assert_H
#define IVL_ivl_assert_H #define IVL_ivl_assert_H
/* /*
* Copyright (c) 2007-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2007-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -24,9 +24,9 @@
#define ivl_assert(tok, expression) \ #define ivl_assert(tok, expression) \
do { \ do { \
if (! (expression)) { \ if (! (expression)) { \
cerr << (tok).get_fileline() << ": assert: " \ std::cerr << (tok).get_fileline() << ": assert: " \
<< __FILE__ << ":" << __LINE__ \ << __FILE__ << ":" << __LINE__ \
<< ": failed assertion " << #expression << endl; \ << ": failed assertion " << #expression << std::endl; \
abort(); \ abort(); \
} \ } \
} while (0) } while (0)

View File

@ -37,6 +37,8 @@
# include "discipline.h" # include "discipline.h"
# include <list> # include <list>
using namespace std;
# define YY_USER_INIT reset_lexor(); # define YY_USER_INIT reset_lexor();
# define yylval VLlval # define yylval VLlval

View File

@ -1,7 +1,7 @@
#ifndef IVL_LineInfo_H #ifndef IVL_LineInfo_H
#define IVL_LineInfo_H #define IVL_LineInfo_H
/* /*
* Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -22,8 +22,6 @@
# include "StringHeap.h" # include "StringHeap.h"
# include <string> # include <string>
using namespace std;
/* /*
* This class holds line information for an internal object. * This class holds line information for an internal object.
* *
@ -40,7 +38,7 @@ class LineInfo {
virtual ~LineInfo(); virtual ~LineInfo();
// Get a fully formatted file/lineno // Get a fully formatted file/lineno
string get_fileline() const; std::string get_fileline() const;
// Set the file/line from another LineInfo object. // Set the file/line from another LineInfo object.
void set_line(const LineInfo&that); void set_line(const LineInfo&that);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -29,6 +29,8 @@ static char **string_pool = NULL;
static unsigned string_pool_count = 0; static unsigned string_pool_count = 0;
#endif #endif
using namespace std;
static const unsigned DEFAULT_CELL_SIZE = 0x10000; static const unsigned DEFAULT_CELL_SIZE = 0x10000;

View File

@ -1,7 +1,7 @@
#ifndef IVL_StringHeap_H #ifndef IVL_StringHeap_H
#define IVL_StringHeap_H #define IVL_StringHeap_H
/* /*
* Copyright (c) 2002-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -21,8 +21,6 @@
# include <string> # include <string>
using namespace std;
class perm_string { class perm_string {
public: public:
@ -61,7 +59,7 @@ extern bool operator > (perm_string a, perm_string b);
extern bool operator < (perm_string a, perm_string b); extern bool operator < (perm_string a, perm_string b);
extern bool operator >= (perm_string a, perm_string b); extern bool operator >= (perm_string a, perm_string b);
extern bool operator <= (perm_string a, perm_string b); extern bool operator <= (perm_string a, perm_string b);
extern ostream& operator << (ostream&out, perm_string that); extern std::ostream& operator << (std::ostream&out, perm_string that);
/* /*
* The string heap is a way to permanently allocate strings * The string heap is a way to permanently allocate strings
@ -100,7 +98,7 @@ class StringHeapLex : private StringHeap {
const char*add(const char*); const char*add(const char*);
perm_string make(const char*); perm_string make(const char*);
perm_string make(const string&); perm_string make(const std::string&);
unsigned add_count() const; unsigned add_count() const;
unsigned add_hit_count() const; unsigned add_hit_count() const;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2016 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -23,6 +23,8 @@
# include "netmisc.h" # include "netmisc.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
/* /*
* Scan the link for drivers. If there are only constant drivers, then * Scan the link for drivers. If there are only constant drivers, then
* the nexus has a known constant value. * the nexus has a known constant value.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -32,6 +32,8 @@
# include <cassert> # include <cassert>
# include "ivl_alloc.h" # include "ivl_alloc.h"
using namespace std;
/* /*
* The module library items are maps of key names to file name within * The module library items are maps of key names to file name within
* the directory. * the directory.

View File

@ -62,6 +62,8 @@ const char NOTICE[] =
# include "discipline.h" # include "discipline.h"
# include "t-dll.h" # include "t-dll.h"
using namespace std;
#if defined(__MINGW32__) && !defined(HAVE_GETOPT_H) #if defined(__MINGW32__) && !defined(HAVE_GETOPT_H)
extern "C" int getopt(int argc, char*argv[], const char*fmt); extern "C" int getopt(int argc, char*argv[], const char*fmt);
extern "C" int optind; extern "C" int optind;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2015 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -25,6 +25,8 @@
# include "netenum.h" # include "netenum.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
/* /*
* NetAssign * NetAssign
*/ */

View File

@ -37,6 +37,8 @@
# include <sstream> # include <sstream>
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
Design:: Design() Design:: Design()
: errors(0), nodes_(0), procs_(0), aprocs_(0) : errors(0), nodes_(0), procs_(0), aprocs_(0)
{ {

View File

@ -22,6 +22,8 @@
# include "netlist.h" # include "netlist.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
/* /*
* NOTE: The name_ is perm-allocated by the caller. * NOTE: The name_ is perm-allocated by the caller.
*/ */

View File

@ -27,6 +27,8 @@
# include <iostream> # include <iostream>
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
NetExpr::NetExpr(unsigned w) NetExpr::NetExpr(unsigned w)
: net_type_(0), width_(w), signed_flag_(false) : net_type_(0), width_(w), signed_flag_(false)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -23,6 +23,8 @@
# include "PExpr.h" # include "PExpr.h"
# include <iostream> # include <iostream>
using namespace std;
/* /*
* To make a NetUserFunc device, make as many pins as there are ports * To make a NetUserFunc device, make as many pins as there are ports
* in the function. Get the port count from the function definition, * in the function. Get the port count from the function definition,

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2016 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -29,6 +29,8 @@
# include <cstdlib> # include <cstdlib>
# include "ivl_alloc.h" # include "ivl_alloc.h"
using namespace std;
void Nexus::connect(Link&r) void Nexus::connect(Link&r)
{ {
Nexus*r_nexus = r.next_? r.find_nexus_() : 0; Nexus*r_nexus = r.next_? r.find_nexus_() : 0;

View File

@ -27,6 +27,8 @@
# include "netlist.h" # include "netlist.h"
# include "netmisc.h" # include "netmisc.h"
using namespace std;
NexusSet* NetExpr::nex_input(bool, bool, bool) const NexusSet* NetExpr::nex_input(bool, bool, bool) const
{ {
cerr << get_fileline() cerr << get_fileline()

View File

@ -26,6 +26,8 @@
# include "netlist.h" # include "netlist.h"
# include "netmisc.h" # include "netmisc.h"
using namespace std;
void NetProc::nex_output(NexusSet&) void NetProc::nex_output(NexusSet&)
{ {
cerr << get_fileline() cerr << get_fileline()

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2015 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -24,6 +24,8 @@
# include "netmisc.h" # include "netmisc.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
NetBlock::NetBlock(Type t, NetScope*ss) NetBlock::NetBlock(Type t, NetScope*ss)
: type_(t), subscope_(ss), last_(0) : type_(t), subscope_(ss), last_(0)
{ {

View File

@ -31,6 +31,8 @@
# include <sstream> # include <sstream>
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
class PExpr; class PExpr;
Definitions::Definitions() Definitions::Definitions()

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -29,6 +29,8 @@
# include "ivl_target_priv.h" # include "ivl_target_priv.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
static bool has_enable(ivl_switch_type_t tt) static bool has_enable(ivl_switch_type_t tt)
{ {
switch (tt) { switch (tt) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu> * Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
@ -22,6 +22,8 @@
# include "compiler.h" # include "compiler.h"
# include "netlist.h" # include "netlist.h"
using namespace std;
NetUDP::NetUDP(NetScope*s, perm_string n, unsigned pins, PUdp *u) NetUDP::NetUDP(NetScope*s, perm_string n, unsigned pins, PUdp *u)
: NetNode(s, n, pins), udp(u) : NetNode(s, n, pins), udp(u)
{ {

View File

@ -1,7 +1,7 @@
#ifndef IVL_netclass_H #ifndef IVL_netclass_H
#define IVL_netclass_H #define IVL_netclass_H
/* /*
* Copyright (c) 2012-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -110,7 +110,7 @@ class netclass_t : public ivl_type_s {
bool emit_defs(struct target_t*tgt) const; bool emit_defs(struct target_t*tgt) const;
std::ostream& debug_dump(std::ostream&fd) const; std::ostream& debug_dump(std::ostream&fd) const;
void dump_scope(ostream&fd) const; void dump_scope(std::ostream&fd) const;
private: private:
perm_string name_; perm_string name_;

View File

@ -37,6 +37,7 @@
# include "netvector.h" # include "netvector.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
ostream& operator<< (ostream&o, NetNet::Type t) ostream& operator<< (ostream&o, NetNet::Type t)
{ {

370
netlist.h

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,7 @@
# include "compiler.h" # include "compiler.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
NetNet* sub_net_from(Design*des, NetScope*scope, long val, NetNet*sig) NetNet* sub_net_from(Design*des, NetScope*scope, long val, NetNet*sig)
{ {

View File

@ -130,7 +130,7 @@ extern NetExpr*normalize_variable_base(NetExpr *base, long msb, long lsb,
unsigned long wid, bool is_up, unsigned long wid, bool is_up,
long slice_off =0); long slice_off =0);
extern NetExpr*normalize_variable_base(NetExpr *base, extern NetExpr*normalize_variable_base(NetExpr *base,
const list<netrange_t>&dims, const std::list<netrange_t>&dims,
unsigned long wid, bool is_up); unsigned long wid, bool is_up);
/* /*
@ -141,7 +141,7 @@ extern NetExpr*normalize_variable_base(NetExpr *base,
* ... foo[1][x] ... * ... foo[1][x] ...
* base is (x) and the generated expression will be (x+8). * base is (x) and the generated expression will be (x+8).
*/ */
extern NetExpr*normalize_variable_bit_base(const list<long>&indices, NetExpr *base, extern NetExpr*normalize_variable_bit_base(const std::list<long>&indices, NetExpr *base,
const NetNet*reg); const NetNet*reg);
/* /*
@ -153,7 +153,7 @@ extern NetExpr*normalize_variable_bit_base(const list<long>&indices, NetExpr *ba
* base is (x), wid input is (2), and is_up is (true). The output * base is (x), wid input is (2), and is_up is (true). The output
* expression is (x+8). * expression is (x+8).
*/ */
extern NetExpr *normalize_variable_part_base(const list<long>&indices, NetExpr*base, extern NetExpr *normalize_variable_part_base(const std::list<long>&indices, NetExpr*base,
const NetNet*reg, const NetNet*reg,
unsigned long wid, bool is_up); unsigned long wid, bool is_up);
/* /*
@ -167,7 +167,7 @@ extern NetExpr *normalize_variable_part_base(const list<long>&indices, NetExpr*b
* base is (x) and the generated expression will be (x*8 - 8), with * base is (x) and the generated expression will be (x*8 - 8), with
* lwid set to (8). * lwid set to (8).
*/ */
extern NetExpr*normalize_variable_slice_base(const list<long>&indices, NetExpr *base, extern NetExpr*normalize_variable_slice_base(const std::list<long>&indices, NetExpr *base,
const NetNet*reg, unsigned long&lwid); const NetNet*reg, unsigned long&lwid);
/* /*
@ -181,8 +181,8 @@ template <class TYPE> struct __IndicesManip {
template <class TYPE> inline __IndicesManip<TYPE> as_indices(const std::list<TYPE>&indices) template <class TYPE> inline __IndicesManip<TYPE> as_indices(const std::list<TYPE>&indices)
{ return __IndicesManip<TYPE>(indices); } { return __IndicesManip<TYPE>(indices); }
extern ostream& operator << (ostream&o, __IndicesManip<long>); extern std::ostream& operator << (std::ostream&o, __IndicesManip<long>);
extern ostream& operator << (ostream&o, __IndicesManip<NetExpr*>); extern std::ostream& operator << (std::ostream&o, __IndicesManip<NetExpr*>);
/* /*
* Given a list of index expressions, generate elaborated expressions * Given a list of index expressions, generate elaborated expressions
@ -198,18 +198,18 @@ extern void indices_to_expressions(Design*des, NetScope*scope,
const LineInfo*loc, const LineInfo*loc,
// src is the index list, and count is // src is the index list, and count is
// the number of items in the list to use. // the number of items in the list to use.
const list<index_component_t>&src, unsigned count, const std::list<index_component_t>&src, unsigned count,
// True if the expression MUST be constant. // True if the expression MUST be constant.
bool need_const, bool need_const,
// These are the outputs. // These are the outputs.
indices_flags&flags, indices_flags&flags,
list<NetExpr*>&indices,list<long>&indices_const); std::list<NetExpr*>&indices,std::list<long>&indices_const);
extern NetExpr*normalize_variable_unpacked(const NetNet*net, list<long>&indices); extern NetExpr*normalize_variable_unpacked(const NetNet*net, std::list<long>&indices);
extern NetExpr*normalize_variable_unpacked(const netsarray_t*net, list<long>&indices); extern NetExpr*normalize_variable_unpacked(const netsarray_t*net, std::list<long>&indices);
extern NetExpr*normalize_variable_unpacked(const NetNet*net, list<NetExpr*>&indices); extern NetExpr*normalize_variable_unpacked(const NetNet*net, std::list<NetExpr*>&indices);
extern NetExpr*normalize_variable_unpacked(const LineInfo&loc, const netsarray_t*net, list<NetExpr*>&indices); extern NetExpr*normalize_variable_unpacked(const LineInfo&loc, const netsarray_t*net, std::list<NetExpr*>&indices);
extern NetExpr*make_canonical_index(Design*des, NetScope*scope, extern NetExpr*make_canonical_index(Design*des, NetScope*scope,
// loc for error messages // loc for error messages
@ -387,15 +387,15 @@ extern uint64_t get_scaled_time_from_real(Design*des,
extern void collapse_partselect_pv_to_concat(Design*des, NetNet*sig); extern void collapse_partselect_pv_to_concat(Design*des, NetNet*sig);
extern bool evaluate_index_prefix(Design*des, NetScope*scope, extern bool evaluate_index_prefix(Design*des, NetScope*scope,
list<long>&prefix_indices, std::list<long>&prefix_indices,
const list<index_component_t>&indices); const std::list<index_component_t>&indices);
extern NetExpr*collapse_array_indices(Design*des, NetScope*scope, NetNet*net, extern NetExpr*collapse_array_indices(Design*des, NetScope*scope, NetNet*net,
const std::list<index_component_t>&indices); const std::list<index_component_t>&indices);
extern NetExpr*collapse_array_exprs(Design*des, NetScope*scope, extern NetExpr*collapse_array_exprs(Design*des, NetScope*scope,
const LineInfo*loc, NetNet*net, const LineInfo*loc, NetNet*net,
const list<index_component_t>&indices); const std::list<index_component_t>&indices);
extern void assign_unpacked_with_bufz(Design*des, NetScope*scope, extern void assign_unpacked_with_bufz(Design*des, NetScope*scope,
const LineInfo*loc, const LineInfo*loc,

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -29,6 +29,8 @@
# include "netlist.h" # include "netlist.h"
# include "compiler.h" # include "compiler.h"
using namespace std;
class nodangle_f : public functor_t { class nodangle_f : public functor_t {
public: public:
void event(Design*des, NetEvent*ev); void event(Design*des, NetEvent*ev);

266
parse.y
View File

@ -31,11 +31,13 @@
# include <cstring> # include <cstring>
# include <sstream> # include <sstream>
using namespace std;
class PSpecPath; class PSpecPath;
extern void lex_end_table(); extern void lex_end_table();
static list<pform_range_t>* param_active_range = 0; static std::list<pform_range_t>* param_active_range = 0;
static bool param_active_signed = false; static bool param_active_signed = false;
static ivl_variable_type_t param_active_type = IVL_VT_LOGIC; static ivl_variable_type_t param_active_type = IVL_VT_LOGIC;
@ -92,7 +94,7 @@ static unsigned args_after_notifier;
/* The rules sometimes push attributes into a global context where /* The rules sometimes push attributes into a global context where
sub-rules may grab them. This makes parser rules a little easier to sub-rules may grab them. This makes parser rules a little easier to
write in some cases. */ write in some cases. */
static list<named_pexpr_t>*attributes_in_context = 0; static std::list<named_pexpr_t>*attributes_in_context = 0;
/* Later version of bison (including 1.35) will not compile in stack /* Later version of bison (including 1.35) will not compile in stack
extension if the output is compiled with C++ and either the YYSTYPE extension if the output is compiled with C++ and either the YYSTYPE
@ -132,15 +134,15 @@ static list<named_pexpr_t>*attributes_in_context = 0;
static const struct str_pair_t pull_strength = { IVL_DR_PULL, IVL_DR_PULL }; static const struct str_pair_t pull_strength = { IVL_DR_PULL, IVL_DR_PULL };
static const struct str_pair_t str_strength = { IVL_DR_STRONG, IVL_DR_STRONG }; static const struct str_pair_t str_strength = { IVL_DR_STRONG, IVL_DR_STRONG };
static list<pform_port_t>* make_port_list(char*id, list<pform_range_t>*udims, PExpr*expr) static std::list<pform_port_t>* make_port_list(char*id, std::list<pform_range_t>*udims, PExpr*expr)
{ {
list<pform_port_t>*tmp = new list<pform_port_t>; std::list<pform_port_t>*tmp = new std::list<pform_port_t>;
tmp->push_back(pform_port_t(lex_strings.make(id), udims, expr)); tmp->push_back(pform_port_t(lex_strings.make(id), udims, expr));
delete[]id; delete[]id;
return tmp; return tmp;
} }
static list<pform_port_t>* make_port_list(list<pform_port_t>*tmp, static std::list<pform_port_t>* make_port_list(list<pform_port_t>*tmp,
char*id, list<pform_range_t>*udims, PExpr*expr) char*id, std::list<pform_range_t>*udims, PExpr*expr)
{ {
tmp->push_back(pform_port_t(lex_strings.make(id), udims, expr)); tmp->push_back(pform_port_t(lex_strings.make(id), udims, expr));
delete[]id; delete[]id;
@ -153,20 +155,20 @@ list<pform_range_t>* make_range_from_width(uint64_t wid)
range.first = new PENumber(new verinum(wid-1, integer_width)); range.first = new PENumber(new verinum(wid-1, integer_width));
range.second = new PENumber(new verinum((uint64_t)0, integer_width)); range.second = new PENumber(new verinum((uint64_t)0, integer_width));
list<pform_range_t>*rlist = new list<pform_range_t>; std::list<pform_range_t>*rlist = new std::list<pform_range_t>;
rlist->push_back(range); rlist->push_back(range);
return rlist; return rlist;
} }
static list<perm_string>* list_from_identifier(char*id) static std::list<perm_string>* list_from_identifier(char*id)
{ {
list<perm_string>*tmp = new list<perm_string>; std::list<perm_string>*tmp = new std::list<perm_string>;
tmp->push_back(lex_strings.make(id)); tmp->push_back(lex_strings.make(id));
delete[]id; delete[]id;
return tmp; return tmp;
} }
static list<perm_string>* list_from_identifier(list<perm_string>*tmp, char*id) static std::list<perm_string>* list_from_identifier(list<perm_string>*tmp, char*id)
{ {
tmp->push_back(lex_strings.make(id)); tmp->push_back(lex_strings.make(id));
delete[]id; delete[]id;
@ -175,15 +177,15 @@ static list<perm_string>* list_from_identifier(list<perm_string>*tmp, char*id)
list<pform_range_t>* copy_range(list<pform_range_t>* orig) list<pform_range_t>* copy_range(list<pform_range_t>* orig)
{ {
list<pform_range_t>*copy = 0; std::list<pform_range_t>*copy = 0;
if (orig) if (orig)
copy = new list<pform_range_t> (*orig); copy = new std::list<pform_range_t> (*orig);
return copy; return copy;
} }
template <class T> void append(vector<T>&out, const vector<T>&in) template <class T> void append(vector<T>&out, const std::vector<T>&in)
{ {
for (size_t idx = 0 ; idx < in.size() ; idx += 1) for (size_t idx = 0 ; idx < in.size() ; idx += 1)
out.push_back(in[idx]); out.push_back(in[idx]);
@ -207,7 +209,7 @@ static void strip_tail_items(list<PExpr*>*lst)
*/ */
static PECallFunction*make_call_function(perm_string tn, PExpr*arg) static PECallFunction*make_call_function(perm_string tn, PExpr*arg)
{ {
vector<PExpr*> parms(1); std::vector<PExpr*> parms(1);
parms[0] = arg; parms[0] = arg;
PECallFunction*tmp = new PECallFunction(tn, parms); PECallFunction*tmp = new PECallFunction(tn, parms);
return tmp; return tmp;
@ -215,16 +217,16 @@ static PECallFunction*make_call_function(perm_string tn, PExpr*arg)
static PECallFunction*make_call_function(perm_string tn, PExpr*arg1, PExpr*arg2) static PECallFunction*make_call_function(perm_string tn, PExpr*arg1, PExpr*arg2)
{ {
vector<PExpr*> parms(2); std::vector<PExpr*> parms(2);
parms[0] = arg1; parms[0] = arg1;
parms[1] = arg2; parms[1] = arg2;
PECallFunction*tmp = new PECallFunction(tn, parms); PECallFunction*tmp = new PECallFunction(tn, parms);
return tmp; return tmp;
} }
static list<named_pexpr_t>* make_named_numbers(perm_string name, long first, long last, PExpr*val =0) static std::list<named_pexpr_t>* make_named_numbers(perm_string name, long first, long last, PExpr*val =0)
{ {
list<named_pexpr_t>*lst = new list<named_pexpr_t>; std::list<named_pexpr_t>*lst = new std::list<named_pexpr_t>;
named_pexpr_t tmp; named_pexpr_t tmp;
// We are counting up. // We are counting up.
if (first <= last) { if (first <= last) {
@ -250,9 +252,9 @@ static list<named_pexpr_t>* make_named_numbers(perm_string name, long first, lon
return lst; return lst;
} }
static list<named_pexpr_t>* make_named_number(perm_string name, PExpr*val =0) static std::list<named_pexpr_t>* make_named_number(perm_string name, PExpr*val =0)
{ {
list<named_pexpr_t>*lst = new list<named_pexpr_t>; std::list<named_pexpr_t>*lst = new std::list<named_pexpr_t>;
named_pexpr_t tmp; named_pexpr_t tmp;
tmp.name = name; tmp.name = name;
tmp.parm = val; tmp.parm = val;
@ -282,7 +284,7 @@ static long check_enum_seq_value(const YYLTYPE&loc, verinum *arg, bool zero_ok)
return value; return value;
} }
static void current_task_set_statement(const YYLTYPE&loc, vector<Statement*>*s) static void current_task_set_statement(const YYLTYPE&loc, std::vector<Statement*>*s)
{ {
if (s == 0) { if (s == 0) {
/* if the statement list is null, then the parser /* if the statement list is null, then the parser
@ -320,7 +322,7 @@ static void current_task_set_statement(const YYLTYPE&loc, vector<Statement*>*s)
current_task->set_statement(tmp); current_task->set_statement(tmp);
} }
static void current_function_set_statement(const YYLTYPE&loc, vector<Statement*>*s) static void current_function_set_statement(const YYLTYPE&loc, std::vector<Statement*>*s)
{ {
if (s == 0) { if (s == 0) {
/* if the statement list is null, then the parser /* if the statement list is null, then the parser
@ -369,11 +371,11 @@ static void current_function_set_statement(const YYLTYPE&loc, vector<Statement*>
/* text items are C strings allocated by the lexor using /* text items are C strings allocated by the lexor using
strdup. They can be put into lists with the texts type. */ strdup. They can be put into lists with the texts type. */
char*text; char*text;
list<perm_string>*perm_strings; std::list<perm_string>*perm_strings;
list<pform_port_t>*port_list; std::list<pform_port_t>*port_list;
vector<pform_tf_port_t>* tf_ports; std::vector<pform_tf_port_t>* tf_ports;
pform_name_t*pform_name; pform_name_t*pform_name;
@ -381,7 +383,7 @@ static void current_function_set_statement(const YYLTYPE&loc, vector<Statement*>
hname_t*hier; hname_t*hier;
list<string>*strings; std::list<std::string>*strings;
struct str_pair_t drive; struct str_pair_t drive;
@ -393,18 +395,18 @@ static void current_function_set_statement(const YYLTYPE&loc, vector<Statement*>
Module::port_t *mport; Module::port_t *mport;
LexicalScope::range_t* value_range; LexicalScope::range_t* value_range;
vector<Module::port_t*>*mports; std::vector<Module::port_t*>*mports;
named_number_t* named_number; named_number_t* named_number;
list<named_number_t>* named_numbers; std::list<named_number_t>* named_numbers;
named_pexpr_t*named_pexpr; named_pexpr_t*named_pexpr;
list<named_pexpr_t>*named_pexprs; std::list<named_pexpr_t>*named_pexprs;
struct parmvalue_t*parmvalue; struct parmvalue_t*parmvalue;
list<pform_range_t>*ranges; std::list<pform_range_t>*ranges;
PExpr*expr; PExpr*expr;
list<PExpr*>*exprs; std::list<PExpr*>*exprs;
svector<PEEvent*>*event_expr; svector<PEEvent*>*event_expr;
@ -416,20 +418,20 @@ static void current_function_set_statement(const YYLTYPE&loc, vector<Statement*>
PBlock::BL_TYPE join_keyword; PBlock::BL_TYPE join_keyword;
PWire*wire; PWire*wire;
vector<PWire*>*wires; std::vector<PWire*>*wires;
PEventStatement*event_statement; PEventStatement*event_statement;
Statement*statement; Statement*statement;
vector<Statement*>*statement_list; std::vector<Statement*>*statement_list;
net_decl_assign_t*net_decl_assign; net_decl_assign_t*net_decl_assign;
enum_type_t*enum_type; enum_type_t*enum_type;
decl_assignment_t*decl_assignment; decl_assignment_t*decl_assignment;
list<decl_assignment_t*>*decl_assignments; std::list<decl_assignment_t*>*decl_assignments;
struct_member_t*struct_member; struct_member_t*struct_member;
list<struct_member_t*>*struct_members; std::list<struct_member_t*>*struct_members;
struct_type_t*struct_type; struct_type_t*struct_type;
data_type_t*data_type; data_type_t*data_type;
@ -445,7 +447,7 @@ static void current_function_set_statement(const YYLTYPE&loc, vector<Statement*>
struct { struct {
data_type_t*type; data_type_t*type;
list<PExpr*>*exprs; std::list<PExpr*>*exprs;
} class_declaration_extends; } class_declaration_extends;
struct { struct {
@ -458,7 +460,7 @@ static void current_function_set_statement(const YYLTYPE&loc, vector<Statement*>
verireal* realtime; verireal* realtime;
PSpecPath* specpath; PSpecPath* specpath;
list<index_component_t> *dimensions; std::list<index_component_t> *dimensions;
LexicalScope::lifetime_t lifetime; LexicalScope::lifetime_t lifetime;
}; };
@ -981,7 +983,7 @@ class_item_qualifier_opt
class_new /* IEEE1800-2005 A.2.4 */ class_new /* IEEE1800-2005 A.2.4 */
: K_new '(' expression_list_with_nuls ')' : K_new '(' expression_list_with_nuls ')'
{ list<PExpr*>*expr_list = $3; { std::list<PExpr*>*expr_list = $3;
strip_tail_items(expr_list); strip_tail_items(expr_list);
PENewClass*tmp = new PENewClass(*expr_list); PENewClass*tmp = new PENewClass(*expr_list);
FILE_NAME(tmp, @1); FILE_NAME(tmp, @1);
@ -1197,14 +1199,14 @@ data_type /* IEEE1800-2005: A.2.2.1 */
$$ = tmp; $$ = tmp;
} }
| K_integer signed_unsigned_opt | K_integer signed_unsigned_opt
{ list<pform_range_t>*pd = make_range_from_width(integer_width); { std::list<pform_range_t>*pd = make_range_from_width(integer_width);
vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $2, pd); vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $2, pd);
tmp->reg_flag = true; tmp->reg_flag = true;
tmp->integer_flag = true; tmp->integer_flag = true;
$$ = tmp; $$ = tmp;
} }
| K_time unsigned_signed_opt | K_time unsigned_signed_opt
{ list<pform_range_t>*pd = make_range_from_width(64); { std::list<pform_range_t>*pd = make_range_from_width(64);
vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $2, pd); vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $2, pd);
tmp->reg_flag = !gn_system_verilog(); tmp->reg_flag = !gn_system_verilog();
$$ = tmp; $$ = tmp;
@ -1750,12 +1752,12 @@ loop_statement /* IEEE1800-2005: A.6.8 */
/* TODO: Replace register_variable_list with list_of_variable_decl_assignments. */ /* TODO: Replace register_variable_list with list_of_variable_decl_assignments. */
list_of_variable_decl_assignments /* IEEE1800-2005 A.2.3 */ list_of_variable_decl_assignments /* IEEE1800-2005 A.2.3 */
: variable_decl_assignment : variable_decl_assignment
{ list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>; { std::list<decl_assignment_t*>*tmp = new std::list<decl_assignment_t*>;
tmp->push_back($1); tmp->push_back($1);
$$ = tmp; $$ = tmp;
} }
| list_of_variable_decl_assignments ',' variable_decl_assignment | list_of_variable_decl_assignments ',' variable_decl_assignment
{ list<decl_assignment_t*>*tmp = $1; { std::list<decl_assignment_t*>*tmp = $1;
tmp->push_back($3); tmp->push_back($3);
$$ = tmp; $$ = tmp;
} }
@ -1800,13 +1802,13 @@ variable_decl_assignment /* IEEE1800-2005 A.2.3 */
loop_variables /* IEEE1800-2005: A.6.8 */ loop_variables /* IEEE1800-2005: A.6.8 */
: loop_variables ',' IDENTIFIER : loop_variables ',' IDENTIFIER
{ list<perm_string>*tmp = $1; { std::list<perm_string>*tmp = $1;
tmp->push_back(lex_strings.make($3)); tmp->push_back(lex_strings.make($3));
delete[]$3; delete[]$3;
$$ = tmp; $$ = tmp;
} }
| IDENTIFIER | IDENTIFIER
{ list<perm_string>*tmp = new list<perm_string>; { std::list<perm_string>*tmp = new std::list<perm_string>;
tmp->push_back(lex_strings.make($1)); tmp->push_back(lex_strings.make($1));
delete[]$1; delete[]$1;
$$ = tmp; $$ = tmp;
@ -2115,7 +2117,7 @@ simple_immediate_assertion_statement /* IEEE1800-2012 A.6.10 */
: assert_or_assume '(' expression ')' statement_or_null %prec less_than_K_else : assert_or_assume '(' expression ')' statement_or_null %prec less_than_K_else
{ {
if (gn_supported_assertions_flag) { if (gn_supported_assertions_flag) {
list<PExpr*>arg_list; std::list<PExpr*>arg_list;
PCallTask*tmp1 = new PCallTask(lex_strings.make("$error"), arg_list); PCallTask*tmp1 = new PCallTask(lex_strings.make("$error"), arg_list);
FILE_NAME(tmp1, @1); FILE_NAME(tmp1, @1);
PCondit*tmp2 = new PCondit($3, $5, tmp1); PCondit*tmp2 = new PCondit($3, $5, tmp1);
@ -2201,14 +2203,14 @@ simple_type_or_string /* IEEE1800-2005: A.2.2.1 */
$$ = tmp; $$ = tmp;
} }
| K_integer | K_integer
{ list<pform_range_t>*pd = make_range_from_width(integer_width); { std::list<pform_range_t>*pd = make_range_from_width(integer_width);
vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd); vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
tmp->reg_flag = true; tmp->reg_flag = true;
tmp->integer_flag = true; tmp->integer_flag = true;
$$ = tmp; $$ = tmp;
} }
| K_time | K_time
{ list<pform_range_t>*pd = make_range_from_width(64); { std::list<pform_range_t>*pd = make_range_from_width(64);
vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd); vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
tmp->reg_flag = !gn_system_verilog(); tmp->reg_flag = !gn_system_verilog();
$$ = tmp; $$ = tmp;
@ -2388,7 +2390,7 @@ task_declaration /* IEEE1800-2005: A.2.7 */
tf_port_declaration /* IEEE1800-2005: A.2.7 */ tf_port_declaration /* IEEE1800-2005: A.2.7 */
: port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';'
{ vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, { std::vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1,
$2 ? IVL_VT_LOGIC : $2 ? IVL_VT_LOGIC :
IVL_VT_NO_TYPE, IVL_VT_NO_TYPE,
$3, $4, $5); $3, $4, $5);
@ -2399,7 +2401,7 @@ tf_port_declaration /* IEEE1800-2005: A.2.7 */
shape. Generate a range ([31:0]) to make it work. */ shape. Generate a range ([31:0]) to make it work. */
| port_direction K_integer list_of_identifiers ';' | port_direction K_integer list_of_identifiers ';'
{ list<pform_range_t>*range_stub = make_range_from_width(integer_width); { std::list<pform_range_t>*range_stub = make_range_from_width(integer_width);
vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, true, vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, true,
range_stub, $3, true); range_stub, $3, true);
$$ = tmp; $$ = tmp;
@ -2408,7 +2410,7 @@ tf_port_declaration /* IEEE1800-2005: A.2.7 */
/* Ports can be time with a width of [63:0] (unsigned). */ /* Ports can be time with a width of [63:0] (unsigned). */
| port_direction K_time list_of_identifiers ';' | port_direction K_time list_of_identifiers ';'
{ list<pform_range_t>*range_stub = make_range_from_width(64); { std::list<pform_range_t>*range_stub = make_range_from_width(64);
vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, false, vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, false,
range_stub, $3); range_stub, $3);
$$ = tmp; $$ = tmp;
@ -2417,7 +2419,7 @@ tf_port_declaration /* IEEE1800-2005: A.2.7 */
/* Ports can be real or realtime. */ /* Ports can be real or realtime. */
| port_direction real_or_realtime list_of_identifiers ';' | port_direction real_or_realtime list_of_identifiers ';'
{ vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_REAL, true, { std::vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_REAL, true,
0, $3); 0, $3);
$$ = tmp; $$ = tmp;
} }
@ -2426,7 +2428,7 @@ tf_port_declaration /* IEEE1800-2005: A.2.7 */
/* Ports can be string. */ /* Ports can be string. */
| port_direction K_string list_of_identifiers ';' | port_direction K_string list_of_identifiers ';'
{ vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_STRING, true, { std::vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_STRING, true,
0, $3); 0, $3);
$$ = tmp; $$ = tmp;
} }
@ -2445,7 +2447,7 @@ tf_port_declaration /* IEEE1800-2005: A.2.7 */
tf_port_item /* IEEE1800-2005: A.2.7 */ tf_port_item /* IEEE1800-2005: A.2.7 */
: port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt
{ vector<pform_tf_port_t>*tmp; { std::vector<pform_tf_port_t>*tmp;
NetNet::PortType use_port_type = $1; NetNet::PortType use_port_type = $1;
if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || ($2 == 0))) if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || ($2 == 0)))
use_port_type = port_declaration_context.port_type; use_port_type = port_declaration_context.port_type;
@ -2526,7 +2528,7 @@ tf_port_list /* IEEE1800-2005: A.2.7 */
tf_port_item_list tf_port_item_list
: tf_port_item_list ',' tf_port_item : tf_port_item_list ',' tf_port_item
{ vector<pform_tf_port_t>*tmp; { std::vector<pform_tf_port_t>*tmp;
if ($1 && $3) { if ($1 && $3) {
size_t s1 = $1->size(); size_t s1 = $1->size();
tmp = $1; tmp = $1;
@ -2590,7 +2592,7 @@ value_range /* IEEE1800-2005: A.8.3 */
variable_dimension /* IEEE1800-2005: A.2.5 */ variable_dimension /* IEEE1800-2005: A.2.5 */
: '[' expression ':' expression ']' : '[' expression ':' expression ']'
{ list<pform_range_t> *tmp = new list<pform_range_t>; { std::list<pform_range_t> *tmp = new std::list<pform_range_t>;
pform_range_t index ($2,$4); pform_range_t index ($2,$4);
tmp->push_back(index); tmp->push_back(index);
$$ = tmp; $$ = tmp;
@ -2602,20 +2604,20 @@ variable_dimension /* IEEE1800-2005: A.2.5 */
cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. " cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
<< "Use at least -g2005-sv to remove this warning." << endl; << "Use at least -g2005-sv to remove this warning." << endl;
} }
list<pform_range_t> *tmp = new list<pform_range_t>; list<pform_range_t> *tmp = new std::list<pform_range_t>;
pform_range_t index ($2,0); pform_range_t index ($2,0);
tmp->push_back(index); tmp->push_back(index);
$$ = tmp; $$ = tmp;
} }
| '[' ']' | '[' ']'
{ list<pform_range_t> *tmp = new list<pform_range_t>; { std::list<pform_range_t> *tmp = new std::list<pform_range_t>;
pform_range_t index (0,0); pform_range_t index (0,0);
tmp->push_back(index); tmp->push_back(index);
$$ = tmp; $$ = tmp;
} }
| '[' '$' ']' | '[' '$' ']'
{ // SystemVerilog queue { // SystemVerilog queue
list<pform_range_t> *tmp = new list<pform_range_t>; list<pform_range_t> *tmp = new std::list<pform_range_t>;
pform_range_t index (new PENull,0); pform_range_t index (new PENull,0);
if (!gn_system_verilog()) { if (!gn_system_verilog()) {
yyerror("error: Queue declarations require SystemVerilog."); yyerror("error: Queue declarations require SystemVerilog.");
@ -2625,7 +2627,7 @@ variable_dimension /* IEEE1800-2005: A.2.5 */
} }
| '[' '$' ':' expression ']' | '[' '$' ':' expression ']'
{ // SystemVerilog queue with a max size { // SystemVerilog queue with a max size
list<pform_range_t> *tmp = new list<pform_range_t>; list<pform_range_t> *tmp = new std::list<pform_range_t>;
pform_range_t index (new PENull,$4); pform_range_t index (new PENull,$4);
if (!gn_system_verilog()) { if (!gn_system_verilog()) {
yyerror("error: Queue declarations require SystemVerilog."); yyerror("error: Queue declarations require SystemVerilog.");
@ -2663,7 +2665,7 @@ attribute_instance_list
| K_PSTAR attribute_list K_STARP { $$ = $2; } | K_PSTAR attribute_list K_STARP { $$ = $2; }
| attribute_instance_list K_PSTAR K_STARP { $$ = $1; } | attribute_instance_list K_PSTAR K_STARP { $$ = $1; }
| attribute_instance_list K_PSTAR attribute_list K_STARP | attribute_instance_list K_PSTAR attribute_list K_STARP
{ list<named_pexpr_t>*tmp = $1; { std::list<named_pexpr_t>*tmp = $1;
if (tmp) { if (tmp) {
tmp->splice(tmp->end(), *$3); tmp->splice(tmp->end(), *$3);
delete $3; delete $3;
@ -2674,13 +2676,13 @@ attribute_instance_list
attribute_list attribute_list
: attribute_list ',' attribute : attribute_list ',' attribute
{ list<named_pexpr_t>*tmp = $1; { std::list<named_pexpr_t>*tmp = $1;
tmp->push_back(*$3); tmp->push_back(*$3);
delete $3; delete $3;
$$ = tmp; $$ = tmp;
} }
| attribute | attribute
{ list<named_pexpr_t>*tmp = new list<named_pexpr_t>; { std::list<named_pexpr_t>*tmp = new std::list<named_pexpr_t>;
tmp->push_back(*$1); tmp->push_back(*$1);
delete $1; delete $1;
$$ = tmp; $$ = tmp;
@ -2914,7 +2916,7 @@ enum_name_list
{ $$ = $1; { $$ = $1;
} }
| enum_name_list ',' enum_name | enum_name_list ',' enum_name
{ list<named_pexpr_t>*lst = $1; { std::list<named_pexpr_t>*lst = $1;
lst->splice(lst->end(), *$3); lst->splice(lst->end(), *$3);
delete $3; delete $3;
$$ = lst; $$ = lst;
@ -3018,12 +3020,12 @@ struct_data_type
in IEEE 1800-2012 A.2.2.1. */ in IEEE 1800-2012 A.2.2.1. */
struct_union_member_list struct_union_member_list
: struct_union_member_list struct_union_member : struct_union_member_list struct_union_member
{ list<struct_member_t*>*tmp = $1; { std::list<struct_member_t*>*tmp = $1;
tmp->push_back($2); tmp->push_back($2);
$$ = tmp; $$ = tmp;
} }
| struct_union_member | struct_union_member
{ list<struct_member_t*>*tmp = new list<struct_member_t*>; { std::list<struct_member_t*>*tmp = new std::list<struct_member_t*>;
tmp->push_back($1); tmp->push_back($1);
$$ = tmp; $$ = tmp;
} }
@ -3111,12 +3113,12 @@ defparam_assign_list
delay1 delay1
: '#' delay_value_simple : '#' delay_value_simple
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($2); tmp->push_back($2);
$$ = tmp; $$ = tmp;
} }
| '#' '(' delay_value ')' | '#' '(' delay_value ')'
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($3); tmp->push_back($3);
$$ = tmp; $$ = tmp;
} }
@ -3124,23 +3126,23 @@ delay1
delay3 delay3
: '#' delay_value_simple : '#' delay_value_simple
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($2); tmp->push_back($2);
$$ = tmp; $$ = tmp;
} }
| '#' '(' delay_value ')' | '#' '(' delay_value ')'
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($3); tmp->push_back($3);
$$ = tmp; $$ = tmp;
} }
| '#' '(' delay_value ',' delay_value ')' | '#' '(' delay_value ',' delay_value ')'
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($3); tmp->push_back($3);
tmp->push_back($5); tmp->push_back($5);
$$ = tmp; $$ = tmp;
} }
| '#' '(' delay_value ',' delay_value ',' delay_value ')' | '#' '(' delay_value ',' delay_value ',' delay_value ')'
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($3); tmp->push_back($3);
tmp->push_back($5); tmp->push_back($5);
tmp->push_back($7); tmp->push_back($7);
@ -3155,12 +3157,12 @@ delay3_opt
delay_value_list delay_value_list
: delay_value : delay_value
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($1); tmp->push_back($1);
$$ = tmp; $$ = tmp;
} }
| delay_value_list ',' delay_value | delay_value_list ',' delay_value
{ list<PExpr*>*tmp = $1; { std::list<PExpr*>*tmp = $1;
tmp->push_back($3); tmp->push_back($3);
$$ = tmp; $$ = tmp;
} }
@ -3737,22 +3739,22 @@ expr_mintypmax
expression_list_with_nuls expression_list_with_nuls
: expression_list_with_nuls ',' expression : expression_list_with_nuls ',' expression
{ list<PExpr*>*tmp = $1; { std::list<PExpr*>*tmp = $1;
if (tmp->empty()) tmp->push_back(0); if (tmp->empty()) tmp->push_back(0);
tmp->push_back($3); tmp->push_back($3);
$$ = tmp; $$ = tmp;
} }
| expression | expression
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($1); tmp->push_back($1);
$$ = tmp; $$ = tmp;
} }
| |
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
$$ = tmp; $$ = tmp;
} }
| expression_list_with_nuls ',' | expression_list_with_nuls ','
{ list<PExpr*>*tmp = $1; { std::list<PExpr*>*tmp = $1;
if (tmp->empty()) tmp->push_back(0); if (tmp->empty()) tmp->push_back(0);
tmp->push_back(0); tmp->push_back(0);
$$ = tmp; $$ = tmp;
@ -3761,12 +3763,12 @@ expression_list_with_nuls
expression_list_proper expression_list_proper
: expression_list_proper ',' expression : expression_list_proper ',' expression
{ list<PExpr*>*tmp = $1; { std::list<PExpr*>*tmp = $1;
tmp->push_back($3); tmp->push_back($3);
$$ = tmp; $$ = tmp;
} }
| expression | expression
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($1); tmp->push_back($1);
$$ = tmp; $$ = tmp;
} }
@ -3848,7 +3850,7 @@ expr_primary
call. It can also be a call to a class method (function). */ call. It can also be a call to a class method (function). */
| hierarchy_identifier attribute_list_opt '(' expression_list_with_nuls ')' | hierarchy_identifier attribute_list_opt '(' expression_list_with_nuls ')'
{ list<PExpr*>*expr_list = $4; { std::list<PExpr*>*expr_list = $4;
strip_tail_items(expr_list); strip_tail_items(expr_list);
PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list); PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
delete $1; delete $1;
@ -3884,7 +3886,7 @@ expr_primary
} }
| SYSTEM_IDENTIFIER '(' ')' | SYSTEM_IDENTIFIER '(' ')'
{ perm_string tn = lex_strings.make($1); { perm_string tn = lex_strings.make($1);
const vector<PExpr*>empty; const std::vector<PExpr*>empty;
PECallFunction*tmp = new PECallFunction(tn, empty); PECallFunction*tmp = new PECallFunction(tn, empty);
FILE_NAME(tmp, @1); FILE_NAME(tmp, @1);
delete[]$1; delete[]$1;
@ -4120,7 +4122,7 @@ expr_primary
| '{' '}' | '{' '}'
{ // This is the empty queue syntax. { // This is the empty queue syntax.
if (gn_system_verilog()) { if (gn_system_verilog()) {
list<PExpr*> empty_list; std::list<PExpr*> empty_list;
PEConcat*tmp = new PEConcat(empty_list); PEConcat*tmp = new PEConcat(empty_list);
FILE_NAME(tmp, @1); FILE_NAME(tmp, @1);
$$ = tmp; $$ = tmp;
@ -4188,7 +4190,7 @@ function_item_list
| function_item_list function_item | function_item_list function_item
{ /* */ { /* */
if ($1 && $2) { if ($1 && $2) {
vector<pform_tf_port_t>*tmp = $1; std::vector<pform_tf_port_t>*tmp = $1;
size_t s1 = tmp->size(); size_t s1 = tmp->size();
tmp->resize(s1 + $2->size()); tmp->resize(s1 + $2->size());
for (size_t idx = 0 ; idx < $2->size() ; idx += 1) for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
@ -4488,13 +4490,13 @@ list_of_variable_port_identifiers
list_of_ports list_of_ports
: port_opt : port_opt
{ vector<Module::port_t*>*tmp { std::vector<Module::port_t*>*tmp
= new vector<Module::port_t*>(1); = new std::vector<Module::port_t*>(1);
(*tmp)[0] = $1; (*tmp)[0] = $1;
$$ = tmp; $$ = tmp;
} }
| list_of_ports ',' port_opt | list_of_ports ',' port_opt
{ vector<Module::port_t*>*tmp = $1; { std::vector<Module::port_t*>*tmp = $1;
tmp->push_back($3); tmp->push_back($3);
$$ = tmp; $$ = tmp;
} }
@ -4502,13 +4504,13 @@ list_of_ports
list_of_port_declarations list_of_port_declarations
: port_declaration : port_declaration
{ vector<Module::port_t*>*tmp { std::vector<Module::port_t*>*tmp
= new vector<Module::port_t*>(1); = new std::vector<Module::port_t*>(1);
(*tmp)[0] = $1; (*tmp)[0] = $1;
$$ = tmp; $$ = tmp;
} }
| list_of_port_declarations ',' port_declaration | list_of_port_declarations ',' port_declaration
{ vector<Module::port_t*>*tmp = $1; { std::vector<Module::port_t*>*tmp = $1;
tmp->push_back($3); tmp->push_back($3);
$$ = tmp; $$ = tmp;
} }
@ -4517,7 +4519,7 @@ list_of_port_declarations
perm_string name = lex_strings.make($3); perm_string name = lex_strings.make($3);
ptmp = pform_module_port_reference(name, @3.text, ptmp = pform_module_port_reference(name, @3.text,
@3.first_line); @3.first_line);
vector<Module::port_t*>*tmp = $1; std::vector<Module::port_t*>*tmp = $1;
tmp->push_back(ptmp); tmp->push_back(ptmp);
/* Get the port declaration details, the port type /* Get the port declaration details, the port type
@ -4765,7 +4767,7 @@ lpvalue
cont_assign cont_assign
: lpvalue '=' expression : lpvalue '=' expression
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($1); tmp->push_back($1);
tmp->push_back($3); tmp->push_back($3);
$$ = tmp; $$ = tmp;
@ -4774,7 +4776,7 @@ cont_assign
cont_assign_list cont_assign_list
: cont_assign_list ',' cont_assign : cont_assign_list ',' cont_assign
{ list<PExpr*>*tmp = $1; { std::list<PExpr*>*tmp = $1;
tmp->splice(tmp->end(), *$3); tmp->splice(tmp->end(), *$3);
delete $3; delete $3;
$$ = tmp; $$ = tmp;
@ -5654,7 +5656,7 @@ parameter_value_opt
FILE_NAME(tmp, @1); FILE_NAME(tmp, @1);
struct parmvalue_t*lst = new struct parmvalue_t; struct parmvalue_t*lst = new struct parmvalue_t;
lst->by_order = new list<PExpr*>; lst->by_order = new std::list<PExpr*>;
lst->by_order->push_back(tmp); lst->by_order->push_back(tmp);
lst->by_name = 0; lst->by_name = 0;
$$ = lst; $$ = lst;
@ -5666,7 +5668,7 @@ parameter_value_opt
FILE_NAME(tmp, @1); FILE_NAME(tmp, @1);
struct parmvalue_t*lst = new struct parmvalue_t; struct parmvalue_t*lst = new struct parmvalue_t;
lst->by_order = new list<PExpr*>; lst->by_order = new std::list<PExpr*>;
lst->by_order->push_back(tmp); lst->by_order->push_back(tmp);
lst->by_name = 0; lst->by_name = 0;
$$ = lst; $$ = lst;
@ -5699,13 +5701,13 @@ parameter_value_byname
parameter_value_byname_list parameter_value_byname_list
: parameter_value_byname : parameter_value_byname
{ list<named_pexpr_t>*tmp = new list<named_pexpr_t>; { std::list<named_pexpr_t>*tmp = new std::list<named_pexpr_t>;
tmp->push_back(*$1); tmp->push_back(*$1);
delete $1; delete $1;
$$ = tmp; $$ = tmp;
} }
| parameter_value_byname_list ',' parameter_value_byname | parameter_value_byname_list ',' parameter_value_byname
{ list<named_pexpr_t>*tmp = $1; { std::list<named_pexpr_t>*tmp = $1;
tmp->push_back(*$3); tmp->push_back(*$3);
delete $3; delete $3;
$$ = tmp; $$ = tmp;
@ -5817,13 +5819,13 @@ port_name
port_name_list port_name_list
: port_name_list ',' port_name : port_name_list ',' port_name
{ list<named_pexpr_t>*tmp = $1; { std::list<named_pexpr_t>*tmp = $1;
tmp->push_back(*$3); tmp->push_back(*$3);
delete $3; delete $3;
$$ = tmp; $$ = tmp;
} }
| port_name | port_name
{ list<named_pexpr_t>*tmp = new list<named_pexpr_t>; { std::list<named_pexpr_t>*tmp = new std::list<named_pexpr_t>;
tmp->push_back(*$1); tmp->push_back(*$1);
delete $1; delete $1;
$$ = tmp; $$ = tmp;
@ -5832,24 +5834,24 @@ port_name_list
port_conn_expression_list_with_nuls port_conn_expression_list_with_nuls
: port_conn_expression_list_with_nuls ',' attribute_list_opt expression : port_conn_expression_list_with_nuls ',' attribute_list_opt expression
{ list<PExpr*>*tmp = $1; { std::list<PExpr*>*tmp = $1;
tmp->push_back($4); tmp->push_back($4);
delete $3; delete $3;
$$ = tmp; $$ = tmp;
} }
| attribute_list_opt expression | attribute_list_opt expression
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($2); tmp->push_back($2);
delete $1; delete $1;
$$ = tmp; $$ = tmp;
} }
| |
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back(0); tmp->push_back(0);
$$ = tmp; $$ = tmp;
} }
| port_conn_expression_list_with_nuls ',' | port_conn_expression_list_with_nuls ','
{ list<PExpr*>*tmp = $1; { std::list<PExpr*>*tmp = $1;
tmp->push_back(0); tmp->push_back(0);
$$ = tmp; $$ = tmp;
} }
@ -5954,7 +5956,7 @@ dimensions
: variable_dimension : variable_dimension
{ $$ = $1; } { $$ = $1; }
| dimensions variable_dimension | dimensions variable_dimension
{ list<pform_range_t> *tmp = $1; { std::list<pform_range_t> *tmp = $1;
if ($2) { if ($2) {
tmp->splice(tmp->end(), *$2); tmp->splice(tmp->end(), *$2);
delete $2; delete $2;
@ -6008,13 +6010,13 @@ register_variable
register_variable_list register_variable_list
: register_variable : register_variable
{ list<perm_string>*tmp = new list<perm_string>; { std::list<perm_string>*tmp = new std::list<perm_string>;
tmp->push_back(lex_strings.make($1)); tmp->push_back(lex_strings.make($1));
$$ = tmp; $$ = tmp;
delete[]$1; delete[]$1;
} }
| register_variable_list ',' register_variable | register_variable_list ',' register_variable
{ list<perm_string>*tmp = $1; { std::list<perm_string>*tmp = $1;
tmp->push_back(lex_strings.make($3)); tmp->push_back(lex_strings.make($3));
$$ = tmp; $$ = tmp;
delete[]$3; delete[]$3;
@ -6033,13 +6035,13 @@ net_variable
net_variable_list net_variable_list
: net_variable : net_variable
{ list<perm_string>*tmp = new list<perm_string>; { std::list<perm_string>*tmp = new std::list<perm_string>;
tmp->push_back(lex_strings.make($1)); tmp->push_back(lex_strings.make($1));
$$ = tmp; $$ = tmp;
delete[]$1; delete[]$1;
} }
| net_variable_list ',' net_variable | net_variable_list ',' net_variable
{ list<perm_string>*tmp = $1; { std::list<perm_string>*tmp = $1;
tmp->push_back(lex_strings.make($3)); tmp->push_back(lex_strings.make($3));
$$ = tmp; $$ = tmp;
delete[]$3; delete[]$3;
@ -6185,7 +6187,7 @@ specify_edge_path_decl
: specify_edge_path '=' '(' delay_value_list ')' : specify_edge_path '=' '(' delay_value_list ')'
{ $$ = pform_assign_path_delay($1, $4); } { $$ = pform_assign_path_delay($1, $4); }
| specify_edge_path '=' delay_value_simple | specify_edge_path '=' delay_value_simple
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($3); tmp->push_back($3);
$$ = pform_assign_path_delay($1, tmp); $$ = pform_assign_path_delay($1, tmp);
} }
@ -6222,7 +6224,7 @@ specify_simple_path_decl
: specify_simple_path '=' '(' delay_value_list ')' : specify_simple_path '=' '(' delay_value_list ')'
{ $$ = pform_assign_path_delay($1, $4); } { $$ = pform_assign_path_delay($1, $4); }
| specify_simple_path '=' delay_value_simple | specify_simple_path '=' delay_value_simple
{ list<PExpr*>*tmp = new list<PExpr*>; { std::list<PExpr*>*tmp = new std::list<PExpr*>;
tmp->push_back($3); tmp->push_back($3);
$$ = pform_assign_path_delay($1, tmp); $$ = pform_assign_path_delay($1, tmp);
} }
@ -6248,7 +6250,7 @@ specify_simple_path
specify_path_identifiers specify_path_identifiers
: IDENTIFIER : IDENTIFIER
{ list<perm_string>*tmp = new list<perm_string>; { std::list<perm_string>*tmp = new std::list<perm_string>;
tmp->push_back(lex_strings.make($1)); tmp->push_back(lex_strings.make($1));
$$ = tmp; $$ = tmp;
delete[]$1; delete[]$1;
@ -6259,7 +6261,7 @@ specify_path_identifiers
"in path declarations. The declaration " "in path declarations. The declaration "
"will be applied to the whole vector."); "will be applied to the whole vector.");
} }
list<perm_string>*tmp = new list<perm_string>; std::list<perm_string>*tmp = new std::list<perm_string>;
tmp->push_back(lex_strings.make($1)); tmp->push_back(lex_strings.make($1));
$$ = tmp; $$ = tmp;
delete[]$1; delete[]$1;
@ -6270,13 +6272,13 @@ specify_path_identifiers
"in path declarations. The declaration " "in path declarations. The declaration "
"will be applied to the whole vector."); "will be applied to the whole vector.");
} }
list<perm_string>*tmp = new list<perm_string>; std::list<perm_string>*tmp = new std::list<perm_string>;
tmp->push_back(lex_strings.make($1)); tmp->push_back(lex_strings.make($1));
$$ = tmp; $$ = tmp;
delete[]$1; delete[]$1;
} }
| specify_path_identifiers ',' IDENTIFIER | specify_path_identifiers ',' IDENTIFIER
{ list<perm_string>*tmp = $1; { std::list<perm_string>*tmp = $1;
tmp->push_back(lex_strings.make($3)); tmp->push_back(lex_strings.make($3));
$$ = tmp; $$ = tmp;
delete[]$3; delete[]$3;
@ -6287,7 +6289,7 @@ specify_path_identifiers
"in path declarations. The declaration " "in path declarations. The declaration "
"will be applied to the whole vector."); "will be applied to the whole vector.");
} }
list<perm_string>*tmp = $1; std::list<perm_string>*tmp = $1;
tmp->push_back(lex_strings.make($3)); tmp->push_back(lex_strings.make($3));
$$ = tmp; $$ = tmp;
delete[]$3; delete[]$3;
@ -6298,7 +6300,7 @@ specify_path_identifiers
"in path declarations. The declaration " "in path declarations. The declaration "
"will be applied to the whole vector."); "will be applied to the whole vector.");
} }
list<perm_string>*tmp = $1; std::list<perm_string>*tmp = $1;
tmp->push_back(lex_strings.make($3)); tmp->push_back(lex_strings.make($3));
$$ = tmp; $$ = tmp;
delete[]$3; delete[]$3;
@ -6839,7 +6841,7 @@ statement_item /* This is roughly statement_item in the LRM */
$$ = tmp; $$ = tmp;
} }
| SYSTEM_IDENTIFIER ';' | SYSTEM_IDENTIFIER ';'
{ list<PExpr*>pt; { std::list<PExpr*>pt;
PCallTask*tmp = new PCallTask(lex_strings.make($1), pt); PCallTask*tmp = new PCallTask(lex_strings.make($1), pt);
FILE_NAME(tmp,@1); FILE_NAME(tmp,@1);
delete[]$1; delete[]$1;
@ -6885,7 +6887,7 @@ statement_item /* This is roughly statement_item in the LRM */
} }
| hierarchy_identifier ';' | hierarchy_identifier ';'
{ list<PExpr*>pt; { std::list<PExpr*>pt;
PCallTask*tmp = pform_make_call_task(@1, *$1, pt); PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
delete $1; delete $1;
$$ = tmp; $$ = tmp;
@ -6988,12 +6990,12 @@ statement_or_null_list_opt
statement_or_null_list statement_or_null_list
: statement_or_null_list statement_or_null : statement_or_null_list statement_or_null
{ vector<Statement*>*tmp = $1; { std::vector<Statement*>*tmp = $1;
if ($2) tmp->push_back($2); if ($2) tmp->push_back($2);
$$ = tmp; $$ = tmp;
} }
| statement_or_null | statement_or_null
{ vector<Statement*>*tmp = new vector<Statement*>(0); { std::vector<Statement*>*tmp = new std::vector<Statement*>(0);
if ($1) tmp->push_back($1); if ($1) tmp->push_back($1);
$$ = tmp; $$ = tmp;
} }
@ -7007,13 +7009,13 @@ analog_statement
/* Task items are, other than the statement, task port items and /* Task items are, other than the statement, task port items and
other block items. */ other block items. */
task_item task_item
: block_item_decl { $$ = new vector<pform_tf_port_t>(0); } : block_item_decl { $$ = new std::vector<pform_tf_port_t>(0); }
| tf_port_declaration { $$ = $1; } | tf_port_declaration { $$ = $1; }
; ;
task_item_list task_item_list
: task_item_list task_item : task_item_list task_item
{ vector<pform_tf_port_t>*tmp = $1; { std::vector<pform_tf_port_t>*tmp = $1;
size_t s1 = tmp->size(); size_t s1 = tmp->size();
tmp->resize(s1 + $2->size()); tmp->resize(s1 + $2->size());
for (size_t idx = 0 ; idx < $2->size() ; idx += 1) for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
@ -7079,13 +7081,13 @@ udp_comb_entry
udp_comb_entry_list udp_comb_entry_list
: udp_comb_entry : udp_comb_entry
{ list<string>*tmp = new list<string>; { std::list<string>*tmp = new std::list<string>;
tmp->push_back($1); tmp->push_back($1);
delete[]$1; delete[]$1;
$$ = tmp; $$ = tmp;
} }
| udp_comb_entry_list udp_comb_entry | udp_comb_entry_list udp_comb_entry
{ list<string>*tmp = $1; { std::list<string>*tmp = $1;
tmp->push_back($2); tmp->push_back($2);
delete[]$2; delete[]$2;
$$ = tmp; $$ = tmp;
@ -7094,13 +7096,13 @@ udp_comb_entry_list
udp_sequ_entry_list udp_sequ_entry_list
: udp_sequ_entry : udp_sequ_entry
{ list<string>*tmp = new list<string>; { std::list<string>*tmp = new std::list<string>;
tmp->push_back($1); tmp->push_back($1);
delete[]$1; delete[]$1;
$$ = tmp; $$ = tmp;
} }
| udp_sequ_entry_list udp_sequ_entry | udp_sequ_entry_list udp_sequ_entry
{ list<string>*tmp = $1; { std::list<string>*tmp = $1;
tmp->push_back($2); tmp->push_back($2);
delete[]$2; delete[]$2;
$$ = tmp; $$ = tmp;
@ -7199,7 +7201,7 @@ udp_port_decl
| K_output IDENTIFIER ';' | K_output IDENTIFIER ';'
{ perm_string pname = lex_strings.make($2); { perm_string pname = lex_strings.make($2);
PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC); PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
vector<PWire*>*tmp = new vector<PWire*>(1); vector<PWire*>*tmp = new std::vector<PWire*>(1);
(*tmp)[0] = pp; (*tmp)[0] = pp;
$$ = tmp; $$ = tmp;
delete[]$2; delete[]$2;
@ -7207,7 +7209,7 @@ udp_port_decl
| K_reg IDENTIFIER ';' | K_reg IDENTIFIER ';'
{ perm_string pname = lex_strings.make($2); { perm_string pname = lex_strings.make($2);
PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC); PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
vector<PWire*>*tmp = new vector<PWire*>(1); vector<PWire*>*tmp = new std::vector<PWire*>(1);
(*tmp)[0] = pp; (*tmp)[0] = pp;
$$ = tmp; $$ = tmp;
delete[]$2; delete[]$2;
@ -7215,7 +7217,7 @@ udp_port_decl
| K_reg K_output IDENTIFIER ';' | K_reg K_output IDENTIFIER ';'
{ perm_string pname = lex_strings.make($3); { perm_string pname = lex_strings.make($3);
PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC); PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
vector<PWire*>*tmp = new vector<PWire*>(1); vector<PWire*>*tmp = new std::vector<PWire*>(1);
(*tmp)[0] = pp; (*tmp)[0] = pp;
$$ = tmp; $$ = tmp;
delete[]$3; delete[]$3;
@ -7226,7 +7228,7 @@ udp_port_decls
: udp_port_decl : udp_port_decl
{ $$ = $1; } { $$ = $1; }
| udp_port_decls udp_port_decl | udp_port_decls udp_port_decl
{ vector<PWire*>*tmp = $1; { std::vector<PWire*>*tmp = $1;
size_t s1 = $1->size(); size_t s1 = $1->size();
tmp->resize(s1+$2->size()); tmp->resize(s1+$2->size());
for (size_t idx = 0 ; idx < $2->size() ; idx += 1) for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
@ -7238,13 +7240,13 @@ udp_port_decls
udp_port_list udp_port_list
: IDENTIFIER : IDENTIFIER
{ list<perm_string>*tmp = new list<perm_string>; { std::list<perm_string>*tmp = new std::list<perm_string>;
tmp->push_back(lex_strings.make($1)); tmp->push_back(lex_strings.make($1));
delete[]$1; delete[]$1;
$$ = tmp; $$ = tmp;
} }
| udp_port_list ',' IDENTIFIER | udp_port_list ',' IDENTIFIER
{ list<perm_string>*tmp = $1; { std::list<perm_string>*tmp = $1;
tmp->push_back(lex_strings.make($3)); tmp->push_back(lex_strings.make($3));
delete[]$3; delete[]$3;
$$ = tmp; $$ = tmp;
@ -7260,13 +7262,13 @@ udp_initial_expr_opt
udp_input_declaration_list udp_input_declaration_list
: K_input IDENTIFIER : K_input IDENTIFIER
{ list<perm_string>*tmp = new list<perm_string>; { std::list<perm_string>*tmp = new std::list<perm_string>;
tmp->push_back(lex_strings.make($2)); tmp->push_back(lex_strings.make($2));
$$ = tmp; $$ = tmp;
delete[]$2; delete[]$2;
} }
| udp_input_declaration_list ',' K_input IDENTIFIER | udp_input_declaration_list ',' K_input IDENTIFIER
{ list<perm_string>*tmp = $1; { std::list<perm_string>*tmp = $1;
tmp->push_back(lex_strings.make($4)); tmp->push_back(lex_strings.make($4));
$$ = tmp; $$ = tmp;
delete[]$4; delete[]$4;

View File

@ -58,7 +58,7 @@ extern void pform_dump(std::ostream&out, const PTaskFunc*tf);
*/ */
extern int pform_parse(const char*path); extern int pform_parse(const char*path);
extern string vl_file; extern std::string vl_file;
extern void pform_set_timescale(int units, int prec, const char*file, extern void pform_set_timescale(int units, int prec, const char*file,
unsigned lineno); unsigned lineno);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -24,6 +24,8 @@
# include <cstdio> # include <cstdio>
# include <iostream> # include <iostream>
using namespace std;
extern const char*vl_file; extern const char*vl_file;
unsigned error_count = 0; unsigned error_count = 0;
unsigned warn_count = 0; unsigned warn_count = 0;
@ -75,4 +77,3 @@ int VLwrap()
{ {
return -1; return -1;
} }

View File

@ -1,7 +1,7 @@
#ifndef IVL_parse_misc_H #ifndef IVL_parse_misc_H
#define IVL_parse_misc_H #define IVL_parse_misc_H
/* /*
* Copyright (c) 1998-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -64,7 +64,7 @@ extern void VLwarn(const YYLTYPE&loc, const char*msg);
extern void destroy_lexor(); extern void destroy_lexor();
extern ostream& operator << (ostream&, const YYLTYPE&loc); extern std::ostream& operator << (std::ostream&, const YYLTYPE&loc);
extern unsigned error_count, warn_count; extern unsigned error_count, warn_count;
extern unsigned long based_size; extern unsigned long based_size;

View File

@ -45,6 +45,8 @@
# include "ivl_assert.h" # include "ivl_assert.h"
# include "ivl_alloc.h" # include "ivl_alloc.h"
using namespace std;
/* /*
* The "// synthesis translate_on/off" meta-comments cause this flag * The "// synthesis translate_on/off" meta-comments cause this flag
* to be turned off or on. The pform_make_behavior and similar * to be turned off or on. The pform_make_behavior and similar

110
pform.h
View File

@ -89,8 +89,8 @@ extern bool pform_library_flag;
struct parmvalue_t { struct parmvalue_t {
list<PExpr*>*by_order; std::list<PExpr*>*by_order;
list<named_pexpr_t>*by_name; std::list<named_pexpr_t>*by_name;
}; };
struct str_pair_t { ivl_drive_t str0, str1; }; struct str_pair_t { ivl_drive_t str0, str1; };
@ -108,9 +108,9 @@ struct lgate {
: parms(0), parms_by_name(0), file(NULL), lineno(0) : parms(0), parms_by_name(0), file(NULL), lineno(0)
{ } { }
string name; std::string name;
list<PExpr*>*parms; std::list<PExpr*>*parms;
list<named_pexpr_t>*parms_by_name; std::list<named_pexpr_t>*parms_by_name;
pform_range_t range; pform_range_t range;
@ -123,8 +123,8 @@ extern std::list<pform_range_t>* copy_range(std::list<pform_range_t>* orig);
/* Use this function to transform the parted form of the attribute /* Use this function to transform the parted form of the attribute
list to the attribute map that is used later. */ list to the attribute map that is used later. */
extern void pform_bind_attributes(map<perm_string,PExpr*>&attributes, extern void pform_bind_attributes(std::map<perm_string,PExpr*>&attributes,
list<named_pexpr_t>*attr, std::list<named_pexpr_t>*attr,
bool keep_attr =false); bool keep_attr =false);
/* The lexor calls this function to change the default nettype. */ /* The lexor calls this function to change the default nettype. */
@ -168,8 +168,8 @@ extern PWire* pform_get_make_wire_in_scope(const struct vlltype&li,
extern void pform_startmodule(const struct vlltype&loc, const char*name, extern void pform_startmodule(const struct vlltype&loc, const char*name,
bool program_block, bool is_interface, bool program_block, bool is_interface,
LexicalScope::lifetime_t lifetime, LexicalScope::lifetime_t lifetime,
list<named_pexpr_t>*attr); std::list<named_pexpr_t>*attr);
extern void pform_module_set_ports(vector<Module::port_t*>*); extern void pform_module_set_ports(std::vector<Module::port_t*>*);
extern void pform_set_scope_timescale(const struct vlltype&loc); extern void pform_set_scope_timescale(const struct vlltype&loc);
/* These functions are used when we have a complete port definition, either /* These functions are used when we have a complete port definition, either
@ -180,14 +180,14 @@ extern void pform_module_define_port(const struct vlltype&li,
NetNet::PortType, NetNet::PortType,
NetNet::Type type, NetNet::Type type,
data_type_t*vtype, data_type_t*vtype,
list<named_pexpr_t>*attr, std::list<named_pexpr_t>*attr,
bool keep_attr =false); bool keep_attr =false);
extern void pform_module_define_port(const struct vlltype&li, extern void pform_module_define_port(const struct vlltype&li,
list<pform_port_t>*ports, std::list<pform_port_t>*ports,
NetNet::PortType, NetNet::PortType,
NetNet::Type type, NetNet::Type type,
data_type_t*vtype, data_type_t*vtype,
list<named_pexpr_t>*attr); std::list<named_pexpr_t>*attr);
extern Module::port_t* pform_module_port_reference(perm_string name, extern Module::port_t* pform_module_port_reference(perm_string name,
const char*file, const char*file,
@ -209,16 +209,16 @@ extern void pform_set_constructor_return(PFunction*net);
extern void pform_end_class_declaration(const struct vlltype&loc); extern void pform_end_class_declaration(const struct vlltype&loc);
extern void pform_make_udp(perm_string name, list<perm_string>*parms, extern void pform_make_udp(perm_string name, std::list<perm_string>*parms,
std::vector<PWire*>*decl, list<string>*table, std::vector<PWire*>*decl, std::list<std::string>*table,
Statement*init, Statement*init,
const char*file, unsigned lineno); const char*file, unsigned lineno);
extern void pform_make_udp(perm_string name, extern void pform_make_udp(perm_string name,
bool sync_flag, perm_string out_name, bool sync_flag, perm_string out_name,
PExpr*sync_init, PExpr*sync_init,
list<perm_string>*parms, std::list<perm_string>*parms,
list<string>*table, std::list<std::string>*table,
const char*file, unsigned lineno); const char*file, unsigned lineno);
/* /*
* Package related functions. * Package related functions.
@ -289,7 +289,7 @@ extern verinum* pform_verinum_with_size(verinum*s, verinum*val,
* This function takes the list of names as new genvars to declare in * This function takes the list of names as new genvars to declare in
* the current module or generate scope. * the current module or generate scope.
*/ */
extern void pform_genvars(const struct vlltype&li, list<perm_string>*names); extern void pform_genvars(const struct vlltype&li, std::list<perm_string>*names);
/* /*
* This flag is set by the parser to indicate the current generate block * This flag is set by the parser to indicate the current generate block
@ -309,7 +309,7 @@ extern void pform_start_generate_if(const struct vlltype&li, PExpr*test);
extern void pform_start_generate_else(const struct vlltype&li); extern void pform_start_generate_else(const struct vlltype&li);
extern void pform_start_generate_case(const struct vlltype&lp, PExpr*test); extern void pform_start_generate_case(const struct vlltype&lp, PExpr*test);
extern void pform_start_generate_nblock(const struct vlltype&lp, char*name); extern void pform_start_generate_nblock(const struct vlltype&lp, char*name);
extern void pform_generate_case_item(const struct vlltype&lp, list<PExpr*>*test); extern void pform_generate_case_item(const struct vlltype&lp, std::list<PExpr*>*test);
extern void pform_generate_block_name(char*name); extern void pform_generate_block_name(char*name);
extern void pform_endgenerate(bool end_conditional); extern void pform_endgenerate(bool end_conditional);
@ -350,22 +350,22 @@ extern void pform_makewire(const struct vlltype&li, perm_string name,
NetNet::Type type, NetNet::Type type,
NetNet::PortType pt, NetNet::PortType pt,
ivl_variable_type_t, ivl_variable_type_t,
list<named_pexpr_t>*attr); std::list<named_pexpr_t>*attr);
/* This form handles simple declarations */ /* This form handles simple declarations */
extern void pform_makewire(const struct vlltype&li, extern void pform_makewire(const struct vlltype&li,
list<pform_range_t>*range, std::list<pform_range_t>*range,
bool signed_flag, bool signed_flag,
list<perm_string>*names, std::list<perm_string>*names,
NetNet::Type type, NetNet::Type type,
NetNet::PortType, NetNet::PortType,
ivl_variable_type_t, ivl_variable_type_t,
list<named_pexpr_t>*attr, std::list<named_pexpr_t>*attr,
PWSRType rt = SR_NET); PWSRType rt = SR_NET);
/* This form handles assignment declarations. */ /* This form handles assignment declarations. */
extern void pform_makewire(const struct vlltype&li, extern void pform_makewire(const struct vlltype&li,
list<PExpr*>*delay, std::list<PExpr*>*delay,
str_pair_t str, str_pair_t str,
net_decl_assign_t*assign_list, net_decl_assign_t*assign_list,
NetNet::Type type, NetNet::Type type,
@ -382,8 +382,8 @@ extern void pform_makewire(const struct vlltype&li,
extern void pform_makewire(const struct vlltype&li, extern void pform_makewire(const struct vlltype&li,
struct_type_t*struct_type, struct_type_t*struct_type,
NetNet::PortType, NetNet::PortType,
list<perm_string>*names, std::list<perm_string>*names,
list<named_pexpr_t>*attr); std::list<named_pexpr_t>*attr);
extern void pform_make_var_init(const struct vlltype&li, extern void pform_make_var_init(const struct vlltype&li,
perm_string name, PExpr*expr); perm_string name, PExpr*expr);
@ -393,15 +393,15 @@ extern void pform_make_var_init(const struct vlltype&li,
the port type, i.e. input, output or inout, and, if specified, the the port type, i.e. input, output or inout, and, if specified, the
range and signedness. If the wire does not exist, create it. */ range and signedness. If the wire does not exist, create it. */
extern void pform_set_port_type(const struct vlltype&li, extern void pform_set_port_type(const struct vlltype&li,
list<pform_port_t>*ports, std::list<pform_port_t>*ports,
NetNet::PortType, NetNet::PortType,
data_type_t*dt, data_type_t*dt,
list<named_pexpr_t>*attr); std::list<named_pexpr_t>*attr);
extern void pform_set_reg_idx(perm_string name, extern void pform_set_reg_idx(perm_string name,
std::list<pform_range_t>*indices); std::list<pform_range_t>*indices);
extern void pform_set_data_type(const struct vlltype&li, data_type_t*, list<perm_string>*names, NetNet::Type net_type, list<named_pexpr_t>*attr); extern void pform_set_data_type(const struct vlltype&li, data_type_t*, std::list<perm_string>*names, NetNet::Type net_type, std::list<named_pexpr_t>*attr);
extern void pform_set_struct_type(const struct vlltype&li, struct_type_t*struct_type, std::list<perm_string>*names, NetNet::Type net_type, std::list<named_pexpr_t>*attr); extern void pform_set_struct_type(const struct vlltype&li, struct_type_t*struct_type, std::list<perm_string>*names, NetNet::Type net_type, std::list<named_pexpr_t>*attr);
@ -416,7 +416,7 @@ extern void pform_set_class_type(const struct vlltype&li, class_type_t*class_typ
passed in. */ passed in. */
extern void pform_set_attrib(perm_string name, perm_string key, extern void pform_set_attrib(perm_string name, perm_string key,
char*value); char*value);
extern void pform_set_type_attrib(perm_string name, const string&key, extern void pform_set_type_attrib(perm_string name, const std::string&key,
char*value); char*value);
extern LexicalScope::range_t* pform_parameter_value_range(bool exclude_flag, extern LexicalScope::range_t* pform_parameter_value_range(bool exclude_flag,
@ -427,24 +427,24 @@ extern void pform_set_parameter(const struct vlltype&loc,
perm_string name, perm_string name,
ivl_variable_type_t type, ivl_variable_type_t type,
bool signed_flag, bool signed_flag,
list<pform_range_t>*range, std::list<pform_range_t>*range,
PExpr*expr, LexicalScope::range_t*value_range); PExpr*expr, LexicalScope::range_t*value_range);
extern void pform_set_localparam(const struct vlltype&loc, extern void pform_set_localparam(const struct vlltype&loc,
perm_string name, perm_string name,
ivl_variable_type_t type, ivl_variable_type_t type,
bool signed_flag, bool signed_flag,
list<pform_range_t>*range, std::list<pform_range_t>*range,
PExpr*expr); PExpr*expr);
extern void pform_set_specparam(const struct vlltype&loc, extern void pform_set_specparam(const struct vlltype&loc,
perm_string name, perm_string name,
list<pform_range_t>*range, std::list<pform_range_t>*range,
PExpr*expr); PExpr*expr);
extern void pform_set_defparam(const pform_name_t&name, PExpr*expr); extern void pform_set_defparam(const pform_name_t&name, PExpr*expr);
extern void pform_set_param_from_type(const struct vlltype&loc, extern void pform_set_param_from_type(const struct vlltype&loc,
const data_type_t *data_type, const data_type_t *data_type,
const char *name, const char *name,
list<pform_range_t> *&param_range, std::list<pform_range_t> *&param_range,
bool &param_signed, bool &param_signed,
ivl_variable_type_t &param_type); ivl_variable_type_t &param_type);
@ -452,14 +452,14 @@ extern void pform_set_param_from_type(const struct vlltype&loc,
* Functions related to specify blocks. * Functions related to specify blocks.
*/ */
extern PSpecPath*pform_make_specify_path(const struct vlltype&li, extern PSpecPath*pform_make_specify_path(const struct vlltype&li,
list<perm_string>*src, char pol, std::list<perm_string>*src, char pol,
bool full_flag, list<perm_string>*dst); bool full_flag, std::list<perm_string>*dst);
extern PSpecPath*pform_make_specify_edge_path(const struct vlltype&li, extern PSpecPath*pform_make_specify_edge_path(const struct vlltype&li,
int edge_flag, /*posedge==true */ int edge_flag, /*posedge==true */
list<perm_string>*src, char pol, std::list<perm_string>*src, char pol,
bool full_flag, list<perm_string>*dst, bool full_flag, std::list<perm_string>*dst,
PExpr*data_source_expression); PExpr*data_source_expression);
extern PSpecPath*pform_assign_path_delay(PSpecPath*obj, list<PExpr*>*delays); extern PSpecPath*pform_assign_path_delay(PSpecPath*obj, std::list<PExpr*>*delays);
extern void pform_module_specify_path(PSpecPath*obj); extern void pform_module_specify_path(PSpecPath*obj);
@ -468,17 +468,17 @@ extern void pform_module_specify_path(PSpecPath*obj);
* or initial items. * or initial items.
*/ */
extern PProcess* pform_make_behavior(ivl_process_type_t, Statement*, extern PProcess* pform_make_behavior(ivl_process_type_t, Statement*,
list<named_pexpr_t>*attr); std::list<named_pexpr_t>*attr);
extern void pform_mc_translate_on(bool flag); extern void pform_mc_translate_on(bool flag);
extern std::vector<PWire*>* pform_make_udp_input_ports(list<perm_string>*); extern std::vector<PWire*>* pform_make_udp_input_ports(std::list<perm_string>*);
extern void pform_make_events(list<perm_string>*names, extern void pform_make_events(std::list<perm_string>*names,
const char*file, unsigned lineno); const char*file, unsigned lineno);
/* /*
* Make real datum objects. * Make real datum objects.
*/ */
extern void pform_make_reals(list<perm_string>*names, extern void pform_make_reals(std::list<perm_string>*names,
const char*file, unsigned lineno); const char*file, unsigned lineno);
/* /*
@ -488,19 +488,19 @@ extern void pform_make_reals(list<perm_string>*names,
extern void pform_makegates(const struct vlltype&loc, extern void pform_makegates(const struct vlltype&loc,
PGBuiltin::Type type, PGBuiltin::Type type,
struct str_pair_t str, struct str_pair_t str,
list<PExpr*>*delay, std::list<PExpr*>*delay,
svector<lgate>*gates, svector<lgate>*gates,
list<named_pexpr_t>*attr); std::list<named_pexpr_t>*attr);
extern void pform_make_modgates(const struct vlltype&loc, extern void pform_make_modgates(const struct vlltype&loc,
perm_string type, perm_string type,
struct parmvalue_t*overrides, struct parmvalue_t*overrides,
svector<lgate>*gates, svector<lgate>*gates,
list<named_pexpr_t>*attr); std::list<named_pexpr_t>*attr);
/* Make a continuous assignment node, with optional bit- or part- select. */ /* Make a continuous assignment node, with optional bit- or part- select. */
extern void pform_make_pgassign_list(list<PExpr*>*alist, extern void pform_make_pgassign_list(std::list<PExpr*>*alist,
list<PExpr*>*del, std::list<PExpr*>*del,
struct str_pair_t str, struct str_pair_t str,
const char* fn, unsigned lineno); const char* fn, unsigned lineno);
@ -510,14 +510,14 @@ extern std::vector<pform_tf_port_t>*pform_make_task_ports(const struct vlltype&l
NetNet::PortType pt, NetNet::PortType pt,
ivl_variable_type_t vtype, ivl_variable_type_t vtype,
bool signed_flag, bool signed_flag,
list<pform_range_t>*range, std::list<pform_range_t>*range,
list<perm_string>*names, std::list<perm_string>*names,
bool isint = false); bool isint = false);
extern std::vector<pform_tf_port_t>*pform_make_task_ports(const struct vlltype&loc, extern std::vector<pform_tf_port_t>*pform_make_task_ports(const struct vlltype&loc,
NetNet::PortType pt, NetNet::PortType pt,
data_type_t*vtype, data_type_t*vtype,
list<perm_string>*names); std::list<perm_string>*names);
/* /*
* The parser uses this function to convert a unary * The parser uses this function to convert a unary
@ -540,7 +540,7 @@ extern PExpr* pform_genvar_inc_dec(const struct vlltype&loc, const char*name,
* parses the source file and places all the modules it finds into the * parses the source file and places all the modules it finds into the
* mod list. The dump function dumps a module to the output stream. * mod list. The dump function dumps a module to the output stream.
*/ */
extern void pform_dump(ostream&out, Module*mod); extern void pform_dump(std::ostream&out, Module*mod);
/* ** pform_discipline.cc /* ** pform_discipline.cc
* Functions for handling the parse of natures and disciplines. These * Functions for handling the parse of natures and disciplines. These
@ -560,10 +560,10 @@ extern void pform_discipline_potential(const struct vlltype&loc, const char*name
extern void pform_discipline_flow(const struct vlltype&loc, const char*name); extern void pform_discipline_flow(const struct vlltype&loc, const char*name);
extern void pform_attach_discipline(const struct vlltype&loc, extern void pform_attach_discipline(const struct vlltype&loc,
ivl_discipline_t discipline, list<perm_string>*names); ivl_discipline_t discipline, std::list<perm_string>*names);
extern void pform_dump(ostream&out, const ivl_nature_s*); extern void pform_dump(std::ostream&out, const ivl_nature_s*);
extern void pform_dump(ostream&out, const ivl_discipline_s*); extern void pform_dump(std::ostream&out, const ivl_discipline_s*);
/* ** pform_analog.cc /* ** pform_analog.cc
*/ */
@ -584,7 +584,7 @@ extern PExpr* pform_make_branch_probe_expression(const struct vlltype&loc,
* is the hierarchical name of a valid parameter name and value * is the hierarchical name of a valid parameter name and value
* is the value user wants to assign to. The value should be constant. * is the value user wants to assign to. The value should be constant.
*/ */
extern void parm_to_defparam_list(const string&param); extern void parm_to_defparam_list(const std::string&param);
/* /*
* Tasks to set the timeunit or timeprecision for SystemVerilog. * Tasks to set the timeunit or timeprecision for SystemVerilog.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008 Stephen Williams (steve@icarus.com) * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -23,6 +23,8 @@
# include "parse_misc.h" # include "parse_misc.h"
# include "AStatement.h" # include "AStatement.h"
using namespace std;
AContrib* pform_contribution_statement(const struct vlltype&loc, AContrib* pform_contribution_statement(const struct vlltype&loc,
PExpr*lval, PExpr*rval) PExpr*lval, PExpr*rval)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2019 Picture Elements, Inc. * Copyright (c) 2012-2021 Picture Elements, Inc.
* Stephen Williams (steve@icarus.com) * Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
@ -22,6 +22,8 @@
# include "parse_misc.h" # include "parse_misc.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
static void pform_set_class_type(const struct vlltype&li, class_type_t*, perm_string name, NetNet::Type net_type, list<named_pexpr_t>*attr) static void pform_set_class_type(const struct vlltype&li, class_type_t*, perm_string name, NetNet::Type net_type, list<named_pexpr_t>*attr)
{ {
PWire*net = pform_get_make_wire_in_scope(li, name, net_type, NetNet::NOT_A_PORT, IVL_VT_CLASS); PWire*net = pform_get_make_wire_in_scope(li, name, net_type, NetNet::NOT_A_PORT, IVL_VT_CLASS);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -23,6 +23,8 @@
# include "parse_misc.h" # include "parse_misc.h"
# include "discipline.h" # include "discipline.h"
using namespace std;
map<perm_string,ivl_nature_t> natures; map<perm_string,ivl_nature_t> natures;
map<perm_string,ivl_discipline_t> disciplines; map<perm_string,ivl_discipline_t> disciplines;
map<perm_string,ivl_nature_t> access_function_nature; map<perm_string,ivl_nature_t> access_function_nature;

View File

@ -38,6 +38,8 @@
# include <iomanip> # include <iomanip>
# include <typeinfo> # include <typeinfo>
using namespace std;
ostream& operator << (ostream&out, const PExpr&obj) ostream& operator << (ostream&out, const PExpr&obj)
{ {
obj.dump(out); obj.dump(out);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2016 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -21,6 +21,8 @@
# include "PClass.h" # include "PClass.h"
# include "parse_misc.h" # include "parse_misc.h"
using namespace std;
/* /*
* The functions here help the parser put together class type declarations. * The functions here help the parser put together class type declarations.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -21,6 +21,8 @@
# include "parse_misc.h" # include "parse_misc.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
static void pform_set_string_type(const struct vlltype&li, const string_type_t*, perm_string name, NetNet::Type net_type, list<named_pexpr_t>*attr) static void pform_set_string_type(const struct vlltype&li, const string_type_t*, perm_string name, NetNet::Type net_type, list<named_pexpr_t>*attr)
{ {
PWire*net = pform_get_make_wire_in_scope(li, name, net_type, NetNet::NOT_A_PORT, IVL_VT_STRING); PWire*net = pform_get_make_wire_in_scope(li, name, net_type, NetNet::NOT_A_PORT, IVL_VT_STRING);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -21,6 +21,8 @@
# include "parse_misc.h" # include "parse_misc.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
ivl_variable_type_t struct_type_t::figure_packed_base_type(void) const ivl_variable_type_t struct_type_t::figure_packed_base_type(void) const
{ {
if (! packed_flag) if (! packed_flag)

View File

@ -1,7 +1,7 @@
#ifndef IVL_pform_types_H #ifndef IVL_pform_types_H
#define IVL_pform_types_H #define IVL_pform_types_H
/* /*
* Copyright (c) 2007-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 2007-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -82,12 +82,12 @@ typedef std::pair<PExpr*,PExpr*> pform_range_t;
* declarations. * declarations.
*/ */
struct pform_port_t { struct pform_port_t {
pform_port_t(perm_string n, list<pform_range_t>*ud, PExpr*e) pform_port_t(perm_string n, std::list<pform_range_t>*ud, PExpr*e)
: name(n), udims(ud), expr(e) { } : name(n), udims(ud), expr(e) { }
~pform_port_t() { } ~pform_port_t() { }
perm_string name; perm_string name;
list<pform_range_t>*udims; std::list<pform_range_t>*udims;
PExpr*expr; PExpr*expr;
}; };
@ -180,14 +180,14 @@ struct enum_type_t : public data_type_t {
ivl_variable_type_t base_type; ivl_variable_type_t base_type;
bool signed_flag; bool signed_flag;
bool integer_flag; // True if "integer" was used bool integer_flag; // True if "integer" was used
std::unique_ptr< list<pform_range_t> > range; std::unique_ptr< std::list<pform_range_t> > range;
std::unique_ptr< list<named_pexpr_t> > names; std::unique_ptr< std::list<named_pexpr_t> > names;
LineInfo li; LineInfo li;
}; };
struct struct_member_t : public LineInfo { struct struct_member_t : public LineInfo {
std::unique_ptr<data_type_t> type; std::unique_ptr<data_type_t> type;
std::unique_ptr< list<decl_assignment_t*> > names; std::unique_ptr< std::list<decl_assignment_t*> > names;
void pform_dump(std::ostream&out, unsigned indent) const; void pform_dump(std::ostream&out, unsigned indent) const;
}; };
@ -198,7 +198,7 @@ struct struct_type_t : public data_type_t {
bool packed_flag; bool packed_flag;
bool union_flag; bool union_flag;
std::unique_ptr< list<struct_member_t*> > members; std::unique_ptr< std::list<struct_member_t*> > members;
}; };
struct atom2_type_t : public data_type_t { struct atom2_type_t : public data_type_t {
@ -244,7 +244,7 @@ struct vector_type_t : public data_type_t {
bool reg_flag; // True if "reg" was used bool reg_flag; // True if "reg" was used
bool integer_flag; // True if "integer" was used bool integer_flag; // True if "integer" was used
bool implicit_flag; // True if this type is implicitly logic/reg bool implicit_flag; // True if this type is implicitly logic/reg
std::unique_ptr< list<pform_range_t> > pdims; std::unique_ptr< std::list<pform_range_t> > pdims;
}; };
struct array_base_t : public data_type_t { struct array_base_t : public data_type_t {
@ -253,7 +253,7 @@ struct array_base_t : public data_type_t {
: base_type(btype), dims(pd) { } : base_type(btype), dims(pd) { }
data_type_t*base_type; data_type_t*base_type;
std::unique_ptr< list<pform_range_t> > dims; std::unique_ptr< std::list<pform_range_t> > dims;
}; };
/* /*

View File

@ -22,6 +22,7 @@
# include "netmisc.h" # include "netmisc.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
/* /*
* Search for the hierarchical name. * Search for the hierarchical name.

View File

@ -1,7 +1,7 @@
%{ %{
/* /*
* Copyright (c) 2000-2017 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -36,6 +36,8 @@
# include "functor.h" # include "functor.h"
# include <cassert> # include <cassert>
using namespace std;
struct syn_token_t { struct syn_token_t {
int token; int token;

View File

@ -32,6 +32,8 @@
# include <cstring> # include <cstring>
# include "ivl_alloc.h" # include "ivl_alloc.h"
using namespace std;
static StringHeap api_strings; static StringHeap api_strings;
/* THE FOLLOWING ARE FUNCTIONS THAT ARE CALLED FROM THE TARGET. */ /* THE FOLLOWING ARE FUNCTIONS THAT ARE CALLED FROM THE TARGET. */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2020 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -30,6 +30,8 @@
# include "ivl_alloc.h" # include "ivl_alloc.h"
# include "ivl_assert.h" # include "ivl_assert.h"
using namespace std;
/* /*
* This is a little convenience function for converting a NetExpr * This is a little convenience function for converting a NetExpr
* expression type to the expression type used by ivl_expr_t objects. * expression type to the expression type used by ivl_expr_t objects.

View File

@ -34,6 +34,8 @@
# include "ivl_assert.h" # include "ivl_assert.h"
# include "ivl_alloc.h" # include "ivl_alloc.h"
using namespace std;
struct dll_target dll_target_obj; struct dll_target dll_target_obj;
#if defined(__WIN32__) #if defined(__WIN32__)

View File

@ -575,7 +575,7 @@ struct ivl_udp_s {
ccharp_t*table; // zero terminated array of pointers ccharp_t*table; // zero terminated array of pointers
perm_string file; perm_string file;
unsigned lineno; unsigned lineno;
string*ports; std::string*ports;
}; };
/* /*
@ -616,7 +616,7 @@ struct ivl_nexus_ptr_s {
*/ */
struct ivl_nexus_s { struct ivl_nexus_s {
ivl_nexus_s() : ptrs_(1), nexus_(0), name_(0), private_data(0) { } ivl_nexus_s() : ptrs_(1), nexus_(0), name_(0), private_data(0) { }
vector<ivl_nexus_ptr_s>ptrs_; std::vector<ivl_nexus_ptr_s>ptrs_;
const Nexus*nexus_; const Nexus*nexus_;
const char*name_; const char*name_;
void*private_data; void*private_data;

View File

@ -24,6 +24,8 @@
# include "target.h" # include "target.h"
# include <typeinfo> # include <typeinfo>
using namespace std;
target_t::~target_t() target_t::~target_t()
{ {
} }

View File

@ -185,10 +185,10 @@ struct expr_scan_t {
/* This function takes a fully qualified Verilog name (which may have, /* This function takes a fully qualified Verilog name (which may have,
for example, dots in it) and produces a mangled version that can be for example, dots in it) and produces a mangled version that can be
used by most any language. */ used by most any language. */
extern string mangle(const string&str); extern std::string mangle(const std::string&str);
/* This function takes a string and produces an escaped version that can be /* This function takes a string and produces an escaped version that can be
used inside a string constant for a C++ compiler. */ used inside a string constant for a C++ compiler. */
extern string stresc(const string&str); extern std::string stresc(const std::string&str);
#endif /* IVL_target_H */ #endif /* IVL_target_H */

4
util.h
View File

@ -1,7 +1,7 @@
#ifndef IVL_util_H #ifndef IVL_util_H
#define IVL_util_H #define IVL_util_H
/* /*
* Copyright (c) 2000-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -43,7 +43,7 @@ struct attrib_list_t {
verinum val; verinum val;
}; };
extern attrib_list_t* evaluate_attributes(const map<perm_string,PExpr*>&att, extern attrib_list_t* evaluate_attributes(const std::map<perm_string,PExpr*>&att,
unsigned&natt, unsigned&natt,
Design*des, NetScope*scope); Design*des, NetScope*scope);

View File

@ -27,6 +27,8 @@
# include <cstdio> // Needed to get snprintf for as_string(). # include <cstdio> // Needed to get snprintf for as_string().
# include <algorithm> # include <algorithm>
using namespace std;
#if !defined(HAVE_LROUND) #if !defined(HAVE_LROUND)
/* /*
* If the system doesn't provide the lround function, then we provide * If the system doesn't provide the lround function, then we provide

View File

@ -1,7 +1,7 @@
#ifndef IVL_verinum_H #ifndef IVL_verinum_H
#define IVL_verinum_H #define IVL_verinum_H
/* /*
* Copyright (c) 1998-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -25,11 +25,9 @@
#ifdef HAVE_IOSFWD #ifdef HAVE_IOSFWD
# include <iosfwd> # include <iosfwd>
#else #else
class ostream; # include <iostream>
#endif #endif
using namespace std;
/* /*
* Numbers in Verilog are multibit strings, where each bit has 4 * Numbers in Verilog are multibit strings, where each bit has 4
* possible values: 0, 1, x or z. The verinum number is store in * possible values: 0, 1, x or z. The verinum number is store in
@ -42,7 +40,7 @@ class verinum {
enum V { V0 = 0, V1, Vx, Vz }; enum V { V0 = 0, V1, Vx, Vz };
verinum(); verinum();
explicit verinum(const string&str); explicit verinum(const std::string&str);
verinum(const V*v, unsigned nbits, bool has_len =true); verinum(const V*v, unsigned nbits, bool has_len =true);
explicit verinum(V, unsigned nbits =1, bool has_len =true); explicit verinum(V, unsigned nbits =1, bool has_len =true);
verinum(uint64_t val, unsigned bits); verinum(uint64_t val, unsigned bits);
@ -110,7 +108,7 @@ class verinum {
signed long as_long() const; signed long as_long() const;
double as_double() const; double as_double() const;
string as_string() const; std::string as_string() const;
private: private:
void signed_trim(); void signed_trim();
@ -154,8 +152,8 @@ extern verinum cast_to_width(const verinum&, unsigned width);
needed to accurately represent the contained value, signed or not. */ needed to accurately represent the contained value, signed or not. */
extern verinum trim_vnum(const verinum&); extern verinum trim_vnum(const verinum&);
extern ostream& operator<< (ostream&, const verinum&); extern std::ostream& operator<< (std::ostream&, const verinum&);
extern ostream& operator<< (ostream&, verinum::V); extern std::ostream& operator<< (std::ostream&, verinum::V);
inline verinum::V bit4_z2x(verinum::V bit) inline verinum::V bit4_z2x(verinum::V bit)
{ return bit<2? bit : verinum::Vx; /* Relies on V0 and V1 being <2 */} { return bit<2? bit : verinum::Vx; /* Relies on V0 and V1 being <2 */}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -29,6 +29,8 @@
# include <cassert> # include <cassert>
# include <cstring> # include <cstring>
using namespace std;
verireal::verireal() verireal::verireal()
{ {
value_ = 0.0; value_ = 0.0;

View File

@ -1,7 +1,7 @@
#ifndef IVL_verireal_H #ifndef IVL_verireal_H
#define IVL_verireal_H #define IVL_verireal_H
/* /*
* Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -23,11 +23,9 @@
#ifdef HAVE_IOSFWD #ifdef HAVE_IOSFWD
# include <iosfwd> # include <iosfwd>
#else #else
class ostream; # include <iostream>
#endif #endif
using namespace std;
class verinum; class verinum;
/* /*
@ -39,7 +37,7 @@ class verinum;
class verireal { class verireal {
friend ostream& operator<< (ostream&, const verireal&); friend std::ostream& operator<< (std::ostream&, const verireal&);
friend verireal operator+ (const verireal&, const verireal&); friend verireal operator+ (const verireal&, const verireal&);
friend verireal operator- (const verireal&, const verireal&); friend verireal operator- (const verireal&, const verireal&);
friend verireal operator* (const verireal&, const verireal&); friend verireal operator* (const verireal&, const verireal&);
@ -73,7 +71,7 @@ class verireal {
double value_; double value_;
}; };
extern ostream& operator<< (ostream&, const verireal&); extern std::ostream& operator<< (std::ostream&, const verireal&);
extern verireal operator* (const verireal&, const verireal&); extern verireal operator* (const verireal&, const verireal&);
extern verireal operator/ (const verireal&, const verireal&); extern verireal operator/ (const verireal&, const verireal&);
extern verireal operator/ (const verireal&, const verinum&); extern verireal operator/ (const verireal&, const verinum&);

View File

@ -53,8 +53,8 @@ class Architecture : public Scope, public LineInfo {
virtual ~Statement() =0; virtual ~Statement() =0;
virtual int elaborate(Entity*ent, Architecture*arc); virtual int elaborate(Entity*ent, Architecture*arc);
virtual int emit(ostream&out, Entity*ent, Architecture*arc); virtual int emit(std::ostream&out, Entity*ent, Architecture*arc);
virtual void dump(ostream&out, int indent = 0) const; virtual void dump(std::ostream&out, int indent = 0) const;
}; };
public: public:
@ -100,10 +100,10 @@ class Architecture : public Scope, public LineInfo {
// of the specified entity. This method is used by the // of the specified entity. This method is used by the
// elaborate code to display generated code to the specified // elaborate code to display generated code to the specified
// output. // output.
int emit(ostream&out, Entity*entity); int emit(std::ostream&out, Entity*entity);
// The dump method writes a debug display to the given output. // The dump method writes a debug display to the given output.
void dump(ostream&out, perm_string of_entity, int indent = 0) const; void dump(std::ostream&out, perm_string of_entity, int indent = 0) const;
private: private:
perm_string name_; perm_string name_;
@ -143,8 +143,8 @@ class GenerateStatement : public Architecture::Statement {
protected: protected:
int elaborate_statements(Entity*ent, Architecture*arc); int elaborate_statements(Entity*ent, Architecture*arc);
int emit_statements(ostream&out, Entity*ent, Architecture*arc); int emit_statements(std::ostream&out, Entity*ent, Architecture*arc);
void dump_statements(ostream&out, int indent) const; void dump_statements(std::ostream&out, int indent) const;
private: private:
perm_string name_; perm_string name_;
@ -159,8 +159,8 @@ class ForGenerate : public GenerateStatement {
~ForGenerate(); ~ForGenerate();
int elaborate(Entity*ent, Architecture*arc); int elaborate(Entity*ent, Architecture*arc);
int emit(ostream&out, Entity*entity, Architecture*arc); int emit(std::ostream&out, Entity*entity, Architecture*arc);
void dump(ostream&out, int ident =0) const; void dump(std::ostream&out, int ident =0) const;
private: private:
perm_string genvar_; perm_string genvar_;
@ -176,7 +176,7 @@ class IfGenerate : public GenerateStatement {
~IfGenerate(); ~IfGenerate();
int elaborate(Entity*ent, Architecture*arc); int elaborate(Entity*ent, Architecture*arc);
int emit(ostream&out, Entity*entity, Architecture*arc); int emit(std::ostream&out, Entity*entity, Architecture*arc);
private: private:
Expression*cond_; Expression*cond_;
@ -194,8 +194,8 @@ class SignalAssignment : public Architecture::Statement {
~SignalAssignment(); ~SignalAssignment();
virtual int elaborate(Entity*ent, Architecture*arc); virtual int elaborate(Entity*ent, Architecture*arc);
virtual int emit(ostream&out, Entity*entity, Architecture*arc); virtual int emit(std::ostream&out, Entity*entity, Architecture*arc);
virtual void dump(ostream&out, int ident =0) const; virtual void dump(std::ostream&out, int ident =0) const;
private: private:
ExpName*lval_; ExpName*lval_;
@ -209,8 +209,8 @@ class CondSignalAssignment : public Architecture::Statement {
~CondSignalAssignment(); ~CondSignalAssignment();
int elaborate(Entity*ent, Architecture*arc); int elaborate(Entity*ent, Architecture*arc);
int emit(ostream&out, Entity*entity, Architecture*arc); int emit(std::ostream&out, Entity*entity, Architecture*arc);
void dump(ostream&out, int ident =0) const; void dump(std::ostream&out, int ident =0) const;
private: private:
ExpName*lval_; ExpName*lval_;
@ -230,8 +230,8 @@ class ComponentInstantiation : public Architecture::Statement {
~ComponentInstantiation(); ~ComponentInstantiation();
virtual int elaborate(Entity*ent, Architecture*arc); virtual int elaborate(Entity*ent, Architecture*arc);
virtual int emit(ostream&out, Entity*entity, Architecture*arc); virtual int emit(std::ostream&out, Entity*entity, Architecture*arc);
virtual void dump(ostream&out, int indent =0) const; virtual void dump(std::ostream&out, int indent =0) const;
// Returns the expression that initializes a generic (or NULL if not found). // Returns the expression that initializes a generic (or NULL if not found).
Expression*find_generic_map(perm_string by_name) const; Expression*find_generic_map(perm_string by_name) const;
@ -256,13 +256,13 @@ class StatementList : public Architecture::Statement {
return elaborate(ent, static_cast<ScopeBase*>(arc)); return elaborate(ent, static_cast<ScopeBase*>(arc));
} }
int emit(ostream&out, Entity*ent, Architecture*arc) { int emit(std::ostream&out, Entity*ent, Architecture*arc) {
return emit(out, ent, static_cast<ScopeBase*>(arc)); return emit(out, ent, static_cast<ScopeBase*>(arc));
} }
virtual int elaborate(Entity*ent, ScopeBase*scope); virtual int elaborate(Entity*ent, ScopeBase*scope);
virtual int emit(ostream&out, Entity*entity, ScopeBase*scope); virtual int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
virtual void dump(ostream&out, int indent =0) const; virtual void dump(std::ostream&out, int indent =0) const;
std::list<SequentialStmt*>& stmt_list() { return statements_; } std::list<SequentialStmt*>& stmt_list() { return statements_; }
@ -277,8 +277,8 @@ class InitialStatement : public StatementList {
InitialStatement(std::list<SequentialStmt*>*statement_list) InitialStatement(std::list<SequentialStmt*>*statement_list)
: StatementList(statement_list) {} : StatementList(statement_list) {}
int emit(ostream&out, Entity*entity, ScopeBase*scope); int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
void dump(ostream&out, int indent =0) const; void dump(std::ostream&out, int indent =0) const;
}; };
// There is no direct VHDL counterpart to SV 'final' statement, // There is no direct VHDL counterpart to SV 'final' statement,
@ -288,8 +288,8 @@ class FinalStatement : public StatementList {
FinalStatement(std::list<SequentialStmt*>*statement_list) FinalStatement(std::list<SequentialStmt*>*statement_list)
: StatementList(statement_list) {} : StatementList(statement_list) {}
int emit(ostream&out, Entity*entity, ScopeBase*scope); int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
void dump(ostream&out, int indent =0) const; void dump(std::ostream&out, int indent =0) const;
}; };
class ProcessStatement : public StatementList, public Scope { class ProcessStatement : public StatementList, public Scope {
@ -302,8 +302,8 @@ class ProcessStatement : public StatementList, public Scope {
~ProcessStatement(); ~ProcessStatement();
int elaborate(Entity*ent, Architecture*arc); int elaborate(Entity*ent, Architecture*arc);
int emit(ostream&out, Entity*entity, Architecture*arc); int emit(std::ostream&out, Entity*entity, Architecture*arc);
void dump(ostream&out, int indent =0) const; void dump(std::ostream&out, int indent =0) const;
private: private:
perm_string iname_; perm_string iname_;

View File

@ -25,6 +25,8 @@
# include <typeinfo> # include <typeinfo>
# include <cassert> # include <cassert>
using namespace std;
int Architecture::elaborate(Entity*entity) int Architecture::elaborate(Entity*entity)
{ {
int errors = 0; int errors = 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011-2013 Stephen Williams (steve@icarus.com) * Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -28,6 +28,8 @@
# include <typeinfo> # include <typeinfo>
# include <ivl_assert.h> # include <ivl_assert.h>
using namespace std;
int Scope::emit_signals(ostream&out, Entity*entity, ScopeBase*scope) int Scope::emit_signals(ostream&out, Entity*entity, ScopeBase*scope)
{ {
int errors = 0; int errors = 0;

View File

@ -32,6 +32,8 @@
# include <iomanip> # include <iomanip>
# include <typeinfo> # include <typeinfo>
using namespace std;
static ostream& operator << (ostream&out, port_mode_t that) static ostream& operator << (ostream&out, port_mode_t that)
{ {
switch (that) { switch (that) {

View File

@ -1,7 +1,7 @@
#ifndef IVL_entity_H #ifndef IVL_entity_H
#define IVL_entity_H #define IVL_entity_H
/* /*
* Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -127,15 +127,15 @@ class Entity : public ComponentBase {
// declaration to allow for that case. // declaration to allow for that case.
void set_declaration_l_value(perm_string by_name, bool flag); void set_declaration_l_value(perm_string by_name, bool flag);
int emit(ostream&out); int emit(std::ostream&out);
void dump(ostream&out, int indent = 0) const; void dump(std::ostream&out, int indent = 0) const;
private: private:
std::map<perm_string,Architecture*>arch_; std::map<perm_string,Architecture*>arch_;
Architecture*bind_arch_; Architecture*bind_arch_;
map<perm_string,VType::decl_t> declarations_; std::map<perm_string,VType::decl_t> declarations_;
int elaborate_generic_exprs_(void); int elaborate_generic_exprs_(void);
int elaborate_ports_(void); int elaborate_ports_(void);
@ -159,6 +159,6 @@ extern int emit_entities(void);
* Use this function to dump a description of the design entities to a * Use this function to dump a description of the design entities to a
* file. This is for debug, not for any useful purpose. * file. This is for debug, not for any useful purpose.
*/ */
extern void dump_design_entities(ostream&file); extern void dump_design_entities(std::ostream&file);
#endif /* IVL_entity_H */ #endif /* IVL_entity_H */

Some files were not shown because too many files have changed in this diff Show More