Implement a-b muxes as vector devices
This commit is contained in:
parent
d00e3fc9a9
commit
d4eb4d38bc
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: draw_mux.c,v 1.7 2003/12/19 01:27:10 steve Exp $"
|
#ident "$Id: draw_mux.c,v 1.8 2005/02/12 22:54:29 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vvp_priv.h"
|
# include "vvp_priv.h"
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*
|
/*
|
||||||
* This draws a general mux, a slice at a time. Use MUXX so that
|
* This draws a general mux, a slice at a time. Use MUXX so that
|
||||||
* unknows lead to unknown output.
|
* unknows lead to unknown output.
|
||||||
|
|
@ -136,6 +137,7 @@ static void draw_lpm_mux_bitslice(ivl_lpm_t net, unsigned slice)
|
||||||
draw_input_from_net(s);
|
draw_input_from_net(s);
|
||||||
fprintf(vvp_out, ", C<1>;\n");
|
fprintf(vvp_out, ", C<1>;\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This draws a simple A/B mux. The mux can have any width, enough
|
* This draws a simple A/B mux. The mux can have any width, enough
|
||||||
|
|
@ -143,48 +145,38 @@ static void draw_lpm_mux_bitslice(ivl_lpm_t net, unsigned slice)
|
||||||
*/
|
*/
|
||||||
static void draw_lpm_mux_ab(ivl_lpm_t net)
|
static void draw_lpm_mux_ab(ivl_lpm_t net)
|
||||||
{
|
{
|
||||||
ivl_nexus_t s;
|
/* Only support A-B muxes in this function. */
|
||||||
unsigned idx, width;
|
|
||||||
|
|
||||||
/* Only support A-B muxes at this oint. */
|
|
||||||
assert(ivl_lpm_size(net) == 2);
|
assert(ivl_lpm_size(net) == 2);
|
||||||
assert(ivl_lpm_selects(net) == 1);
|
assert(ivl_lpm_selects(net) == 1);
|
||||||
|
|
||||||
width = ivl_lpm_width(net);
|
fprintf(vvp_out, "L_%p .functor MUXZ", net);
|
||||||
s = ivl_lpm_select(net, 0);
|
fprintf(vvp_out, ", %s", draw_net_input(ivl_lpm_data(net,0)));
|
||||||
|
fprintf(vvp_out, ", %s", draw_net_input(ivl_lpm_data(net,1)));
|
||||||
for (idx = 0 ; idx < width ; idx += 1) {
|
fprintf(vvp_out, ", %s", draw_net_input(ivl_lpm_select(net,0)));
|
||||||
ivl_nexus_t a = ivl_lpm_data2(net, 0, idx);
|
fprintf(vvp_out, ", C4<>;\n");
|
||||||
ivl_nexus_t b = ivl_lpm_data2(net, 1, idx);
|
|
||||||
fprintf(vvp_out, "L_%s.%s/%u .functor MUXZ, ",
|
|
||||||
vvp_mangle_id(ivl_scope_name(ivl_lpm_scope(net))),
|
|
||||||
vvp_mangle_id(ivl_lpm_basename(net)), idx);
|
|
||||||
draw_input_from_net(a);
|
|
||||||
fprintf(vvp_out, ", ");
|
|
||||||
draw_input_from_net(b);
|
|
||||||
fprintf(vvp_out, ", ");
|
|
||||||
draw_input_from_net(s);
|
|
||||||
fprintf(vvp_out, ", C<1>;\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_lpm_mux(ivl_lpm_t net)
|
void draw_lpm_mux(ivl_lpm_t net)
|
||||||
{
|
{
|
||||||
unsigned idx;
|
|
||||||
|
|
||||||
if ((ivl_lpm_size(net) == 2) && (ivl_lpm_selects(net) == 1)) {
|
if ((ivl_lpm_size(net) == 2) && (ivl_lpm_selects(net) == 1)) {
|
||||||
draw_lpm_mux_ab(net);
|
draw_lpm_mux_ab(net);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
# if 0
|
||||||
for (idx = 0 ; idx < ivl_lpm_width(net) ; idx += 1)
|
for (idx = 0 ; idx < ivl_lpm_width(net) ; idx += 1)
|
||||||
draw_lpm_mux_bitslice(net, idx);
|
draw_lpm_mux_bitslice(net, idx);
|
||||||
|
# else
|
||||||
|
fprintf(stderr, "XXXX Forgot how to implement wide muxes.\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: draw_mux.c,v $
|
* $Log: draw_mux.c,v $
|
||||||
|
* Revision 1.8 2005/02/12 22:54:29 steve
|
||||||
|
* Implement a-b muxes as vector devices
|
||||||
|
*
|
||||||
* Revision 1.7 2003/12/19 01:27:10 steve
|
* Revision 1.7 2003/12/19 01:27:10 steve
|
||||||
* Fix various unsigned compare warnings.
|
* Fix various unsigned compare warnings.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: vvp_scope.c,v 1.117 2005/02/12 06:25:15 steve Exp $"
|
#ident "$Id: vvp_scope.c,v 1.118 2005/02/12 22:54:29 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vvp_priv.h"
|
# include "vvp_priv.h"
|
||||||
|
|
@ -551,7 +551,6 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
|
||||||
if (lpm) switch (ivl_lpm_type(lpm)) {
|
if (lpm) switch (ivl_lpm_type(lpm)) {
|
||||||
|
|
||||||
case IVL_LPM_FF:
|
case IVL_LPM_FF:
|
||||||
case IVL_LPM_MUX:
|
|
||||||
for (idx = 0 ; idx < ivl_lpm_width(lpm) ; idx += 1)
|
for (idx = 0 ; idx < ivl_lpm_width(lpm) ; idx += 1)
|
||||||
if (ivl_lpm_q(lpm, idx) == nex) {
|
if (ivl_lpm_q(lpm, idx) == nex) {
|
||||||
sprintf(result, "L_%s.%s/%u",
|
sprintf(result, "L_%s.%s/%u",
|
||||||
|
|
@ -580,6 +579,7 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
|
||||||
case IVL_LPM_SHIFTR:
|
case IVL_LPM_SHIFTR:
|
||||||
case IVL_LPM_SUB:
|
case IVL_LPM_SUB:
|
||||||
case IVL_LPM_MULT:
|
case IVL_LPM_MULT:
|
||||||
|
case IVL_LPM_MUX:
|
||||||
case IVL_LPM_DIVIDE:
|
case IVL_LPM_DIVIDE:
|
||||||
case IVL_LPM_MOD:
|
case IVL_LPM_MOD:
|
||||||
case IVL_LPM_UFUNC:
|
case IVL_LPM_UFUNC:
|
||||||
|
|
@ -2041,6 +2041,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vvp_scope.c,v $
|
* $Log: vvp_scope.c,v $
|
||||||
|
* Revision 1.118 2005/02/12 22:54:29 steve
|
||||||
|
* Implement a-b muxes as vector devices
|
||||||
|
*
|
||||||
* Revision 1.117 2005/02/12 06:25:15 steve
|
* Revision 1.117 2005/02/12 06:25:15 steve
|
||||||
* Draw C4 and C8 constants to account for strength.
|
* Draw C4 and C8 constants to account for strength.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue