forked from github/verilator
Internals: Move widthPow2. No functional change.
This commit is contained in:
parent
87e8736823
commit
33c9591a4b
@ -230,15 +230,6 @@ string AstNode::quoteName(const string& namein) {
|
||||
return out;
|
||||
}
|
||||
|
||||
int AstNode::widthPow2() const {
|
||||
// I.e. width 30 returns 32, width 32 returns 32.
|
||||
uint32_t width = this->width();
|
||||
for (int p2=30; p2>=0; p2--) {
|
||||
if (width > (1UL<<p2)) return (1UL<<(p2+1));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
// Insertion
|
||||
|
||||
|
@ -981,7 +981,6 @@ public:
|
||||
int width() const;
|
||||
int widthMin() const;
|
||||
int widthWords() const { return VL_WORDS_I(width()); }
|
||||
int widthPow2() const;
|
||||
bool isQuad() const { return (width()>VL_WORDSIZE && width()<=VL_QUADSIZE); }
|
||||
bool isWide() const { return (width()>VL_QUADSIZE); }
|
||||
bool isDouble() const;
|
||||
|
@ -326,6 +326,15 @@ pair<uint32_t,uint32_t> AstNodeDType::dimensions() {
|
||||
return make_pair(packed, unpacked);
|
||||
}
|
||||
|
||||
int AstNodeDType::widthPow2() const {
|
||||
// I.e. width 30 returns 32, width 32 returns 32.
|
||||
uint32_t width = this->width();
|
||||
for (int p2=30; p2>=0; p2--) {
|
||||
if (width > (1UL<<p2)) return (1UL<<(p2+1));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Special operators
|
||||
int AstArraySel::dimension(AstNode* nodep) {
|
||||
// How many dimensions is this reference from the base variable?
|
||||
|
@ -487,7 +487,7 @@ public:
|
||||
visit(nodep->castNodeUniop(), vup);
|
||||
} else {
|
||||
putbs("VL_REDXOR_");
|
||||
puts(cvtToStr(nodep->lhsp()->widthPow2()));
|
||||
puts(cvtToStr(nodep->lhsp()->dtypep()->widthPow2()));
|
||||
puts("(");
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
puts(")");
|
||||
|
Loading…
Reference in New Issue
Block a user