Add NAND and XNOR functors.

This commit is contained in:
steve 2001-04-21 02:04:01 +00:00
parent 67e72ce77e
commit 7c6f496765
4 changed files with 67 additions and 4 deletions

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.16 2001/04/15 16:37:48 steve Exp $"
#ident "$Id: vvp_scope.c,v 1.17 2001/04/21 02:04:01 steve Exp $"
#endif
# include "vvp_priv.h"
@ -130,6 +130,10 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
ltype = "BUF";
break;
case IVL_LO_NAND:
ltype = "NAND";
break;
case IVL_LO_NOR:
ltype = "NOR";
break;
@ -142,6 +146,10 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
ltype = "OR";
break;
case IVL_LO_XNOR:
ltype = "XNOR";
break;
case IVL_LO_XOR:
ltype = "XOR";
break;
@ -306,6 +314,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
/*
* $Log: vvp_scope.c,v $
* Revision 1.17 2001/04/21 02:04:01 steve
* Add NAND and XNOR functors.
*
* Revision 1.16 2001/04/15 16:37:48 steve
* add XOR support.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: compile.cc,v 1.36 2001/04/18 05:03:49 steve Exp $"
#ident "$Id: compile.cc,v 1.37 2001/04/21 02:04:01 steve Exp $"
#endif
# include "compile.h"
@ -261,12 +261,18 @@ void compile_functor(char*label, char*type, unsigned init,
} else if (strcmp(type, "BUF") == 0) {
obj->table = ft_BUF;
} else if (strcmp(type, "NAND") == 0) {
obj->table = ft_NAND;
} else if (strcmp(type, "NOR") == 0) {
obj->table = ft_NOR;
} else if (strcmp(type, "NOT") == 0) {
obj->table = ft_NOT;
} else if (strcmp(type, "XNOR") == 0) {
obj->table = ft_XNOR;
} else if (strcmp(type, "XOR") == 0) {
obj->table = ft_XOR;
@ -840,6 +846,9 @@ void compile_dump(FILE*fd)
/*
* $Log: compile.cc,v $
* Revision 1.37 2001/04/21 02:04:01 steve
* Add NAND and XNOR functors.
*
* Revision 1.36 2001/04/18 05:03:49 steve
* Resolve forward references for %fork.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: draw_tt.c,v 1.5 2001/04/15 16:37:48 steve Exp $"
#ident "$Id: draw_tt.c,v 1.6 2001/04/21 02:04:01 steve Exp $"
#endif
# include <stdio.h>
@ -56,6 +56,40 @@ static void draw_AND(void)
printf("};\n");
}
static void draw_NAND(void)
{
unsigned i0, i1, i2, i3;
printf("const unsigned char ft_NAND[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 ((i0 == 0) || (i1 == 0) ||
(i2 == 0) || (i3 == 0))
val = 1;
else if ((i0 == 1) && (i1 == 1) &&
(i2 == 1) && (i3 == 1))
val = 0;
else
val = 2;
byte |= val << (i0*2);
}
printf("0x%02x, ", byte);
}
}
printf("};\n");
}
static void draw_BUF(void)
{
unsigned i0, i1, i2, i3;
@ -354,6 +388,7 @@ main()
printf("# include \"functor.h\"\n");
draw_AND();
draw_BUF();
draw_NAND();
draw_NOR();
draw_NOT();
draw_OR();
@ -366,6 +401,9 @@ main()
/*
* $Log: draw_tt.c,v $
* Revision 1.6 2001/04/21 02:04:01 steve
* Add NAND and XNOR functors.
*
* Revision 1.5 2001/04/15 16:37:48 steve
* add XOR support.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: functor.h,v 1.12 2001/04/15 16:37:48 steve Exp $"
#ident "$Id: functor.h,v 1.13 2001/04/21 02:04:01 steve Exp $"
#endif
# include "pointers.h"
@ -169,14 +169,19 @@ extern void functor_dump(FILE*fd);
extern const unsigned char ft_AND[];
extern const unsigned char ft_BUF[];
extern const unsigned char ft_NAND[];
extern const unsigned char ft_NOR[];
extern const unsigned char ft_NOT[];
extern const unsigned char ft_OR[];
extern const unsigned char ft_XNOR[];
extern const unsigned char ft_XOR[];
extern const unsigned char ft_var[];
/*
* $Log: functor.h,v $
* Revision 1.13 2001/04/21 02:04:01 steve
* Add NAND and XNOR functors.
*
* Revision 1.12 2001/04/15 16:37:48 steve
* add XOR support.
*