diff --git a/cprop.cc b/cprop.cc index 70ca5bbff..aa16a70fc 100644 --- a/cprop.cc +++ b/cprop.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: cprop.cc,v 1.17 2000/10/07 19:45:42 steve Exp $" +#ident "$Id: cprop.cc,v 1.18 2000/11/11 00:03:36 steve Exp $" #endif # include "netlist.h" @@ -153,7 +153,8 @@ void cprop_functor::lpm_ff(Design*des, NetFF*obj) // If some of the FFs are unconnected, make a new FF array // that does not include the useless FF devices. if (unlinked_count > 0) { - NetFF*tmp = new NetFF(obj->name(), obj->width()-unlinked_count); + NetFF*tmp = new NetFF(obj->scope(), obj->name(), + obj->width()-unlinked_count); connect(tmp->pin_Clock(), obj->pin_Clock()); connect(tmp->pin_Enable(), obj->pin_Enable()); connect(tmp->pin_Aload(), obj->pin_Aload()); @@ -433,6 +434,9 @@ void cprop(Design*des) /* * $Log: cprop.cc,v $ + * Revision 1.18 2000/11/11 00:03:36 steve + * Add support for the t-dll backend grabing flip-flops. + * * Revision 1.17 2000/10/07 19:45:42 steve * Put logic devices into scopes. * diff --git a/design_dump.cc b/design_dump.cc index 651636110..57e142804 100644 --- a/design_dump.cc +++ b/design_dump.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: design_dump.cc,v 1.102 2000/11/04 06:36:24 steve Exp $" +#ident "$Id: design_dump.cc,v 1.103 2000/11/11 00:03:36 steve Exp $" #endif /* @@ -250,7 +250,9 @@ void NetConst::dump_node(ostream&o, unsigned ind) const void NetFF::dump_node(ostream&o, unsigned ind) const { - o << setw(ind) << "" << "LPM_FF: " << name() << endl; + o << setw(ind) << "" << "LPM_FF: " << name() + << " scope=" << (scope()? scope()->name() : "") << endl; + dump_node_pins(o, ind+4); dump_obj_attr(o, ind+4); } @@ -975,6 +977,9 @@ void Design::dump(ostream&o) const /* * $Log: design_dump.cc,v $ + * Revision 1.103 2000/11/11 00:03:36 steve + * Add support for the t-dll backend grabing flip-flops. + * * Revision 1.102 2000/11/04 06:36:24 steve * Apply sequential UDP rework from Stephan Boettcher (PR#39) * diff --git a/ivl_target.h b/ivl_target.h index fb8949386..47d356167 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: ivl_target.h,v 1.26 2000/10/31 17:49:02 steve Exp $" +#ident "$Id: ivl_target.h,v 1.27 2000/11/11 00:03:36 steve Exp $" #endif #ifdef __cplusplus @@ -72,6 +72,17 @@ _BEGIN_DECL * processes. Structural expressions are instead treated as logic * gates. * + * ivl_lpm_t + * This object is the base class for all the various LPM type + * device nodes. This object carries a few base properties + * (including a type) including a handle to the specific type. + * + * All the ivl_lpm_*_t objects are derived from this type, and + * there are methods to get one from the other. + * + * ivl_lpm_ff_t + * This is a flip-flop. + * * ivl_net_logic_t * This object represents various built in logic devices. In fact, * this includes just about every directional device that has a @@ -113,6 +124,8 @@ _BEGIN_DECL */ typedef struct ivl_design_s *ivl_design_t; typedef struct ivl_expr_s *ivl_expr_t; +typedef struct ivl_lpm_s *ivl_lpm_t; +typedef struct ivl_lpm_ff_s *ivl_lpm_ff_t; typedef struct ivl_lval_s *ivl_lval_t; typedef struct ivl_net_const_s*ivl_net_const_t; typedef struct ivl_net_event_s*ivl_net_event_t; @@ -161,6 +174,11 @@ typedef enum ivl_logic_e { IVL_LO_XOR } ivl_logic_t; +/* This is the type of an LPM object. */ +typedef enum ivl_lpm_type_e { + IVL_LPM_FF +} ivl_lpm_type_t; + /* Processes are initial or always blocks with a statement. This is the type of the ivl_process_t object. */ typedef enum ivl_process_type_e { @@ -339,6 +357,31 @@ extern ivl_logic_t ivl_logic_type(ivl_net_logic_t net); extern ivl_nexus_t ivl_logic_pin(ivl_net_logic_t net, unsigned pin); extern unsigned ivl_logic_pins(ivl_net_logic_t net); +/* LPM + * These functions support access to the properties of LPM devices. + * + * ivl_lpm_name + * Return the name of the device. + * + * ivl_lpm_type + * Return the ivl_lpm_type_t of the secific LPM device. + * + * ivl_lpm_width + * Return the width of the LPM device. What this means depends on + * the LPM type, but it generally has to do with the width of the + * output data path. + */ +extern const char* ivl_lpm_name(ivl_lpm_t net); +extern ivl_lpm_type_t ivl_lpm_type(ivl_lpm_t net); +extern unsigned ivl_lpm_width(ivl_lpm_t net); + + +/* + * These are cast functions for the ivl_lpm_t. They cast the object to + * the requested type, checking for errors along the way. + */ +extern ivl_lpm_ff_t ivl_lpm_ff(ivl_lpm_t net); + /* LVAL * The l-values of assignments are concatenation of ivl_lval_t @@ -444,6 +487,8 @@ extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net); extern int ivl_scope_children(ivl_scope_t net, ivl_scope_f func); extern unsigned ivl_scope_logs(ivl_scope_t net); extern ivl_net_logic_t ivl_scope_log(ivl_scope_t net, unsigned idx); +extern unsigned ivl_scope_lpms(ivl_scope_t net); +extern ivl_lpm_t ivl_scope_lpm(ivl_scope_t, unsigned idx); extern const char* ivl_scope_name(ivl_scope_t net); extern unsigned ivl_scope_sigs(ivl_scope_t net); extern ivl_signal_t ivl_scope_sig(ivl_scope_t net, unsigned idx); @@ -549,6 +594,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.27 2000/11/11 00:03:36 steve + * Add support for the t-dll backend grabing flip-flops. + * * Revision 1.26 2000/10/31 17:49:02 steve * Support time variables. * diff --git a/netlist.cc b/netlist.cc index 88ffb8dd6..1a38d0aa2 100644 --- a/netlist.cc +++ b/netlist.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: netlist.cc,v 1.144 2000/10/31 17:49:02 steve Exp $" +#ident "$Id: netlist.cc,v 1.145 2000/11/11 00:03:36 steve Exp $" #endif # include @@ -446,6 +446,11 @@ const NetProc* NetProcTop::statement() const return statement_; } +NetScope* NetProcTop::scope() +{ + return scope_; +} + const NetScope* NetProcTop::scope() const { return scope_; @@ -468,8 +473,8 @@ const NetScope* NetProcTop::scope() const * ... */ -NetFF::NetFF(const string&n, unsigned wid) -: NetNode(n, 8 + 2*wid) +NetFF::NetFF(NetScope*s, const string&n, unsigned wid) +: NetNode(s, n, 8 + 2*wid) { pin_Clock().set_dir(Link::INPUT); pin_Clock().set_name("Clock", 0); @@ -2449,6 +2454,9 @@ bool NetUDP::sequ_glob_(string input, char output) /* * $Log: netlist.cc,v $ + * Revision 1.145 2000/11/11 00:03:36 steve + * Add support for the t-dll backend grabing flip-flops. + * * Revision 1.144 2000/10/31 17:49:02 steve * Support time variables. * diff --git a/netlist.h b/netlist.h index 6e67267c3..10bd08530 100644 --- a/netlist.h +++ b/netlist.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: netlist.h,v 1.177 2000/11/04 06:36:24 steve Exp $" +#ident "$Id: netlist.h,v 1.178 2000/11/11 00:03:36 steve Exp $" #endif /* @@ -568,7 +568,7 @@ class NetModulo : public NetNode { class NetFF : public NetNode { public: - NetFF(const string&n, unsigned width); + NetFF(NetScope*s, const string&n, unsigned width); ~NetFF(); unsigned width() const; @@ -2007,6 +2007,7 @@ class NetProcTop : public LineInfo { NetProc*statement(); const NetProc*statement() const; + NetScope*scope(); const NetScope*scope() const; void dump(ostream&, unsigned ind) const; @@ -2811,6 +2812,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.178 2000/11/11 00:03:36 steve + * Add support for the t-dll backend grabing flip-flops. + * * Revision 1.177 2000/11/04 06:36:24 steve * Apply sequential UDP rework from Stephan Boettcher (PR#39) * diff --git a/syn-rules.y b/syn-rules.y index 722e8e5ab..cdfbafd88 100644 --- a/syn-rules.y +++ b/syn-rules.y @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: syn-rules.y,v 1.9 2000/09/02 20:54:21 steve Exp $" +#ident "$Id: syn-rules.y,v 1.10 2000/11/11 00:03:36 steve Exp $" #endif /* @@ -139,7 +139,8 @@ static void make_DFF_CE(Design*des, NetProcTop*top, NetEvWait*wclk, assert(d); - NetFF*ff = new NetFF(asn->l_val(0)->name(), asn->l_val(0)->pin_count()); + NetFF*ff = new NetFF(top->scope(), asn->l_val(0)->name(), + asn->l_val(0)->pin_count()); for (unsigned idx = 0 ; idx < ff->width() ; idx += 1) { connect(ff->pin_Data(idx), d->pin(idx)); diff --git a/t-dll-api.cc b/t-dll-api.cc index d3854a94f..d561255da 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-api.cc,v 1.16 2000/10/28 22:32:34 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.17 2000/11/11 00:03:36 steve Exp $" #endif # include "t-dll.h" @@ -234,6 +234,27 @@ extern "C" ivl_nexus_t ivl_logic_pin(ivl_net_logic_t net, unsigned pin) return net->pins_[pin]; } +extern "C" ivl_lpm_ff_t ivl_lpm_ff(ivl_lpm_t net) +{ + assert(net->type == IVL_LPM_FF); + return (ivl_lpm_ff_t)net; +} + +extern "C" const char* ivl_lpm_name(ivl_lpm_t net) +{ + return net->name; +} + +extern "C" ivl_lpm_type_t ivl_lpm_type(ivl_lpm_t net) +{ + return net->type; +} + +extern "C" unsigned ivl_lpm_width(ivl_lpm_t net) +{ + return net->width; +} + extern "C" ivl_expr_t ivl_lval_mux(ivl_lval_t net) { assert(net); @@ -324,6 +345,19 @@ extern "C" ivl_net_logic_t ivl_scope_log(ivl_scope_t net, unsigned idx) return net->log_[idx]; } +extern "C" unsigned ivl_scope_lpms(ivl_scope_t net) +{ + assert(net); + return net->nlpm_; +} + +extern "C" ivl_lpm_t ivl_scope_lpm(ivl_scope_t net, unsigned idx) +{ + assert(net); + assert(idx < net->nlpm_); + return net->lpm_[idx]; +} + extern "C" const char* ivl_scope_name(ivl_scope_t net) { return net->name_; @@ -536,6 +570,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.17 2000/11/11 00:03:36 steve + * Add support for the t-dll backend grabing flip-flops. + * * Revision 1.16 2000/10/28 22:32:34 steve * API for concatenation expressions. * diff --git a/t-dll.cc b/t-dll.cc index 20c0f31c5..5d94be2bb 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.cc,v 1.18 2000/11/09 22:19:34 steve Exp $" +#ident "$Id: t-dll.cc,v 1.19 2000/11/11 00:03:36 steve Exp $" #endif # include "compiler.h" @@ -116,6 +116,24 @@ void scope_add_logic(ivl_scope_t scope, ivl_net_logic_t net) } +static void scope_add_lpm(ivl_scope_t scope, ivl_lpm_t net) +{ + if (scope->nlpm_ == 0) { + assert(scope->lpm_ == 0); + scope->nlpm_ = 1; + scope->lpm_ = (ivl_lpm_t*)malloc(sizeof(ivl_lpm_t)); + scope->lpm_[0] = net; + + } else { + assert(scope->lpm_); + scope->nlpm_ += 1; + scope->lpm_ = (ivl_lpm_t*) + realloc(scope->lpm_, + scope->nlpm_*sizeof(ivl_lpm_t)); + scope->lpm_[scope->nlpm_-1] = net; + } +} + bool dll_target::start_design(const Design*des) { dll_path_ = des->get_flag("DLL"); @@ -137,6 +155,8 @@ bool dll_target::start_design(const Design*des) des_.root_->sigs_ = 0; des_.root_->nlog_ = 0; des_.root_->log_ = 0; + des_.root_->nlpm_ = 0; + des_.root_->lpm_ = 0; target_ = (target_design_f)dlsym(dll_, LU "target_design" TU); if (target_ == 0) { @@ -253,6 +273,49 @@ void dll_target::logic(const NetLogic*net) scope_add_logic(scope, obj); } +void dll_target::lpm_ff(const NetFF*net) +{ + ivl_lpm_ff_t obj = new struct ivl_lpm_ff_s; + obj->base.type = IVL_LPM_FF; + obj->base.name = strdup(net->name()); + obj->base.width = net->width(); + obj->base.scope = find_scope(des_.root_, net->scope()); + assert(obj->base.scope); + + scope_add_lpm(obj->base.scope, &obj->base); + + const Nexus*nex; + + nex = net->pin_Clock().nexus(); + assert(nex->t_cookie()); + obj->clk = (ivl_nexus_t) nex->t_cookie(); + /* XXXX set nexus back pointer? XXXX */ + + if (obj->base.width == 1) { + nex = net->pin_Q(0).nexus(); + assert(nex->t_cookie()); + obj->q.pin = (ivl_nexus_t) nex->t_cookie(); + + nex = net->pin_Data(0).nexus(); + assert(nex->t_cookie()); + obj->d.pin = (ivl_nexus_t) nex->t_cookie(); + + } else { + obj->q.pins = new ivl_nexus_t [obj->base.width * 2]; + obj->d.pins = obj->q.pins + obj->base.width; + + for (unsigned idx = 0 ; idx < obj->base.width ; idx += 1) { + nex = net->pin_Q(idx).nexus(); + assert(nex->t_cookie()); + obj->q.pins[idx] = (ivl_nexus_t) nex->t_cookie(); + + nex = net->pin_Data(idx).nexus(); + assert(nex->t_cookie()); + obj->d.pins[idx] = (ivl_nexus_t) nex->t_cookie(); + } + } +} + /* * The assignment l-values are captured by the assignment statements * themselves in the process handling. @@ -336,6 +399,8 @@ void dll_target::scope(const NetScope*net) scope->sigs_ = 0; scope->nlog_ = 0; scope->log_ = 0; + scope->nlpm_ = 0; + scope->lpm_ = 0; ivl_scope_t parent = find_scope(des_.root_, net->parent()); assert(parent != 0); @@ -510,6 +575,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.19 2000/11/11 00:03:36 steve + * Add support for the t-dll backend grabing flip-flops. + * * Revision 1.18 2000/11/09 22:19:34 steve * Initialize scope when creating it. * diff --git a/t-dll.h b/t-dll.h index e685e8b62..8db6acba8 100644 --- a/t-dll.h +++ b/t-dll.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.h,v 1.17 2000/10/28 22:32:34 steve Exp $" +#ident "$Id: t-dll.h,v 1.18 2000/11/11 00:03:36 steve Exp $" #endif # include "target.h" @@ -49,6 +49,7 @@ struct dll_target : public target_t, public expr_scan_t { bool bufz(const NetBUFZ*); void event(const NetEvent*); void logic(const NetLogic*); + void lpm_ff(const NetFF*); void net_assign(const NetAssign_*); bool net_const(const NetConst*); void net_probe(const NetEvProbe*); @@ -134,6 +135,34 @@ struct ivl_expr_s { } u_; }; +/* + * This is the base part of all ivl_lpm_*_t objects. It contains a + * type code to identify the extended type, and holds properties that + * are common to all (or most) lpm devices. + */ +struct ivl_lpm_s { + ivl_lpm_type_t type; + ivl_scope_t scope; + char* name; + + unsigned width; +}; + +struct ivl_lpm_ff_s { + struct ivl_lpm_s base; + + ivl_nexus_t clk; + + union { + ivl_nexus_t*pins; + ivl_nexus_t pin; + } q; + union { + ivl_nexus_t*pins; + ivl_nexus_t pin; + } d; +}; + /* * This object contains references to ivl_nexus_t objects that in turn * are reg nets. This is used by the assignment to represent the @@ -233,6 +262,9 @@ struct ivl_scope_s { unsigned nlog_; ivl_net_logic_t*log_; + + unsigned nlpm_; + ivl_lpm_t* lpm_; }; /* @@ -317,6 +349,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.18 2000/11/11 00:03:36 steve + * Add support for the t-dll backend grabing flip-flops. + * * Revision 1.17 2000/10/28 22:32:34 steve * API for concatenation expressions. * diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 0166fffdc..5ae0137ae 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: stub.c,v 1.23 2000/10/28 22:32:34 steve Exp $" +#ident "$Id: stub.c,v 1.24 2000/11/11 00:03:36 steve Exp $" #endif /* @@ -88,6 +88,24 @@ static void show_expression(ivl_expr_t net, unsigned ind) } } +static void show_lpm(ivl_lpm_t net) +{ + switch (ivl_lpm_type(net)) { + case IVL_LPM_FF: { + ivl_lpm_ff_t ff = ivl_lpm_ff(net); + + fprintf(out, " LPM_FF %s: \n", + ivl_lpm_name(net), + ivl_lpm_width(net)); + break; + } + + default: + fprintf(out, " %s: \n", ivl_lpm_name(net), + ivl_lpm_width(net)); + } +} + static void show_statement(ivl_statement_t net, unsigned ind) { unsigned idx; @@ -306,6 +324,9 @@ static int show_scope(ivl_scope_t net) for (idx = 0 ; idx < ivl_scope_logs(net) ; idx += 1) show_logic(ivl_scope_log(net, idx)); + for (idx = 0 ; idx < ivl_scope_lpms(net) ; idx += 1) + show_lpm(ivl_scope_lpm(net, idx)); + fprintf(out, "end scope %s\n", ivl_scope_name(net)); return ivl_scope_children(net, show_scope); } @@ -340,6 +361,9 @@ DECLARE_CYGWIN_DLL(DllMain); /* * $Log: stub.c,v $ + * Revision 1.24 2000/11/11 00:03:36 steve + * Add support for the t-dll backend grabing flip-flops. + * * Revision 1.23 2000/10/28 22:32:34 steve * API for concatenation expressions. *