Support structural addition.

This commit is contained in:
steve 2001-06-07 02:12:43 +00:00
parent f3019ff5a0
commit f480943649
12 changed files with 200 additions and 22 deletions

View File

@ -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.26 2001/02/18 01:07:32 steve Exp $"
#ident "$Id: cprop.cc,v 1.27 2001/06/07 02:12:43 steve Exp $"
#endif
# include "netlist.h"
@ -66,7 +66,7 @@ void cprop_functor::lpm_add_sub(Design*des, NetAddSub*obj)
&& (driven_value(obj->pin_DataA(0)) == verinum::V0)) {
NetAddSub*tmp = 0;
tmp = new NetAddSub(obj->name(), obj->width()-1);
tmp = new NetAddSub(obj->scope(), obj->name(), obj->width()-1);
//connect(tmp->pin_Aclr(), obj->pin_Aclr());
//connect(tmp->pin_Add_Sub(), obj->pin_Add_Sub());
//connect(tmp->pin_Clock(), obj->pin_Clock());
@ -91,7 +91,7 @@ void cprop_functor::lpm_add_sub(Design*des, NetAddSub*obj)
&& (driven_value(obj->pin_DataB(0)) == verinum::V0)) {
NetAddSub*tmp = 0;
tmp = new NetAddSub(obj->name(), obj->width()-1);
tmp = new NetAddSub(obj->scope(), obj->name(), obj->width()-1);
//connect(tmp->pin_Aclr(), obj->pin_Aclr());
//connect(tmp->pin_Add_Sub(), obj->pin_Add_Sub());
//connect(tmp->pin_Clock(), obj->pin_Clock());
@ -937,6 +937,9 @@ void cprop(Design*des)
/*
* $Log: cprop.cc,v $
* 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.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_net.cc,v 1.66 2001/05/17 03:34:47 steve Exp $"
#ident "$Id: elab_net.cc,v 1.67 2001/06/07 02:12:43 steve Exp $"
#endif
# include "PExpr.h"
@ -204,7 +204,7 @@ NetNet* PEBinary::elaborate_net_add_(Design*des, const string&path,
osig = new NetNet(scope, des->local_symbol(path),
NetNet::WIRE, owidth);
osig->local_flag(true);
NetAddSub*adder = new NetAddSub(name, width);
NetAddSub*adder = new NetAddSub(scope, name, width);
// Connect the adder to the various parts.
for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1)
@ -1901,6 +1901,9 @@ NetNet* PEUnary::elaborate_net(Design*des, const string&path,
/*
* $Log: elab_net.cc,v $
* Revision 1.67 2001/06/07 02:12:43 steve
* Support structural addition.
*
* Revision 1.66 2001/05/17 03:34:47 steve
* Make error message include error: prefix.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: expr_synth.cc,v 1.20 2001/02/15 06:59:36 steve Exp $"
#ident "$Id: expr_synth.cc,v 1.21 2001/06/07 02:12:43 steve Exp $"
#endif
# include "netlist.h"
@ -48,7 +48,7 @@ NetNet* NetEBAdd::synthesize(Design*des)
NetNet*osig = new NetNet(lsig->scope(), path, NetNet::IMPLICIT, width);
string oname = des->local_symbol(path);
NetAddSub *adder = new NetAddSub(oname, width);
NetAddSub *adder = new NetAddSub(lsig->scope(), oname, width);
for (unsigned idx = 0 ; idx < width; idx += 1) {
connect(lsig->pin(idx), adder->pin_DataA(idx));
connect(rsig->pin(idx), adder->pin_DataB(idx));
@ -447,6 +447,9 @@ NetNet* NetESignal::synthesize(Design*des)
/*
* $Log: expr_synth.cc,v $
* Revision 1.21 2001/06/07 02:12:43 steve
* Support structural addition.
*
* Revision 1.20 2001/02/15 06:59:36 steve
* FreeBSD port has a maintainer now.
*

View File

@ -45,6 +45,7 @@ ivl_logic_udp
ivl_lpm_clk
ivl_lpm_data
ivl_lpm_datab
ivl_lpm_data2
ivl_lpm_name
ivl_lpm_q

View File

@ -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.63 2001/05/20 01:06:16 steve Exp $"
#ident "$Id: ivl_target.h,v 1.64 2001/06/07 02:12:43 steve Exp $"
#endif
#ifdef __cplusplus
@ -201,6 +201,7 @@ typedef enum ivl_logic_e {
/* This is the type of an LPM object. */
typedef enum ivl_lpm_type_e {
IVL_LPM_ADD,
IVL_LPM_FF,
IVL_LPM_MUX
} ivl_lpm_type_t;
@ -461,7 +462,11 @@ extern const char* ivl_udp_name(ivl_udp_t net);
/* LPM
* These functions support access to the properties of LPM devices.
* These functions support access to the properties of LPM
* devices. LPM devices are a variety of devices that handle more
* complex structural semantics.
*
* These are the functions that apply to all LPM devices:
*
* ivl_lpm_name
* Return the name of the device.
@ -474,9 +479,22 @@ extern const char* ivl_udp_name(ivl_udp_t net);
* the LPM type, but it generally has to do with the width of the
* output data path.
*
*
* These functions apply to a subset of the LPM devices, or may have
* varying meaning depending on the device:
*
* ivl_lpm_data
* Return the input data nexus for device types that have a single
* input vector.
* input vector. This is also used to the get nexa of the first
* vector for devices that have more inputs.
*
* ivl_lpm_datab
* Return the input data nexis for device types that have a second
* input vector. For example, arithmetic devices are like this.
*
* ivl_lpm_q
* Return the output data nexus for device types that have a single
* output vector. This is most devices, it turns out.
*
* ivl_lpm_selects
* This is the size of the select input for a LPM_MUX device
@ -492,11 +510,13 @@ extern unsigned ivl_lpm_width(ivl_lpm_t net);
/* IVL_LPM_FF */
extern ivl_nexus_t ivl_lpm_clk(ivl_lpm_t net);
/* IVL_LPM_FF */
/* IVL_LPM_ADD IVL_LPM_FF */
extern ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx);
/* IVL_LPM_ADD */
extern ivl_nexus_t ivl_lpm_datab(ivl_lpm_t net, unsigned idx);
/* IVL_LPM_MUX */
extern ivl_nexus_t ivl_lpm_data2(ivl_lpm_t net, unsigned sdx, unsigned idx);
/* IVL_LPM_FF */
/* IVL_LPM_ADD IVL_LPM_FF */
extern ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx);
/* IVL_LPM_MUX */
extern unsigned ivl_lpm_selects(ivl_lpm_t net);
@ -852,6 +872,9 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
* Revision 1.64 2001/06/07 02:12:43 steve
* Support structural addition.
*
* Revision 1.63 2001/05/20 01:06:16 steve
* stub ivl_expr_parms for sfunctions.
*

View File

@ -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.160 2001/04/22 23:09:46 steve Exp $"
#ident "$Id: netlist.cc,v 1.161 2001/06/07 02:12:43 steve Exp $"
#endif
# include <cassert>
@ -620,8 +620,8 @@ const Link& NetFF::pin_Q(unsigned w) const
* 7 -- DataB[0]
* 8 -- Result[0]
*/
NetAddSub::NetAddSub(const string&n, unsigned w)
: NetNode(n, w*3+6)
NetAddSub::NetAddSub(NetScope*s, const string&n, unsigned w)
: NetNode(s, n, w*3+6)
{
pin(0).set_dir(Link::INPUT); pin(0).set_name("Add_Sub", 0);
pin(1).set_dir(Link::INPUT); pin(1).set_name("Aclr", 0);
@ -2323,6 +2323,9 @@ const NetProc*NetTaskDef::proc() const
/*
* $Log: netlist.cc,v $
* 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.
*

View File

@ -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.206 2001/05/08 23:59:33 steve Exp $"
#ident "$Id: netlist.h,v 1.207 2001/06/07 02:12:43 steve Exp $"
#endif
/*
@ -394,7 +394,7 @@ class NetNet : public NetObj, public LineInfo {
class NetAddSub : public NetNode {
public:
NetAddSub(const string&n, unsigned width);
NetAddSub(NetScope*s, const string&n, unsigned width);
~NetAddSub();
// Get the width of the device (that is, the width of the
@ -2809,6 +2809,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.207 2001/06/07 02:12:43 steve
* Support structural addition.
*
* Revision 1.206 2001/05/08 23:59:33 steve
* Add ivl and vvp.tgt support for memories in
* expressions and l-values. (Stephan Boettcher)

View File

@ -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.46 2001/05/20 01:06:16 steve Exp $"
#ident "$Id: t-dll-api.cc,v 1.47 2001/06/07 02:12:43 steve Exp $"
#endif
# include "t-dll.h"
@ -449,6 +449,10 @@ extern "C" ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx)
{
assert(net);
switch (net->type) {
case IVL_LPM_ADD:
assert(idx < net->u_.arith.width);
return net->u_.arith.a[idx];
case IVL_LPM_FF:
assert(idx < net->u_.ff.width);
if (net->u_.ff.width == 1)
@ -462,6 +466,21 @@ extern "C" ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx)
}
}
extern "C" ivl_nexus_t ivl_lpm_datab(ivl_lpm_t net, unsigned idx)
{
assert(net);
switch (net->type) {
case IVL_LPM_ADD:
assert(idx < net->u_.arith.width);
return net->u_.arith.b[idx];
default:
assert(0);
return 0;
}
}
extern "C" ivl_nexus_t ivl_lpm_data2(ivl_lpm_t net, unsigned sdx, unsigned idx)
{
assert(net);
@ -487,6 +506,10 @@ extern "C" ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx)
assert(net);
switch (net->type) {
case IVL_LPM_ADD:
assert(idx < net->u_.arith.width);
return net->u_.arith.q[idx];
case IVL_LPM_FF:
assert(idx < net->u_.ff.width);
if (net->u_.ff.width == 1)
@ -558,6 +581,8 @@ extern "C" unsigned ivl_lpm_width(ivl_lpm_t net)
return net->u_.ff.width;
case IVL_LPM_MUX:
return net->u_.mux.width;
case IVL_LPM_ADD:
return net->u_.arith.width;
default:
assert(0);
return 0;
@ -1146,6 +1171,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
/*
* $Log: t-dll-api.cc,v $
* Revision 1.47 2001/06/07 02:12:43 steve
* Support structural addition.
*
* Revision 1.46 2001/05/20 01:06:16 steve
* stub ivl_expr_parms for sfunctions.
*

View File

@ -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.42 2001/05/20 15:09:39 steve Exp $"
#ident "$Id: t-dll.cc,v 1.43 2001/06/07 02:12:43 steve Exp $"
#endif
# include "compiler.h"
@ -606,6 +606,49 @@ void dll_target::memory(const NetMemory*net)
scope_add_mem(obj->scope_, obj);
}
void dll_target::lpm_add_sub(const NetAddSub*net)
{
ivl_lpm_t obj = new struct ivl_lpm_s;
obj->type = IVL_LPM_ADD;
obj->name = strdup(net->name());
assert(net->scope());
obj->scope = find_scope(des_.root_, net->scope());
assert(obj->scope);
obj->u_.arith.width = net->width();
obj->u_.arith.q = new ivl_nexus_t[3 * obj->u_.arith.width];
obj->u_.arith.a = obj->u_.arith.q + obj->u_.arith.width;
obj->u_.arith.b = obj->u_.arith.a + obj->u_.arith.width;
for (unsigned idx = 0 ; idx < obj->u_.arith.width ; idx += 1) {
const Nexus*nex;
nex = net->pin_Result(idx).nexus();
assert(nex->t_cookie());
obj->u_.arith.q[idx] = (ivl_nexus_t) nex->t_cookie();
nexus_lpm_add(obj->u_.arith.q[idx], obj, 0,
IVL_DR_STRONG, IVL_DR_STRONG);
nex = net->pin_DataA(idx).nexus();
assert(nex->t_cookie());
obj->u_.arith.a[idx] = (ivl_nexus_t) nex->t_cookie();
nexus_lpm_add(obj->u_.arith.a[idx], obj, 0,
IVL_DR_HiZ, IVL_DR_HiZ);
nex = net->pin_DataB(idx).nexus();
assert(nex->t_cookie());
obj->u_.arith.b[idx] = (ivl_nexus_t) nex->t_cookie();
nexus_lpm_add(obj->u_.arith.b[idx], obj, 0,
IVL_DR_HiZ, IVL_DR_HiZ);
}
scope_add_lpm(obj->scope, obj);
}
void dll_target::lpm_ff(const NetFF*net)
{
ivl_lpm_t obj = new struct ivl_lpm_s;
@ -1020,6 +1063,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/*
* $Log: t-dll.cc,v $
* Revision 1.43 2001/06/07 02:12:43 steve
* Support structural addition.
*
* Revision 1.42 2001/05/20 15:09:39 steve
* Mingw32 support (Venkat Iyer)
*

10
t-dll.h
View File

@ -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.45 2001/05/20 15:09:39 steve Exp $"
#ident "$Id: t-dll.h,v 1.46 2001/06/07 02:12:43 steve Exp $"
#endif
# include "target.h"
@ -61,6 +61,7 @@ struct dll_target : public target_t, public expr_scan_t {
void event(const NetEvent*);
void logic(const NetLogic*);
void udp(const NetUDP*);
void lpm_add_sub(const NetAddSub*);
void lpm_ff(const NetFF*);
void lpm_mux(const NetMux*);
void net_assign(const NetAssign_*);
@ -247,6 +248,10 @@ struct ivl_lpm_s {
} s;
} mux;
struct ivl_lpm_arith_s {
unsigned short width;
ivl_nexus_t*q, *a, *b;
} arith;
} u_;
};
@ -523,6 +528,9 @@ struct ivl_statement_s {
/*
* $Log: t-dll.h,v $
* Revision 1.46 2001/06/07 02:12:43 steve
* Support structural addition.
*
* Revision 1.45 2001/05/20 15:09:39 steve
* Mingw32 support (Venkat Iyer)
*

View File

@ -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.42 2001/05/22 02:14:47 steve Exp $"
#ident "$Id: stub.c,v 1.43 2001/06/07 02:12:43 steve Exp $"
#endif
/*
@ -99,6 +99,22 @@ static void show_lpm(ivl_lpm_t net)
unsigned width = ivl_lpm_width(net);
switch (ivl_lpm_type(net)) {
case IVL_LPM_ADD: {
fprintf(out, " LPM_ADD %s: <width=%u>\n",
ivl_lpm_name(net), width);
for (idx = 0 ; idx < width ; idx += 1)
fprintf(out, " Q %u: %s\n", idx,
ivl_nexus_name(ivl_lpm_q(net, idx)));
for (idx = 0 ; idx < width ; idx += 1)
fprintf(out, " Data A %u: %s\n", idx,
ivl_nexus_name(ivl_lpm_data(net, idx)));
for (idx = 0 ; idx < width ; idx += 1)
fprintf(out, " Data B %u: %s\n", idx,
ivl_nexus_name(ivl_lpm_datab(net, idx)));
break;
}
case IVL_LPM_FF: {
fprintf(out, " LPM_FF %s: <width=%u>\n",
@ -550,6 +566,9 @@ DECLARE_CYGWIN_DLL(DllMain);
/*
* $Log: stub.c,v $
* Revision 1.43 2001/06/07 02:12:43 steve
* Support structural addition.
*
* Revision 1.42 2001/05/22 02:14:47 steve
* Update the mingw build to not require cygwin files.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vvp_scope.c,v 1.28 2001/05/12 16:34:47 steve Exp $"
#ident "$Id: vvp_scope.c,v 1.29 2001/06/07 02:12:43 steve Exp $"
#endif
# include "vvp_priv.h"
@ -114,6 +114,14 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
return result;
}
case IVL_LPM_ADD:
for (idx = 0 ; idx < ivl_lpm_width(lpm) ; idx += 1)
if (ivl_lpm_q(lpm, idx) == nex) {
sprintf(result, "L_%s[%u]",
ivl_lpm_name(lpm), idx);
return result;
}
}
assert(0);
@ -598,6 +606,29 @@ static void draw_event_in_scope(ivl_event_t obj)
}
}
static void draw_lpm_add(ivl_lpm_t net)
{
unsigned idx, width;
width = ivl_lpm_width(net);
fprintf(vvp_out, "L_%s .arith/sum %u", ivl_lpm_name(net), width);
for (idx = 0 ; idx < width ; idx += 1) {
ivl_nexus_t a = ivl_lpm_data(net, idx);
fprintf(vvp_out, ", ");
draw_input_from_net(a);
}
for (idx = 0 ; idx < width ; idx += 1) {
ivl_nexus_t b = ivl_lpm_datab(net, idx);
fprintf(vvp_out, ", ");
draw_input_from_net(b);
}
fprintf(vvp_out, ";\n");
}
static void draw_lpm_mux(ivl_lpm_t net)
{
ivl_nexus_t s;
@ -628,6 +659,10 @@ static void draw_lpm_mux(ivl_lpm_t net)
static void draw_lpm_in_scope(ivl_lpm_t net)
{
switch (ivl_lpm_type(net)) {
case IVL_LPM_ADD:
draw_lpm_add(net);
return;
case IVL_LPM_MUX:
draw_lpm_mux(net);
return;
@ -717,6 +752,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
/*
* $Log: vvp_scope.c,v $
* Revision 1.29 2001/06/07 02:12:43 steve
* Support structural addition.
*
* Revision 1.28 2001/05/12 16:34:47 steve
* Fixup the resolver syntax.
*