Seperate arrayness from word count
This commit is contained in:
parent
37111eb4a8
commit
d883979fd8
13
elab_sig.cc
13
elab_sig.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: elab_sig.cc,v 1.48 2007/03/08 06:11:35 steve Exp $"
|
||||
#ident "$Id: elab_sig.cc,v 1.49 2007/04/02 01:12:34 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -626,6 +626,7 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
|
|||
|
||||
long array_s0 = 0;
|
||||
long array_e0 = 0;
|
||||
unsigned array_dimensions = 0;
|
||||
|
||||
/* If the ident has idx expressions, then this is a
|
||||
memory. It can only have the idx registers after the msb
|
||||
|
|
@ -664,6 +665,7 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
|
|||
|
||||
perm_string name = lex_strings.make(hname_.peek_tail_name());
|
||||
|
||||
array_dimensions = 1;
|
||||
array_s0 = lval.as_long();
|
||||
array_e0 = rval.as_long();
|
||||
}
|
||||
|
|
@ -709,8 +711,10 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
|
|||
<< " in scope " << scope->name() << endl;
|
||||
}
|
||||
|
||||
NetNet*sig = new NetNet(scope, name, wtype, msb, lsb,
|
||||
array_s0, array_e0);
|
||||
|
||||
NetNet*sig = array_dimensions > 0
|
||||
? new NetNet(scope, name, wtype, msb, lsb, array_s0, array_e0)
|
||||
: new NetNet(scope, name, wtype, msb, lsb);
|
||||
|
||||
ivl_variable_type_t use_data_type = data_type_;
|
||||
if (use_data_type == IVL_VT_NO_TYPE) {
|
||||
|
|
@ -738,6 +742,9 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: elab_sig.cc,v $
|
||||
* Revision 1.49 2007/04/02 01:12:34 steve
|
||||
* Seperate arrayness from word count
|
||||
*
|
||||
* Revision 1.48 2007/03/08 06:11:35 steve
|
||||
* Elaborate scopes of modules instantated in generate loops.
|
||||
*
|
||||
|
|
|
|||
1
ivl.def
1
ivl.def
|
|
@ -145,6 +145,7 @@ ivl_signal_attr_cnt
|
|||
ivl_signal_attr_val
|
||||
ivl_signal_basename
|
||||
ivl_signal_data_type
|
||||
ivl_signal_dimensions
|
||||
ivl_signal_integer
|
||||
ivl_signal_local
|
||||
ivl_signal_lsb
|
||||
|
|
|
|||
10
ivl_target.h
10
ivl_target.h
|
|
@ -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.181 2007/03/22 16:08:16 steve Exp $"
|
||||
#ident "$Id: ivl_target.h,v 1.182 2007/04/02 01:12:34 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <inttypes.h>
|
||||
|
|
@ -1473,6 +1473,10 @@ extern int ivl_scope_time_units(ivl_scope_t net);
|
|||
* Note that arraying of the signal into words is distinct from the
|
||||
* vectors. The width of a signal is the width of a WORD.
|
||||
*
|
||||
* ivl_signal_dimensions
|
||||
* The signal may be an array (of vectors) in which case this
|
||||
* function returns >0, the number of dimensions of the array.
|
||||
*
|
||||
* ivl_signal_msb
|
||||
* ivl_signal_lsb
|
||||
* ivl_signal_width
|
||||
|
|
@ -1535,6 +1539,7 @@ extern int ivl_scope_time_units(ivl_scope_t net);
|
|||
extern ivl_nexus_t ivl_signal_nex(ivl_signal_t net, unsigned word);
|
||||
extern int ivl_signal_array_base(ivl_signal_t net);
|
||||
extern unsigned ivl_signal_array_count(ivl_signal_t net);
|
||||
extern unsigned ivl_signal_dimensions(ivl_signal_t net);
|
||||
extern int ivl_signal_msb(ivl_signal_t net);
|
||||
extern int ivl_signal_lsb(ivl_signal_t net);
|
||||
extern unsigned ivl_signal_width(ivl_signal_t net);
|
||||
|
|
@ -1779,6 +1784,9 @@ _END_DECL
|
|||
|
||||
/*
|
||||
* $Log: ivl_target.h,v $
|
||||
* Revision 1.182 2007/04/02 01:12:34 steve
|
||||
* Seperate arrayness from word count
|
||||
*
|
||||
* Revision 1.181 2007/03/22 16:08:16 steve
|
||||
* Spelling fixes from Larry
|
||||
*
|
||||
|
|
|
|||
53
netlist.cc
53
netlist.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: netlist.cc,v 1.256 2007/03/02 06:13:22 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.257 2007/04/02 01:12:34 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -400,7 +400,7 @@ const Link& NetDelaySrc::condit_pin() const
|
|||
NetNet::NetNet(NetScope*s, perm_string n, Type t, unsigned npins)
|
||||
: NetObj(s, n, 1), sig_next_(0), sig_prev_(0),
|
||||
type_(t), port_type_(NOT_A_PORT), data_type_(IVL_VT_NO_TYPE),
|
||||
signed_(false), msb_(npins-1), lsb_(0), s0_(0), e0_(0),
|
||||
signed_(false), msb_(npins-1), lsb_(0), dimensions_(0), s0_(0), e0_(0),
|
||||
local_flag_(false), eref_count_(0), lref_count_(0)
|
||||
{
|
||||
assert(s);
|
||||
|
|
@ -434,6 +434,46 @@ NetNet::NetNet(NetScope*s, perm_string n, Type t, unsigned npins)
|
|||
s->add_signal(this);
|
||||
}
|
||||
|
||||
NetNet::NetNet(NetScope*s, perm_string n, Type t,
|
||||
long ms, long ls)
|
||||
: NetObj(s, n, 1),
|
||||
sig_next_(0), sig_prev_(0), type_(t),
|
||||
port_type_(NOT_A_PORT), data_type_(IVL_VT_NO_TYPE), signed_(false),
|
||||
msb_(ms), lsb_(ls), dimensions_(0), s0_(0), e0_(0),
|
||||
local_flag_(false), eref_count_(0), lref_count_(0)
|
||||
{
|
||||
assert(s);
|
||||
|
||||
verinum::V init_value = verinum::Vz;
|
||||
Link::DIR dir = Link::PASSIVE;
|
||||
|
||||
switch (t) {
|
||||
case REG:
|
||||
case IMPLICIT_REG:
|
||||
init_value = verinum::Vx;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
case SUPPLY0:
|
||||
init_value = verinum::V0;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
case SUPPLY1:
|
||||
init_value = verinum::V1;
|
||||
dir = Link::OUTPUT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
|
||||
pin(idx).set_name(perm_string::literal("P"), idx);
|
||||
pin(idx).set_dir(dir);
|
||||
pin(idx).set_init(init_value);
|
||||
}
|
||||
|
||||
s->add_signal(this);
|
||||
}
|
||||
|
||||
static unsigned calculate_count(long s, long e)
|
||||
{
|
||||
if (s >= e)
|
||||
|
|
@ -447,7 +487,7 @@ NetNet::NetNet(NetScope*s, perm_string n, Type t,
|
|||
: NetObj(s, n, calculate_count(array_s, array_e)),
|
||||
sig_next_(0), sig_prev_(0), type_(t),
|
||||
port_type_(NOT_A_PORT), data_type_(IVL_VT_NO_TYPE), signed_(false),
|
||||
msb_(ms), lsb_(ls), s0_(array_s), e0_(array_e),
|
||||
msb_(ms), lsb_(ls), dimensions_(1), s0_(array_s), e0_(array_e),
|
||||
local_flag_(false), eref_count_(0), lref_count_(0)
|
||||
{
|
||||
assert(s);
|
||||
|
|
@ -613,9 +653,7 @@ unsigned NetNet::sb_to_idx(long sb) const
|
|||
|
||||
unsigned NetNet::array_dimensions() const
|
||||
{
|
||||
if (s0_ == e0_)
|
||||
return 0;
|
||||
return 1;
|
||||
return dimensions_;
|
||||
}
|
||||
|
||||
long NetNet::array_first() const
|
||||
|
|
@ -2287,6 +2325,9 @@ const NetProc*NetTaskDef::proc() const
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.257 2007/04/02 01:12:34 steve
|
||||
* Seperate arrayness from word count
|
||||
*
|
||||
* Revision 1.256 2007/03/02 06:13:22 steve
|
||||
* Add support for edge sensitive spec paths.
|
||||
*
|
||||
|
|
|
|||
10
netlist.h
10
netlist.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: netlist.h,v 1.374 2007/03/26 18:17:50 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.375 2007/04/02 01:12:34 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -469,7 +469,9 @@ class NetNet : public NetObj {
|
|||
// dimensions. If s0==e0, then this is not an array after
|
||||
// all.
|
||||
explicit NetNet(NetScope*s, perm_string n, Type t,
|
||||
long ms, long ls, long s0 =0, long e0 =0);
|
||||
long ms, long ls);
|
||||
explicit NetNet(NetScope*s, perm_string n, Type t,
|
||||
long ms, long ls, long s0, long e0);
|
||||
|
||||
virtual ~NetNet();
|
||||
|
||||
|
|
@ -561,6 +563,7 @@ class NetNet : public NetObj {
|
|||
bool isint_; // original type of integer
|
||||
|
||||
long msb_, lsb_;
|
||||
const unsigned dimensions_;
|
||||
long s0_, e0_;
|
||||
|
||||
bool local_flag_;
|
||||
|
|
@ -3495,6 +3498,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.375 2007/04/02 01:12:34 steve
|
||||
* Seperate arrayness from word count
|
||||
*
|
||||
* Revision 1.374 2007/03/26 18:17:50 steve
|
||||
* Remove pretense of general use for t_cookie.
|
||||
*
|
||||
|
|
|
|||
10
t-dll-api.cc
10
t-dll-api.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll-api.cc,v 1.143 2007/03/26 16:51:48 steve Exp $"
|
||||
#ident "$Id: t-dll-api.cc,v 1.144 2007/04/02 01:12:34 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1502,6 +1502,11 @@ extern "C" unsigned ivl_signal_array_count(ivl_signal_t net)
|
|||
return net->array_words;
|
||||
}
|
||||
|
||||
extern "C" unsigned ivl_signal_dimensions(ivl_signal_t net)
|
||||
{
|
||||
return net->array_dimensions_;
|
||||
}
|
||||
|
||||
extern "C" const char* ivl_signal_attr(ivl_signal_t net, const char*key)
|
||||
{
|
||||
if (net->nattr == 0)
|
||||
|
|
@ -1960,6 +1965,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-api.cc,v $
|
||||
* Revision 1.144 2007/04/02 01:12:34 steve
|
||||
* Seperate arrayness from word count
|
||||
*
|
||||
* Revision 1.143 2007/03/26 16:51:48 steve
|
||||
* do not calculate nexus name unless needed.
|
||||
*
|
||||
|
|
|
|||
7
t-dll.cc
7
t-dll.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll.cc,v 1.169 2007/03/26 20:32:47 steve Exp $"
|
||||
#ident "$Id: t-dll.cc,v 1.170 2007/04/02 01:12:34 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -2052,6 +2052,8 @@ void dll_target::signal(const NetNet*net)
|
|||
obj->isint_ = false;
|
||||
obj->local_ = (net->local_flag() && (net->peek_eref() == 0))? 1 : 0;
|
||||
|
||||
obj->array_dimensions_ = net->array_dimensions();
|
||||
|
||||
switch (net->port_type()) {
|
||||
|
||||
case NetNet::PINPUT:
|
||||
|
|
@ -2225,6 +2227,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
|
|||
|
||||
/*
|
||||
* $Log: t-dll.cc,v $
|
||||
* Revision 1.170 2007/04/02 01:12:34 steve
|
||||
* Seperate arrayness from word count
|
||||
*
|
||||
* Revision 1.169 2007/03/26 20:32:47 steve
|
||||
* More efficient allocate of ivl_nexus_t objects.
|
||||
*
|
||||
|
|
|
|||
8
t-dll.h
8
t-dll.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll.h,v 1.141 2007/03/26 20:32:47 steve Exp $"
|
||||
#ident "$Id: t-dll.h,v 1.142 2007/04/02 01:12:34 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -572,6 +572,9 @@ struct ivl_signal_s {
|
|||
unsigned isint_ : 1;
|
||||
unsigned local_ : 1;
|
||||
|
||||
/* For now, support only 0 or 1 array dimensions. */
|
||||
unsigned array_dimensions_ : 1;
|
||||
|
||||
/* These encode the run-time index for the least significant
|
||||
bit, and the distance to the second bit. */
|
||||
signed lsb_index;
|
||||
|
|
@ -676,6 +679,9 @@ struct ivl_statement_s {
|
|||
|
||||
/*
|
||||
* $Log: t-dll.h,v $
|
||||
* Revision 1.142 2007/04/02 01:12:34 steve
|
||||
* Seperate arrayness from word count
|
||||
*
|
||||
* Revision 1.141 2007/03/26 20:32:47 steve
|
||||
* More efficient allocate of ivl_nexus_t objects.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: expression.c,v 1.4 2007/03/06 05:22:49 steve Exp $"
|
||||
#ident "$Id: expression.c,v 1.5 2007/04/02 01:12:34 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -38,8 +38,9 @@ static void show_array_expression(ivl_expr_t net, unsigned ind)
|
|||
unsigned width = ivl_signal_width(sig);
|
||||
const char*vt = vt_type_string(net);
|
||||
|
||||
fprintf(out, "%*sArray: %s, word_count=%u, width=%u, type=%s\n",
|
||||
ind, "", name, ivl_signal_array_count(sig), width, vt);
|
||||
fprintf(out, "%*sArray: %s, word_count=%u (%u dimensions), width=%u, type=%s\n",
|
||||
ind, "", name, ivl_signal_array_count(sig),
|
||||
ivl_signal_dimensions(sig), width, vt);
|
||||
}
|
||||
|
||||
static void show_binary_expression(ivl_expr_t net, unsigned ind)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: statement.c,v 1.12 2007/01/17 05:00:12 steve Exp $"
|
||||
#ident "$Id: statement.c,v 1.13 2007/04/02 01:12:34 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -40,10 +40,10 @@ static unsigned show_assign_lval(ivl_lval_t lval, unsigned ind)
|
|||
if (ivl_lval_idx(lval)) {
|
||||
fprintf(out, "%*sAddress-0 select expression:\n", ind+4, "");
|
||||
show_expression(ivl_lval_idx(lval), ind+6);
|
||||
if (ivl_signal_array_count(sig) <= 1) {
|
||||
if (ivl_signal_dimensions(sig) < 1) {
|
||||
fprintf(out, "%*sERROR: Address on signal with "
|
||||
"word count=%u\n", ind+4, "",
|
||||
ivl_signal_array_count(sig));
|
||||
"array dimensions=%u\n", ind+4, "",
|
||||
ivl_signal_dimensions(sig));
|
||||
stub_errors += 1;
|
||||
}
|
||||
} else if (ivl_signal_array_count(sig) > 1) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vvp_scope.c,v 1.156 2007/03/22 16:08:18 steve Exp $"
|
||||
#ident "$Id: vvp_scope.c,v 1.157 2007/04/02 01:12:34 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvp_priv.h"
|
||||
|
|
@ -985,7 +985,7 @@ static void draw_reg_in_scope(ivl_signal_t sig)
|
|||
|
||||
/* If the reg objects are collected into an array, then first
|
||||
write out the .array record to declare the array indices. */
|
||||
if (ivl_signal_array_count(sig) > 1) {
|
||||
if (ivl_signal_dimensions(sig) > 0) {
|
||||
unsigned word_count = ivl_signal_array_count(sig);
|
||||
unsigned iword;
|
||||
int last = ivl_signal_array_base(sig)+ivl_signal_array_count(sig)-1;
|
||||
|
|
@ -1036,6 +1036,7 @@ static void draw_net_in_scope(ivl_signal_t sig)
|
|||
for (iword = 0 ; iword < ivl_signal_array_count(sig); iword += 1) {
|
||||
|
||||
unsigned word_count = ivl_signal_array_count(sig);
|
||||
unsigned dimensions = ivl_signal_dimensions(sig);
|
||||
struct vvp_nexus_data*nex_data;
|
||||
|
||||
/* Connect the pin of the signal to something. */
|
||||
|
|
@ -1055,14 +1056,14 @@ static void draw_net_in_scope(ivl_signal_t sig)
|
|||
if (strength_aware_flag)
|
||||
vec8 = "8";
|
||||
|
||||
if (iword == 0 && word_count > 1) {
|
||||
if (iword == 0 && dimensions > 0) {
|
||||
int last = ivl_signal_array_base(sig) + word_count-1;
|
||||
int first = ivl_signal_array_base(sig);
|
||||
fprintf(vvp_out, "v%p .array \"%s\", %d %d;\n",
|
||||
sig, vvp_mangle_name(ivl_signal_basename(sig)),
|
||||
last, first);
|
||||
}
|
||||
if (word_count > 1) {
|
||||
if (dimensions > 0) {
|
||||
/* If this is a word of an array, then use an
|
||||
array reference in place of the net name. */
|
||||
fprintf(vvp_out, "v%p_%u .net%s%s v%p, %d %d, %s;"
|
||||
|
|
@ -2369,6 +2370,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
|
||||
/*
|
||||
* $Log: vvp_scope.c,v $
|
||||
* Revision 1.157 2007/04/02 01:12:34 steve
|
||||
* Seperate arrayness from word count
|
||||
*
|
||||
* Revision 1.156 2007/03/22 16:08:18 steve
|
||||
* Spelling fixes from Larry
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue