From ba4137d1e874e505781ae830e0b1fec6ebbcccbe Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 2 Jan 2012 10:14:20 -0800 Subject: [PATCH] Keep the width information for all the tran gates. Update the compiler to keep the actual width information for all the tran gates. --- elaborate.cc | 18 ++++++++++++------ net_tran.cc | 6 +++--- netlist.h | 3 ++- t-dll.cc | 3 +-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index ed85ab6b2..e2bf04e64 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -524,7 +524,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope, << "tran device." << endl; des->errors += 1; } else { - gate = new NetTran(scope, inst_name, IVL_SW_TRAN); + gate = new NetTran(scope, inst_name, IVL_SW_TRAN, + instance_width); } break; @@ -534,7 +535,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope, << "rtran device." << endl; des->errors += 1; } else { - gate = new NetTran(scope, inst_name, IVL_SW_RTRAN); + gate = new NetTran(scope, inst_name, IVL_SW_RTRAN, + instance_width); } break; @@ -544,7 +546,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope, << "tranif0 device." << endl; des->errors += 1; } else { - gate = new NetTran(scope, inst_name, IVL_SW_TRANIF0); + gate = new NetTran(scope, inst_name, IVL_SW_TRANIF0, + instance_width); } break; @@ -554,7 +557,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope, << "rtranif0 device." << endl; des->errors += 1; } else { - gate = new NetTran(scope, inst_name, IVL_SW_RTRANIF0); + gate = new NetTran(scope, inst_name, IVL_SW_RTRANIF0, + instance_width); } break; @@ -564,7 +568,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope, << "tranif1 device." << endl; des->errors += 1; } else { - gate = new NetTran(scope, inst_name, IVL_SW_TRANIF1); + gate = new NetTran(scope, inst_name, IVL_SW_TRANIF1, + instance_width); } break; @@ -574,7 +579,8 @@ NetNode* PGBuiltin::create_gate_for_output_(Design*des, NetScope*scope, << "rtranif1 device." << endl; des->errors += 1; } else { - gate = new NetTran(scope, inst_name, IVL_SW_RTRANIF1); + gate = new NetTran(scope, inst_name, IVL_SW_RTRANIF1, + instance_width); } break; diff --git a/net_tran.cc b/net_tran.cc index 79d9c50f0..e170bb3fc 100644 --- a/net_tran.cc +++ b/net_tran.cc @@ -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) -: NetNode(scope__, n, has_enable(tt)? 3 : 2), type_(tt) +NetTran::NetTran(NetScope*scope__, perm_string n, ivl_switch_type_t tt, + unsigned width) +: NetNode(scope__, n, has_enable(tt)? 3 : 2), type_(tt), wid_(width) { pin(0).set_dir(Link::PASSIVE); pin(1).set_dir(Link::PASSIVE); if (pin_count() == 3) { pin(2).set_dir(Link::INPUT); // Enable } - wid_ = 0; part_ = 0; off_ = 0; } diff --git a/netlist.h b/netlist.h index 8304bb777..055466b5d 100644 --- a/netlist.h +++ b/netlist.h @@ -1613,7 +1613,8 @@ class NetTran : public NetNode, public IslandBranch { public: // 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 NetTran(NetScope*scope, perm_string n, unsigned wid, unsigned part, unsigned off); diff --git a/t-dll.cc b/t-dll.cc index 7ac03ae15..676ae5f27 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -963,7 +963,7 @@ bool dll_target::tran(const NetTran*net) { struct ivl_switch_s*obj = new struct ivl_switch_s; obj->type = net->type(); - obj->width = 0; + obj->width = net->vector_width(); obj->part = 0; obj->offset = 0; obj->name = net->name(); @@ -996,7 +996,6 @@ bool dll_target::tran(const NetTran*net) } if (obj->type == IVL_SW_TRAN_VP) { - obj->width = net->vector_width(); obj->part = net->part_width(); obj->offset= net->part_offset(); }