mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Tristate support; merge from branch.
This commit is contained in:
committed by
Wilson Snyder
parent
6f81a9cb1e
commit
0e4f9170fa
@@ -291,6 +291,14 @@ V3Number& V3Number::setSingleBits(char value) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
V3Number& V3Number::setAllBits0() {
|
||||
for (int i=0; i<words(); i++) { m_value[i] = m_valueX[i]=0; }
|
||||
return *this;
|
||||
}
|
||||
V3Number& V3Number::setAllBits1() {
|
||||
for (int i=0; i<words(); i++) { m_value[i]= ~0; m_valueX[i] = 0; }
|
||||
return *this;
|
||||
}
|
||||
V3Number& V3Number::setAllBitsX() {
|
||||
for (int i=0; i<words(); i++) { m_value[i]=m_valueX[i] = ~0; }
|
||||
return *this;
|
||||
@@ -584,6 +592,22 @@ V3Number& V3Number::opBitsXZ (const V3Number& lhs) { // 0/1->1, X/Z->0
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
V3Number& V3Number::opBitsZ (const V3Number& lhs) { // 0/1->1, X/Z->0
|
||||
// op i, L(lhs) bit return
|
||||
setZero();
|
||||
for(int bit=0; bit<this->width(); bit++) {
|
||||
if (lhs.bitIsZ(bit)) { setBit(bit,1); }
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
V3Number& V3Number::opBitsNonZ (const V3Number& lhs) { // 0/1->1, X/Z->0
|
||||
// op i, L(lhs) bit return
|
||||
setZero();
|
||||
for(int bit=0; bit<this->width(); bit++) {
|
||||
if (!lhs.bitIsZ(bit)) { setBit(bit,1); }
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
// Operators - Simple per-bit logical ops
|
||||
|
||||
Reference in New Issue
Block a user