Skip to content

Commit

Permalink
Add support for only two variable delays and add delay checks.
Browse files Browse the repository at this point in the history
This patch adds checks that the delay count is correct for the
various gates and adds support for a missing variable decay
time. For this case the decay time is the minimum of the rise
and fall times. This is denoted by setting the decay variable
to 0 in the vvp file. vvp notes this and sets an ignore decay
time property in the base delay. This turns off the ability
to set the decay time and the minimum delay calculation will
also update the decay time.
  • Loading branch information
caryr authored and steveicarus committed Jul 14, 2010
1 parent 6fbf470 commit 13fb07d
Show file tree
Hide file tree
Showing 11 changed files with 286 additions and 46 deletions.
11 changes: 9 additions & 2 deletions PDelays.cc
Expand Up @@ -65,6 +65,15 @@ void PDelays::set_delays(const svector<PExpr*>*del, bool df)
delete_flag_ = df;
}

unsigned PDelays::delay_count() const
{
unsigned dly_cnt = 0;
for (unsigned idx = 0 ; idx < 3 ; idx += 1)
if (delay_[idx]) dly_cnt += 1;

return dly_cnt;
}

static NetExpr*calculate_val(Design*des, NetScope*scope, PExpr*expr)
{
ivl_variable_type_t tmp_type = IVL_VT_NO_TYPE;
Expand Down Expand Up @@ -144,8 +153,6 @@ static NetExpr* calc_decay_time(NetExpr *rise, NetExpr *fall)
else return fall;
}

cerr << fall->get_fileline() << ": sorry: can not calculate the "
<< "decay time from " << *rise << " and " << *fall << endl;
return 0;
}

Expand Down
4 changes: 3 additions & 1 deletion PDelays.h
@@ -1,7 +1,7 @@
#ifndef __PDelays_H
#define __PDelays_H
/*
* Copyright (c) 1999-2002 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
Expand Down Expand Up @@ -50,6 +50,8 @@ class PDelays {
void set_delay(PExpr*);
void set_delays(const svector<PExpr*>*del, bool delete_flag=true);

unsigned delay_count() const;

void eval_delays(Design*des, NetScope*scope,
NetExpr*&rise_time,
NetExpr*&fall_time,
Expand Down
103 changes: 103 additions & 0 deletions PGate.cc
Expand Up @@ -99,6 +99,11 @@ void PGate::eval_delays(Design*des, NetScope*scope,
as_net_flag);
}

unsigned PGate::delay_count() const
{
return delay_.delay_count();
}

PGAssign::PGAssign(svector<PExpr*>*pins)
: PGate(perm_string(), pins)
{
Expand Down Expand Up @@ -143,6 +148,104 @@ void PGBuiltin::set_range(PExpr*msb, PExpr*lsb)
lsb_ = lsb;
}

const char* PGBuiltin::gate_name() const
{
switch(type_) {
case AND:
return "AND";
break;
case NAND:
return "NAND";
break;

case OR:
return "OR";
break;
case NOR:
return "NOR";
break;

case XOR:
return "XOR";
break;
case XNOR:
return "XNOR";
break;

case BUF:
return "BUF";
break;
case NOT:
return "NOT";
break;

case BUFIF0:
return "BUFIF0";
break;
case NOTIF0:
return "NOTIF0";
break;

case BUFIF1:
return "BUFIF1";
break;
case NOTIF1:
return "NOTIF1";
break;

case NMOS:
return "NMOS";
break;
case RNMOS:
return "RNMOS";
break;

case PMOS:
return "PMOS";
break;
case RPMOS:
return "RPMOS";
break;

case TRAN:
return "TRAN";
break;
case RTRAN:
return "RTRAN";
break;

case TRANIF0:
return "TRANIF0";
break;
case RTRANIF0:
return "RTRANIF0";
break;

case TRANIF1:
return "TRANIF1";
break;
case RTRANIF1:
return "RTRANIF1";
break;

case CMOS:
return "CMOS";
break;
case RCMOS:
return "RCMOS";
break;

case PULLUP:
return "PULLUP";
break;
case PULLDOWN:
return "PULLDOWN";
break;
}

return "<unknown>";
}

PGModule::PGModule(perm_string type, perm_string name, svector<PExpr*>*pins)
: PGate(name, pins), overrides_(0), pins_(0),
npins_(0), parms_(0), nparms_(0), msb_(0), lsb_(0)
Expand Down
5 changes: 5 additions & 0 deletions PGate.h
Expand Up @@ -68,6 +68,8 @@ class PGate : public LineInfo {
NetExpr*&decay_time,
bool as_net_flag =false) const;

unsigned delay_count() const;

unsigned pin_count() const { return pins_? pins_->count() : 0; }
PExpr*pin(unsigned idx) const { return (*pins_)[idx]; }

Expand Down Expand Up @@ -149,6 +151,7 @@ class PGBuiltin : public PGate {
~PGBuiltin();

Type type() const { return type_; }
const char * gate_name() const;
void set_range(PExpr*msb, PExpr*lsb);

virtual void dump(ostream&out, unsigned ind =4) const;
Expand All @@ -165,6 +168,8 @@ class PGBuiltin : public PGate {
perm_string gate_name,
unsigned instance_width) const;

bool check_delay_count(Design*des) const;

Type type_;
PExpr*msb_;
PExpr*lsb_;
Expand Down

0 comments on commit 13fb07d

Please sign in to comment.