Keep the width information for all the tran gates.

Update the compiler to keep the actual width information for all the
tran gates.
This commit is contained in:
Cary R 2012-01-02 10:14:20 -08:00
parent 142f661737
commit ba4137d1e8
4 changed files with 18 additions and 12 deletions

View File

@ -524,7 +524,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope,
<< "tran device." << endl; << "tran device." << endl;
des->errors += 1; des->errors += 1;
} else { } else {
gate = new NetTran(scope, inst_name, IVL_SW_TRAN); gate = new NetTran(scope, inst_name, IVL_SW_TRAN,
instance_width);
} }
break; break;
@ -534,7 +535,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope,
<< "rtran device." << endl; << "rtran device." << endl;
des->errors += 1; des->errors += 1;
} else { } else {
gate = new NetTran(scope, inst_name, IVL_SW_RTRAN); gate = new NetTran(scope, inst_name, IVL_SW_RTRAN,
instance_width);
} }
break; break;
@ -544,7 +546,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope,
<< "tranif0 device." << endl; << "tranif0 device." << endl;
des->errors += 1; des->errors += 1;
} else { } else {
gate = new NetTran(scope, inst_name, IVL_SW_TRANIF0); gate = new NetTran(scope, inst_name, IVL_SW_TRANIF0,
instance_width);
} }
break; break;
@ -554,7 +557,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope,
<< "rtranif0 device." << endl; << "rtranif0 device." << endl;
des->errors += 1; des->errors += 1;
} else { } else {
gate = new NetTran(scope, inst_name, IVL_SW_RTRANIF0); gate = new NetTran(scope, inst_name, IVL_SW_RTRANIF0,
instance_width);
} }
break; break;
@ -564,7 +568,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope,
<< "tranif1 device." << endl; << "tranif1 device." << endl;
des->errors += 1; des->errors += 1;
} else { } else {
gate = new NetTran(scope, inst_name, IVL_SW_TRANIF1); gate = new NetTran(scope, inst_name, IVL_SW_TRANIF1,
instance_width);
} }
break; break;
@ -574,7 +579,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope,
<< "rtranif1 device." << endl; << "rtranif1 device." << endl;
des->errors += 1; des->errors += 1;
} else { } else {
gate = new NetTran(scope, inst_name, IVL_SW_RTRANIF1); gate = new NetTran(scope, inst_name, IVL_SW_RTRANIF1,
instance_width);
} }
break; break;

View File

@ -42,15 +42,15 @@ static bool has_enable(ivl_switch_type_t tt)
} }
} }
NetTran::NetTran(NetScope*scope__, perm_string n, ivl_switch_type_t tt) NetTran::NetTran(NetScope*scope__, perm_string n, ivl_switch_type_t tt,
: NetNode(scope__, n, has_enable(tt)? 3 : 2), type_(tt) unsigned width)
: NetNode(scope__, n, has_enable(tt)? 3 : 2), type_(tt), wid_(width)
{ {
pin(0).set_dir(Link::PASSIVE); pin(0).set_dir(Link::PASSIVE);
pin(1).set_dir(Link::PASSIVE); pin(1).set_dir(Link::PASSIVE);
if (pin_count() == 3) { if (pin_count() == 3) {
pin(2).set_dir(Link::INPUT); // Enable pin(2).set_dir(Link::INPUT); // Enable
} }
wid_ = 0;
part_ = 0; part_ = 0;
off_ = 0; off_ = 0;
} }

View File

@ -1613,7 +1613,8 @@ class NetTran : public NetNode, public IslandBranch {
public: public:
// Tran devices other than TRAN_VP // Tran devices other than TRAN_VP
NetTran(NetScope*scope, perm_string n, ivl_switch_type_t type); NetTran(NetScope*scope, perm_string n, ivl_switch_type_t type,
unsigned wid);
// Create a TRAN_VP // Create a TRAN_VP
NetTran(NetScope*scope, perm_string n, unsigned wid, NetTran(NetScope*scope, perm_string n, unsigned wid,
unsigned part, unsigned off); unsigned part, unsigned off);

View File

@ -963,7 +963,7 @@ bool dll_target::tran(const NetTran*net)
{ {
struct ivl_switch_s*obj = new struct ivl_switch_s; struct ivl_switch_s*obj = new struct ivl_switch_s;
obj->type = net->type(); obj->type = net->type();
obj->width = 0; obj->width = net->vector_width();
obj->part = 0; obj->part = 0;
obj->offset = 0; obj->offset = 0;
obj->name = net->name(); obj->name = net->name();
@ -996,7 +996,6 @@ bool dll_target::tran(const NetTran*net)
} }
if (obj->type == IVL_SW_TRAN_VP) { if (obj->type == IVL_SW_TRAN_VP) {
obj->width = net->vector_width();
obj->part = net->part_width(); obj->part = net->part_width();
obj->offset= net->part_offset(); obj->offset= net->part_offset();
} }