Skip to content

Commit

Permalink
Handle 64bit delay constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Aug 8, 2006
1 parent 00891db commit fc0695b
Show file tree
Hide file tree
Showing 20 changed files with 175 additions and 61 deletions.
7 changes: 5 additions & 2 deletions elab_net.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_net.cc,v 1.188 2006/06/20 05:06:47 steve Exp $"
#ident "$Id: elab_net.cc,v 1.189 2006/08/08 05:11:37 steve Exp $"
#endif

# include "config.h"
Expand Down Expand Up @@ -1619,7 +1619,7 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
constant value, extend the value to fit the desired
output. */
if (lwidth > pvalue.len()) {
verinum tmp (0UL, lwidth);
verinum tmp ((uint64_t)0, lwidth);
for (unsigned idx = 0 ; idx < pvalue.len() ; idx += 1)
tmp.set(idx, pvalue.get(idx));

Expand Down Expand Up @@ -2840,6 +2840,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,

/*
* $Log: elab_net.cc,v $
* Revision 1.189 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*
* Revision 1.188 2006/06/20 05:06:47 steve
* Sign extend operands of signed addition.
*
Expand Down
15 changes: 9 additions & 6 deletions elaborate.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elaborate.cc,v 1.340 2006/06/02 04:48:50 steve Exp $"
#ident "$Id: elaborate.cc,v 1.341 2006/08/08 05:11:37 steve Exp $"
#endif

# include "config.h"
Expand Down Expand Up @@ -1343,7 +1343,7 @@ static NetExpr*elaborate_delay_expr(PExpr*expr, Design*des, NetScope*scope)
verireal fn = tmp->value();

int shift = scope->time_unit() - des->get_precision();
long delay = fn.as_long(shift);
int64_t delay = fn.as_long64(shift);
if (delay < 0)
delay = 0;

Expand All @@ -1355,8 +1355,8 @@ static NetExpr*elaborate_delay_expr(PExpr*expr, Design*des, NetScope*scope)
if (NetEConst*tmp = dynamic_cast<NetEConst*>(dex)) {
verinum fn = tmp->value();

unsigned long delay =
des->scale_to_precision(fn.as_ulong(), scope);
uint64_t delay =
des->scale_to_precision(fn.as_ulong64(), scope);

delete tmp;
return new NetEConst(verinum(delay));
Expand All @@ -1368,7 +1368,7 @@ static NetExpr*elaborate_delay_expr(PExpr*expr, Design*des, NetScope*scope)
return that expression. */
int shift = scope->time_unit() - des->get_precision();
if (shift > 0) {
unsigned long scale = 1;
uint64_t scale = 1;
while (shift > 0) {
scale *= 10;
shift -= 1;
Expand Down Expand Up @@ -2063,7 +2063,7 @@ NetProc* PDelayStatement::elaborate(Design*des, NetScope*scope) const

if (NetEConst*tmp = dynamic_cast<NetEConst*>(dex)) {
if (statement_)
return new NetPDelay(tmp->value().as_ulong(),
return new NetPDelay(tmp->value().as_ulong64(),
statement_->elaborate(des, scope));
else
return new NetPDelay(tmp->value().as_ulong(), 0);
Expand Down Expand Up @@ -3133,6 +3133,9 @@ Design* elaborate(list<perm_string>roots)

/*
* $Log: elaborate.cc,v $
* Revision 1.341 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*
* Revision 1.340 2006/06/02 04:48:50 steve
* Make elaborate_expr methods aware of the width that the context
* requires of it. In the process, fix sizing of the width of unary
Expand Down
7 changes: 5 additions & 2 deletions eval.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: eval.cc,v 1.42 2006/05/19 04:07:24 steve Exp $"
#ident "$Id: eval.cc,v 1.43 2006/08/08 05:11:37 steve Exp $"
#endif

# include "config.h"
Expand Down Expand Up @@ -259,7 +259,7 @@ verinum* PEUnary::eval_const(const Design*des, NetScope*scope) const
/* We need to expand the value a bit if we are
taking the 2's complement so that we are
guaranteed to not overflow. */
verinum tmp (0UL, val->len()+1);
verinum tmp ((uint64_t)0, val->len()+1);
for (unsigned idx = 0 ; idx < val->len() ; idx += 1)
tmp.set(idx, val->get(idx));

Expand All @@ -276,6 +276,9 @@ verinum* PEUnary::eval_const(const Design*des, NetScope*scope) const

/*
* $Log: eval.cc,v $
* Revision 1.43 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*
* Revision 1.42 2006/05/19 04:07:24 steve
* eval_const is not strict.
*
Expand Down
7 changes: 5 additions & 2 deletions expr_synth.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: expr_synth.cc,v 1.79 2006/07/31 03:50:17 steve Exp $"
#ident "$Id: expr_synth.cc,v 1.80 2006/08/08 05:11:37 steve Exp $"
#endif

# include "config.h"
Expand Down Expand Up @@ -792,7 +792,7 @@ NetNet* NetESelect::synthesize(Design *des)

assert(expr_width() > sub->vector_width());
unsigned pad_width = expr_width() - sub->vector_width();
verinum pad(0UL, pad_width);
verinum pad((uint64_t)0, pad_width);
NetConst*con = new NetConst(scope, scope->local_symbol(),
pad);
con->set_line(*this);
Expand Down Expand Up @@ -890,6 +890,9 @@ NetNet* NetESignal::synthesize(Design*des)

/*
* $Log: expr_synth.cc,v $
* Revision 1.80 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*
* Revision 1.79 2006/07/31 03:50:17 steve
* Add support for power in constant expressions.
*
Expand Down
9 changes: 7 additions & 2 deletions ivl_target.h
Expand Up @@ -19,9 +19,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: ivl_target.h,v 1.169 2006/07/30 02:51:35 steve Exp $"
#ident "$Id: ivl_target.h,v 1.170 2006/08/08 05:11:37 steve Exp $"
#endif

# include <stdint.h>

#ifdef __cplusplus
#define _BEGIN_DECL extern "C" {
#define _END_DECL }
Expand Down Expand Up @@ -1658,7 +1660,7 @@ extern ivl_statement_t ivl_stmt_cond_true(ivl_statement_t net);
/* IVL_ST_ASSIGN IVL_ST_ASSIGN_NB IVL_ST_DELAYX */
extern ivl_expr_t ivl_stmt_delay_expr(ivl_statement_t net);
/* IVL_ST_DELAY */
extern unsigned long ivl_stmt_delay_val(ivl_statement_t net);
extern uint64_t ivl_stmt_delay_val(ivl_statement_t net);
/* IVL_ST_WAIT IVL_ST_TRIGGER */
extern unsigned ivl_stmt_nevent(ivl_statement_t net);
extern ivl_event_t ivl_stmt_events(ivl_statement_t net, unsigned idx);
Expand Down Expand Up @@ -1718,6 +1720,9 @@ _END_DECL

/*
* $Log: ivl_target.h,v $
* Revision 1.170 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*
* Revision 1.169 2006/07/30 02:51:35 steve
* Fix/implement signed right shift.
*
Expand Down
9 changes: 6 additions & 3 deletions net_design.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: net_design.cc,v 1.49 2006/07/31 03:50:17 steve Exp $"
#ident "$Id: net_design.cc,v 1.50 2006/08/08 05:11:37 steve Exp $"
#endif

# include "config.h"
Expand Down Expand Up @@ -67,8 +67,8 @@ int Design::get_precision() const
return des_precision_;
}

unsigned long Design::scale_to_precision(unsigned long val,
const NetScope*scope) const
uint64_t Design::scale_to_precision(uint64_t val,
const NetScope*scope) const
{
int units = scope->time_unit();
assert( units >= des_precision_ );
Expand Down Expand Up @@ -562,6 +562,9 @@ void Design::delete_process(NetProcTop*top)

/*
* $Log: net_design.cc,v $
* Revision 1.50 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*
* Revision 1.49 2006/07/31 03:50:17 steve
* Add support for power in constant expressions.
*
Expand Down
9 changes: 6 additions & 3 deletions net_proc.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: net_proc.cc,v 1.6 2002/08/12 01:34:59 steve Exp $"
#ident "$Id: net_proc.cc,v 1.7 2006/08/08 05:11:37 steve Exp $"
#endif

# include "config.h"
Expand Down Expand Up @@ -131,7 +131,7 @@ NetForever::~NetForever()
delete statement_;
}

NetPDelay::NetPDelay(unsigned long d, NetProc*st)
NetPDelay::NetPDelay(uint64_t d, NetProc*st)
: delay_(d), expr_(0), statement_(st)
{
}
Expand All @@ -146,7 +146,7 @@ NetPDelay::~NetPDelay()
if (expr_) delete expr_;
}

unsigned long NetPDelay::delay() const
uint64_t NetPDelay::delay() const
{
assert(expr_ == 0);
return delay_;
Expand Down Expand Up @@ -177,6 +177,9 @@ const NetExpr* NetRepeat::expr() const

/*
* $Log: net_proc.cc,v $
* Revision 1.7 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*
* Revision 1.6 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
Expand Down
14 changes: 9 additions & 5 deletions netlist.h
Expand Up @@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: netlist.h,v 1.359 2006/07/31 03:50:17 steve Exp $"
#ident "$Id: netlist.h,v 1.360 2006/08/08 05:11:37 steve Exp $"
#endif

/*
Expand All @@ -31,6 +31,7 @@
# include <string>
# include <map>
# include <list>
# include <stdint.h>
# include "ivl_target.h"
# include "verinum.h"
# include "verireal.h"
Expand Down Expand Up @@ -2288,11 +2289,11 @@ class NetFuncDef {
class NetPDelay : public NetProc {

public:
NetPDelay(unsigned long d, NetProc*st);
NetPDelay(uint64_t d, NetProc*st);
NetPDelay(NetExpr* d, NetProc*st);
~NetPDelay();

unsigned long delay() const;
uint64_t delay() const;
const NetExpr*expr() const;

virtual NexusSet* nex_input();
Expand All @@ -2304,7 +2305,7 @@ class NetPDelay : public NetProc {
bool emit_proc_recurse(struct target_t*) const;

private:
unsigned long delay_;
uint64_t delay_;
NetExpr*expr_;
NetProc*statement_;
};
Expand Down Expand Up @@ -3394,7 +3395,7 @@ class Design {

/* This function takes a delay value and a scope, and returns
the delay value scaled to the precision of the design. */
unsigned long scale_to_precision(unsigned long, const NetScope*)const;
uint64_t scale_to_precision(uint64_t, const NetScope*)const;

/* Look up a scope. If no starting scope is passed, then the
path is taken as an absolute scope name. Otherwise, the
Expand Down Expand Up @@ -3509,6 +3510,9 @@ extern ostream& operator << (ostream&, NetNet::Type);

/*
* $Log: netlist.h,v $
* Revision 1.360 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*
* Revision 1.359 2006/07/31 03:50:17 steve
* Add support for power in constant expressions.
*
Expand Down
16 changes: 8 additions & 8 deletions parse.y
Expand Up @@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: parse.y,v 1.218 2006/07/31 03:50:17 steve Exp $"
#ident "$Id: parse.y,v 1.219 2006/08/08 05:11:37 steve Exp $"
#endif

# include "config.h"
Expand Down Expand Up @@ -1125,7 +1125,7 @@ function_item
re = new PENumber(new verinum(INTEGER_WIDTH-1,
INTEGER_WIDTH));
(*range_stub)[0] = re;
re = new PENumber(new verinum(0UL, INTEGER_WIDTH));
re = new PENumber(new verinum((uint64_t)0, INTEGER_WIDTH));
(*range_stub)[1] = re;
svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINPUT,
Expand Down Expand Up @@ -3084,7 +3084,7 @@ task_port_item
re = new PENumber(new verinum(INTEGER_WIDTH-1,
INTEGER_WIDTH));
(*range_stub)[0] = re;
re = new PENumber(new verinum(0UL, INTEGER_WIDTH));
re = new PENumber(new verinum((uint64_t)0, INTEGER_WIDTH));
(*range_stub)[1] = re;
svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINPUT,
Expand All @@ -3100,7 +3100,7 @@ task_port_item
re = new PENumber(new verinum(INTEGER_WIDTH-1,
INTEGER_WIDTH));
(*range_stub)[0] = re;
re = new PENumber(new verinum(0UL, INTEGER_WIDTH));
re = new PENumber(new verinum((uint64_t)0, INTEGER_WIDTH));
(*range_stub)[1] = re;
svector<PWire*>*tmp
= pform_make_task_ports(NetNet::POUTPUT,
Expand All @@ -3116,7 +3116,7 @@ task_port_item
re = new PENumber(new verinum(INTEGER_WIDTH-1,
INTEGER_WIDTH));
(*range_stub)[0] = re;
re = new PENumber(new verinum(0UL, INTEGER_WIDTH));
re = new PENumber(new verinum((uint64_t)0, INTEGER_WIDTH));
(*range_stub)[1] = re;
svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINOUT,
Expand Down Expand Up @@ -3207,7 +3207,7 @@ task_port_decl
re = new PENumber(new verinum(INTEGER_WIDTH-1,
INTEGER_WIDTH));
(*range_stub)[0] = re;
re = new PENumber(new verinum(0UL, INTEGER_WIDTH));
re = new PENumber(new verinum((uint64_t)0, INTEGER_WIDTH));
(*range_stub)[1] = re;
svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINPUT,
Expand All @@ -3224,7 +3224,7 @@ task_port_decl
re = new PENumber(new verinum(INTEGER_WIDTH-1,
INTEGER_WIDTH));
(*range_stub)[0] = re;
re = new PENumber(new verinum(0UL, INTEGER_WIDTH));
re = new PENumber(new verinum((uint64_t)0, INTEGER_WIDTH));
(*range_stub)[1] = re;
svector<PWire*>*tmp
= pform_make_task_ports(NetNet::POUTPUT,
Expand All @@ -3241,7 +3241,7 @@ task_port_decl
re = new PENumber(new verinum(INTEGER_WIDTH-1,
INTEGER_WIDTH));
(*range_stub)[0] = re;
re = new PENumber(new verinum(0UL, INTEGER_WIDTH));
re = new PENumber(new verinum((uint64_t)0, INTEGER_WIDTH));
(*range_stub)[1] = re;
svector<PWire*>*tmp
= pform_make_task_ports(NetNet::PINOUT,
Expand Down

0 comments on commit fc0695b

Please sign in to comment.