Support functor delays for gates and UDP devices.

(Stephan Boettcher)
This commit is contained in:
steve 2001-12-06 03:31:24 +00:00
parent c8319bcc02
commit ec4f8c80d5
18 changed files with 255 additions and 142 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.56 2001/11/01 04:26:57 steve Exp $"
#ident "$Id: vvp_scope.c,v 1.57 2001/12/06 03:31:24 steve Exp $"
#endif
# include "vvp_priv.h"
@ -427,6 +427,21 @@ static void draw_net_in_scope(ivl_signal_t sig)
free(args);
}
static void draw_delay(ivl_net_logic_t lptr)
{
unsigned d0 = ivl_logic_delay(lptr, 0);
unsigned d1 = ivl_logic_delay(lptr, 1);
unsigned d2 = ivl_logic_delay(lptr, 2);
if (d0 == 0 && d1 == 0 && d2 == 0)
return;
if (d0 == d1 && d1 == d2)
fprintf(vvp_out, " (%d)", d0);
else
fprintf(vvp_out, " (%d,%d,%d)", d0, d1, d2);
}
static void draw_udp_def(ivl_udp_t udp)
{
unsigned init;
@ -491,6 +506,7 @@ static void draw_udp_in_scope(ivl_net_logic_t lptr)
vvp_mangle_id(ivl_logic_name(lptr)));
fprintf(vvp_out, " UDP_%s",
vvp_mangle_id(ivl_udp_name(udp)));
draw_delay(lptr);
for (pdx = 1 ; pdx < ivl_logic_pins(lptr) ; pdx += 1)
{
@ -636,10 +652,12 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
vvp_mangle_id(ivl_logic_name(lptr)),
level, inst,
lcasc);
else
else {
fprintf(vvp_out, "L_%s .functor %s",
vvp_mangle_id(ivl_logic_name(lptr)),
ltype);
draw_delay(lptr);
}
for (pdx = inst; pdx < ninp && pdx < inst+4 ; pdx += 1) {
if (level) {
fprintf(vvp_out, ", L_%s/%d/%d",
@ -1217,6 +1235,10 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
/*
* $Log: vvp_scope.c,v $
* Revision 1.57 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.56 2001/11/01 04:26:57 steve
* Generate code for deassign and cassign.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: arith.cc,v 1.20 2001/11/07 03:34:41 steve Exp $"
#ident "$Id: arith.cc,v 1.21 2001/12/06 03:31:24 steve Exp $"
#endif
# include "arith.h"
@ -36,7 +36,7 @@ void vvp_arith_::output_x_(vvp_ipoint_t base, bool push, unsigned val)
vvp_ipoint_t ptr = ipoint_index(base,idx);
functor_t obj = functor_index(ptr);
obj->put_oval(push, val);
obj->put_oval(val, push);
}
}
@ -49,7 +49,7 @@ void vvp_arith_::output_val_(vvp_ipoint_t base, bool push, unsigned long sum)
unsigned val = sum & 1;
sum >>= 1;
obj->put_oval(push, val);
obj->put_oval(val, push);
}
}
@ -79,7 +79,7 @@ void vvp_wide_arith_::output_val_(vvp_ipoint_t base, bool push)
page += 1;
}
obj->put_oval(push, val);
obj->put_oval(val, push);
}
}
@ -213,7 +213,7 @@ void vvp_arith_mult::wide(vvp_ipoint_t base, bool push)
unsigned val = sum[idx];
obj->put_oval(push, val);
obj->put_oval(val, push);
}
delete[]sum;
@ -369,7 +369,7 @@ void vvp_cmp_ge::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
}
}
put_oval(push, out_val);
put_oval(out_val, push);
}
void vvp_cmp_gt::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
@ -403,7 +403,7 @@ void vvp_cmp_gt::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
}
}
put_oval(push, out_val);
put_oval(out_val, push);
}
@ -442,7 +442,7 @@ void vvp_shiftl::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
for (unsigned idx = 0 ; idx < amount ; idx += 1) {
optr = ipoint_index(base, idx);
ofp = functor_index(optr);
ofp->put_oval(push, 0);
ofp->put_oval(0, push);
}
for (unsigned idx = amount ; idx < wid_ ; idx += 1) {
@ -451,7 +451,7 @@ void vvp_shiftl::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
iptr = ipoint_index(base, idx - amount);
ifp = functor_index(iptr);
ofp->put_oval(push, ifp->ival & 3);
ofp->put_oval(ifp->ival & 3, push);
}
}
}
@ -494,13 +494,13 @@ void vvp_shiftr::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
iptr = ipoint_index(base, idx + amount);
ifp = functor_index(iptr);
ofp->put_oval(push, ifp->ival & 3);
ofp->put_oval(ifp->ival & 3, push);
}
for (unsigned idx = wid_-amount; idx < wid_ ; idx += 1) {
optr = ipoint_index(base, idx);
ofp = functor_index(optr);
ofp->put_oval(push, 0);
ofp->put_oval(0, push);
}
}
}
@ -508,6 +508,10 @@ void vvp_shiftr::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
/*
* $Log: arith.cc,v $
* Revision 1.21 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.20 2001/11/07 03:34:41 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: bufif.cc,v 1.3 2001/11/07 03:34:42 steve Exp $"
#ident "$Id: bufif.cc,v 1.4 2001/12/06 03:31:24 steve Exp $"
#endif
# include "bufif.h"
@ -80,11 +80,15 @@ void vvp_bufif1_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned)
break;
}
put_ostr(push, val, str);
put_ostr(val, str, push);
}
/*
* $Log: bufif.cc,v $
* Revision 1.4 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.3 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*

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.114 2001/11/07 03:34:42 steve Exp $"
#ident "$Id: compile.cc,v 1.115 2001/12/06 03:31:24 steve Exp $"
#endif
# include "arith.h"
@ -579,7 +579,7 @@ static vvp_ipoint_t make_const_functor(unsigned val,
functor_t obj = new const_functor_s(str0, str1);
functor_define(fdx, obj);
obj->put_oval(false, val);
obj->put_oval(val, false);
return fdx;
}
@ -929,6 +929,7 @@ char **compile_udp_table(char **table, char *row)
}
void compile_udp_functor(char*label, char*type,
vvp_delay_t delay,
unsigned argc, struct symb_s*argv)
{
struct vvp_udp_s *u = udp_find(type);
@ -951,11 +952,13 @@ void compile_udp_functor(char*label, char*type,
}
}
udp->delay = delay;
inputs_connect(fdx, argc, argv);
free(argv);
if (u->sequ)
udp->put_oval(false, u->init);
udp->put_oval(u->init, false);
}
@ -1341,6 +1344,10 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
/*
* $Log: compile.cc,v $
* Revision 1.115 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.114 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: compile.h,v 1.37 2001/11/06 03:07:22 steve Exp $"
#ident "$Id: compile.h,v 1.38 2001/12/06 03:31:24 steve Exp $"
#endif
# include <stdio.h>
@ -73,6 +73,7 @@ extern void compile_vpi_time_precision(long pre);
* to existing functors to manage the linking.
*/
extern void compile_functor(char*label, char*type,
vvp_delay_t delay,
unsigned argc, struct symb_s*argv);
@ -128,6 +129,7 @@ extern void compile_udp_def(int sequ, char*label, char *name,
unsigned nin, unsigned init, char **table);
extern void compile_udp_functor(char*label, char*type,
vvp_delay_t delay,
unsigned argc, struct symb_s*argv);
extern char **compile_udp_table(char **table, char *row);
@ -220,6 +222,10 @@ extern void compile_net(char*label, char*name,
/*
* $Log: compile.h,v $
* Revision 1.38 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.37 2001/11/06 03:07:22 steve
* Code rearrange. (Stephan Boettcher)
*

View File

@ -19,9 +19,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: delay.h,v 1.1 2001/11/10 18:07:11 steve Exp $"
#ident "$Id: delay.h,v 1.2 2001/12/06 03:31:24 steve Exp $"
#endif
#include "pointers.h"
/*
** vvp_delay_t del;
**
@ -61,8 +63,6 @@
** tgt and src are deleted.
*/
typedef struct vvp_delay_s *vvp_delay_t;
struct vvp_delay_s {
vvp_delay_s(unsigned);
unsigned delay(unsigned char idx) { return del[tab[idx]]; }
@ -113,6 +113,10 @@ vvp_delay_t vvp_delay_set(vvp_delay_t tgt, vvp_delay_t src,
/*
** $Log: delay.h,v $
** Revision 1.2 2001/12/06 03:31:24 steve
** Support functor delays for gates and UDP devices.
** (Stephan Boettcher)
**
** Revision 1.1 2001/11/10 18:07:11 steve
** Runtime support for functor delays. (Stephan Boettcher)
**

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: force.cc,v 1.3 2001/11/07 03:34:42 steve Exp $"
#ident "$Id: force.cc,v 1.4 2001/12/06 03:31:24 steve Exp $"
#endif
# include "codes.h"
@ -35,41 +35,29 @@ inline bool functor_s::disable(vvp_ipoint_t ptr)
inline bool functor_s::enable(vvp_ipoint_t ptr)
{
unsigned val;
if (ostr == 0)
val = 3;
else switch (ostr & 0x88) {
case 0x00: val = 0; break;
case 0x88: val = 1; break;
default: val = 2;
}
if (val != oval) {
oval = val;
propagate(true);
}
bool r = inhibit;
inhibit = 0;
if (r) {
if (get_str() != get_ostr())
propagate();
else
assert(get() == get_oval());
}
return r;
}
inline void functor_s::force(unsigned val, unsigned str)
void force_functor_s::set(vvp_ipoint_t i, bool push,
unsigned val, unsigned str)
{
if (ostr != str || oval != val) {
unsigned save = ostr;
if (ipoint_port(i) == 0) {
oval = val;
ostr = str;
propagate(true);
ostr = save;
}
}
void force_functor_s::set(vvp_ipoint_t i, bool, unsigned val, unsigned str)
{
put(i, val);
if (ipoint_port(i) == 0) {
if (active && out) {
if (active && out) {
functor_t tgt = functor_index(out);
tgt->force(ival&3, get_ostr());
if (str != tgt->get_str())
tgt->propagate(val, str, push);
else
assert(val == tgt->get());
}
}
}
@ -123,7 +111,7 @@ bool of_FORCE(vthread_t thr, vvp_code_t cp)
fofu->port[3] = tgt->out;
tgt->out = ipoint_make(ifofu, 3);
fofu->set(ifofu, false, fofu->ival&3, fofu->get_ostr());
fofu->set(ifofu, false, fofu->get_oval(), fofu->get_ostr());
}
return true;
@ -136,7 +124,6 @@ bool of_RELEASE(vthread_t thr, vvp_code_t cp)
if (release_force(itgt, tgt))
tgt->enable(itgt);
// bug: a strength change will not be propagated.
return true;
}
@ -158,7 +145,7 @@ void var_functor_s::set(vvp_ipoint_t ptr, bool push, unsigned val, unsigned)
unsigned pp = ipoint_port(ptr);
if (assigned() && pp==1 || !assigned() && pp==0) {
put_oval(push, val);
put_oval(val, push);
}
}
@ -249,6 +236,10 @@ bool of_DEASSIGN(vthread_t thr, vvp_code_t cp)
/*
* $Log: force.cc,v $
* Revision 1.4 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.3 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: functor.cc,v 1.34 2001/11/16 04:22:27 steve Exp $"
#ident "$Id: functor.cc,v 1.35 2001/12/06 03:31:24 steve Exp $"
#endif
# include "functor.h"
@ -114,10 +114,12 @@ functor_s::functor_s()
port[2] = 0;
port[3] = 0;
ival = 0xaa;
cval = 2;
oval = 2;
odrive0 = 6;
odrive1 = 6;
ostr = StX;
cstr = StX;
inhibit = 0;
#if defined(WITH_DEBUG)
breakpoint = 0;
@ -169,6 +171,10 @@ edge_inputs_functor_s::~edge_inputs_functor_s()
/*
* $Log: functor.cc,v $
* Revision 1.35 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.34 2001/11/16 04:22:27 steve
* include stdlib.h for portability.
*

View File

@ -19,19 +19,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: functor.h,v 1.39 2001/11/10 18:07:12 steve Exp $"
#ident "$Id: functor.h,v 1.40 2001/12/06 03:31:24 steve Exp $"
#endif
# include "pointers.h"
# include "delay.h"
/*
* Create a propagation event. The fun parameter points to the functor
* to have its output propagated, and the delay is the delay to
* schedule the propagation.
*/
extern void schedule_functor(functor_t fun, unsigned delay);
/*
* The vvp_ipoint_t is an integral type that is 32bits. The low 2 bits
* select the port of the referenced functor, and the remaining 30
@ -68,7 +61,7 @@ extern void schedule_functor(functor_t fun, unsigned delay);
* STRONG = 6,
* SUPPLY = 7
*
* The output value (oval) is combined with the drive specifications
* The output value (cval) is combined with the drive specifications
* to make a fully strength aware output, as described below.
*
* OUTPUT STRENGTHS:
@ -81,9 +74,9 @@ extern void schedule_functor(functor_t fun, unsigned delay);
* strength-value closest to supply0.
*
* The functor calculates, when it operates, a 4-value output into
* oval and a fully strength aware value into ostr. The mode-0
* functors use the odrive0 and odrive1 fields to form the strength
* value.
* oval and a fully strength aware value into ostr. Functors with
* fixed drive strength use the odrive0 and odrive1 fields to form the
* strength value.
*/
/*
@ -163,14 +156,19 @@ struct functor_s {
private:
/* Output value (low bits) and drive1 and drive0 strength. */
unsigned oval : 2;
unsigned cval : 2;
protected:
unsigned odrive0 : 3;
unsigned odrive1 : 3;
private:
/* Strength form of the output value. */
unsigned cstr : 8;
protected:
unsigned ostr : 8;
unsigned oval : 2;
private:
unsigned inhibit : 1;
public:
@ -178,18 +176,24 @@ struct functor_s {
/* True if this functor triggers a breakpoint. */
unsigned breakpoint : 1;
#endif
public:
virtual void set(vvp_ipoint_t ipt, bool push,
unsigned val, unsigned str = 0) = 0;
inline unsigned char get() { return oval; }
inline unsigned char get() { return cval; }
inline unsigned char get_str() { return cstr; }
inline unsigned char get_oval() { return oval; }
inline unsigned char get_ostr() { return ostr; }
void put(vvp_ipoint_t ipt, unsigned val);
void put_oval(bool push, unsigned val);
void put_ostr(bool push, unsigned val, unsigned str);
void put_oval(unsigned val, bool push = true);
void put_ostr(unsigned val, unsigned str, bool push = true);
void schedule(unsigned delay);
bool disable(vvp_ipoint_t ptr);
bool enable(vvp_ipoint_t ptr);
void propagate(bool push);
void force(unsigned val, unsigned str);
void propagate(bool push = true);
void propagate(unsigned val, unsigned str, bool push = true);
};
/*
@ -204,63 +208,72 @@ inline void functor_s::put(vvp_ipoint_t ptr, unsigned val)
ival = (ival & imask) | ((val & 3) << (2*pp));
}
inline void functor_s::propagate(bool push)
inline void functor_s::propagate(unsigned val, unsigned str, bool push)
{
cval = val;
cstr = str;
vvp_ipoint_t idx = out;
while (idx) {
functor_t idxp = functor_index(idx);
idxp->set(idx, push, oval, ostr);
idxp->set(idx, push, val, str);
idx = idxp->port[ipoint_port(idx)];
#if defined(WITH_DEBUG)
if (fp->breakpoint)
breakpoint();
#endif
}
#if defined(WITH_DEBUG)
if (breakpoint)
breakpoint();
#endif
}
inline void functor_s::put_ostr(bool push, unsigned val, unsigned str)
inline void functor_s::propagate(bool push)
{
if (val != oval || str != ostr) {
propagate(get_oval(), get_ostr(), push);
}
inline void functor_s::put_ostr(unsigned val, unsigned str, bool push)
{
if (str != get_ostr() || val != get_oval()) {
unsigned char ooval = oval;
ostr = str;
oval = val;
if (inhibit)
return;
oval = val;
unsigned del;
if (delay)
del = vvp_delay_get(delay, oval, val);
del = vvp_delay_get(delay, ooval, val);
else
del = 0;
if (del == 0 && push)
propagate(true);
if (push && del == 0) {
propagate();
}
else
schedule_functor(this, del);
schedule(del);
}
}
inline void functor_s::put_oval(bool push, unsigned val)
inline void functor_s::put_oval(unsigned val, bool push)
{
unsigned char str;
switch (val) {
case 0:
ostr = 0x00 | (odrive0<<0) | (odrive0<<4);
str = 0x00 | (odrive0<<0) | (odrive0<<4);
break;
case 1:
ostr = 0x88 | (odrive1<<0) | (odrive1<<4);
str = 0x88 | (odrive1<<0) | (odrive1<<4);
break;
case 2:
ostr = 0x80 | (odrive0<<0) | (odrive1<<4);
str = 0x80 | (odrive0<<0) | (odrive1<<4);
break;
case 3:
ostr = 0x00;
default:
str = 0x00;
break;
}
put_ostr(push, val, ostr);
put_ostr(val, str, push);
}
/*
@ -280,7 +293,7 @@ inline void functor_s::put_oval(bool push, unsigned val)
* propagation events to pass the output on.
*/
inline static
void functor_set(vvp_ipoint_t ptr, unsigned val, unsigned str, bool push)
void functor_set(vvp_ipoint_t ptr, unsigned val, unsigned str, bool push = true)
{
functor_t fp = functor_index(ptr);
fp->set(ptr, push, val, str);
@ -302,20 +315,6 @@ unsigned functor_get(vvp_ipoint_t ptr)
return fp->get();
}
/*
* When a propagation event happens, this function is called with the
* address of the affected functor. It propagates the output to all
* the inputs it is connected to, creating new propagation event on
* the way.
*/
inline static
void functor_propagate(functor_t fp, bool push=true)
{
fp->propagate(push);
}
// Special infrastructure functor types
@ -376,6 +375,10 @@ extern vvp_fvector_t vvp_fvector_continuous_new(unsigned size, vvp_ipoint_t p);
/*
* $Log: functor.h,v $
* Revision 1.40 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.39 2001/11/10 18:07:12 steve
* Runtime support for functor delays. (Stephan Boettcher)
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: logic.cc,v 1.3 2001/11/16 04:22:27 steve Exp $"
#ident "$Id: logic.cc,v 1.4 2001/12/06 03:31:24 steve Exp $"
#endif
# include "logic.h"
@ -53,7 +53,7 @@ void table_functor_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned)
val >>= 2 * (ival&0x03);
val &= 0x03;
put_oval(push, val);
put_oval(val, push);
}
/*
@ -62,7 +62,9 @@ void table_functor_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned)
* functor. Also resolve the inputs to the functor.
*/
void compile_functor(char*label, char*type, unsigned argc, struct symb_s*argv)
void compile_functor(char*label, char*type,
vvp_delay_t delay,
unsigned argc, struct symb_s*argv)
{
functor_t obj;
@ -130,6 +132,8 @@ void compile_functor(char*label, char*type, unsigned argc, struct symb_s*argv)
define_functor_symbol(label, fdx);
free(label);
obj->delay = delay;
inputs_connect(fdx, argc, argv);
free(argv);
}
@ -137,6 +141,10 @@ void compile_functor(char*label, char*type, unsigned argc, struct symb_s*argv)
/*
* $Log: logic.cc,v $
* Revision 1.4 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.3 2001/11/16 04:22:27 steve
* include stdlib.h for portability.
*

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: memory.cc,v 1.13 2001/11/07 03:34:42 steve Exp $"
#ident "$Id: memory.cc,v 1.14 2001/12/06 03:31:24 steve Exp $"
#endif
#include "memory.h"
@ -317,7 +317,7 @@ void update_data(vvp_memory_port_t data)
vvp_ipoint_t dx = ipoint_index(data->ix, i);
functor_t df = functor_index(dx);
unsigned char out = get_bit(data->cur_bits, i + data->bitoff);
df->put_oval(false, out);
df->put_oval(out);
}
}
@ -338,7 +338,7 @@ void update_data_ports(vvp_memory_t mem, vvp_memory_bits_t bits, int bit,
{
vvp_ipoint_t ix = ipoint_index(a->ix, i);
functor_t df = functor_index(ix);
df->put_oval(false, val);
df->put_oval(val);
}
}
a = a->next;

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: npmos.cc,v 1.6 2001/11/07 03:34:42 steve Exp $"
#ident "$Id: npmos.cc,v 1.7 2001/12/06 03:31:24 steve Exp $"
#endif
# include "npmos.h"
@ -58,10 +58,13 @@ void vvp_pmos_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned s)
unsigned char val;
unsigned char str;
if (in0 == 3 || in1 == 0) {
if (in1 == 0) {
// gate on; output follows input
val = in0;
str = istr;
} else if (in0 == 3) {
val = 3;
str = HiZ;
} else if (in1 == 2 || in1 == 3) {
// gate X or Z; output is undefined
val = 2;
@ -82,11 +85,15 @@ void vvp_pmos_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned s)
str = HiZ;
}
put_ostr(push, val, str);
put_ostr(val, str, push);
}
/*
* $Log: npmos.cc,v $
* Revision 1.7 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.6 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*

View File

@ -19,11 +19,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: parse.y,v 1.40 2001/11/01 03:00:19 steve Exp $"
#ident "$Id: parse.y,v 1.41 2001/12/06 03:31:25 steve Exp $"
#endif
# include "parse_misc.h"
# include "compile.h"
# include "delay.h"
# include <stdio.h>
# include <stdlib.h>
# include <assert.h>
@ -51,6 +52,8 @@ extern FILE*yyin;
struct argv_s argv;
vpiHandle vpi;
vvp_delay_t cdelay;
};
@ -79,6 +82,7 @@ extern FILE*yyin;
%type <argv> argument_opt argument_list
%type <vpi> argument
%type <cdelay> delay
%%
@ -117,13 +121,11 @@ statement
/* Functor statements define functors. The functor must have a
label and a type name, and may have operands. */
: T_LABEL K_FUNCTOR T_SYMBOL ',' symbols ';'
{ struct symbv_s obj = $5;
compile_functor($1, $3, obj.cnt, obj.vect);
}
: T_LABEL K_FUNCTOR T_SYMBOL delay ',' symbols ';'
{ compile_functor($1, $3, $4, $6.cnt, $6.vect); }
| T_LABEL K_FUNCTOR T_SYMBOL',' T_NUMBER ';'
{ compile_functor($1, $3, 0, 0); }
| T_LABEL K_FUNCTOR T_SYMBOL delay ',' T_NUMBER ';'
{ compile_functor($1, $3, $4, 0, 0); }
/* UDP statements define or instantiate UDPs. Definitions take a
@ -136,8 +138,8 @@ statement
| T_LABEL K_UDP_C T_STRING ',' T_NUMBER ',' udp_table ';'
{ compile_udp_def(0, $1, $3, $5, 0, $7); }
| T_LABEL K_UDP T_SYMBOL ',' symbols ';'
{ compile_udp_functor($1, $3, $5.cnt, $5.vect); }
| T_LABEL K_UDP T_SYMBOL delay ',' symbols ';'
{ compile_udp_functor($1, $3, $4, $6.cnt, $6.vect); }
/* Memory. Definition, port, initialization */
@ -495,6 +497,17 @@ o_komma
| ','
;
delay
: /* empty */
{ $$ = 0; }
| '(' T_NUMBER ')'
{ $$ = new vvp_delay_2_s($2, $2); }
| '(' T_NUMBER ',' T_NUMBER ')'
{ $$ = new vvp_delay_2_s($2, $4); }
| '(' T_NUMBER ',' T_NUMBER ',' T_NUMBER ')'
{ $$ = new vvp_delay_3_s($2, $4, $6); }
;
%%
int compile_design(const char*path)
@ -514,6 +527,10 @@ int compile_design(const char*path)
/*
* $Log: parse.y,v $
* Revision 1.41 2001/12/06 03:31:25 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.40 2001/11/01 03:00:19 steve
* Add force/cassign/release/deassign support. (Stephan Boettcher)
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: pointers.h,v 1.7 2001/11/07 03:34:42 steve Exp $"
#ident "$Id: pointers.h,v 1.8 2001/12/06 03:31:25 steve Exp $"
#endif
/*
@ -104,8 +104,17 @@ typedef struct vthread_s*vthread_t;
typedef struct vvp_fvector_s *vvp_fvector_t;
/* delay object */
typedef struct vvp_delay_s *vvp_delay_t;
/*
* $Log: pointers.h,v $
* Revision 1.8 2001/12/06 03:31:25 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.7 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: resolv.cc,v 1.8 2001/11/07 03:34:42 steve Exp $"
#ident "$Id: resolv.cc,v 1.9 2001/12/06 03:31:25 steve Exp $"
#endif
# include "resolv.h"
@ -164,11 +164,21 @@ void resolv_functor_s::set(vvp_ipoint_t i, bool push, unsigned, unsigned str)
}
/* If the output changes, then create a propagation event. */
put_ostr(push, val, sval);
// Do not propagate (push). Why? Because if, for example, a
// clock buffer is modeled as parallel inverters, the output
// must not show 'bx transitions when the inverters all propagte
// at the same time.
put_ostr(val, sval, false);
}
/*
* $Log: resolv.cc,v $
* Revision 1.9 2001/12/06 03:31:25 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.8 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: schedule.cc,v 1.13 2001/11/07 03:34:42 steve Exp $"
#ident "$Id: schedule.cc,v 1.14 2001/12/06 03:31:25 steve Exp $"
#endif
# include "schedule.h"
@ -56,6 +56,7 @@ struct event_s {
};
unsigned val :2;
unsigned type :2;
// unsigned char str;
struct event_s*next;
struct event_s*last;
@ -238,13 +239,15 @@ void schedule_vthread(vthread_t thr, unsigned delay)
schedule_event_(cur);
}
void schedule_functor(functor_t funp, unsigned delay)
void functor_s::schedule(unsigned delay)
{
struct event_s*cur = e_alloc();
cur->delay = delay;
cur->funp = funp;
cur->funp = this;
cur->type = TYPE_PROP;
// cur->str = get_ostr();
// cur->val = get_oval();
schedule_event_(cur);
}
@ -320,23 +323,23 @@ void schedule_simulate(void)
case TYPE_PROP:
//printf("Propagate %p\n", cur->fun);
functor_propagate(cur->funp);
cur->funp->propagate();
e_free(cur);
break;
case TYPE_ASSIGN:
switch (cur->val) {
case 0:
functor_set(cur->fun, cur->val, St0, false);
functor_set(cur->fun, cur->val, St0);
break;
case 1:
functor_set(cur->fun, cur->val, St1, false);
functor_set(cur->fun, cur->val, St1);
break;
case 2:
functor_set(cur->fun, cur->val, StX, false);
functor_set(cur->fun, cur->val, StX);
break;
case 3:
functor_set(cur->fun, cur->val, HiZ, false);
functor_set(cur->fun, cur->val, HiZ);
break;
}
e_free(cur);
@ -361,6 +364,10 @@ void schedule_simulate(void)
/*
* $Log: schedule.cc,v $
* Revision 1.14 2001/12/06 03:31:25 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.13 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: udp.cc,v 1.13 2001/11/07 03:34:42 steve Exp $"
#ident "$Id: udp.cc,v 1.14 2001/12/06 03:31:25 steve Exp $"
#endif
#include "udp.h"
@ -31,12 +31,12 @@
#include <stdlib.h>
#include <stdio.h>
void udp_functor_s::set(vvp_ipoint_t i, bool, unsigned val, unsigned)
void udp_functor_s::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
{
// old_ival is set on the way out
put(i, val);
unsigned char out = udp->propagate(this, i);
put_oval(false, out);
put_oval(out, push);
}
@ -350,6 +350,10 @@ void vvp_udp_s::compile_row_(udp_table_entry_t row, char *rchr)
/*
* $Log: udp.cc,v $
* Revision 1.14 2001/12/06 03:31:25 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.13 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vpi_signal.cc,v 1.29 2001/11/07 03:34:42 steve Exp $"
#ident "$Id: vpi_signal.cc,v 1.30 2001/12/06 03:31:25 steve Exp $"
#endif
/*
@ -404,7 +404,7 @@ static void functor_poke(struct __vpiSignal*rfp, unsigned idx,
{
vvp_ipoint_t ptr = vvp_fvector_get(rfp->bits,idx);
functor_t fu = functor_index(ptr);
fu->put_ostr(true, val, str);
fu->put_ostr(val, str, true);
}
static vpiHandle signal_put_value(vpiHandle ref, s_vpi_value*vp,
@ -552,6 +552,10 @@ vpiHandle vpip_make_net(char*name, int msb, int lsb, bool signed_flag,
/*
* $Log: vpi_signal.cc,v $
* Revision 1.30 2001/12/06 03:31:25 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)
*
* Revision 1.29 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*