经典IC设计面试问题7
时间:10-02
整理:3721RD
点击:
What is meant byinferring latches,how to avoid it?
Consider the following :
always @(s1 or s0 or i0 or i1 or i2 or i3)
case ({s1, s0})
2'd0 : out = i0;
2'd1 : out = i1;
2'd2 : out =i2;
endcase
in a case statement if all the possiblecombinations are not compared and default is also not specified like inexample above a latch will be inferred ,a latch is inferred because toreproduce the previous value when unknown branch is specified.
Forexample in above case if {s1,s0}=3 , the previous stored value isreproduced for this storing a latch is inferred.
The same may beobserved in IF statement in case an ELSE IF is not specified.
Toavoid inferring latches make sure that all the cases are mentioned ifnot default condition is provided.
Consider the following :
always @(s1 or s0 or i0 or i1 or i2 or i3)
case ({s1, s0})
2'd0 : out = i0;
2'd1 : out = i1;
2'd2 : out =i2;
endcase
in a case statement if all the possiblecombinations are not compared and default is also not specified like inexample above a latch will be inferred ,a latch is inferred because toreproduce the previous value when unknown branch is specified.
Forexample in above case if {s1,s0}=3 , the previous stored value isreproduced for this storing a latch is inferred.
The same may beobserved in IF statement in case an ELSE IF is not specified.
Toavoid inferring latches make sure that all the cases are mentioned ifnot default condition is provided.
谢谢louzhu分享!
张宁益
dsfsdfgsdf
嘿嘿,很基础,练英语了
