2005-04-03 07:45:51 +02:00
|
|
|
#ifndef __delay_H
|
2001-11-10 19:07:11 +01:00
|
|
|
#define __delay_H
|
|
|
|
|
/*
|
2005-04-03 07:45:51 +02:00
|
|
|
* Copyright 2005 Stephen Williams
|
2001-11-10 19:07:11 +01:00
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
2002-08-12 03:34:58 +02:00
|
|
|
#ifdef HAVE_CVS_IDENT
|
2005-06-22 02:04:48 +02:00
|
|
|
#ident "$Id: delay.h,v 1.8 2005/06/22 00:04:49 steve Exp $"
|
2001-11-10 19:07:11 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*
|
2005-04-03 07:45:51 +02:00
|
|
|
*/
|
2001-11-10 19:07:11 +01:00
|
|
|
|
2005-04-03 07:45:51 +02:00
|
|
|
# include "vvp_net.h"
|
2005-06-02 18:02:11 +02:00
|
|
|
# include "schedule.h"
|
2001-11-10 19:07:11 +01:00
|
|
|
|
2005-04-03 07:45:51 +02:00
|
|
|
/*
|
|
|
|
|
* Instances of this object are functions that calculate the delay for
|
|
|
|
|
* the transition from the source vvp_bit4_t value to the destination
|
|
|
|
|
* value.
|
|
|
|
|
*/
|
|
|
|
|
class vvp_delay_t {
|
2001-11-10 19:07:11 +01:00
|
|
|
|
2005-04-03 07:45:51 +02:00
|
|
|
public:
|
|
|
|
|
vvp_delay_t(vvp_time64_t rise, vvp_time64_t fall);
|
|
|
|
|
vvp_delay_t(vvp_time64_t rise, vvp_time64_t fall, vvp_time64_t decay);
|
|
|
|
|
~vvp_delay_t();
|
2001-11-10 19:07:11 +01:00
|
|
|
|
2005-04-03 07:45:51 +02:00
|
|
|
vvp_time64_t get_delay(vvp_bit4_t from, vvp_bit4_t to);
|
2001-11-10 19:07:11 +01:00
|
|
|
|
2005-04-03 07:45:51 +02:00
|
|
|
private:
|
|
|
|
|
vvp_time64_t rise_, fall_, decay_;
|
|
|
|
|
vvp_time64_t min_delay_;
|
2001-11-10 19:07:11 +01:00
|
|
|
};
|
|
|
|
|
|
2005-05-14 21:43:23 +02:00
|
|
|
/* vvp_fun_delay
|
|
|
|
|
* This is a lighter weight version of vvp_fun_drive, that only
|
|
|
|
|
* carries delays. The output that it propagates is vvp_vector4_t so
|
|
|
|
|
* drive strengths are lost, but then again it doesn't go through the
|
|
|
|
|
* effort of calculating strength values either.
|
2005-06-02 18:02:11 +02:00
|
|
|
*
|
|
|
|
|
* The node needs a pointer to the vvp_net_t input so that it knows
|
|
|
|
|
* how to find its output when propaging delayed output.
|
2005-05-14 21:43:23 +02:00
|
|
|
*/
|
2005-06-02 18:02:11 +02:00
|
|
|
class vvp_fun_delay : public vvp_net_fun_t, private vvp_gen_event_s {
|
2005-05-14 21:43:23 +02:00
|
|
|
|
|
|
|
|
public:
|
2005-06-02 18:02:11 +02:00
|
|
|
vvp_fun_delay(vvp_net_t*net, vvp_bit4_t init, const vvp_delay_t&d);
|
2005-05-14 21:43:23 +02:00
|
|
|
~vvp_fun_delay();
|
|
|
|
|
|
2005-06-22 02:04:48 +02:00
|
|
|
void recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit);
|
2005-05-14 21:43:23 +02:00
|
|
|
//void recv_long(vvp_net_ptr_t port, long bit);
|
|
|
|
|
|
|
|
|
|
private:
|
2005-06-02 18:02:11 +02:00
|
|
|
virtual void run_run();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
vvp_net_t*net_;
|
2005-05-14 21:43:23 +02:00
|
|
|
vvp_delay_t delay_;
|
|
|
|
|
vvp_vector4_t cur_;
|
|
|
|
|
};
|
|
|
|
|
|
2001-11-10 19:07:11 +01:00
|
|
|
/*
|
2005-04-03 07:45:51 +02:00
|
|
|
* $Log: delay.h,v $
|
2005-06-22 02:04:48 +02:00
|
|
|
* Revision 1.8 2005/06/22 00:04:49 steve
|
|
|
|
|
* Reduce vvp_vector4 copies by using const references.
|
|
|
|
|
*
|
2005-06-02 18:02:11 +02:00
|
|
|
* Revision 1.7 2005/06/02 16:02:11 steve
|
|
|
|
|
* Add support for notif0/1 gates.
|
|
|
|
|
* Make delay nodes support inertial delay.
|
|
|
|
|
* Add the %force/link instruction.
|
|
|
|
|
*
|
2005-05-14 21:43:23 +02:00
|
|
|
* Revision 1.6 2005/05/14 19:43:23 steve
|
|
|
|
|
* Move functor delays to vvp_delay_fun object.
|
|
|
|
|
*
|
2005-04-03 07:45:51 +02:00
|
|
|
* Revision 1.5 2005/04/03 05:45:51 steve
|
|
|
|
|
* Rework the vvp_delay_t class.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2001-11-10 19:07:11 +01:00
|
|
|
#endif // __delay_H
|