Re: [问题] hw5

楼主: ric2k1 (Ric)   2010-05-15 00:09:58
※ 引述《pokia (幻影成风)》之铭言:
: 第一题附的updateWatch()里
: isWatchedValue()指的是什么意思?
Gate::isWatchedValue(newIdx)
就是去检查第 newIdx 个 watch pin (in _wCandidates) 的 value
是否 = watched value
比方说 3-input AND gate, 这个 gate 本身将会放在他的 _wCandidates 的第 0 个位置
而其他三个 fanins 会放在第 1 ~ 3 个位置.
==> isWatchedValue(0) 就会检查这个 gate 的 value 是否为 0
==> isWatchedValue(1 ~ 3) 会检查第 1 ~ 3 个 fanin 的 value 是否为 1
: 还有最后一段的
: if(!isWatchedValue(otherIdx))
: return genIndexImp(otherIdx);
: IMP_NEW? 这边也不太懂...
: 我只知道newIdx在找新的index,不可以和另一个watch冲突...
: 剩下的就不太明白了!?
: 有人知道这个function大概的意思吗?
会到这里表示要 update watch pin 但是找不到
(没有其他非 watch 的 pin 都是非 watch value)
所以传入的 newIdx 必须 restore 回原来的值
同时去检查另一个 watch pin,
如果它不是 watch value (e.g. 0 or x for AND's fanin),
那么就是著去 generate new implication (genIndexImp(otherIdx)),
如果 other watch pin 的值是 known (e.g. 0 for AND's fanin)
==> return IMP_DONE (i.e. no new implication is generated)
otherwise (e.g. x for AND's fanin)
==> return IMP_NEW (i.e. new implication is generated on this watch pin)
相反的,如果另一个 watch pin 也是 watch value 的话,
则所有的 pins 都是 watch value
(i.e. AND gate has value 0 and all its fanins have value 1's)
==> return IMP_CONFLICT
: 顺便问一下,OR gate b 为什么也要把自己放在watching-1??
: 我忘记了...
因为 OR gate 的 output 是 watch 1,
所以如果 output 也是个 watched pin 的话,
自己 value 变成 1 的时候也要通知自己去 update watch pin
所以自己会在自己的 watching-1 list 上面
作者: pokia (幻影成风)   2010-05-15 02:45:00
请问(a)~(h)是连续的问题吗??也就是b<-1是在f<-0之后...etc
楼主: ric2k1 (Ric)   2010-05-15 16:30:00
是的

Links booklink

Contact Us: admin [ a t ] ucptt.com