BitVector¶
-
class BitVector¶
入力用のビットベクタを表すクラス
実体は BitVectorRep が持つ.
Subclassed by DffVector, InputVector
Public Functions
-
explicit BitVector(SizeType len = 0)¶
コンストラクタ
内容は X で初期化される.
- パラメータ:
len -- [in] ベクタ長
-
~BitVector()¶
デストラクタ
-
SizeType len() const¶
ベクタ長を返す.
-
inline SizeType block_num() const¶
ブロック長を返す.
-
SizeType x_count() const¶
X の個数を得る.
-
std::string bin_str() const¶
内容を BIN 形式で表す.
-
std::string hex_str() const¶
内容を HEX 形式で表す.
X を含む場合の出力は不定
-
void init()¶
すべて未定(X) で初期化する.
-
void lshift(Val3 new_val)¶
1ビット左シフトを行う.
ビット長は変わらないので左端の1ビットは捨てられる.
- パラメータ:
new_val -- [in] 右端に挿入する値
-
void rshift(Val3 new_val)¶
1ビット右シフトを行う.
ビット長は変わらないので右端の1ビットは捨てられる.
- パラメータ:
new_val -- [in] 左端に挿入する値
-
void set_val(SizeType pos, Val3 val)¶
値を設定する.
- パラメータ:
pos -- [in] 位置番号 ( 0 <= pos < len() )
val -- [in] 値
-
bool set_from_bin(const std::string &bin_string)¶
BIN文字列から内容を設定する.
bin_string がベクタ長より短い時には残りはXで初期化される.
bin_string がベクタ長より長い時には余りは切り捨てられる.
有効な文字は '0', '1', 'x', 'X'
- パラメータ:
bin_string -- [in] BIN文字列
- 戻り値:
true -- 適切に設定された.
false -- bin_string に不適切な文字が含まれていた.
-
bool set_from_hex(const std::string &hex_string)¶
HEX文字列から内容を設定する.
hex_string が短い時には残りは0で初期化される.
hex_string が長い時には余りは捨てられる.
有効な文字は '0'〜'9', 'a'〜'f', 'A'〜'F'
この形式は X を扱えない.
- パラメータ:
hex_string -- [in] HEX 文字列
- 戻り値:
true -- 適切に設定された.
false -- hex_string に不適切な文字が含まれていた.
-
template<class URNG>
inline void set_from_random(URNG &randgen)¶ 乱数パタンを設定する.
結果はかならず 0 か 1 になる.(Xは含まれない)
- パラメータ:
randgen -- [in] 乱数生成器
-
template<class URNG>
inline void fix_x_from_random(URNG &randgen)¶ X の部分を乱数で 0/1 に設定する.
- パラメータ:
randgen -- [in] 乱数生成器
-
bool operator&&(const BitVector &right) const¶
両立関係の比較を行う.
- パラメータ:
right -- [in] オペランド2
- 戻り値:
left と right が両立する時 true を返す.
-
bool operator==(const BitVector &right) const¶
等価関係の比較を行なう.
- パラメータ:
right -- [in] オペランド2
- 戻り値:
left と right が等しいとき true を返す.
-
inline bool operator!=(const BitVector &right) const¶
等価関係の比較を行なう.
- パラメータ:
right -- [in] オペランド2
- 戻り値:
left と right が等しくないとき true を返す.
-
bool operator<(const BitVector &right) const¶
包含関係の比較を行なう
false だからといって逆に left が right を含むとは限らない.
- パラメータ:
right -- [in] オペランド2
- 戻り値:
minterm の集合として right が left を含んでいたら true を返す.
-
inline bool operator>(const BitVector &right) const¶
包含関係の比較を行なう.
false だからといって逆に right が left を含むとは限らない.
- パラメータ:
right -- [in] オペランド2
- 戻り値:
minterm の集合として left が right を含んでいたら true を返す.
-
bool operator<=(const BitVector &right) const¶
包含関係の比較を行なう
こちらは等しい場合も含む.
false だからといって逆に left が right を含むとは限らない.
- パラメータ:
right -- [in] オペランド2
- 戻り値:
minterm の集合として right が left を含んでいたら true を返す.
-
inline bool operator>=(const BitVector &right) const¶
包含関係の比較を行なう
こちらは等しい場合も含む.
false だからといって逆に right が left を含むとは限らない.
- パラメータ:
right -- [in] オペランド2
- 戻り値:
minterm の集合として left が right を含んでいたら true を返す.
-
inline BitVector operator&(const BitVector &right) const¶
マージする.
left と right がコンフリクトしている時の結果は不定
- パラメータ:
right -- [in] オペランド2
- 戻り値:
マージ結果を返す.
-
SizeType hash() const¶
ハッシュ値を計算する.
-
explicit BitVector(SizeType len = 0)¶