Generate x out for x select on wide muxes.

This commit is contained in:
steve 2002-08-29 03:04:01 +00:00
parent 60046cc790
commit e79f62c5fa
4 changed files with 67 additions and 8 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: draw_mux.c,v 1.4 2002/08/12 01:35:03 steve Exp $"
#ident "$Id: draw_mux.c,v 1.5 2002/08/29 03:04:01 steve Exp $"
#endif
# include "vvp_priv.h"
@ -28,6 +28,10 @@
# include <stdlib.h>
# include <string.h>
/*
* This draws a general mux, a slice at a time. Use MUXX so that
* unknows lead to unknown output.
*/
static void draw_lpm_mux_bitslice(ivl_lpm_t net, unsigned slice)
{
unsigned sel = ivl_lpm_selects(net);
@ -55,7 +59,7 @@ static void draw_lpm_mux_bitslice(ivl_lpm_t net, unsigned slice)
select vector. */
for (idx = 0 ; idx < size ; idx += 2) {
fprintf(vvp_out, "L_%s/%u/%u/%u .functor MUXZ, ",
fprintf(vvp_out, "L_%s/%u/%u/%u .functor MUXX, ",
vvp_mangle_id(ivl_lpm_name(net)), slice, sel, idx);
{
@ -76,7 +80,7 @@ static void draw_lpm_mux_bitslice(ivl_lpm_t net, unsigned slice)
fprintf(vvp_out, ", C<1>;\n");
}
/* Draw the tree of MUXZ devices to connect the inner tree
/* Draw the tree of MUXX devices to connect the inner tree
nodes. */
for (seldx = 1 ; seldx < (sel-1) ; seldx += 1) {
unsigned level = sel - seldx;
@ -84,7 +88,7 @@ static void draw_lpm_mux_bitslice(ivl_lpm_t net, unsigned slice)
s = ivl_lpm_select(net, seldx);
for (idx = 0 ; idx < size ; idx += span) {
fprintf(vvp_out, "L_%s/%u/%u/%u .functor MUXZ, ",
fprintf(vvp_out, "L_%s/%u/%u/%u .functor MUXX, ",
vvp_mangle_id(ivl_lpm_name(net)), slice, level, idx);
fprintf(vvp_out, "L_%s/%u/%u/%u, ",
@ -106,7 +110,7 @@ static void draw_lpm_mux_bitslice(ivl_lpm_t net, unsigned slice)
s = ivl_lpm_select(net, sel-1);
fprintf(vvp_out, "L_%s/%u .functor MUXZ, ",
fprintf(vvp_out, "L_%s/%u .functor MUXX, ",
vvp_mangle_id(ivl_lpm_name(net)), slice);
fprintf(vvp_out, "L_%s/%u/2/0, ",
@ -172,6 +176,9 @@ void draw_lpm_mux(ivl_lpm_t net)
/*
* $Log: draw_mux.c,v $
* Revision 1.5 2002/08/29 03:04:01 steve
* Generate x out for x select on wide muxes.
*
* Revision 1.4 2002/08/12 01:35:03 steve
* conditional ident string using autoconfig.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: draw_tt.c,v 1.13 2002/08/12 01:35:08 steve Exp $"
#ident "$Id: draw_tt.c,v 1.14 2002/08/29 03:04:01 steve Exp $"
#endif
# include <stdio.h>
@ -284,6 +284,44 @@ static void draw_NMOS(void)
printf("};\n");
}
static void draw_MUXX(void)
{
unsigned i0, i1, i2, i3;
printf("const unsigned char ft_MUXX[64] = {");
for (i3 = 0 ; i3 < 4 ; i3 += 1)
for (i2 = 0 ; i2 < 4 ; i2 += 1) {
printf("\n ");
for (i1 = 0 ; i1 < 4 ; i1 += 1) {
unsigned idx = (i3 << 4) | (i2 << 2) | i1;
unsigned char byte = 0;
for (i0 = 0 ; i0 < 4 ; i0 += 1) {
unsigned val;
if (i3 == 0)
val = 3;
else if (i3 == 2)
val = 2;
else if (i3 == 3)
val = 2;
else if (i2 >= 2) {
val = 2;
} else if (i2 == 0)
val = i0;
else
val = i1;
byte |= val << (i0*2);
}
printf("0x%02x, ", byte);
}
}
printf("};\n");
}
static void draw_MUXZ(void)
{
unsigned i0, i1, i2, i3;
@ -628,6 +666,7 @@ main()
draw_BUFZ();
draw_PMOS();
draw_NMOS();
draw_MUXX();
draw_MUXZ();
draw_EEQ();
draw_NAND();
@ -643,6 +682,9 @@ main()
/*
* $Log: draw_tt.c,v $
* Revision 1.14 2002/08/29 03:04:01 steve
* Generate x out for x select on wide muxes.
*
* Revision 1.13 2002/08/12 01:35:08 steve
* conditional ident string using autoconfig.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: logic.cc,v 1.10 2002/08/12 01:35:08 steve Exp $"
#ident "$Id: logic.cc,v 1.11 2002/08/29 03:04:01 steve Exp $"
#endif
# include "logic.h"
@ -112,6 +112,9 @@ void compile_functor(char*label, char*type,
} else if (strcmp(type, "RNMOS") == 0) {
obj = new vvp_rnmos_s;
} else if (strcmp(type, "MUXX") == 0) {
obj = new table_functor_s(ft_MUXX);
} else if (strcmp(type, "MUXZ") == 0) {
obj = new table_functor_s(ft_MUXZ);
@ -164,6 +167,9 @@ void compile_functor(char*label, char*type,
/*
* $Log: logic.cc,v $
* Revision 1.11 2002/08/29 03:04:01 steve
* Generate x out for x select on wide muxes.
*
* Revision 1.10 2002/08/12 01:35:08 steve
* conditional ident string using autoconfig.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: logic.h,v 1.5 2002/08/12 01:35:08 steve Exp $"
#ident "$Id: logic.h,v 1.6 2002/08/29 03:04:01 steve Exp $"
#endif
# include "functor.h"
@ -51,6 +51,7 @@ extern const unsigned char ft_BUFIF1[];
extern const unsigned char ft_BUFZ[];
extern const unsigned char ft_PMOS[];
extern const unsigned char ft_NMOS[];
extern const unsigned char ft_MUXX[];
extern const unsigned char ft_MUXZ[];
extern const unsigned char ft_EEQ[];
extern const unsigned char ft_NAND[];
@ -63,6 +64,9 @@ extern const unsigned char ft_var[];
/*
* $Log: logic.h,v $
* Revision 1.6 2002/08/29 03:04:01 steve
* Generate x out for x select on wide muxes.
*
* Revision 1.5 2002/08/12 01:35:08 steve
* conditional ident string using autoconfig.
*