Add the PMOS and NMOS functor types.
This commit is contained in:
parent
181066311b
commit
64ff74df37
|
|
@ -16,7 +16,7 @@
|
|||
# 59 Temple Place - Suite 330
|
||||
# Boston, MA 02111-1307, USA
|
||||
#
|
||||
#ident "$Id: Makefile.in,v 1.27 2001/08/09 19:35:29 steve Exp $"
|
||||
#ident "$Id: Makefile.in,v 1.28 2001/10/09 02:28:16 steve Exp $"
|
||||
#
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
|
@ -64,7 +64,7 @@ vpi_priv.o vpi_scope.o vpi_signal.o vpi_tasks.o vpi_time.o vpi_memory.o \
|
|||
vpi_vthr_vector.o vvp_vpi.o
|
||||
|
||||
O = main.o parse.o parse_misc.o lexor.o arith.o bufif.o compile.o debug.o \
|
||||
functor.o fvectors.o resolv.o symbols.o codes.o vthread.o schedule.o \
|
||||
functor.o fvectors.o npmos.o resolv.o symbols.o codes.o vthread.o schedule.o \
|
||||
tables.o udp.o memory.o $V
|
||||
|
||||
vvp: $O
|
||||
|
|
|
|||
|
|
@ -17,11 +17,12 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: compile.cc,v 1.100 2001/09/15 18:27:04 steve Exp $"
|
||||
#ident "$Id: compile.cc,v 1.101 2001/10/09 02:28:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "arith.h"
|
||||
# include "bufif.h"
|
||||
# include "npmos.h"
|
||||
# include "compile.h"
|
||||
# include "functor.h"
|
||||
# include "resolv.h"
|
||||
|
|
@ -678,6 +679,14 @@ void compile_functor(char*label, char*type, unsigned argc, struct symb_s*argv)
|
|||
obj->obj = new vvp_bufif1_s;
|
||||
obj->mode = M42;
|
||||
|
||||
} else if (strcmp(type, "PMOS") == 0) {
|
||||
obj->obj = new vvp_pmos_s;
|
||||
obj->mode = M42;
|
||||
|
||||
} else if (strcmp(type, "NMOS") == 0) {
|
||||
obj->obj = new vvp_nmos_s;
|
||||
obj->mode = M42;
|
||||
|
||||
} else if (strcmp(type, "MUXZ") == 0) {
|
||||
obj->table = ft_MUXZ;
|
||||
|
||||
|
|
@ -1637,6 +1646,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
|
|||
|
||||
/*
|
||||
* $Log: compile.cc,v $
|
||||
* Revision 1.101 2001/10/09 02:28:16 steve
|
||||
* Add the PMOS and NMOS functor types.
|
||||
*
|
||||
* Revision 1.100 2001/09/15 18:27:04 steve
|
||||
* Make configure detect malloc.h
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.9 2001/06/19 03:01:10 steve Exp $"
|
||||
#ident "$Id: draw_tt.c,v 1.10 2001/10/09 02:28:17 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -190,6 +190,74 @@ static void draw_BUFIF1(void)
|
|||
printf("};\n");
|
||||
}
|
||||
|
||||
static void draw_PMOS(void)
|
||||
{
|
||||
unsigned i0, i1, i2, i3;
|
||||
|
||||
printf("const unsigned char ft_PMOS[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 (i2 == 0 || i0 == 3)
|
||||
val = 3;
|
||||
else if (i0 == 1)
|
||||
val = 1;
|
||||
else if (i0 == 0)
|
||||
val = 0;
|
||||
else
|
||||
val = 2;
|
||||
|
||||
byte |= val << (i0*2);
|
||||
}
|
||||
|
||||
printf("0x%02x, ", byte);
|
||||
}
|
||||
}
|
||||
|
||||
printf("};\n");
|
||||
}
|
||||
|
||||
static void draw_NMOS(void)
|
||||
{
|
||||
unsigned i0, i1, i2, i3;
|
||||
|
||||
printf("const unsigned char ft_NMOS[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 (i2 == 1 || i0 == 3)
|
||||
val = 3;
|
||||
else if (i0 == 1)
|
||||
val = 1;
|
||||
else if (i0 == 0)
|
||||
val = 0;
|
||||
else
|
||||
val = 2;
|
||||
|
||||
byte |= val << (i0*2);
|
||||
}
|
||||
|
||||
printf("0x%02x, ", byte);
|
||||
}
|
||||
}
|
||||
|
||||
printf("};\n");
|
||||
}
|
||||
|
||||
static void draw_MUXZ(void)
|
||||
{
|
||||
unsigned i0, i1, i2, i3;
|
||||
|
|
@ -531,6 +599,8 @@ main()
|
|||
draw_BUF();
|
||||
draw_BUFIF0();
|
||||
draw_BUFIF1();
|
||||
draw_PMOS();
|
||||
draw_NMOS();
|
||||
draw_MUXZ();
|
||||
draw_EEQ();
|
||||
draw_NAND();
|
||||
|
|
@ -546,6 +616,9 @@ main()
|
|||
|
||||
/*
|
||||
* $Log: draw_tt.c,v $
|
||||
* Revision 1.10 2001/10/09 02:28:17 steve
|
||||
* Add the PMOS and NMOS functor types.
|
||||
*
|
||||
* Revision 1.9 2001/06/19 03:01:10 steve
|
||||
* Add structural EEQ gates (Stephan Boettcher)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.30 2001/08/08 01:05:06 steve Exp $"
|
||||
#ident "$Id: functor.h,v 1.31 2001/10/09 02:28:17 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "pointers.h"
|
||||
|
|
@ -304,6 +304,8 @@ extern const unsigned char ft_AND[];
|
|||
extern const unsigned char ft_BUF[];
|
||||
extern const unsigned char ft_BUFIF0[];
|
||||
extern const unsigned char ft_BUFIF1[];
|
||||
extern const unsigned char ft_PMOS[];
|
||||
extern const unsigned char ft_NMOS[];
|
||||
extern const unsigned char ft_MUXZ[];
|
||||
extern const unsigned char ft_EEQ[];
|
||||
extern const unsigned char ft_NAND[];
|
||||
|
|
@ -316,6 +318,9 @@ extern const unsigned char ft_var[];
|
|||
|
||||
/*
|
||||
* $Log: functor.h,v $
|
||||
* Revision 1.31 2001/10/09 02:28:17 steve
|
||||
* Add the PMOS and NMOS functor types.
|
||||
*
|
||||
* Revision 1.30 2001/08/08 01:05:06 steve
|
||||
* Initial implementation of vvp_fvectors.
|
||||
* (Stephan Boettcher)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
* General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: npmos.cc,v 1.1 2001/10/09 02:28:17 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "npmos.h"
|
||||
# include "functor.h"
|
||||
# include "schedule.h"
|
||||
|
||||
void vvp_pmos_s::set(vvp_ipoint_t ptr, functor_t fp, bool push)
|
||||
{
|
||||
unsigned in0 = fp->ival & 0x03;
|
||||
unsigned in1 = (fp->ival >> 2) & 0x03;
|
||||
|
||||
unsigned char out0 = 0x00 | (fp->odrive0<<0) | (fp->odrive0<<4);
|
||||
unsigned char out1 = 0x88 | (fp->odrive1<<0) | (fp->odrive1<<4);
|
||||
unsigned char outX = 0x80 | (fp->odrive1<<0) | (fp->odrive0<<4);
|
||||
unsigned char outH = 0x88 | (fp->odrive1<<4) | (0);
|
||||
unsigned char outL = 0x00 | (fp->odrive1<<0) | (0);
|
||||
|
||||
if (in0 == 3 || in1 == 1) {
|
||||
|
||||
fp->oval = 3;
|
||||
fp->ostr = HiZ;
|
||||
|
||||
} else {
|
||||
|
||||
switch (in1) {
|
||||
|
||||
case 0:
|
||||
switch (in0) {
|
||||
case 0:
|
||||
fp->oval = 0;
|
||||
fp->ostr = out0;
|
||||
break;
|
||||
case 1:
|
||||
fp->oval = 1;
|
||||
fp->ostr = out1;
|
||||
break;
|
||||
default:
|
||||
fp->oval = 2;
|
||||
fp->ostr = outX;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fp->oval = 2;
|
||||
switch (in0) {
|
||||
case 0:
|
||||
fp->ostr = outL;
|
||||
break;
|
||||
case 1:
|
||||
fp->ostr = outH;
|
||||
break;
|
||||
default:
|
||||
fp->ostr = outX;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (push)
|
||||
functor_propagate(ptr);
|
||||
else
|
||||
schedule_functor(ptr, 0);
|
||||
}
|
||||
|
||||
void vvp_nmos_s::set(vvp_ipoint_t ptr, functor_t fp, bool push)
|
||||
{
|
||||
unsigned in0 = fp->ival & 0x03;
|
||||
unsigned in1 = (fp->ival >> 2) & 0x03;
|
||||
|
||||
unsigned char out0 = 0x00 | (fp->odrive0<<0) | (fp->odrive0<<4);
|
||||
unsigned char out1 = 0x88 | (fp->odrive1<<0) | (fp->odrive1<<4);
|
||||
unsigned char outX = 0x80 | (fp->odrive1<<0) | (fp->odrive0<<4);
|
||||
unsigned char outH = 0x88 | (fp->odrive1<<4) | (0);
|
||||
unsigned char outL = 0x00 | (fp->odrive1<<0) | (0);
|
||||
|
||||
if (in0 == 3 || in1 == 0) {
|
||||
|
||||
fp->oval = 3;
|
||||
fp->ostr = HiZ;
|
||||
|
||||
} else {
|
||||
|
||||
switch (in1) {
|
||||
|
||||
case 1:
|
||||
switch (in0) {
|
||||
case 0:
|
||||
fp->oval = 0;
|
||||
fp->ostr = out0;
|
||||
break;
|
||||
case 1:
|
||||
fp->oval = 1;
|
||||
fp->ostr = out1;
|
||||
break;
|
||||
default:
|
||||
fp->oval = 2;
|
||||
fp->ostr = outX;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fp->oval = 2;
|
||||
switch (in0) {
|
||||
case 0:
|
||||
fp->ostr = outL;
|
||||
break;
|
||||
case 1:
|
||||
fp->ostr = outH;
|
||||
break;
|
||||
default:
|
||||
fp->ostr = outX;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (push)
|
||||
functor_propagate(ptr);
|
||||
else
|
||||
schedule_functor(ptr, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: npmos.cc,v $
|
||||
* Revision 1.1 2001/10/09 02:28:17 steve
|
||||
* Add the PMOS and NMOS functor types.
|
||||
*
|
||||
* Revision 1.1 2001/05/31 04:12:43 steve
|
||||
* Make the bufif0 and bufif1 gates strength aware,
|
||||
* and accurately propagate strengths of outputs.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
#ifndef __npmos_H
|
||||
#define __npmos_H
|
||||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
* General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: npmos.h,v 1.1 2001/10/09 02:28:17 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "functor.h"
|
||||
|
||||
class vvp_pmos_s : public vvp_fobj_s {
|
||||
|
||||
public:
|
||||
virtual void set(vvp_ipoint_t i, functor_t f, bool push);
|
||||
|
||||
private: // not implemented
|
||||
};
|
||||
|
||||
class vvp_nmos_s : public vvp_fobj_s {
|
||||
|
||||
public:
|
||||
virtual void set(vvp_ipoint_t i, functor_t f, bool push);
|
||||
|
||||
private: // not implemented
|
||||
};
|
||||
|
||||
/*
|
||||
* $Log: npmos.h,v $
|
||||
* Revision 1.1 2001/10/09 02:28:17 steve
|
||||
* Add the PMOS and NMOS functor types.
|
||||
*
|
||||
* Revision 1.1 2001/05/31 04:12:43 steve
|
||||
* Make the bufif0 and bufif1 gates strength aware,
|
||||
* and accurately propagate strengths of outputs.
|
||||
*
|
||||
*/
|
||||
#endif
|
||||
Loading…
Reference in New Issue