Question

In: Electrical Engineering

In Verilog, what are three ways of preventing latch inference in case statements?

In Verilog, what are three ways of preventing latch inference in case statements?

Solutions

Expert Solution

1.Include all possible cases in the case statement.

always @ (SEL or DIN1 or DIN2)

begin

case (SEL)

2'b00 : DOUT <= DIN1 + DIN2;

2'b01 : DOUT <= DIN1 - DIN2;

2'b10 : DOUT <= DIN1;

endcase

end


This example will create latches because there is no provision for the case when SEL = "11". To eliminate the latches, add another entry to address this possibility.

2. 2'b11 : DOUT <= DIN2;

Using the DEFAULT clause (Verilog) will always work, but this may create extraneous logic. This always the safest methodology, but it may create a larger and slower design, as any unknown state will have logic to bring it to a known state.

3. always @ (SEL or DIN1 or DIN2)

begin

case (SEL)

2'b00 : DOUT <= DIN1 + DIN2;

2'b01 : DOUT <= DIN1 - DIN2;

2'b10 : DOUT <= DIN1;

2'b11 :

begin

DOUT <= DIN2;

TEMP <= DIN1;

end

endcase

end

This example will infer latches because the "11" case assigns two outputs, while the others only assign one. Looking at this case from TEMP's point of view, only one of four possible cases are specified, so it is incomplete.

Avoid this situation by assigning values to the exact same list of outputs for each case.


Related Solutions

In Verilog, what are three ways of preventing latch inference in case statements?
In Verilog, what are three ways of preventing latch inference in case statements?
What are the three types of post-transcriptional processing, and what are the consequences of preventing each...
What are the three types of post-transcriptional processing, and what are the consequences of preventing each of these modifications in terms of gene expression? Essay answers are limited to about 600 words.
1.In what specific ways does widespread corruption aggravate the problem of underdevelopment, preventing economic takeoffs? 2.In...
1.In what specific ways does widespread corruption aggravate the problem of underdevelopment, preventing economic takeoffs? 2.In what specific ways does the lack of protection for property rights and the sanctity of contracts aggravate the problem of underdevelopment, preventing economic takeoffs?
Three facts/tips on preventing urinary tract infections?
Three facts/tips on preventing urinary tract infections?
Able to provide and explain clearly at least 4 internal and 4 external ways of preventing...
Able to provide and explain clearly at least 4 internal and 4 external ways of preventing stock loss by firm "US automotive industry" (500 word only )
Explain the concept of coordinated financial statements? In what ways are the major financial statements coordinated?...
Explain the concept of coordinated financial statements? In what ways are the major financial statements coordinated? (4points)
What are the two ways a case can get to federal court?
*Business Law*1) What are the two ways a case can get to federal court?2) What is venue?
What are the various ways of adjusting financial statements for changing prices?
What are the various ways of adjusting financial statements for changing prices?
What are three ways that the Margin of Safety can be expressed, and what are their...
What are three ways that the Margin of Safety can be expressed, and what are their formulas? How does the Margin of Safety help managers? What is the formula for the Degree of Operating Leverage ? How does the Degree of Operating Leverage help managers?
Select three (3) ways, (from the list below) and EXPLAIN in each case how the experimenter...
Select three (3) ways, (from the list below) and EXPLAIN in each case how the experimenter can become the extraneous variable, (List of extraneous variables - experimenter characteristics and experimenter expectancies as it relates to Physiological ­experimenter characteristics including such aspects as age, sex, and race and Psychological ­experimenter attribute including such personality characteristics as hostility, anxiety, and introversion or extroversion.). Provide an explanation/justification for each way in no less than 200 words. List and explain a method for controlling...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT