Support UDP initial values.

This commit is contained in:
steve 2005-06-09 05:04:45 +00:00
parent 77792dcc2f
commit 3607fb584d
8 changed files with 88 additions and 29 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: compile.cc,v 1.205 2005/06/09 04:12:30 steve Exp $"
#ident "$Id: compile.cc,v 1.206 2005/06/09 05:04:45 steve Exp $"
#endif
# include "arith.h"
@ -1120,7 +1120,15 @@ void compile_udp_def(int sequ, char *label, char *name,
unsigned nin, unsigned init, char **table)
{
if (sequ) {
vvp_udp_seq_s *u = new vvp_udp_seq_s(label, name, nin);
vvp_bit4_t init4;
if (init == 0)
init4 = BIT4_0;
else if (init == 1)
init4 = BIT4_1;
else
init4 = BIT4_X;
vvp_udp_seq_s *u = new vvp_udp_seq_s(label, name, nin, init4);
u->compile_table(table);
} else {
vvp_udp_comb_s *u = new vvp_udp_comb_s(label, name, nin);
@ -1553,6 +1561,9 @@ void compile_param_string(char*label, char*name, char*str, char*value)
/*
* $Log: compile.cc,v $
* Revision 1.206 2005/06/09 05:04:45 steve
* Support UDP initial values.
*
* Revision 1.205 2005/06/09 04:12:30 steve
* Support sequential UDP devices.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: delay.cc,v 1.6 2005/06/02 16:02:11 steve Exp $"
#ident "$Id: delay.cc,v 1.7 2005/06/09 05:04:45 steve Exp $"
#endif
#include "delay.h"
@ -120,7 +120,7 @@ void vvp_fun_delay::recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit)
if (use_delay == 0)
vvp_send_vec4(net_->out, cur_);
else
schedule_generic(this, 0, use_delay, false);
schedule_generic(this, use_delay, false);
}
void vvp_fun_delay::run_run()
@ -130,6 +130,9 @@ void vvp_fun_delay::run_run()
/*
* $Log: delay.cc,v $
* Revision 1.7 2005/06/09 05:04:45 steve
* Support UDP initial values.
*
* Revision 1.6 2005/06/02 16:02:11 steve
* Add support for notif0/1 gates.
* Make delay nodes support inertial delay.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: schedule.cc,v 1.35 2005/06/02 16:02:11 steve Exp $"
#ident "$Id: schedule.cc,v 1.36 2005/06/09 05:04:45 steve Exp $"
#endif
# include "schedule.h"
@ -476,13 +476,12 @@ void schedule_set_vector(vvp_net_ptr_t ptr, vvp_vector8_t bit)
schedule_event_(cur, 0, SEQ_ACTIVE);
}
void schedule_generic(vvp_gen_event_t obj, unsigned char val,
vvp_time64_t delay, bool sync_flag)
void schedule_generic(vvp_gen_event_t obj, vvp_time64_t delay, bool sync_flag)
{
struct generic_event_s*cur = new generic_event_s;
cur->obj = obj;
cur->val = val;
cur->val = 0;
schedule_event_(cur, delay, sync_flag? SEQ_ROSYNC : SEQ_ACTIVE);
}
@ -583,6 +582,9 @@ void schedule_simulate(void)
/*
* $Log: schedule.cc,v $
* Revision 1.36 2005/06/09 05:04:45 steve
* Support UDP initial values.
*
* Revision 1.35 2005/06/02 16:02:11 steve
* Add support for notif0/1 gates.
* Make delay nodes support inertial delay.

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: schedule.h,v 1.22 2005/06/02 16:02:11 steve Exp $"
#ident "$Id: schedule.h,v 1.23 2005/06/09 05:04:45 steve Exp $"
#endif
# include "vthread.h"
@ -79,8 +79,8 @@ extern void schedule_set_vector(vvp_net_ptr_t ptr, vvp_vector8_t val);
typedef struct vvp_gen_event_s *vvp_gen_event_t;
extern void schedule_generic(vvp_gen_event_t obj, unsigned char val,
vvp_time64_t delay, bool sync_flag);
extern void schedule_generic(vvp_gen_event_t obj, vvp_time64_t delay,
bool sync_flag);
struct vvp_gen_event_s
{
@ -131,6 +131,9 @@ extern unsigned long count_event_pool;
/*
* $Log: schedule.h,v $
* Revision 1.23 2005/06/09 05:04:45 steve
* Support UDP initial values.
*
* Revision 1.22 2005/06/02 16:02:11 steve
* Add support for notif0/1 gates.
* Make delay nodes support inertial delay.

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: udp.cc,v 1.30 2005/06/09 04:12:30 steve Exp $"
#ident "$Id: udp.cc,v 1.31 2005/06/09 05:04:45 steve Exp $"
#endif
#include "udp.h"
@ -44,8 +44,8 @@ struct vvp_udp_s *udp_find(const char *label)
return (struct vvp_udp_s *)v.ptr;
}
vvp_udp_s::vvp_udp_s(char*label, unsigned ports)
: ports_(ports)
vvp_udp_s::vvp_udp_s(char*label, unsigned ports, vvp_bit4_t init)
: ports_(ports), init_(init)
{
if (!udp_table)
udp_table = new_symbol_table();
@ -66,8 +66,13 @@ unsigned vvp_udp_s::port_count() const
return ports_;
}
vvp_bit4_t vvp_udp_s::get_init() const
{
return init_;
}
vvp_udp_comb_s::vvp_udp_comb_s(char*label, char*name, unsigned ports)
: vvp_udp_s(label, ports)
: vvp_udp_s(label, ports, BIT4_X)
{
name_ = name;
levels0_ = 0;
@ -232,8 +237,9 @@ void vvp_udp_comb_s::compile_table(char**tab)
assert(nrows1 == nlevels1_);
}
vvp_udp_seq_s::vvp_udp_seq_s(char*label, char*name, unsigned ports)
: vvp_udp_s(label, ports)
vvp_udp_seq_s::vvp_udp_seq_s(char*label, char*name,
unsigned ports, vvp_bit4_t init)
: vvp_udp_s(label, ports, init)
{
levels0_ = 0;
levels1_ = 0;
@ -674,17 +680,30 @@ vvp_udp_fun_core::vvp_udp_fun_core(vvp_net_t*net,
{
def_ = def;
delay_ = del;
cur_out_ = BIT4_X;
cur_out_ = def_->get_init();
// Assume initially that all the inputs are 1'bx
current_.mask0 = 0;
current_.mask1 = 0;
current_.maskx = ~ ((-1UL) << port_count());
if (cur_out_ != BIT4_X)
schedule_generic(this, 0, false);
}
vvp_udp_fun_core::~vvp_udp_fun_core()
{
}
/*
* This method is used to propagate the initial value on startup.
*/
void vvp_udp_fun_core::run_run()
{
vvp_vector4_t tmp (1);
tmp.set_bit(0, cur_out_);
propagate_vec4(tmp);
}
void vvp_udp_fun_core::recv_vec4_from_inputs(unsigned port)
{
/* For now, assume udps are 1-bit wide. */
@ -751,6 +770,9 @@ void compile_udp_functor(char*label, char*type,
/*
* $Log: udp.cc,v $
* Revision 1.31 2005/06/09 05:04:45 steve
* Support UDP initial values.
*
* Revision 1.30 2005/06/09 04:12:30 steve
* Support sequential UDP devices.
*

View File

@ -22,18 +22,19 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: udp.h,v 1.17 2005/06/09 04:12:30 steve Exp $"
#ident "$Id: udp.h,v 1.18 2005/06/09 05:04:45 steve Exp $"
#endif
# include <vvp_net.h>
# include <delay.h>
# include "schedule.h"
struct udp_levels_table;
struct vvp_udp_s {
public:
explicit vvp_udp_s(char*label, unsigned ports);
explicit vvp_udp_s(char*label, unsigned ports, vvp_bit4_t init);
virtual ~vvp_udp_s();
// Return the number of input ports for the defined UDP. This
@ -41,12 +42,16 @@ struct vvp_udp_s {
// sequential UDP.
unsigned port_count() const;
// Return the initial output value.
vvp_bit4_t get_init() const;
virtual vvp_bit4_t calculate_output(const udp_levels_table&cur,
const udp_levels_table&prev,
vvp_bit4_t cur_out) =0;
private:
unsigned ports_;
vvp_bit4_t init_;
};
/*
@ -175,7 +180,7 @@ struct udp_edges_table {
class vvp_udp_seq_s : public vvp_udp_s {
public:
vvp_udp_seq_s(char*label, char*name, unsigned ports);
vvp_udp_seq_s(char*label, char*name, unsigned ports, vvp_bit4_t init);
~vvp_udp_seq_s();
void compile_table(char**tab);
@ -186,6 +191,8 @@ class vvp_udp_seq_s : public vvp_udp_s {
private:
vvp_bit4_t init_;
vvp_bit4_t test_levels_(const udp_levels_table&cur);
// Level sensitive rows of the device.
@ -218,7 +225,7 @@ struct vvp_udp_s *udp_find(const char *label);
* the vvp_wide_fun_t objects and processes them to generate the
* output to be sent.
*/
class vvp_udp_fun_core : public vvp_wide_fun_core {
class vvp_udp_fun_core : public vvp_wide_fun_core, private vvp_gen_event_s {
public:
vvp_udp_fun_core(vvp_net_t*net, vvp_udp_s*def, vvp_delay_t*del);
@ -227,6 +234,8 @@ class vvp_udp_fun_core : public vvp_wide_fun_core {
void recv_vec4_from_inputs(unsigned);
private:
void run_run();
vvp_udp_s*def_;
vvp_delay_t*delay_;
vvp_bit4_t cur_out_;
@ -237,6 +246,9 @@ class vvp_udp_fun_core : public vvp_wide_fun_core {
/*
* $Log: udp.h,v $
* Revision 1.18 2005/06/09 05:04:45 steve
* Support UDP initial values.
*
* Revision 1.17 2005/06/09 04:12:30 steve
* Support sequential UDP devices.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_callback.cc,v 1.36 2005/06/02 16:02:11 steve Exp $"
#ident "$Id: vpi_callback.cc,v 1.37 2005/06/09 05:04:45 steve Exp $"
#endif
/*
@ -207,16 +207,16 @@ static struct __vpiCallback* make_sync(p_cb_data data, bool readonly_flag)
switch (obj->cb_time.type) {
case vpiSuppressTime:
schedule_generic(cb, 0, 0, readonly_flag);
schedule_generic(cb, 0, readonly_flag);
break;
case vpiSimTime:
{ vvp_time64_t tv = vpip_timestruct_to_time(&obj->cb_time);
vvp_time64_t tn = schedule_simtime();
if (tv < tn) {
schedule_generic(cb, 0, 0, readonly_flag);
schedule_generic(cb, 0, readonly_flag);
} else {
schedule_generic(cb, 0, tv - tn, readonly_flag);
schedule_generic(cb, tv - tn, readonly_flag);
}
break;
}
@ -246,7 +246,7 @@ static struct __vpiCallback* make_afterdelay(p_cb_data data)
switch (obj->cb_time.type) {
case vpiSimTime: {
vvp_time64_t tv = vpip_timestruct_to_time(&obj->cb_time);
schedule_generic(cb, 0, tv, false);
schedule_generic(cb, tv, false);
break;
}
@ -479,6 +479,9 @@ void vvp_fun_signal::run_vpi_callbacks()
/*
* $Log: vpi_callback.cc,v $
* Revision 1.37 2005/06/09 05:04:45 steve
* Support UDP initial values.
*
* Revision 1.36 2005/06/02 16:02:11 steve
* Add support for notif0/1 gates.
* Make delay nodes support inertial delay.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_priv.cc,v 1.47 2005/06/02 16:02:11 steve Exp $"
#ident "$Id: vpi_priv.cc,v 1.48 2005/06/09 05:04:45 steve Exp $"
#endif
# include "vpi_priv.h"
@ -431,7 +431,7 @@ vpiHandle vpi_put_value(vpiHandle obj, s_vpi_value*vp,
vpip_put_value_event*put = new vpip_put_value_event;
put->handle = obj;
put->value = *vp;
schedule_generic(put, 0, dly, false);
schedule_generic(put, dly, false);
return 0;
}
@ -685,6 +685,9 @@ extern "C" void vpi_control(PLI_INT32 operation, ...)
/*
* $Log: vpi_priv.cc,v $
* Revision 1.48 2005/06/09 05:04:45 steve
* Support UDP initial values.
*
* Revision 1.47 2005/06/02 16:02:11 steve
* Add support for notif0/1 gates.
* Make delay nodes support inertial delay.