※ 引述《ric2k1 (Ric)》之銘言:
※ 引述《ric2k1 (Ric)》之銘言:
Q: 在ite()裡面 bddNode要檢查complement parameter
是不是該用BddNode::isNegEdge()呢? 但是它是private 可以把它改成public嗎??
A: 嗯 是應該改成 public
不過不建議將 BddNode 宣告成 BddNodeInt 或是 BddManager 的 friend class
Q: BddManager::ite(...)
{
...
// check unique table
BddNodeInt* ni = uniquify(t(), e(), v);
ret = size_t(ni); <== what does this mean?
...
}
A: The type of "ret" is BddNode.
However, the line "ret = size_t(ni)" is NOT clear, and will make the later
line "ret = ~ret" ambiguous...
PLEASE CHANGE IT TO ---
ret = BddNode(size_t(ni));
This will make it easier to read.
Q: void forceInsert(size_t b, const BddHashNode& n) {
_buckets[b].push_back(n); }
void forceInsert(const BddHashKey& k, BddNodeInt* const n) {
_buckets[bucketNum(k)].push_back(BddHashNode(k, n)); }
我想問一下這兩個有差嗎?
既然知道 BddHashKey& k 就一定可以由 bucketNum(k) 得到 size_t b吧
還是有些地方會只知道size_t b 而不知道 BddHashKey& k??
如果不用紀錄b的話_uniqueTable.check(k, b, n)似乎可以少傳一個變數?
A: 我想原因有二:
(1) forceInsert(b, n) is called after check(), in which the bucket index
is computed. I just don't want to call the hash function again.
(2) Actually I don't want to expose "bucketNumber()" as a public function
because it seems to be some detailed information about the hash
implementation. Somehow it was left as a public one...
Anyway, I didn't update/improve "bddHash.cpp" this year --- it is the old
code from last semester. I think there's definitely room for improve.
You are welcome to modify it as the way you like.
Q: 請問什麼是canonical form??
A: canonical 的意思是 "標準的" "單一的".
就 BDD 的 canonical 的性質來說, 就是不管原來 function 的表示方法為何,
只要其 functionality 相同, 轉換成 BDD 之後就一定一模一樣.
而一個資料結構 T 具有 canonical form 的性質的意思就說,
若兩筆資料 A, B 有 A = B 的性質, 則 T(A) = T(B)
也就是說若 T(A) != T(B) 則 A != B
Q: 請問一下,所謂的internal node指的是什麼呢??
當我們在建整個電路的BDD,我們所有的資訊是所有gate的連接方式,其中這些
gate包含了我們要的output(function result)、input(function variable)
還有一些內部連接的gates,那所謂的internal node就是指這些和input、output
無關,但連些input、output關係的node嗎??
A: 雖然不知道你問的 "internal node" 的前後文是什麼, 但是你所描述
的聽起來沒錯, 這些 gates 是可以叫做 internal nodes (或叫 internal gates
更好)
但如果你所說的 "internal" 是 BddNodeInt 的 "Int", 那麼他們跟這些 internal
gates 是指不一樣的東西的. 這裡的 internal nodes 是指在 BDD implementation
時連接 BDD 圖型的那些 node (pointer type), 之所以叫 "internal" 是因為
我們故意要隱藏 (encapsulate) 這個資料結構, 一方面讓 BDD 使用者免於了解這些
implementation details, 一方面也可以讓 BDD 在使用上可以 implementation
independent.
Q: 關於BddNode::operator = 的小問題
在bddNode.cpp的112行, 為什麼要先decRefCount再incRefCount?
而且這個function有return什麼嗎?
A: 因為在 "a = b" 中 b 會把 a 舊的值 overwrite. 所以要先將 a 原先
所指的 BddNodeInt's _refCount - 1 (if a._nodeV != 0), 然後再將 b copy
給 a 之後, 把 a 所指的 BddNodeInt's _refCount 再減一.
※ 編輯: ric2k1 來自: 59.121.129.244 (01/08 00:01)
※ 編輯: ric2k1 來自: 59.121.129.244 (01/08 00:02)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.121.128.79
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.121.134.63