Account for carry out on add devices.
This commit is contained in:
parent
2f2657b765
commit
5361efe8ed
28
t-dll.cc
28
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.44 2001/06/07 03:09:37 steve Exp $"
|
||||
#ident "$Id: t-dll.cc,v 1.45 2001/06/07 04:20:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compiler.h"
|
||||
|
|
@ -618,13 +618,19 @@ void dll_target::lpm_add_sub(const NetAddSub*net)
|
|||
obj->scope = find_scope(des_.root_, net->scope());
|
||||
assert(obj->scope);
|
||||
|
||||
/* Choose the width of the adder. If the carry bit is
|
||||
connected, then widen the adder by one and plan on leaving
|
||||
the fake inputs unconnected. */
|
||||
obj->u_.arith.width = net->width();
|
||||
if (net->pin_Cout().is_linked()) {
|
||||
obj->u_.arith.width += 1;
|
||||
}
|
||||
|
||||
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) {
|
||||
for (unsigned idx = 0 ; idx < net->width() ; idx += 1) {
|
||||
const Nexus*nex;
|
||||
|
||||
nex = net->pin_Result(idx).nexus();
|
||||
|
|
@ -649,6 +655,21 @@ void dll_target::lpm_add_sub(const NetAddSub*net)
|
|||
IVL_DR_HiZ, IVL_DR_HiZ);
|
||||
}
|
||||
|
||||
/* If the carry output is connected, then connect the extra Q
|
||||
pin to the carry nexus and zero the a and b inputs. */
|
||||
if (net->pin_Cout().is_linked()) {
|
||||
unsigned carry = obj->u_.arith.width - 1;
|
||||
const Nexus*nex = net->pin_Cout().nexus();
|
||||
assert(nex->t_cookie());
|
||||
|
||||
obj->u_.arith.q[carry] = (ivl_nexus_t) nex->t_cookie();
|
||||
nexus_lpm_add(obj->u_.arith.q[carry], obj, 0,
|
||||
IVL_DR_STRONG, IVL_DR_STRONG);
|
||||
|
||||
obj->u_.arith.a[carry] = 0;
|
||||
obj->u_.arith.b[carry] = 0;
|
||||
}
|
||||
|
||||
scope_add_lpm(obj->scope, obj);
|
||||
}
|
||||
|
||||
|
|
@ -1066,6 +1087,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
|
|||
|
||||
/*
|
||||
* $Log: t-dll.cc,v $
|
||||
* Revision 1.45 2001/06/07 04:20:10 steve
|
||||
* Account for carry out on add devices.
|
||||
*
|
||||
* Revision 1.44 2001/06/07 03:09:37 steve
|
||||
* support subtraction in tgt-vvp.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.44 2001/06/07 03:09:37 steve Exp $"
|
||||
#ident "$Id: stub.c,v 1.45 2001/06/07 04:20:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -106,12 +106,16 @@ static void show_lpm(ivl_lpm_t net)
|
|||
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)
|
||||
for (idx = 0 ; idx < width ; idx += 1) {
|
||||
ivl_nexus_t nex = ivl_lpm_data(net, idx);
|
||||
fprintf(out, " Data A %u: %s\n", idx,
|
||||
ivl_nexus_name(ivl_lpm_data(net, idx)));
|
||||
for (idx = 0 ; idx < width ; idx += 1)
|
||||
nex? ivl_nexus_name(nex) : "");
|
||||
}
|
||||
for (idx = 0 ; idx < width ; idx += 1) {
|
||||
ivl_nexus_t nex = ivl_lpm_datab(net, idx);
|
||||
fprintf(out, " Data B %u: %s\n", idx,
|
||||
ivl_nexus_name(ivl_lpm_datab(net, idx)));
|
||||
nex? ivl_nexus_name(nex) : "");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -581,6 +585,9 @@ DECLARE_CYGWIN_DLL(DllMain);
|
|||
|
||||
/*
|
||||
* $Log: stub.c,v $
|
||||
* Revision 1.45 2001/06/07 04:20:10 steve
|
||||
* Account for carry out on add devices.
|
||||
*
|
||||
* Revision 1.44 2001/06/07 03:09:37 steve
|
||||
* support subtraction in tgt-vvp.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.30 2001/06/07 03:09:37 steve Exp $"
|
||||
#ident "$Id: vvp_scope.c,v 1.31 2001/06/07 04:20:10 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvp_priv.h"
|
||||
|
|
@ -629,14 +629,22 @@ static void draw_lpm_add(ivl_lpm_t net)
|
|||
|
||||
for (idx = 0 ; idx < width ; idx += 1) {
|
||||
ivl_nexus_t a = ivl_lpm_data(net, idx);
|
||||
fprintf(vvp_out, ", ");
|
||||
draw_input_from_net(a);
|
||||
if (a) {
|
||||
fprintf(vvp_out, ", ");
|
||||
draw_input_from_net(a);
|
||||
} else {
|
||||
fprintf(vvp_out, ", C<0>");
|
||||
}
|
||||
}
|
||||
|
||||
for (idx = 0 ; idx < width ; idx += 1) {
|
||||
ivl_nexus_t b = ivl_lpm_datab(net, idx);
|
||||
fprintf(vvp_out, ", ");
|
||||
draw_input_from_net(b);
|
||||
if (b) {
|
||||
fprintf(vvp_out, ", ");
|
||||
draw_input_from_net(b);
|
||||
} else {
|
||||
fprintf(vvp_out, ", C<0>");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(vvp_out, ";\n");
|
||||
|
|
@ -766,6 +774,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
|
||||
/*
|
||||
* $Log: vvp_scope.c,v $
|
||||
* Revision 1.31 2001/06/07 04:20:10 steve
|
||||
* Account for carry out on add devices.
|
||||
*
|
||||
* Revision 1.30 2001/06/07 03:09:37 steve
|
||||
* support subtraction in tgt-vvp.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue