Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Remove Link::strength_t and PGate::strength_t types.

These types are useless repetition of the ivl_drive_t type.
This is also another chapter in the series to push ivl_target
generation further upstream.
  • Loading branch information...
commit 79f8b8fcfd0a78fc56d75b924ba1f9f8b46f3417 1 parent 261cfd1
Stephen Williams steveicarus authored
20 PGate.cc
@@ -30,8 +30,8 @@ PGate::PGate(perm_string name,
30 30 : name_(name), pins_(pins)
31 31 {
32 32 if (del) delay_.set_delays(del);
33   - str0_ = STRONG;
34   - str1_ = STRONG;
  33 + str0_ = IVL_DR_STRONG;
  34 + str1_ = IVL_DR_STRONG;
35 35 }
36 36
37 37 PGate::PGate(perm_string name,
@@ -40,37 +40,37 @@ PGate::PGate(perm_string name,
40 40 : name_(name), pins_(pins)
41 41 {
42 42 if (del) delay_.set_delay(del);
43   - str0_ = STRONG;
44   - str1_ = STRONG;
  43 + str0_ = IVL_DR_STRONG;
  44 + str1_ = IVL_DR_STRONG;
45 45 }
46 46
47 47 PGate::PGate(perm_string name, svector<PExpr*>*pins)
48 48 : name_(name), pins_(pins)
49 49 {
50   - str0_ = STRONG;
51   - str1_ = STRONG;
  50 + str0_ = IVL_DR_STRONG;
  51 + str1_ = IVL_DR_STRONG;
52 52 }
53 53
54 54 PGate::~PGate()
55 55 {
56 56 }
57 57
58   -PGate::strength_t PGate::strength0() const
  58 +ivl_drive_t PGate::strength0() const
59 59 {
60 60 return str0_;
61 61 }
62 62
63   -void PGate::strength0(PGate::strength_t s)
  63 +void PGate::strength0(ivl_drive_t s)
64 64 {
65 65 str0_ = s;
66 66 }
67 67
68   -PGate::strength_t PGate::strength1() const
  68 +ivl_drive_t PGate::strength1() const
69 69 {
70 70 return str1_;
71 71 }
72 72
73   -void PGate::strength1(PGate::strength_t s)
  73 +void PGate::strength1(ivl_drive_t s)
74 74 {
75 75 str1_ = s;
76 76 }
12 PGate.h
@@ -48,8 +48,6 @@ class Module;
48 48 class PGate : public LineInfo {
49 49
50 50 public:
51   - enum strength_t { HIGHZ, WEAK, PULL, STRONG, SUPPLY };
52   -
53 51 explicit PGate(perm_string name, svector<PExpr*>*pins,
54 52 const svector<PExpr*>*del);
55 53
@@ -73,11 +71,11 @@ class PGate : public LineInfo {
73 71 unsigned pin_count() const { return pins_? pins_->count() : 0; }
74 72 PExpr*pin(unsigned idx) const { return (*pins_)[idx]; }
75 73
76   - strength_t strength0() const;
77   - strength_t strength1() const;
  74 + ivl_drive_t strength0() const;
  75 + ivl_drive_t strength1() const;
78 76
79   - void strength0(strength_t);
80   - void strength1(strength_t);
  77 + void strength0(ivl_drive_t);
  78 + void strength1(ivl_drive_t);
81 79
82 80 map<perm_string,PExpr*> attributes;
83 81
@@ -97,7 +95,7 @@ class PGate : public LineInfo {
97 95 PDelays delay_;
98 96 svector<PExpr*>*pins_;
99 97
100   - strength_t str0_, str1_;
  98 + ivl_drive_t str0_, str1_;
101 99
102 100 private: // not implemented
103 101 PGate(const PGate&);
21 design_dump.cc
@@ -43,22 +43,31 @@ static ostream& operator<< (ostream&o, NetBlock::Type t)
43 43 return o;
44 44 }
45 45
46   -ostream& operator << (ostream&o, Link::strength_t str)
  46 +ostream& operator << (ostream&o, ivl_drive_t str)
47 47 {
48 48 switch (str) {
49   - case Link::HIGHZ:
  49 + case IVL_DR_HiZ:
50 50 o << "highz";
51 51 break;
52   - case Link::WEAK:
  52 + case IVL_DR_SMALL:
  53 + o << "small";
  54 + break;
  55 + case IVL_DR_MEDIUM:
  56 + o << "medium";
  57 + break;
  58 + case IVL_DR_WEAK:
53 59 o << "weak";
54 60 break;
55   - case Link::PULL:
  61 + case IVL_DR_LARGE:
  62 + o << "large";
  63 + break;
  64 + case IVL_DR_PULL:
56 65 o << "pull";
57 66 break;
58   - case Link::STRONG:
  67 + case IVL_DR_STRONG:
59 68 o << "strong";
60 69 break;
61   - case Link::SUPPLY:
  70 + case IVL_DR_SUPPLY:
62 71 o << "supply";
63 72 break;
64 73 default:
4 elab_sig.cc
@@ -1009,8 +1009,8 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
1009 1009 pull = new NetLogic(scope, scope->local_symbol(),
1010 1010 1, pull_type, wid);
1011 1011 pull->set_line(*this);
1012   - pull->pin(0).drive0(Link::SUPPLY);
1013   - pull->pin(0).drive1(Link::SUPPLY);
  1012 + pull->pin(0).drive0(IVL_DR_SUPPLY);
  1013 + pull->pin(0).drive1(IVL_DR_SUPPLY);
1014 1014 des->add_node(pull);
1015 1015 wtype = NetNet::WIRE;
1016 1016
32 elaborate.cc
@@ -42,26 +42,6 @@
42 42 # include "ivl_assert.h"
43 43
44 44
45   -static Link::strength_t drive_type(PGate::strength_t drv)
46   -{
47   - switch (drv) {
48   - case PGate::HIGHZ:
49   - return Link::HIGHZ;
50   - case PGate::WEAK:
51   - return Link::WEAK;
52   - case PGate::PULL:
53   - return Link::PULL;
54   - case PGate::STRONG:
55   - return Link::STRONG;
56   - case PGate::SUPPLY:
57   - return Link::SUPPLY;
58   - default:
59   - assert(0);
60   - }
61   - return Link::STRONG;
62   -}
63   -
64   -
65 45 void PGate::elaborate(Design*des, NetScope*scope) const
66 46 {
67 47 cerr << "internal error: what kind of gate? " <<
@@ -79,8 +59,8 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
79 59 NetExpr* rise_time, *fall_time, *decay_time;
80 60 eval_delays(des, scope, rise_time, fall_time, decay_time, true);
81 61
82   - Link::strength_t drive0 = drive_type(strength0());
83   - Link::strength_t drive1 = drive_type(strength1());
  62 + ivl_drive_t drive0 = strength0();
  63 + ivl_drive_t drive1 = strength1();
84 64
85 65 assert(pin(0));
86 66 assert(pin(1));
@@ -192,7 +172,7 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
192 172 /* When we are given a non-default strength value and if the
193 173 * drive source is a bit, part or indexed select we need to
194 174 * add a driver (BUFZ) to convey the strength information. */
195   - if ((drive0 != Link::STRONG || drive1 != Link::STRONG) &&
  175 + if ((drive0 != IVL_DR_STRONG || drive1 != IVL_DR_STRONG) &&
196 176 (dynamic_cast<NetESelect*>(rval_expr))) {
197 177 need_driver_flag = true;
198 178 }
@@ -218,7 +198,7 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
218 198
219 199 /* Set the drive and delays for the r-val. */
220 200
221   - if (drive0 != Link::STRONG || drive1 != Link::STRONG)
  201 + if (drive0 != IVL_DR_STRONG || drive1 != IVL_DR_STRONG)
222 202 rval->pin(0).drivers_drive(drive0, drive1);
223 203
224 204 if (rise_time || fall_time || decay_time)
@@ -709,8 +689,8 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
709 689 log->fall_time(fall_time);
710 690 log->decay_time(decay_time);
711 691
712   - log->pin(0).drive0(drive_type(strength0()));
713   - log->pin(0).drive1(drive_type(strength1()));
  692 + log->pin(0).drive0(strength0());
  693 + log->pin(0).drive1(strength1());
714 694 }
715 695
716 696 cur[idx]->set_line(*this);
3  ivl_target_priv.h
@@ -22,6 +22,7 @@
22 22 # include "ivl_target.h"
23 23 # include <inttypes.h>
24 24 # include <vector>
  25 +# include <ostream>
25 26 # include <valarray>
26 27
27 28 /*
@@ -79,4 +80,6 @@ struct ivl_island_s {
79 80 std::vector<bool> flags;
80 81 };
81 82
  83 +extern std::ostream& operator << (std::ostream&o, ivl_drive_t str);
  84 +
82 85 #endif
8 net_func.cc
@@ -38,8 +38,8 @@ NetUserFunc::NetUserFunc(NetScope*s, perm_string n, NetScope*d, NetEvWait*trigge
38 38 for (unsigned idx = 1 ; idx < pin_count() ; idx += 1) {
39 39
40 40 pin(idx).set_dir(Link::INPUT);
41   - pin(idx).drive0(Link::HIGHZ);
42   - pin(idx).drive1(Link::HIGHZ);
  41 + pin(idx).drive0(IVL_DR_HiZ);
  42 + pin(idx).drive1(IVL_DR_HiZ);
43 43 }
44 44 }
45 45
@@ -136,8 +136,8 @@ NetSysFunc::NetSysFunc(NetScope*s, perm_string n,
136 136 for (unsigned idx = 1 ; idx < pin_count() ; idx += 1) {
137 137
138 138 pin(idx).set_dir(Link::INPUT);
139   - pin(idx).drive0(Link::HIGHZ);
140   - pin(idx).drive1(Link::HIGHZ);
  139 + pin(idx).drive0(IVL_DR_HiZ);
  140 + pin(idx).drive1(IVL_DR_HiZ);
141 141 }
142 142 }
143 143
43 net_link.cc
@@ -105,7 +105,7 @@ void connect(Link&l, Link&r)
@@ -162,61 +162,32 @@ void Link::drivers_delays(NetExpr*rise, NetExpr*fall, NetExpr*decay)
@@ -384,7 +355,7 @@ void Nexus::drivers_delays(NetExpr*rise, NetExpr*fall, NetExpr*decay)
21 netlist.h
@@ -87,8 +87,6 @@ class Link {
87 87 public:
88 88 enum DIR { PASSIVE, INPUT, OUTPUT };
89 89
90   - enum strength_t { HIGHZ, WEAK, PULL, STRONG, SUPPLY };
91   -
92 90 private: // Only NetPins can create/delete Link objects
93 91 Link();
94 92 ~Link();
@@ -104,18 +102,15 @@ class Link {
104 102 // A link has a drive strength for 0 and 1 values. The drive0
105 103 // strength is for when the link has the value 0, and drive1
106 104 // strength is for when the link has a value 1.
107   - void drive0(strength_t);
108   - void drive1(strength_t);
  105 + void drive0(ivl_drive_t);
  106 + void drive1(ivl_drive_t);
109 107
110 108 // This sets the drives for all drivers of this link, and not
111 109 // just the current link.
112   - void drivers_drive(strength_t d0, strength_t d1);
113   -
114   - strength_t drive0() const;
115   - strength_t drive1() const;
  110 + void drivers_drive(ivl_drive_t d0, ivl_drive_t d1);
116 111
117   - ivl_drive_t ivl_drive0() const;
118   - ivl_drive_t ivl_drive1() const;
  112 + ivl_drive_t drive0() const;
  113 + ivl_drive_t drive1() const;
119 114
120 115 void cur_link(NetPins*&net, unsigned &pin);
121 116 void cur_link(const NetPins*&net, unsigned &pin) const;
@@ -159,8 +154,8 @@ class Link {
159 154
160 155 bool pin_zero_ : 1;
161 156 DIR dir_ : 2;
162   - strength_t drive0_ : 3;
163   - strength_t drive1_ : 3;
  157 + ivl_drive_t drive0_ : 3;
  158 + ivl_drive_t drive1_ : 3;
164 159
165 160 private:
166 161 Nexus* find_nexus_() const;
@@ -340,7 +335,7 @@ class Nexus {
340 335 const char* name() const;
341 336
342 337 void drivers_delays(NetExpr*rise, NetExpr*fall, NetExpr*decay);
343   - void drivers_drive(Link::strength_t d0, Link::strength_t d1);
  338 + void drivers_drive(ivl_drive_t d0, ivl_drive_t d1);
344 339
345 340 Link*first_nlink();
346 341 const Link* first_nlink()const;
30 parse.y
@@ -87,8 +87,8 @@ static unsigned args_after_notifier;
87 87 * These are some common strength pairs that are used as defaults when
88 88 * the user is not otherwise specific.
89 89 */
90   -const static struct str_pair_t pull_strength = { PGate::PULL, PGate::PULL };
91   -const static struct str_pair_t str_strength = { PGate::STRONG, PGate::STRONG };
  90 +const static struct str_pair_t pull_strength = { IVL_DR_PULL, IVL_DR_PULL };
  91 +const static struct str_pair_t str_strength = { IVL_DR_STRONG, IVL_DR_STRONG };
92 92
93 93 static list<pair<perm_string,PExpr*> >* make_port_list(char*id, PExpr*expr)
94 94 {
@@ -884,39 +884,39 @@ drive_strength
884 884 }
885 885 | '(' dr_strength0 ',' K_highz1 ')'
886 886 { $$.str0 = $2.str0;
887   - $$.str1 = PGate::HIGHZ;
  887 + $$.str1 = IVL_DR_HiZ;
888 888 }
889 889 | '(' dr_strength1 ',' K_highz0 ')'
890   - { $$.str0 = PGate::HIGHZ;
  890 + { $$.str0 = IVL_DR_HiZ;
891 891 $$.str1 = $2.str1;
892 892 }
893 893 | '(' K_highz1 ',' dr_strength0 ')'
894 894 { $$.str0 = $4.str0;
895   - $$.str1 = PGate::HIGHZ;
  895 + $$.str1 = IVL_DR_HiZ;
896 896 }
897 897 | '(' K_highz0 ',' dr_strength1 ')'
898   - { $$.str0 = PGate::HIGHZ;
  898 + { $$.str0 = IVL_DR_HiZ;
899 899 $$.str1 = $4.str1;
900 900 }
901 901 ;
902 902
903 903 drive_strength_opt
904 904 : drive_strength { $$ = $1; }
905   - | { $$.str0 = PGate::STRONG; $$.str1 = PGate::STRONG; }
  905 + | { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
906 906 ;
907 907
908 908 dr_strength0
909   - : K_supply0 { $$.str0 = PGate::SUPPLY; }
910   - | K_strong0 { $$.str0 = PGate::STRONG; }
911   - | K_pull0 { $$.str0 = PGate::PULL; }
912   - | K_weak0 { $$.str0 = PGate::WEAK; }
  909 + : K_supply0 { $$.str0 = IVL_DR_SUPPLY; }
  910 + | K_strong0 { $$.str0 = IVL_DR_STRONG; }
  911 + | K_pull0 { $$.str0 = IVL_DR_PULL; }
  912 + | K_weak0 { $$.str0 = IVL_DR_WEAK; }
913 913 ;
914 914
915 915 dr_strength1
916   - : K_supply1 { $$.str1 = PGate::SUPPLY; }
917   - | K_strong1 { $$.str1 = PGate::STRONG; }
918   - | K_pull1 { $$.str1 = PGate::PULL; }
919   - | K_weak1 { $$.str1 = PGate::WEAK; }
  916 + : K_supply1 { $$.str1 = IVL_DR_SUPPLY; }
  917 + | K_strong1 { $$.str1 = IVL_DR_STRONG; }
  918 + | K_pull1 { $$.str1 = IVL_DR_PULL; }
  919 + | K_weak1 { $$.str1 = IVL_DR_WEAK; }
920 920 ;
921 921
922 922 event_control
2  pform.h
@@ -91,7 +91,7 @@ struct parmvalue_t {
91 91 svector<named_pexpr_t*>*by_name;
92 92 };
93 93
94   -struct str_pair_t { PGate::strength_t str0, str1; };
  94 +struct str_pair_t { ivl_drive_t str0, str1; };
95 95
96 96 struct net_decl_assign_t {
97 97 perm_string name;
25 pform_dump.cc
@@ -30,6 +30,7 @@
30 30 # include "PGenerate.h"
31 31 # include "PSpec.h"
32 32 # include "discipline.h"
  33 +# include "ivl_target_priv.h"
33 34 # include <iostream>
34 35 # include <iomanip>
35 36 # include <typeinfo>
@@ -52,30 +53,6 @@ ostream& operator << (ostream&o, const PDelays&d)
52 53 return o;
53 54 }
54 55
55   -ostream& operator<< (ostream&o, PGate::strength_t str)
56   -{
57   - switch (str) {
58   - case PGate::HIGHZ:
59   - o << "highz";
60   - break;
61   - case PGate::WEAK:
62   - o << "weak";
63   - break;
64   - case PGate::PULL:
65   - o << "pull";
66   - break;
67   - case PGate::STRONG:
68   - o << "strong";
69   - break;
70   - case PGate::SUPPLY:
71   - o << "supply";
72   - break;
73   - default:
74   - assert(0);
75   - }
76   - return o;
77   -}
78   -
79 56 ostream& operator<< (ostream&out, perm_string that)
80 57 {
81 58 out << that.str();
116 t-dll.cc
@@ -171,41 +171,8 @@ static perm_string make_scope_name(const hname_t&name)
171 171
172 172 static void drive_from_link(const Link&lnk, ivl_drive_t&drv0, ivl_drive_t&drv1)
173 173 {
174   - switch (lnk.drive0()) {
175   - case Link::HIGHZ:
176   - drv0 = IVL_DR_HiZ;
177   - break;
178   - case Link::WEAK:
179   - drv0 = IVL_DR_WEAK;
180   - break;
181   - case Link::PULL:
182   - drv0 = IVL_DR_PULL;
183   - break;
184   - case Link::STRONG:
185   - drv0 = IVL_DR_STRONG;
186   - break;
187   - case Link::SUPPLY:
188   - drv0 = IVL_DR_SUPPLY;
189   - break;
190   - }
191   -
192   - switch (lnk.drive1()) {
193   - case Link::HIGHZ:
194   - drv1 = IVL_DR_HiZ;
195   - break;
196   - case Link::WEAK:
197   - drv1 = IVL_DR_WEAK;
198   - break;
199   - case Link::PULL:
200   - drv1 = IVL_DR_PULL;
201   - break;
202   - case Link::STRONG:
203   - drv1 = IVL_DR_STRONG;
204   - break;
205   - case Link::SUPPLY:
206   - drv1 = IVL_DR_SUPPLY;
207   - break;
208   - }
  174 + drv0 = lnk.drive0();
  175 + drv1 = lnk.drive1();
209 176 }
210 177
211 178 ivl_attribute_s* dll_target::fill_in_attributes(const Attrib*net)
@@ -846,42 +813,8 @@ bool dll_target::bufz(const NetBUFZ*net)
846 813 obj->pins_[0] = net->pin(0).nexus()->t_cookie();
847 814 ivl_nexus_ptr_t out_ptr = nexus_log_add(obj->pins_[0], obj, 0);
848 815
849   -
850   - switch (net->pin(0).drive0()) {
851   - case Link::HIGHZ:
852   - out_ptr->drive0 = IVL_DR_HiZ;
853   - break;
854   - case Link::WEAK:
855   - out_ptr->drive0 = IVL_DR_WEAK;
856   - break;
857   - case Link::PULL:
858   - out_ptr->drive0 = IVL_DR_PULL;
859   - break;
860   - case Link::STRONG:
861   - out_ptr->drive0 = IVL_DR_STRONG;
862   - break;
863   - case Link::SUPPLY:
864   - out_ptr->drive0 = IVL_DR_SUPPLY;
865   - break;
866   - }
867   -
868   - switch (net->pin(0).drive1()) {
869   - case Link::HIGHZ:
870   - out_ptr->drive1 = IVL_DR_HiZ;
871   - break;
872   - case Link::WEAK:
873   - out_ptr->drive1 = IVL_DR_WEAK;
874   - break;
875   - case Link::PULL:
876   - out_ptr->drive1 = IVL_DR_PULL;
877   - break;
878   - case Link::STRONG:
879   - out_ptr->drive1 = IVL_DR_STRONG;
880   - break;
881   - case Link::SUPPLY:
882   - out_ptr->drive1 = IVL_DR_SUPPLY;
883   - break;
884   - }
  816 + out_ptr->drive0 = net->pin(0).drive0();
  817 + out_ptr->drive1 = net->pin(0).drive1();
885 818
886 819 assert(net->pin(1).nexus()->t_cookie());
887 820 obj->pins_[1] = net->pin(1).nexus()->t_cookie();
@@ -1034,41 +967,8 @@ void dll_target::logic(const NetLogic*net)
1034 967 out_ptr = tmp;
1035 968 }
1036 969
1037   - switch (net->pin(0).drive0()) {
1038   - case Link::HIGHZ:
1039   - out_ptr->drive0 = IVL_DR_HiZ;
1040   - break;
1041   - case Link::WEAK:
1042   - out_ptr->drive0 = IVL_DR_WEAK;
1043   - break;
1044   - case Link::PULL:
1045   - out_ptr->drive0 = IVL_DR_PULL;
1046   - break;
1047   - case Link::STRONG:
1048   - out_ptr->drive0 = IVL_DR_STRONG;
1049   - break;
1050   - case Link::SUPPLY:
1051   - out_ptr->drive0 = IVL_DR_SUPPLY;
1052   - break;
1053   - }
1054   -
1055   - switch (net->pin(0).drive1()) {
1056   - case Link::HIGHZ:
1057   - out_ptr->drive1 = IVL_DR_HiZ;
1058   - break;
1059   - case Link::WEAK:
1060   - out_ptr->drive1 = IVL_DR_WEAK;
1061   - break;
1062   - case Link::PULL:
1063   - out_ptr->drive1 = IVL_DR_PULL;
1064   - break;
1065   - case Link::STRONG:
1066   - out_ptr->drive1 = IVL_DR_STRONG;
1067   - break;
1068   - case Link::SUPPLY:
1069   - out_ptr->drive1 = IVL_DR_SUPPLY;
1070   - break;
1071   - }
  970 + out_ptr->drive0 = net->pin(0).drive0();
  971 + out_ptr->drive1 = net->pin(0).drive1();
1072 972
1073 973 assert(net->scope());
1074 974 ivl_scope_t scop = find_scope(des_, net->scope());
@@ -2056,8 +1956,8 @@ void dll_target::lpm_mux(const NetMux*net)
2056 1956 assert(nex->t_cookie());
2057 1957 obj->u_.mux.q = nex->t_cookie();
2058 1958 nexus_lpm_add(obj->u_.mux.q, obj, 0,
2059   - net->pin_Result().ivl_drive0(),
2060   - net->pin_Result().ivl_drive1());
  1959 + net->pin_Result().drive0(),
  1960 + net->pin_Result().drive1());
2061 1961
2062 1962 /* Connect the select bits. */
2063 1963 nex = net->pin_Sel().nexus();

0 comments on commit 79f8b8f

Please sign in to comment.
Something went wrong with that request. Please try again.