Delays expressions are 64bit integers.
Fix the PDelay processing to account for the fact that delay expressions are 64bits. Use int64_t instead of unsigned long.
This commit is contained in:
parent
c6ed0a9d2c
commit
fa02455f36
|
|
@ -74,7 +74,7 @@ static NetExpr*calculate_val(Design*des, NetScope*scope, const PExpr*expr)
|
||||||
verireal fn = tmp->value();
|
verireal fn = tmp->value();
|
||||||
|
|
||||||
int shift = scope->time_unit() - des->get_precision();
|
int shift = scope->time_unit() - des->get_precision();
|
||||||
long delay = fn.as_long(shift);
|
int64_t delay = fn.as_long64(shift);
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
delay = 0;
|
delay = 0;
|
||||||
|
|
||||||
|
|
@ -88,8 +88,7 @@ static NetExpr*calculate_val(Design*des, NetScope*scope, const PExpr*expr)
|
||||||
if (NetEConst*tmp = dynamic_cast<NetEConst*>(dex)) {
|
if (NetEConst*tmp = dynamic_cast<NetEConst*>(dex)) {
|
||||||
verinum fn = tmp->value();
|
verinum fn = tmp->value();
|
||||||
|
|
||||||
unsigned long delay =
|
uint64_t delay = des->scale_to_precision(fn.as_ulong64(), scope);
|
||||||
des->scale_to_precision(fn.as_ulong(), scope);
|
|
||||||
|
|
||||||
delete tmp;
|
delete tmp;
|
||||||
NetEConst*tmp2 = new NetEConst(verinum(delay));
|
NetEConst*tmp2 = new NetEConst(verinum(delay));
|
||||||
|
|
|
||||||
53
PGate.cc
53
PGate.cc
|
|
@ -99,59 +99,6 @@ void PGate::eval_delays(Design*des, NetScope*scope,
|
||||||
as_net_flag);
|
as_net_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PGate::eval_delays(Design*des, NetScope*scope,
|
|
||||||
unsigned long&rise_time,
|
|
||||||
unsigned long&fall_time,
|
|
||||||
unsigned long&decay_time) const
|
|
||||||
{
|
|
||||||
NetExpr*rise_expr, *fall_expr, *decay_expr;
|
|
||||||
delay_.eval_delays(des, scope, rise_expr, fall_expr, decay_expr);
|
|
||||||
|
|
||||||
if (rise_expr == 0) {
|
|
||||||
rise_time = 0;
|
|
||||||
fall_time = 0;
|
|
||||||
decay_time = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NetEConst*tmp = dynamic_cast<NetEConst*> (rise_expr)) {
|
|
||||||
rise_time = tmp->value().as_ulong();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
cerr << get_fileline() << ": error: Delay expressions must be "
|
|
||||||
<< "constant here." << endl;
|
|
||||||
cerr << get_fileline() << ": : Cannot calculate "
|
|
||||||
<< *rise_expr << endl;
|
|
||||||
des->errors += 1;
|
|
||||||
rise_time = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NetEConst*tmp = dynamic_cast<NetEConst*> (fall_expr)) {
|
|
||||||
fall_time = tmp->value().as_ulong();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (fall_expr != rise_expr) {
|
|
||||||
cerr << get_fileline() << ": error: Delay expressions must be "
|
|
||||||
<< "constant here." << endl;
|
|
||||||
cerr << get_fileline() << ": : Cannot calculate "
|
|
||||||
<< *rise_expr << endl;
|
|
||||||
}
|
|
||||||
des->errors += 1;
|
|
||||||
fall_time = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NetEConst*tmp = dynamic_cast<NetEConst*> (decay_expr)) {
|
|
||||||
decay_time = tmp->value().as_ulong();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
cerr << get_fileline() << ": error: Delay expressions must be "
|
|
||||||
<< "constant here." << endl;
|
|
||||||
cerr << get_fileline() << ": : Cannot calculate "
|
|
||||||
<< *rise_expr << endl;
|
|
||||||
des->errors += 1;
|
|
||||||
decay_time = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PGAssign::PGAssign(svector<PExpr*>*pins)
|
PGAssign::PGAssign(svector<PExpr*>*pins)
|
||||||
: PGate(perm_string(), pins)
|
: PGate(perm_string(), pins)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
9
PGate.h
9
PGate.h
|
|
@ -62,15 +62,6 @@ class PGate : public LineInfo {
|
||||||
|
|
||||||
perm_string get_name() const { return name_; }
|
perm_string get_name() const { return name_; }
|
||||||
|
|
||||||
// This method evaluates the delays all the way to an
|
|
||||||
// integer. If the delay is non-constant, then set the times
|
|
||||||
// to 0, print an error message and mark an error to the
|
|
||||||
// design.
|
|
||||||
void eval_delays(Design*des, NetScope*scope,
|
|
||||||
unsigned long&rise_time,
|
|
||||||
unsigned long&fall_time,
|
|
||||||
unsigned long&decay_time) const;
|
|
||||||
|
|
||||||
// This evaluates the delays as far as possible, but returns
|
// This evaluates the delays as far as possible, but returns
|
||||||
// an expression, and do not signal errors.
|
// an expression, and do not signal errors.
|
||||||
void eval_delays(Design*des, NetScope*scope,
|
void eval_delays(Design*des, NetScope*scope,
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ uint64_t get_number_immediate64(ivl_expr_t ex)
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
if (ivl_expr_signed(ex) && bits[nbits-1]=='1' && nbits < 64)
|
if (ivl_expr_signed(ex) && bits[nbits-1]=='1' && nbits < 64)
|
||||||
imm |= -UINT64_C(1) << nbits;
|
imm |= (-UINT64_C(1)) << nbits;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue