From 91a755d0e8afa7eea6e3003024a9f3b403f75092 Mon Sep 17 00:00:00 2001 From: steve Date: Tue, 4 Jun 2002 05:38:43 +0000 Subject: [PATCH] Add support for memory words in l-value of blocking assignments, and remove the special NetAssignMem class. --- PExpr.h | 11 ++- Statement.h | 9 +- design_dump.cc | 17 ++-- elab_lval.cc | 39 ++++++-- elaborate.cc | 72 ++------------- emit.cc | 13 ++- functor.cc | 91 ++---------------- functor.h | 8 +- net_assign.cc | 36 +++++++- netlist.cc | 246 ++----------------------------------------------- netlist.h | 23 ++--- syn-rules.y | 14 +-- t-dll-proc.cc | 61 ++++++------ t-dll.h | 8 +- target.cc | 13 ++- target.h | 8 +- 16 files changed, 168 insertions(+), 501 deletions(-) diff --git a/PExpr.h b/PExpr.h index b21c9ad64..80da89d64 100644 --- a/PExpr.h +++ b/PExpr.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: PExpr.h,v 1.60 2002/05/23 03:08:51 steve Exp $" +#ident "$Id: PExpr.h,v 1.61 2002/06/04 05:38:43 steve Exp $" #endif # include @@ -270,6 +270,10 @@ class PEIdent : public PExpr { Link::strength_t drive0, Link::strength_t drive1) const; + private: + NetAssign_* elaborate_mem_lval_(Design*des, NetScope*scope, + NetMemory*mem) const; + }; class PENumber : public PExpr { @@ -497,6 +501,11 @@ class PECallFunction : public PExpr { /* * $Log: PExpr.h,v $ + * Revision 1.61 2002/06/04 05:38:43 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.60 2002/05/23 03:08:51 steve * Add language support for Verilog-2001 attribute * syntax. Hook this support into existing $attribute diff --git a/Statement.h b/Statement.h index b5456aa2e..a69ad82eb 100644 --- a/Statement.h +++ b/Statement.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: Statement.h,v 1.34 2002/05/26 01:39:02 steve Exp $" +#ident "$Id: Statement.h,v 1.35 2002/06/04 05:38:44 steve Exp $" #endif # include @@ -119,8 +119,6 @@ class PAssign : public PAssign_ { virtual NetProc* elaborate(Design*des, NetScope*scope) const; private: - NetProc*assign_to_memory_(class NetMemory*, PExpr*, - Design*des, NetScope*scope) const; }; class PAssignNB : public PAssign_ { @@ -455,6 +453,11 @@ class PWhile : public Statement { /* * $Log: Statement.h,v $ + * Revision 1.35 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.34 2002/05/26 01:39:02 steve * Carry Verilog 2001 attributes with processes, * all the way through to the ivl_target API. diff --git a/design_dump.cc b/design_dump.cc index 487f085f8..a011a60d7 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.124 2002/05/26 01:39:02 steve Exp $" +#ident "$Id: design_dump.cc,v 1.125 2002/06/04 05:38:44 steve Exp $" #endif # include "config.h" @@ -477,16 +477,6 @@ void NetAssignNB::dump(ostream&o, unsigned ind) const } -void NetAssignMem::dump(ostream&o, unsigned ind) const -{ - o << setw(ind) << ""; - o << "/* " << get_line() << " */" << endl; - o << setw(ind) << ""; - o << memory()->name() << "[" << *index() << "] = "; - rval()->dump(o); - o << ";" << endl; -} - void NetAssignMemNB::dump(ostream&o, unsigned ind) const { o << setw(ind) << ""; @@ -985,6 +975,11 @@ void Design::dump(ostream&o) const /* * $Log: design_dump.cc,v $ + * Revision 1.125 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.124 2002/05/26 01:39:02 steve * Carry Verilog 2001 attributes with processes, * all the way through to the ivl_target API. diff --git a/elab_lval.cc b/elab_lval.cc index 81fec6c0a..d5d7621db 100644 --- a/elab_lval.cc +++ b/elab_lval.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: elab_lval.cc,v 1.18 2002/03/09 04:02:26 steve Exp $" +#ident "$Id: elab_lval.cc,v 1.19 2002/06/04 05:38:44 steve Exp $" #endif # include "config.h" @@ -67,7 +67,7 @@ */ NetAssign_* PExpr::elaborate_lval(Design*des, NetScope*scope) const { - NetNet*ll = 0; //XXXXelaborate_net(des, scope, 0, 0, 0, 0); + NetNet*ll = 0; if (ll == 0) { cerr << get_line() << ": Assignment l-value too complex." << endl; @@ -139,14 +139,13 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const if (reg == 0) { NetMemory*mem = des->find_memory(scope, path_); - if (mem != 0) { - cerr << get_line() << ": sorry: I cannot handle " - << "memories in this l-value context." << endl; - } else { - cerr << get_line() << ": error: Could not find variable ``" - << path_ << "'' in ``" << scope->name() << - "''" << endl; - } + if (mem != 0) + return elaborate_mem_lval_(des, scope, mem); + + cerr << get_line() << ": error: Could not find variable ``" + << path_ << "'' in ``" << scope->name() << + "''" << endl; + des->errors += 1; return 0; } @@ -275,6 +274,21 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const return lv; } +NetAssign_* PEIdent::elaborate_mem_lval_(Design*des, NetScope*scope, + NetMemory*mem) const +{ + assert(msb_ && !lsb_); + + NetExpr*ix = msb_->elaborate_expr(des, scope); + if (ix == 0) + return 0; + + NetAssign_*lv = new NetAssign_(mem); + lv->set_bmux(ix); + lv->set_part(0, mem->width()); + return lv; +} + NetAssign_* PENumber::elaborate_lval(Design*des, NetScope*) const { cerr << get_line() << ": error: Constant values not allowed " @@ -285,6 +299,11 @@ NetAssign_* PENumber::elaborate_lval(Design*des, NetScope*) const /* * $Log: elab_lval.cc,v $ + * Revision 1.19 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.18 2002/03/09 04:02:26 steve * Constant expressions are not l-values for task ports. * diff --git a/elaborate.cc b/elaborate.cc index de91d4436..db56a5feb 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: elaborate.cc,v 1.251 2002/05/27 00:08:45 steve Exp $" +#ident "$Id: elaborate.cc,v 1.252 2002/06/04 05:38:44 steve Exp $" #endif # include "config.h" @@ -863,41 +863,10 @@ NetProc* Statement::elaborate(Design*des, NetScope*) const return cur; } -NetProc* PAssign::assign_to_memory_(NetMemory*mem, PExpr*ix, - Design*des, NetScope*scope) const -{ - assert(scope); - NetExpr*rv = rval()->elaborate_expr(des, scope); - if (rv == 0) - return 0; - - assert(rv); - - rv->set_width(mem->width()); - if (ix == 0) { - cerr << get_line() << ": internal error: No index in lval " - << "of assignment to memory?" << endl; - return 0; - } - - assert(ix); - NetExpr*idx = ix->elaborate_expr(des, scope); - if (idx == 0) { - /* Elaboration failed. The error message was already - printed, so just give up here. */ - return 0; - } - - if (rv->expr_width() < mem->width()) - rv = pad_to_width(rv, mem->width()); - - NetAssignMem*am = new NetAssignMem(mem, idx, rv); - am->set_line(*this); - return am; -} NetAssign_* PAssign_::elaborate_lval(Design*des, NetScope*scope) const { + assert(lval_); return lval_->elaborate_lval(des, scope); } @@ -956,22 +925,6 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const { assert(scope); - /* Catch the case where the lvalue is a reference to a memory - item. These are handled differently. */ - do { - const PEIdent*id = dynamic_cast(lval()); - if (id == 0) break; - - NetNet*net = des->find_signal(scope, id->path()); - if (net && (net->scope() == scope)) - break; - - if (NetMemory*mem = des->find_memory(scope, id->path())) - return assign_to_memory_(mem, id->msb_, des, scope); - - } while(0); - - /* elaborate the lval. This detects any part selects and mux expressions that might exist. */ NetAssign_*lv = elaborate_lval(des, scope); @@ -1559,22 +1512,6 @@ NetProc* PCallTask::elaborate_usr(Design*des, NetScope*scope) const if (port->port_type() == NetNet::PINPUT) continue; - /* Handle the special case that the output parameter is - a memory word. Generate a NetAssignMem instead of a - NetAssign. */ - NetMemory*mem; - const PEIdent*id = dynamic_cast(parms_[idx]); - if (id && (mem = des->find_memory(scope, id->path()))) { - - NetExpr*ix = id->msb_->elaborate_expr(des, scope); - assert(ix); - - NetExpr*rx = new NetESignal(port); - NetAssignMem*am = new NetAssignMem(mem, ix, rx); - block->append(am); - continue; - } - /* Elaborate an l-value version of the port expression for output and inout ports. If the expression does @@ -2569,6 +2506,11 @@ Design* elaborate(listroots) /* * $Log: elaborate.cc,v $ + * Revision 1.252 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.251 2002/05/27 00:08:45 steve * Support carrying the scope of named begin-end * blocks down to the code generator, and have diff --git a/emit.cc b/emit.cc index a232a182c..64dd05d00 100644 --- a/emit.cc +++ b/emit.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: emit.cc,v 1.66 2002/03/09 02:10:22 steve Exp $" +#ident "$Id: emit.cc,v 1.67 2002/06/04 05:38:44 steve Exp $" #endif # include "config.h" @@ -161,12 +161,6 @@ bool NetAssignNB::emit_proc(struct target_t*tgt) const return true; } -bool NetAssignMem::emit_proc(struct target_t*tgt) const -{ - tgt->proc_assign_mem(this); - return true; -} - bool NetAssignMemNB::emit_proc(struct target_t*tgt) const { tgt->proc_assign_mem_nb(this); @@ -487,6 +481,11 @@ bool emit(const Design*des, const char*type) /* * $Log: emit.cc,v $ + * Revision 1.67 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.66 2002/03/09 02:10:22 steve * Add the NetUserFunc netlist node. * diff --git a/functor.cc b/functor.cc index 89c619353..cfb355886 100644 --- a/functor.cc +++ b/functor.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2000 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2002 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: functor.cc,v 1.26 2001/10/19 21:53:24 steve Exp $" +#ident "$Id: functor.cc,v 1.27 2002/06/04 05:38:44 steve Exp $" #endif # include "config.h" @@ -234,16 +234,6 @@ int NetAssignNB::match_proc(proc_match_t*that) return that->assign_nb(this); } -int proc_match_t::assign_mem(NetAssignMem*) -{ - return 0; -} - -int NetAssignMem::match_proc(proc_match_t*that) -{ - return that->assign_mem(this); -} - int proc_match_t::assign_mem_nb(NetAssignMemNB*) { return 0; @@ -288,6 +278,11 @@ int proc_match_t::event_wait(NetEvWait*) /* * $Log: functor.cc,v $ + * Revision 1.27 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.26 2001/10/19 21:53:24 steve * Support multiple root modules (Philip Blundell) * @@ -306,77 +301,5 @@ int proc_match_t::event_wait(NetEvWait*) * * Revision 1.21 2000/08/01 02:48:41 steve * Support <= in synthesis of DFF and ram devices. - * - * Revision 1.20 2000/07/16 04:56:07 steve - * Handle some edge cases during node scans. - * - * Revision 1.19 2000/07/15 05:13:43 steve - * Detect muxing Vz as a bufufN. - * - * Revision 1.18 2000/05/02 00:58:12 steve - * Move signal tables to the NetScope class. - * - * Revision 1.17 2000/04/20 00:28:03 steve - * Catch some simple identity compareoptimizations. - * - * Revision 1.16 2000/04/18 04:50:19 steve - * Clean up unneeded NetEvent objects. - * - * Revision 1.15 2000/04/16 23:32:18 steve - * Synthesis of comparator in expressions. - * - * Connect the NetEvent and related classes - * together better. - * - * Revision 1.14 2000/04/12 20:02:53 steve - * Finally remove the NetNEvent and NetPEvent classes, - * Get synthesis working with the NetEvWait class, - * and get started supporting multiple events in a - * wait in vvm. - * - * Revision 1.13 2000/04/01 21:40:22 steve - * Add support for integer division. - * - * Revision 1.12 2000/02/23 02:56:54 steve - * Macintosh compilers do not support ident. - * - * Revision 1.11 2000/02/13 04:35:43 steve - * Include some block matching from Larry. - * - * Revision 1.10 2000/01/13 03:35:35 steve - * Multiplication all the way to simulation. - * - * Revision 1.9 2000/01/02 17:57:20 steve - * Handle nodes running out during node scan. - * - * Revision 1.8 1999/12/30 04:19:12 steve - * Propogate constant 0 in low bits of adders. - * - * Revision 1.7 1999/12/17 06:18:16 steve - * Rewrite the cprop functor to use the functor_t interface. - * - * Revision 1.6 1999/12/05 02:24:08 steve - * Synthesize LPM_RAM_DQ for writes into memories. - * - * Revision 1.5 1999/12/01 06:06:16 steve - * Redo synth to use match_proc_t scanner. - * - * Revision 1.4 1999/11/18 03:52:19 steve - * Turn NetTmp objects into normal local NetNet objects, - * and add the nodangle functor to clean up the local - * symbols generated by elaboration and other steps. - * - * Revision 1.3 1999/11/01 02:07:40 steve - * Add the synth functor to do generic synthesis - * and add the LPM_FF device to handle rows of - * flip-flops. - * - * Revision 1.2 1999/07/18 05:52:46 steve - * xnfsyn generates DFF objects for XNF output, and - * properly rewrites the Design netlist in the process. - * - * Revision 1.1 1999/07/17 22:01:13 steve - * Add the functor interface for functor transforms. - * */ diff --git a/functor.h b/functor.h index 15202eb52..a4cf55af9 100644 --- a/functor.h +++ b/functor.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: functor.h,v 1.17 2000/09/17 21:26:15 steve Exp $" +#ident "$Id: functor.h,v 1.18 2002/06/04 05:38:44 steve Exp $" #endif /* @@ -83,7 +83,6 @@ struct proc_match_t { virtual ~proc_match_t(); virtual int assign(class NetAssign*); - virtual int assign_mem(class NetAssignMem*); virtual int assign_nb(class NetAssignNB*); virtual int assign_mem_nb(class NetAssignMemNB*); virtual int condit(class NetCondit*); @@ -94,6 +93,11 @@ struct proc_match_t { /* * $Log: functor.h,v $ + * Revision 1.18 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.17 2000/09/17 21:26:15 steve * Add support for modulus (Eric Aardoom) * diff --git a/net_assign.cc b/net_assign.cc index ef418219f..31575c57a 100644 --- a/net_assign.cc +++ b/net_assign.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: net_assign.cc,v 1.10 2002/05/26 01:39:02 steve Exp $" +#ident "$Id: net_assign.cc,v 1.11 2002/06/04 05:38:44 steve Exp $" #endif # include "config.h" @@ -39,7 +39,7 @@ unsigned count_lval_width(const NetAssign_*idx) } NetAssign_::NetAssign_(NetNet*s) -: sig_(s), bmux_(0) +: sig_(s), mem_(0), bmux_(0) { loff_ = 0; lwid_ = sig_->pin_count(); @@ -47,6 +47,14 @@ NetAssign_::NetAssign_(NetNet*s) more = 0; } +NetAssign_::NetAssign_(NetMemory*s) +: sig_(0), mem_(s), bmux_(0) +{ + loff_ = 0; + lwid_ = mem_->width(); + more = 0; +} + NetAssign_::~NetAssign_() { if (sig_) sig_->decr_lref(); @@ -67,7 +75,8 @@ const NetExpr* NetAssign_::bmux() const unsigned NetAssign_::lwidth() const { - if (bmux_) return 1; + if (mem_) return lwid_; + else if (bmux_) return 1; else return lwid_; } @@ -75,6 +84,8 @@ const char*NetAssign_::name() const { if (sig_) { return sig_->name(); + } else if (mem_) { + return mem_->name().c_str(); } else { return ""; } @@ -82,15 +93,25 @@ const char*NetAssign_::name() const NetNet* NetAssign_::sig() const { - assert(sig_); return sig_; } +const NetMemory* NetAssign_::mem() const +{ + return mem_; +} + + void NetAssign_::set_part(unsigned lo, unsigned lw) { loff_ = lo; lwid_ = lw; - assert(sig_->pin_count() >= (lo + lw)); + if (sig_) { + assert(sig_->pin_count() >= (lo + lw)); + } else { + assert(mem_); + assert(lwid_ == mem_->width()); + } } unsigned NetAssign_::get_loff() const @@ -210,6 +231,11 @@ NetAssignNB::~NetAssignNB() /* * $Log: net_assign.cc,v $ + * Revision 1.11 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.10 2002/05/26 01:39:02 steve * Carry Verilog 2001 attributes with processes, * all the way through to the ivl_target API. diff --git a/netlist.cc b/netlist.cc index dd5181c3f..3b6865bc9 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.188 2002/05/27 00:08:45 steve Exp $" +#ident "$Id: netlist.cc,v 1.189 2002/06/04 05:38:44 steve Exp $" #endif # include "config.h" @@ -1465,15 +1465,6 @@ NetAssignMem_::~NetAssignMem_() { } -NetAssignMem::NetAssignMem(NetMemory*m, NetExpr*i, NetExpr*r) -: NetAssignMem_(m, i, r) -{ -} - -NetAssignMem::~NetAssignMem() -{ -} - NetAssignMemNB::NetAssignMemNB(NetMemory*m, NetExpr*i, NetExpr*r) : NetAssignMem_(m, i, r) { @@ -2357,6 +2348,11 @@ const NetProc*NetTaskDef::proc() const /* * $Log: netlist.cc,v $ + * Revision 1.189 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.188 2002/05/27 00:08:45 steve * Support carrying the scope of named begin-end * blocks down to the code generator, and have @@ -2383,235 +2379,5 @@ const NetProc*NetTaskDef::proc() const * to be used in repeat expresions. * * Add the builtin $signed system function. - * - * Revision 1.184 2002/04/21 04:59:08 steve - * Add support for conbinational events by finding - * the inputs to expressions and some statements. - * Get case and assignment statements working. - * - * Revision 1.183 2002/04/14 19:02:34 steve - * Ternary expressions can be signed. - * - * Revision 1.182 2002/04/14 18:41:34 steve - * Support signed integer division. - * - * Revision 1.181 2002/02/01 05:09:14 steve - * Propagate sign in unary minus. - * - * Revision 1.180 2002/01/22 01:40:04 steve - * Precalculate constant results of memory index expressions. - * - * Revision 1.179 2001/12/31 00:08:14 steve - * Support $signed cast of expressions. - * - * Revision 1.178 2001/12/03 04:47:15 steve - * Parser and pform use hierarchical names as hname_t - * objects instead of encoded strings. - * - * Revision 1.177 2001/11/19 04:26:46 steve - * Unary reduction operators are all 1-bit results. - * - * Revision 1.176 2001/11/19 01:54:14 steve - * Port close cropping behavior from mcrgb - * Move window array reset to libmc. - * - * Revision 1.175 2001/11/06 04:32:37 steve - * shift expressions can have definite widths. - * - * Revision 1.174 2001/10/28 01:14:53 steve - * NetObj constructor finally requires a scope. - * - * Revision 1.173 2001/10/16 02:19:27 steve - * Support IVL_LPM_DIVIDE for structural divide. - * - * Revision 1.172 2001/10/07 03:38:08 steve - * parameter names do not have defined size. - * - * Revision 1.171 2001/09/29 01:53:22 steve - * Fix the size of unsized constant operants to compare (PR#274) - * - * Revision 1.170 2001/08/25 23:50:03 steve - * Change the NetAssign_ class to refer to the signal - * instead of link into the netlist. This is faster - * and uses less space. Make the NetAssignNB carry - * the delays instead of the NetAssign_ lval objects. - * - * Change the vvp code generator to support multiple - * l-values, i.e. concatenations of part selects. - * - * Revision 1.169 2001/07/27 04:51:44 steve - * Handle part select expressions as variants of - * NetESignal/IVL_EX_SIGNAL objects, instead of - * creating new and useless temporary signals. - * - * Revision 1.168 2001/07/25 03:10:49 steve - * Create a config.h.in file to hold all the config - * junk, and support gcc 3.0. (Stephan Boettcher) - * - * Revision 1.167 2001/07/22 00:17:49 steve - * Support the NetESubSignal expressions in vvp.tgt. - * - * Revision 1.166 2001/07/07 03:01:37 steve - * Detect and make available to t-dll the right shift. - * - * Revision 1.165 2001/07/04 22:59:25 steve - * handle left shifter in dll output. - * - * Revision 1.164 2001/07/01 00:27:34 steve - * Make NetFF constructor take const char* for the name. - * - * Revision 1.163 2001/06/16 23:45:05 steve - * Add support for structural multiply in t-dll. - * Add code generators and vvp support for both - * structural and behavioral multiply. - * - * Revision 1.162 2001/06/15 04:14:18 steve - * Generate vvp code for GT and GE comparisons. - * - * Revision 1.161 2001/06/07 02:12:43 steve - * Support structural addition. - * - * Revision 1.160 2001/04/22 23:09:46 steve - * More UDP consolidation from Stephan Boettcher. - * - * Revision 1.159 2001/04/06 02:28:02 steve - * Generate vvp code for functions with ports. - * - * Revision 1.158 2001/04/02 02:28:12 steve - * Generate code for task calls. - * - * Revision 1.157 2001/02/10 21:20:38 steve - * Binary operators with operands of indefinite width - * has itself an indefinite width. - * - * Revision 1.156 2001/02/08 01:10:30 steve - * Remove dead code. - * - * Revision 1.155 2001/02/07 21:47:13 steve - * Fix expression widths for rvalues and parameters (PR#131,132) - * - * Revision 1.154 2001/01/18 03:16:35 steve - * NetMux needs a scope. (PR#115) - * - * Revision 1.153 2001/01/06 06:31:58 steve - * declaration initialization for time variables. - * - * Revision 1.152 2001/01/06 02:29:36 steve - * Support arrays of integers. - * - * Revision 1.151 2000/12/11 00:31:43 steve - * Add support for signed reg variables, - * simulate in t-vvm signed comparisons. - * - * Revision 1.150 2000/12/05 06:29:33 steve - * Make signal attributes available to ivl_target API. - * - * Revision 1.149 2000/12/04 17:37:04 steve - * Add Attrib class for holding NetObj attributes. - * - * Revision 1.148 2000/11/29 23:16:19 steve - * Do not delete synthesized signals used in expressions. - * - * Revision 1.147 2000/11/29 05:24:00 steve - * synthesis for unary reduction ! and N operators. - * - * Revision 1.146 2000/11/20 00:58:40 steve - * Add support for supply nets (PR#17) - * - * 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. - * - * Revision 1.143 2000/10/28 00:51:42 steve - * Add scope to threads in vvm, pass that scope - * to vpi sysTaskFunc objects, and add vpi calls - * to access that information. - * - * $display displays scope in %m (PR#1) - * - * Revision 1.142 2000/10/07 19:45:43 steve - * Put logic devices into scopes. - * - * Revision 1.141 2000/10/06 23:46:50 steve - * ivl_target updates, including more complete - * handling of ivl_nexus_t objects. Much reduced - * dependencies on pointers to netlist objects. - * - * Revision 1.140 2000/10/05 05:03:01 steve - * xor and constant devices. - * - * Revision 1.139 2000/09/26 05:05:58 steve - * Detect indefinite widths where definite widths are required. - * - * Revision 1.138 2000/09/26 01:35:42 steve - * Remove the obsolete NetEIdent class. - * - * Revision 1.137 2000/09/24 15:44:44 steve - * Move some NetNet method out of the header file. - * - * Revision 1.136 2000/09/22 03:58:30 steve - * Access to the name of a system task call. - * - * Revision 1.135 2000/09/02 20:54:20 steve - * Rearrange NetAssign to make NetAssign_ separate. - * - * Revision 1.134 2000/08/27 15:51:50 steve - * t-dll iterates signals, and passes them to the - * target module. - * - * Some of NetObj should return char*, not string. - * - * Revision 1.133 2000/07/14 06:12:57 steve - * Move inital value handling from NetNet to Nexus - * objects. This allows better propogation of inital - * values. - * - * Clean up constant propagation a bit to account - * for regs that are not really values. - * - * Revision 1.132 2000/07/07 04:53:54 steve - * Add support for non-constant delays in delay statements, - * Support evaluating ! in constant expressions, and - * move some code from netlist.cc to net_proc.cc. - * - * Revision 1.131 2000/06/25 19:59:42 steve - * Redesign Links to include the Nexus class that - * carries properties of the connected set of links. - * - * Revision 1.130 2000/06/24 22:55:19 steve - * Get rid of useless next_link method. - * - * Revision 1.129 2000/06/13 03:24:48 steve - * Index in memory assign should be a NetExpr. - * - * Revision 1.128 2000/06/12 03:57:10 steve - * NetEParam supports dup_expr. - * - * Revision 1.127 2000/05/27 19:33:23 steve - * Merge similar probes within a module. - * - * Revision 1.126 2000/05/19 01:43:16 steve - * Accept different widths for add operands. - * - * Revision 1.125 2000/05/11 23:37:27 steve - * Add support for procedural continuous assignment. - * - * Revision 1.124 2000/05/07 18:20:07 steve - * Import MCD support from Stephen Tell, and add - * system function parameter support to the IVL core. - * - * Revision 1.123 2000/05/07 04:37:56 steve - * Carry strength values from Verilog source to the - * pform and netlist for gates. - * - * Change vvm constants to use the driver_t to drive - * a constant value. This works better if there are - * multiple drivers on a signal. - * - * Revision 1.122 2000/05/04 03:37:58 steve - * Add infrastructure for system functions, move - * $time to that structure and add $random. */ diff --git a/netlist.h b/netlist.h index b2f1cbc08..fa122454c 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.239 2002/05/27 00:08:45 steve Exp $" +#ident "$Id: netlist.h,v 1.240 2002/06/04 05:38:44 steve Exp $" #endif /* @@ -1222,6 +1222,7 @@ class NetAssign_ { public: NetAssign_(NetNet*sig); + NetAssign_(NetMemory*mem); ~NetAssign_(); // If this expression exists, then only a single bit is to be @@ -1243,6 +1244,7 @@ class NetAssign_ { const char*name() const; NetNet* sig() const; + const NetMemory*mem() const; // This pointer is for keeping simple lists. NetAssign_* more; @@ -1251,6 +1253,7 @@ class NetAssign_ { private: NetNet *sig_; + NetMemory*mem_; NetExpr*bmux_; unsigned loff_; @@ -1346,19 +1349,6 @@ class NetAssignMem_ : public NetProc { NetExpr* rval_; }; -class NetAssignMem : public NetAssignMem_ { - - public: - explicit NetAssignMem(NetMemory*, NetExpr*idx, NetExpr*rv); - ~NetAssignMem(); - - virtual int match_proc(struct proc_match_t*); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(ostream&, unsigned ind) const; - - private: -}; - class NetAssignMemNB : public NetAssignMem_ { public: @@ -2975,6 +2965,11 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.240 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.239 2002/05/27 00:08:45 steve * Support carrying the scope of named begin-end * blocks down to the code generator, and have diff --git a/syn-rules.y b/syn-rules.y index 8034b8841..679828182 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.18 2002/05/23 03:08:51 steve Exp $" +#ident "$Id: syn-rules.y,v 1.19 2002/06/04 05:38:44 steve Exp $" #endif # include "config.h" @@ -304,18 +304,6 @@ struct tokenize : public proc_match_t { return 0; } - int assign_mem(NetAssignMem*dev) - { - syn_token_t*cur; - cur = new syn_token_t; - cur->token = S_ASSIGN_MEM; - cur->assign_mem = dev; - cur->next_ = 0; - last_->next_ = cur; - last_ = cur; - return 0; - } - int assign_mem_nb(NetAssignMemNB*dev) { syn_token_t*cur; diff --git a/t-dll-proc.cc b/t-dll-proc.cc index 2db10571f..b9822110c 100644 --- a/t-dll-proc.cc +++ b/t-dll-proc.cc @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-proc.cc,v 1.45 2002/05/29 22:05:55 steve Exp $" +#ident "$Id: t-dll-proc.cc,v 1.46 2002/06/04 05:38:44 steve Exp $" #endif # include "config.h" @@ -142,14 +142,28 @@ void dll_target::proc_assign(const NetAssign*net) cur->width_ = asn->lwidth(); cur->loff_ = asn->get_loff(); - cur->type_ = IVL_LVAL_REG; - cur->n.sig = find_signal(des_, asn->sig()); + if (asn->sig()) { + cur->type_ = IVL_LVAL_REG; + cur->n.sig = find_signal(des_, asn->sig()); + + cur->idx = 0; + if (asn->bmux()) { + assert(expr_ == 0); + asn->bmux()->expr_scan(this); + cur->type_ = IVL_LVAL_MUX; + cur->idx = expr_; + expr_ = 0; + } + + } else { + assert(asn->mem()); + cur->type_ = IVL_LVAL_MEM; + cur->n.mem = lookup_memory_(asn->mem()); + assert(cur->n.mem); + cur->width_ = ivl_memory_width(cur->n.mem); - cur->idx = 0; - if (asn->bmux()) { assert(expr_ == 0); asn->bmux()->expr_scan(this); - cur->type_ = IVL_LVAL_MUX; cur->idx = expr_; expr_ = 0; } @@ -190,6 +204,7 @@ void dll_target::proc_assign_nb(const NetAssignNB*net) cur->type_ = IVL_LVAL_REG; cur->width_ = asn->lwidth(); cur->loff_ = asn->get_loff(); + assert(asn->sig()); cur->n.sig = find_signal(des_, asn->sig()); cur->idx = 0; @@ -227,35 +242,6 @@ void dll_target::proc_assign_nb(const NetAssignNB*net) } } -void dll_target::proc_assign_mem(const NetAssignMem*net) -{ - assert(stmt_cur_); - assert(stmt_cur_->type_ == IVL_ST_NONE); - - stmt_cur_->type_ = IVL_ST_ASSIGN; - - stmt_cur_->u_.assign_.lvals_ = 1; - stmt_cur_->u_.assign_.lval_ = new struct ivl_lval_s[1]; - stmt_cur_->u_.assign_.delay = 0; - struct ivl_lval_s*cur = stmt_cur_->u_.assign_.lval_; - - cur->type_ = IVL_LVAL_MEM; - cur->n.mem = lookup_memory_(net->memory()); - assert(cur->n.mem); - cur->width_ = ivl_memory_width(cur->n.mem); - - assert(expr_ == 0); - - net->index()->expr_scan(this); - cur->type_ = IVL_LVAL_MEM; - cur->idx = expr_; - expr_ = 0; - - net->rval()->expr_scan(this); - stmt_cur_->u_.assign_.rval_ = expr_; - expr_ = 0; -} - void dll_target::proc_assign_mem_nb(const NetAssignMemNB*net) { assert(stmt_cur_); @@ -817,6 +803,11 @@ void dll_target::proc_while(const NetWhile*net) /* * $Log: t-dll-proc.cc,v $ + * Revision 1.46 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.45 2002/05/29 22:05:55 steve * Offset lvalue index expressions. * diff --git a/t-dll.h b/t-dll.h index 7f6166963..a3793845b 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.81 2002/05/29 22:05:55 steve Exp $" +#ident "$Id: t-dll.h,v 1.82 2002/06/04 05:38:44 steve Exp $" #endif # include "target.h" @@ -103,7 +103,6 @@ struct dll_target : public target_t, public expr_scan_t { statements of a thread. */ struct ivl_statement_s*stmt_cur_; void proc_assign(const NetAssign*); - void proc_assign_mem(const NetAssignMem*); void proc_assign_nb(const NetAssignNB*); void proc_assign_mem_nb(const NetAssignMemNB*net); bool proc_block(const NetBlock*); @@ -605,6 +604,11 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.82 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.81 2002/05/29 22:05:55 steve * Offset lvalue index expressions. * diff --git a/target.cc b/target.cc index 2e2ad85c6..794aeab10 100644 --- a/target.cc +++ b/target.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: target.cc,v 1.60 2002/03/09 02:10:22 steve Exp $" +#ident "$Id: target.cc,v 1.61 2002/06/04 05:38:44 steve Exp $" #endif # include "config.h" @@ -183,12 +183,6 @@ void target_t::proc_assign(const NetAssign*) "Unhandled procedural assignment." << endl; } -void target_t::proc_assign_mem(const NetAssignMem*) -{ - cerr << "target (" << typeid(*this).name() << "): " - "Unhandled memory assignment." << endl; -} - void target_t::proc_assign_nb(const NetAssignNB*) { cerr << "target (" << typeid(*this).name() << "): " @@ -397,6 +391,11 @@ void expr_scan_t::expr_binary(const NetEBinary*ex) /* * $Log: target.cc,v $ + * Revision 1.61 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.60 2002/03/09 02:10:22 steve * Add the NetUserFunc netlist node. * diff --git a/target.h b/target.h index 30e8ca4e5..534957cd3 100644 --- a/target.h +++ b/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: target.h,v 1.57 2002/03/09 02:10:22 steve Exp $" +#ident "$Id: target.h,v 1.58 2002/06/04 05:38:44 steve Exp $" #endif # include "netlist.h" @@ -100,7 +100,6 @@ struct target_t { /* Various kinds of process nodes are dispatched through these. */ virtual void proc_assign(const NetAssign*); - virtual void proc_assign_mem(const NetAssignMem*); virtual void proc_assign_nb(const NetAssignNB*); virtual void proc_assign_mem_nb(const NetAssignMemNB*); virtual bool proc_block(const NetBlock*); @@ -164,6 +163,11 @@ extern const struct target *target_table[]; /* * $Log: target.h,v $ + * Revision 1.58 2002/06/04 05:38:44 steve + * Add support for memory words in l-value of + * blocking assignments, and remove the special + * NetAssignMem class. + * * Revision 1.57 2002/03/09 02:10:22 steve * Add the NetUserFunc netlist node. *