diff --git a/PExpr.h b/PExpr.h index 0b83470fc..b681f3cd2 100644 --- a/PExpr.h +++ b/PExpr.h @@ -595,7 +595,7 @@ class PECallFunction : public PExpr { bool check_call_matches_definition_(Design*des, NetScope*dscope) const; NetExpr* elaborate_sfunc_(Design*des, NetScope*scope, int expr_wid) const; - NetExpr* elaborate_access_func_(Design*des, NetScope*scope, nature_t*) const; + NetExpr* elaborate_access_func_(Design*des, NetScope*scope, ivl_nature_t) const; unsigned test_width_sfunc_(Design*des, NetScope*scope, unsigned min, unsigned lval, ivl_variable_type_t&expr_type, diff --git a/discipline.cc b/discipline.cc index 455f59d42..13078895f 100644 --- a/discipline.cc +++ b/discipline.cc @@ -19,17 +19,17 @@ # include "discipline.h" -nature_t::nature_t(perm_string name__, perm_string access__) +ivl_nature_s::ivl_nature_s(perm_string name__, perm_string access__) : name_(name__), access_(access__) { } -nature_t::~nature_t() +ivl_nature_s::~ivl_nature_s() { } ivl_discipline_s::ivl_discipline_s(perm_string name__, ivl_dis_domain_t domain__, - nature_t*pot, nature_t*flow__) + ivl_nature_t pot, ivl_nature_t flow__) : name_(name__), domain_(domain__), potential_(pot), flow_(flow__) { } diff --git a/discipline.h b/discipline.h index 118625a2b..9cfc4294b 100644 --- a/discipline.h +++ b/discipline.h @@ -33,10 +33,10 @@ extern std::ostream& operator << (std::ostream&, ivl_dis_domain_t); -class nature_t : public LineInfo { +class ivl_nature_s : public LineInfo { public: - explicit nature_t(perm_string name, perm_string access); - ~nature_t(); + explicit ivl_nature_s(perm_string name, perm_string access); + ~ivl_nature_s(); perm_string name() const { return name_; } // Identifier for the access function for this nature @@ -50,28 +50,28 @@ class nature_t : public LineInfo { class ivl_discipline_s : public LineInfo { public: explicit ivl_discipline_s (perm_string name, ivl_dis_domain_t dom, - nature_t*pot, nature_t*flow); + ivl_nature_t pot, ivl_nature_t flow); ~ivl_discipline_s(); perm_string name() const { return name_; } ivl_dis_domain_t domain() const { return domain_; } - const nature_t*potential() const { return potential_; } - const nature_t*flow() const { return flow_; } + const ivl_nature_t potential() const { return potential_; } + const ivl_nature_t flow() const { return flow_; } private: perm_string name_; ivl_dis_domain_t domain_; - nature_t*potential_; - nature_t*flow_; + ivl_nature_t potential_; + ivl_nature_t flow_; private: // not implemented ivl_discipline_s(const ivl_discipline_s&); ivl_discipline_s& operator = (const ivl_discipline_s&); }; -extern map natures; +extern map natures; extern map disciplines; // Map access function name to the nature that it accesses. -extern map access_function_nature; +extern map access_function_nature; #endif diff --git a/elab_expr.cc b/elab_expr.cc index 58ea427ab..2755e46c7 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -42,7 +42,7 @@ bool type_is_vectorable(ivl_variable_type_t type) } } -static nature_t* find_access_function(const pform_name_t&path) +static ivl_nature_t find_access_function(const pform_name_t&path) { if (path.size() != 1) return 0; @@ -1228,7 +1228,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope, int expr_w } NetExpr* PECallFunction::elaborate_access_func_(Design*des, NetScope*scope, - nature_t*nature) const + ivl_nature_t nature) const { // An access function must have 1 or 2 arguments. ivl_assert(*this, parms_.size()==2 || parms_.size()==1); @@ -1276,7 +1276,7 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope, // Not a user defined function. Maybe it is an access // function for a nature? If so then elaborate it that // way. - nature_t*access_nature = find_access_function(path_); + ivl_nature_t access_nature = find_access_function(path_); if (access_nature) return elaborate_access_func_(des, scope, access_nature); diff --git a/ivl.def b/ivl.def index 6d46f4beb..c05ec3196 100644 --- a/ivl.def +++ b/ivl.def @@ -16,7 +16,9 @@ ivl_const_type ivl_const_width ivl_discipline_domain +ivl_discipline_flow ivl_discipline_name +ivl_discipline_potential ivl_event_any ivl_event_basename diff --git a/ivl_target.h b/ivl_target.h index 235faf953..b21987158 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -572,6 +572,8 @@ extern double ivl_const_real(ivl_net_const_t net); */ extern const char*ivl_discipline_name(ivl_discipline_t net); extern ivl_dis_domain_t ivl_discipline_domain(ivl_discipline_t net); +extern ivl_nature_t ivl_discipline_potential(ivl_discipline_t net); +extern ivl_nature_t ivl_discipline_flow(ivl_discipline_t net); /* EVENTS * diff --git a/main.cc b/main.cc index abdb03245..a1ca591bb 100644 --- a/main.cc +++ b/main.cc @@ -700,7 +700,7 @@ int main(int argc, char*argv[]) if (pf_path) { ofstream out (pf_path); out << "PFORM DUMP NATURES:" << endl; - for (map::iterator cur = natures.begin() + for (map::iterator cur = natures.begin() ; cur != natures.end() ; cur ++ ) { pform_dump(out, (*cur).second); } diff --git a/net_expr.cc b/net_expr.cc index 9dd6b59b1..10bdcabe6 100644 --- a/net_expr.cc +++ b/net_expr.cc @@ -600,7 +600,7 @@ ivl_variable_type_t NetESFunc::expr_type() const return type_; } -NetEAccess::NetEAccess(NetBranch*br, nature_t*nat) +NetEAccess::NetEAccess(NetBranch*br, ivl_nature_t nat) : branch_(br), nature_(nat) { } diff --git a/netlist.h b/netlist.h index 43ea14d0c..30d97cd66 100644 --- a/netlist.h +++ b/netlist.h @@ -68,8 +68,6 @@ class NetTaskDef; class NetEvTrig; class NetEvWait; -class nature_t; - struct target; struct functor_t; @@ -2982,7 +2980,7 @@ class NetEUFunc : public NetExpr { class NetEAccess : public NetExpr { public: - explicit NetEAccess(NetBranch*br, nature_t*nat); + explicit NetEAccess(NetBranch*br, ivl_nature_t nat); ~NetEAccess(); virtual ivl_variable_type_t expr_type() const; @@ -2994,7 +2992,7 @@ class NetEAccess : public NetExpr { private: NetBranch*branch_; - nature_t*nature_; + ivl_nature_t nature_; }; /* diff --git a/pform.h b/pform.h index a11a73f1f..a4a3f7fb2 100644 --- a/pform.h +++ b/pform.h @@ -389,7 +389,7 @@ extern void pform_discipline_flow(const struct vlltype&loc, const char*name); extern void pform_attach_discipline(const struct vlltype&loc, ivl_discipline_t discipline, list*names); -extern void pform_dump(ostream&out, const nature_t*); +extern void pform_dump(ostream&out, const ivl_nature_s*); extern void pform_dump(ostream&out, const ivl_discipline_s*); /* ** pform_analog.cc diff --git a/pform_disciplines.cc b/pform_disciplines.cc index 71c91a185..73a23b504 100644 --- a/pform_disciplines.cc +++ b/pform_disciplines.cc @@ -23,9 +23,9 @@ # include "parse_misc.h" # include "discipline.h" -map natures; +map natures; map disciplines; -map access_function_nature; +map access_function_nature; static perm_string nature_name = perm_string::perm_string(); static perm_string nature_access = perm_string::perm_string(); @@ -62,14 +62,14 @@ void pform_end_nature(const struct vlltype&loc) nature_access = nature_name; } - nature_t*tmp = new nature_t(nature_name, nature_access); + ivl_nature_s*tmp = new ivl_nature_s(nature_name, nature_access); FILE_NAME(tmp, loc); natures[nature_name] = tmp; // Make sure the access function is not used by multiple // different natures. - if (nature_t*dup_access_nat = access_function_nature[nature_access]) { + if (ivl_nature_t dup_access_nat = access_function_nature[nature_access]) { cerr << tmp->get_fileline() << ": error: " << "Access function name " << nature_access << " is already used by nature " << dup_access_nat->name() @@ -89,8 +89,8 @@ void pform_end_nature(const struct vlltype&loc) static perm_string discipline_name; static ivl_dis_domain_t discipline_domain = IVL_DIS_NONE; -static nature_t* discipline_potential = 0; -static nature_t* discipline_flow = 0; +static ivl_nature_t discipline_potential = 0; +static ivl_nature_t discipline_flow = 0; void pform_start_discipline(const char*name) { diff --git a/pform_dump.cc b/pform_dump.cc index 87159644a..f745567fe 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -1293,7 +1293,7 @@ void PUdp::dump(ostream&out) const out << "endprimitive" << endl; } -void pform_dump(std::ostream&out, const nature_t*nat) +void pform_dump(std::ostream&out, const ivl_nature_s*nat) { out << "nature " << nat->name() << endl; out << " access " << nat->access() << ";" << endl; @@ -1304,9 +1304,9 @@ void pform_dump(std::ostream&out, const ivl_discipline_s*dis) { out << "discipline " << dis->name() << endl; out << " domain " << dis->domain() << ";" << endl; - if (const nature_t*tmp = dis->potential()) + if (const ivl_nature_s*tmp = dis->potential()) out << " potential " << tmp->name() << ";" << endl; - if (const nature_t*tmp = dis->flow()) + if (const ivl_nature_s*tmp = dis->flow()) out << " flow " << tmp->name() << ";" << endl; out << "enddiscipline" << endl; } diff --git a/t-dll-api.cc b/t-dll-api.cc index d9a5e4346..6dce44632 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -87,11 +87,21 @@ extern "C" ivl_dis_domain_t ivl_discipline_domain(ivl_discipline_t net) return net->domain(); } +extern "C" ivl_nature_t ivl_discipline_flow(ivl_discipline_t net) +{ + return net->flow(); +} + extern "C" const char* ivl_discipline_name(ivl_discipline_t net) { return net->name(); } +extern "C" ivl_nature_t ivl_discipline_potential(ivl_discipline_t net) +{ + return net->potential(); +} + extern "C" ivl_expr_type_t ivl_expr_type(ivl_expr_t net) { if (net == 0)