LPM objects store only their base names.

This commit is contained in:
steve 2003-02-26 01:29:24 +00:00
parent c62a53ad27
commit a275133ff9
7 changed files with 89 additions and 157 deletions

136
cprop.cc
View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2000 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2003 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
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: cprop.cc,v 1.41 2003/01/30 16:23:07 steve Exp $"
#ident "$Id: cprop.cc,v 1.42 2003/02/26 01:29:24 steve Exp $"
#endif
# include "config.h"
@ -834,9 +834,10 @@ void cprop_functor::lpm_mux(Design*des, NetMux*obj)
}
if (flag) {
NetScope*scope = obj->scope();
for (unsigned idx = 0 ; idx < obj->width() ; idx += 1) {
NetLogic*tmp = new NetLogic(obj->scope(),
des->local_symbol(obj->name()),
scope->local_hsymbol(),
3, NetLogic::BUFIF1);
connect(obj->pin_Result(idx), tmp->pin(0));
@ -866,9 +867,10 @@ void cprop_functor::lpm_mux(Design*des, NetMux*obj)
}
if (flag) {
NetScope*scope = obj->scope();
for (unsigned idx = 0 ; idx < obj->width() ; idx += 1) {
NetLogic*tmp = new NetLogic(obj->scope(),
des->local_symbol(obj->name()),
scope->local_hsymbol(),
3, NetLogic::BUFIF0);
connect(obj->pin_Result(idx), tmp->pin(0));
@ -994,6 +996,9 @@ void cprop(Design*des)
/*
* $Log: cprop.cc,v $
* Revision 1.42 2003/02/26 01:29:24 steve
* LPM objects store only their base names.
*
* Revision 1.41 2003/01/30 16:23:07 steve
* Spelling fixes.
*
@ -1019,128 +1024,5 @@ void cprop(Design*des)
*
* Divide signal reference counts between rval
* and lval references.
*
* Revision 1.34 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.33 2002/04/14 02:51:37 steve
* Fix bug removing pairs of ones in XOR.
*
* Revision 1.32 2002/02/03 00:06:28 steve
* Comments about xor evaluation.
*
* Revision 1.31 2001/12/31 01:56:08 steve
* Get sense of 1-bit == operator right.
*
* Revision 1.30 2001/10/28 01:14:53 steve
* NetObj constructor finally requires a scope.
*
* Revision 1.29 2001/07/25 03:10:48 steve
* Create a config.h.in file to hold all the config
* junk, and support gcc 3.0. (Stephan Boettcher)
*
* Revision 1.28 2001/06/15 04:14:18 steve
* Generate vvp code for GT and GE comparisons.
*
* Revision 1.27 2001/06/07 02:12:43 steve
* Support structural addition.
*
* Revision 1.26 2001/02/18 01:07:32 steve
* check signals in the cprop functor.
*
* Revision 1.25 2001/02/16 03:27:31 steve
* Constant propagation for compare ==.
*
* Revision 1.24 2001/02/10 04:50:54 steve
* Catch constants driving root module ports. (PR#130)
*
* Revision 1.23 2000/12/30 03:11:15 steve
* Propagate initial value of constants into wires.
*
* Revision 1.22 2000/11/23 01:55:52 steve
* Propagate constants through xnor gates. (PR#51)
*
* Revision 1.21 2000/11/19 05:26:58 steve
* Replace AND constand propagation.
*
* Revision 1.20 2000/11/18 05:13:27 steve
* Thorough constant propagation for or and nor gates.
*
* Revision 1.19 2000/11/18 04:10:37 steve
* Handle constant propagation through XOR gates,
* including reducing the gate to a constant,
* a buffer or an inverter if possible.
*
* 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.
*
* Revision 1.16 2000/10/06 21:26:34 steve
* Eliminate zero inputs to xor.
*
* Revision 1.15 2000/08/02 14:48:01 steve
* use bufif0 if z is in true case of mux.
*
* Revision 1.14 2000/07/25 02:55:13 steve
* Unlink z constants from nets.
*
* Revision 1.13 2000/07/15 05:13:43 steve
* Detect muxing Vz as a bufufN.
*
* Revision 1.12 2000/06/25 19:59:41 steve
* Redesign Links to include the Nexus class that
* carries properties of the connected set of links.
*
* Revision 1.11 2000/06/24 22:55:19 steve
* Get rid of useless next_link method.
*
* Revision 1.10 2000/05/14 17:55:04 steve
* Support initialization of FF Q value.
*
* Revision 1.9 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.8 2000/04/28 21:00:28 steve
* Over agressive signal elimination in constant probadation.
*
* Revision 1.7 2000/02/23 02:56:54 steve
* Macintosh compilers do not support ident.
*
* Revision 1.6 2000/01/02 17:56:42 steve
* Do not delete constants that input to exressions.
*
* Revision 1.5 1999/12/30 04:19:12 steve
* Propogate constant 0 in low bits of adders.
*
* Revision 1.4 1999/12/17 06:18:15 steve
* Rewrite the cprop functor to use the functor_t interface.
*
* Revision 1.3 1999/12/17 03:38:46 steve
* NetConst can now hold wide constants.
*
* Revision 1.2 1998/12/02 04:37:13 steve
* Add the nobufz function to eliminate bufz objects,
* Object links are marked with direction,
* constant propagation is more careful will wide links,
* Signal folding is aware of attributes, and
* the XNF target can dump UDP objects based on LCA
* attributes.
*
* Revision 1.1 1998/11/13 06:23:17 steve
* Introduce netlist optimizations with the
* cprop function to do constant propogation.
*
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2002 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2003 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
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_net.cc,v 1.106 2003/01/27 05:09:17 steve Exp $"
#ident "$Id: elab_net.cc,v 1.107 2003/02/26 01:29:24 steve Exp $"
#endif
# include "config.h"
@ -180,7 +180,7 @@ NetNet* PEBinary::elaborate_net_add_(Design*des, NetScope*scope,
NetNode*gate;
NetNode*gate_t;
string name = scope->local_hsymbol();
string name = scope->local_symbol();
unsigned width = lsig->pin_count();
if (rsig->pin_count() > lsig->pin_count())
width = rsig->pin_count();
@ -444,7 +444,7 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, NetScope*scope,
case 'L':
case 'G': {
NetCompare*cmp = new
NetCompare(scope, scope->local_hsymbol(), dwidth);
NetCompare(scope, scope->local_symbol(), dwidth);
for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1)
connect(cmp->pin_DataA(idx), lsig->pin(idx));
for (unsigned idx = lsig->pin_count(); idx < dwidth ; idx += 1)
@ -521,7 +521,7 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, NetScope*scope,
}
/* Oh well, do the general case with a NetCompare. */
{ NetCompare*cmp = new NetCompare(scope, scope->local_hsymbol(),
{ NetCompare*cmp = new NetCompare(scope, scope->local_symbol(),
dwidth);
for (unsigned idx = 0 ; idx < dwidth ; idx += 1) {
@ -555,7 +555,7 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, NetScope*scope,
}
/* Oh well, do the general case with a NetCompare. */
{ NetCompare*cmp = new NetCompare(scope, scope->local_hsymbol(),
{ NetCompare*cmp = new NetCompare(scope, scope->local_symbol(),
dwidth);
for (unsigned idx = 0 ; idx < dwidth ; idx += 1) {
@ -626,7 +626,7 @@ NetNet* PEBinary::elaborate_net_div_(Design*des, NetScope*scope,
}
// Create a device with the calculated dimensions.
NetDivide*div = new NetDivide(scope, scope->local_hsymbol(), rwidth,
NetDivide*div = new NetDivide(scope, scope->local_symbol(), rwidth,
lsig->pin_count(),
rsig->pin_count());
des->add_node(div);
@ -691,7 +691,7 @@ NetNet* PEBinary::elaborate_net_mod_(Design*des, NetScope*scope,
if (rsig->pin_count() > rwidth)
rwidth = rsig->pin_count();
}
NetModulo*mod = new NetModulo(scope, scope->local_hsymbol(), rwidth,
NetModulo*mod = new NetModulo(scope, scope->local_symbol(), rwidth,
lsig->pin_count(),
rsig->pin_count());
des->add_node(mod);
@ -860,7 +860,7 @@ NetNet* PEBinary::elaborate_net_mul_(Design*des, NetScope*scope,
rwidth = lsig->pin_count() + rsig->pin_count();
}
NetMult*mult = new NetMult(scope, scope->local_hsymbol(), rwidth,
NetMult*mult = new NetMult(scope, scope->local_symbol(), rwidth,
lsig->pin_count(),
rsig->pin_count());
des->add_node(mult);
@ -961,7 +961,7 @@ NetNet* PEBinary::elaborate_net_shift_(Design*des, NetScope*scope,
// Make the shift device itself, and the output
// NetNet. Connect the Result output pins to the osig signal
NetCLShift*gate = new NetCLShift(scope, scope->local_hsymbol(),
NetCLShift*gate = new NetCLShift(scope, scope->local_symbol(),
lwidth, rsig->pin_count());
NetNet*osig = new NetNet(scope, scope->local_hsymbol(),
@ -1219,7 +1219,7 @@ NetNet* PEIdent::elaborate_net_bitmux_(Design*des, NetScope*scope,
NetNet*sel = msb_->elaborate_net(des, scope, 0, 0, 0, 0);
unsigned sig_width = sig->pin_count();
NetMux*mux = new NetMux(scope, scope->local_hsymbol(), 1,
NetMux*mux = new NetMux(scope, scope->local_symbol(), 1,
sig_width, sel->pin_count());
/* Connect the signal bits to the mux. Account for the
@ -1976,7 +1976,7 @@ NetNet* PETernary::elaborate_net(Design*des, NetScope*scope,
The inputs are the 0 (false) connected to fal_sig and 1
(true) connected to tru_sig. */
NetMux*mux = new NetMux(scope, scope->local_hsymbol(), dwidth, 2, 1);
NetMux*mux = new NetMux(scope, scope->local_symbol(), dwidth, 2, 1);
connect(mux->pin_Sel(0), expr_sig->pin(0));
/* Connect the data inputs. */
@ -2242,7 +2242,7 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
break;
default:
NetAddSub*sub = new NetAddSub(scope, scope->local_hsymbol(),
NetAddSub*sub = new NetAddSub(scope, scope->local_symbol(),
sig->pin_count());
sub->attribute("LPM_Direction", verinum("SUB"));
@ -2284,6 +2284,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
/*
* $Log: elab_net.cc,v $
* Revision 1.107 2003/02/26 01:29:24 steve
* LPM objects store only their base names.
*
* Revision 1.106 2003/01/27 05:09:17 steve
* Spelling fixes.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: expr_synth.cc,v 1.39 2003/01/30 16:23:07 steve Exp $"
#ident "$Id: expr_synth.cc,v 1.40 2003/02/26 01:29:24 steve Exp $"
#endif
# include "config.h"
@ -52,7 +52,7 @@ NetNet* NetEBAdd::synthesize(Design*des)
NetNet*osig = new NetNet(lsig->scope(), path, NetNet::IMPLICIT, width);
osig->local_flag(true);
string oname = des->local_symbol(path);
string oname = osig->scope()->local_symbol();
NetAddSub *adder = new NetAddSub(lsig->scope(), oname, width);
for (unsigned idx = 0 ; idx < width; idx += 1) {
connect(lsig->pin(idx), adder->pin_DataA(idx));
@ -577,7 +577,7 @@ NetNet* NetETernary::synthesize(Design *des)
NetNet*osig = new NetNet(csig->scope(), path, NetNet::IMPLICIT, width);
osig->local_flag(true);
string oname = des->local_symbol(path);
string oname = csig->scope()->local_symbol();
NetMux *mux = new NetMux(csig->scope(), oname, width, 2, 1);
for (unsigned idx = 0 ; idx < width; idx += 1) {
connect(tsig->pin(idx), mux->pin_Data(idx, 1));
@ -643,6 +643,9 @@ NetNet* NetESignal::synthesize(Design*des)
/*
* $Log: expr_synth.cc,v $
* Revision 1.40 2003/02/26 01:29:24 steve
* LPM objects store only their base names.
*
* Revision 1.39 2003/01/30 16:23:07 steve
* Spelling fixes.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: ivl_target.h,v 1.111 2003/01/30 16:23:07 steve Exp $"
#ident "$Id: ivl_target.h,v 1.112 2003/02/26 01:29:24 steve Exp $"
#endif
#ifdef __cplusplus
@ -583,7 +583,7 @@ extern const char* ivl_udp_name(ivl_udp_t net);
*
* These are the functions that apply to all LPM devices:
*
* ivl_lpm_name
* ivl_lpm_name (Obsolete)
* ivl_lpm_basename
* Return the name of the device. The name is the name of the
* device with the scope part, and the basename is without the scope.
@ -626,7 +626,8 @@ extern const char* ivl_udp_name(ivl_udp_t net);
* often the number of inputs per out, i.e., the number of inputs
* per bit for a MUX.
*/
extern const char* ivl_lpm_name(ivl_lpm_t net);
extern const char* ivl_lpm_name(ivl_lpm_t net); /* (Obsolete) */
extern const char* ivl_lpm_basename(ivl_lpm_t net);
extern ivl_scope_t ivl_lpm_scope(ivl_lpm_t net);
extern ivl_lpm_type_t ivl_lpm_type(ivl_lpm_t net);
@ -1143,6 +1144,9 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
* Revision 1.112 2003/02/26 01:29:24 steve
* LPM objects store only their base names.
*
* Revision 1.111 2003/01/30 16:23:07 steve
* Spelling fixes.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2003 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
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: netmisc.cc,v 1.4 2002/08/31 03:48:50 steve Exp $"
#ident "$Id: netmisc.cc,v 1.5 2003/02/26 01:29:24 steve Exp $"
#endif
# include "config.h"
@ -47,7 +47,7 @@ NetNet* add_to_net(Design*des, NetNet*sig, long val)
NetNet::IMPLICIT, width);
res->local_flag(true);
NetAddSub*add = new NetAddSub(scope, scope->local_hsymbol(), width);
NetAddSub*add = new NetAddSub(scope, scope->local_symbol(), width);
for (unsigned idx = 0 ; idx < width ; idx += 1)
connect(sig->pin(idx), add->pin_DataA(idx));
@ -90,6 +90,9 @@ NetExpr* elab_and_eval(Design*des, NetScope*scope, const PExpr*pe)
/*
* $Log: netmisc.cc,v $
* Revision 1.5 2003/02/26 01:29:24 steve
* LPM objects store only their base names.
*
* Revision 1.4 2002/08/31 03:48:50 steve
* Fix reverse bit ordered bit select in continuous assignment.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: synth2.cc,v 1.21 2003/01/27 05:09:17 steve Exp $"
#ident "$Id: synth2.cc,v 1.22 2003/02/26 01:29:24 steve Exp $"
#endif
# include "config.h"
@ -179,7 +179,7 @@ bool NetCase::synth_async(Design*des, NetScope*scope,
}
assert(cur == (1 << sel_pins));
NetMux*mux = new NetMux(scope, scope->local_hsymbol(),
NetMux*mux = new NetMux(scope, scope->local_symbol(),
nex_out->pin_count(),
1 << sel_pins, sel_pins);
@ -251,7 +251,7 @@ bool NetCondit::synth_async(Design*des, NetScope*scope,
else_->synth_async(des, scope, nex_map, bsig);
NetMux*mux = new NetMux(scope, scope->local_hsymbol(),
NetMux*mux = new NetMux(scope, scope->local_symbol(),
nex_out->pin_count(), 2, 1);
connect(mux->pin_Sel(0), ssig->pin(0));
@ -346,7 +346,7 @@ bool NetBlock::synth_sync(Design*des, NetScope*scope, NetFF*ff,
block. Connect this NetFF to the associated pins of
the existing wide NetFF device. While I'm at it, also
copy the aset_value bits for the new ff device. */
NetFF*ff2 = new NetFF(scope, scope->local_hsymbol().c_str(),
NetFF*ff2 = new NetFF(scope, scope->local_symbol().c_str(),
tmp_out->pin_count());
des->add_node(ff2);
@ -631,7 +631,7 @@ bool NetProcTop::synth_sync(Design*des)
NexusSet nex_set;
statement_->nex_output(nex_set);
NetFF*ff = new NetFF(scope(), scope()->local_hsymbol().c_str(),
NetFF*ff = new NetFF(scope(), scope()->local_symbol().c_str(),
nex_set.count());
des->add_node(ff);
ff->attribute("LPM_FFType", verinum("DFF"));
@ -738,6 +738,9 @@ void synth2(Design*des)
/*
* $Log: synth2.cc,v $
* Revision 1.22 2003/02/26 01:29:24 steve
* LPM objects store only their base names.
*
* Revision 1.21 2003/01/27 05:09:17 steve
* Spelling fixes.
*

View File

@ -17,11 +17,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll-api.cc,v 1.90 2003/01/26 21:15:59 steve Exp $"
#ident "$Id: t-dll-api.cc,v 1.91 2003/02/26 01:29:24 steve Exp $"
#endif
# include "config.h"
# include "t-dll.h"
# include <stdlib.h>
# include <string.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
/* THE FOLLOWING ARE FUNCTIONS THAT ARE CALLED FROM THE TARGET. */
@ -558,7 +563,7 @@ extern "C" const char* ivl_udp_name(ivl_udp_t net)
extern "C" const char* ivl_lpm_basename(ivl_lpm_t net)
{
return basename(net->scope, net->name);
return net->name;
}
extern "C" ivl_nexus_t ivl_lpm_async_clr(ivl_lpm_t net)
@ -731,11 +736,37 @@ extern "C" unsigned ivl_lpm_data2_width(ivl_lpm_t net, unsigned sdx)
return 0;
}
}
/*
* This function returns the hierarchical name for the LPM device. The
* name needs to be built up from the scope name and the lpm base
* name.
*
* Anachronism: This function is provided for
* compatibility. Eventually, it will be removed.
*/
extern "C" const char* ivl_lpm_name(ivl_lpm_t net)
{
return net->name;
static char*name_buffer = 0;
static unsigned name_size = 0;
ivl_scope_t scope = ivl_lpm_scope(net);
const char*sn = ivl_scope_name(scope);
unsigned need = strlen(sn) + 1 + strlen(net->name) + 1;
if (need < name_size) {
name_buffer = (char*)realloc(name_buffer, need);
name_size = need;
}
strcpy(name_buffer, sn);
char*tmp = name_buffer + strlen(sn);
*tmp++ = '.';
strcpy(tmp, net->name);
return name_buffer;
}
extern "C" ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx)
{
assert(net);
@ -1648,6 +1679,9 @@ extern "C" ivl_variable_type_t ivl_variable_type(ivl_variable_t net)
/*
* $Log: t-dll-api.cc,v $
* Revision 1.91 2003/02/26 01:29:24 steve
* LPM objects store only their base names.
*
* Revision 1.90 2003/01/26 21:15:59 steve
* Rework expression parsing and elaboration to
* accommodate real/realtime values and expressions.