diff --git a/ivl_target.h b/ivl_target.h index 1a0df2bd1..6d380072b 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -729,12 +729,16 @@ extern unsigned ivl_expr_lineno(ivl_expr_t net); /* IVL_EX_NUMBER */ extern const char* ivl_expr_bits(ivl_expr_t net); + /* IVL_EX_BACCESS */ +extern ivl_branch_t ivl_expr_branch(ivl_expr_t net); /* IVL_EX_UFUNC */ extern ivl_scope_t ivl_expr_def(ivl_expr_t net); /* IVL_EX_REALNUM */ extern double ivl_expr_dvalue(ivl_expr_t net); /* IVL_EX_SIGNAL, IVL_EX_SFUNC, IVL_EX_VARIABLE */ extern const char* ivl_expr_name(ivl_expr_t net); + /* IVL_EX_BACCESS */ +extern ivl_nature_t ivl_expr_nature(ivl_expr_t net); /* IVL_EX_BINARY IVL_EX_UNARY */ extern char ivl_expr_opcode(ivl_expr_t net); /* IVL_EX_BINARY IVL_EX_UNARY, IVL_EX_MEMORY IVL_EX_TERNARY */ diff --git a/ivl_target_priv.h b/ivl_target_priv.h index d42e386d7..8c00df276 100644 --- a/ivl_target_priv.h +++ b/ivl_target_priv.h @@ -20,6 +20,7 @@ */ # include +# include /* * This header has declarations related to the ivl_target.h API that @@ -47,7 +48,7 @@ class ivl_discipline_s; struct ivl_island_s { ivl_discipline_s*discipline; // user accessible flags. They are initially false, always. - vector flags; + std::vector flags; }; #endif diff --git a/netlist.h b/netlist.h index 8492f132e..34df32771 100644 --- a/netlist.h +++ b/netlist.h @@ -32,6 +32,7 @@ # include # include # include "ivl_target.h" +# include "ivl_target_priv.h" # include "pform_types.h" # include "config.h" # include "verinum.h" @@ -184,10 +185,15 @@ class NetBranch : public NetPins, public IslandBranch { // If the branch is named, this returns the name. perm_string name() const { return name_; } + ivl_branch_s* target_obj() const { return &target_obj_; } + void dump(ostream&, unsigned) const; private: perm_string name_; + + mutable ivl_branch_s target_obj_; + // The design class uses this member to list the branches. friend class Design; NetBranch*next_; @@ -3007,6 +3013,9 @@ class NetEAccess : public NetExpr { explicit NetEAccess(NetBranch*br, ivl_nature_t nat); ~NetEAccess(); + ivl_nature_t get_nature() const { return nature_; } + NetBranch* get_branch() const { return branch_; } + virtual ivl_variable_type_t expr_type() const; virtual void dump(ostream&) const; diff --git a/t-dll-api.cc b/t-dll-api.cc index e088217b7..3fbf4362d 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -261,6 +261,12 @@ extern "C" const char* ivl_expr_bits(ivl_expr_t net) return net->u_.number_.bits_; } +extern "C" ivl_branch_t ivl_expr_branch(ivl_expr_t net) +{ + assert(net && (net->type_ == IVL_EX_BACCESS)); + return net->u_.branch_.branch; +} + extern "C" ivl_scope_t ivl_expr_def(ivl_expr_t net) { assert(net); @@ -299,6 +305,12 @@ extern "C" const char* ivl_expr_name(ivl_expr_t net) return 0; } +extern "C" ivl_nature_t ivl_expr_nature(ivl_expr_t net) +{ + assert(net && (net->type_ == IVL_EX_BACCESS)); + return net->u_.branch_.nature; +} + extern "C" char ivl_expr_opcode(ivl_expr_t net) { assert(net); diff --git a/t-dll-expr.cc b/t-dll-expr.cc index 8e0f43bb7..b8708aaa0 100644 --- a/t-dll-expr.cc +++ b/t-dll-expr.cc @@ -160,6 +160,9 @@ void dll_target::expr_access_func(const NetEAccess*net) expr_->lineno = net->get_lineno(); expr_->width_ = 1; expr_->signed_= 1; + + expr_->u_.branch_.branch = net->get_branch()->target_obj(); + expr_->u_.branch_.nature = net->get_nature(); } void dll_target::expr_binary(const NetEBinary*net) diff --git a/t-dll.cc b/t-dll.cc index e08eb7891..f76c9cef4 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -780,7 +780,7 @@ void dll_target::make_const_delays_(struct ivl_net_const_s*obj, bool dll_target::branch(const NetBranch*net) { - struct ivl_branch_s*obj = new struct ivl_branch_s; + struct ivl_branch_s*obj = net->target_obj(); ivl_assert(*net, net->pin_count() == 2); assert(net->pin(0).nexus()->t_cookie()); diff --git a/t-dll.h b/t-dll.h index ec429756a..f2375332e 100644 --- a/t-dll.h +++ b/t-dll.h @@ -232,6 +232,11 @@ struct ivl_expr_s { ivl_expr_t rig_; } binary_; + struct { + ivl_branch_t branch; + ivl_nature_t nature; + } branch_; + struct { unsigned rept; unsigned parms;