Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to solve latch problem:

Status
Not open for further replies.

sarmad88

Junior Member level 2
Junior Member level 2
Joined
Feb 12, 2013
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,474
hi anyone

in my project when exchange this statements:



with ir(3 downto 1) select
output<=mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result when "000",
variance_result when "001",
st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result when "010",
rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result when "011",
covariance_result when "100",
mse_result when "101",
"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ" when others;



by :



process(ir,mean_result,variance_result,st_dev_result,rms_result,covariance_result,mse_result)
begin
case ir(3 downto 1) is
when "000" =>output<=mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result (16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result (16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result;
when "001" =>output<=variance_result;
when "010" =>output<=st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result;
when "011" =>output<=rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result;
when "100" =>output<=covariance_result;
when "101" =>output<= mse_result;
when others=>null;
end case;
end process;



this warning produced:



WARNING:Xst:737 - Found 32-bit latch for signal <output>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.



why? and how can remove this warning??
 

I think it might be the line
Code:
when others=>null;
This causes the previous output value to be latched.
 

because you have not assigned output in all cases.

when write this process to covere all case of ir(3 downto 1) the below error occur



process(ir,mean_result,variance_result,st_dev_result,rms_result,covariance_result,mse_result)
begin

case ir(3 downto 1) is
when "000" =>output<=mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result;
when "001" =>output<=variance_result;
when "010" =>output<=st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result;
when "011" =>output<=rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result;
when "100" =>output<=covariance_result;
when "101" =>output<= mse_result;
when "110" =>NULL;
when "111" =>NULL;

end case;
end process;



ERROR:HDLParsers:812 - "G:/project/VHDL/project/again/step1/main.vhd" Line 219. A value is missing in case.

how can overcom this error and the same time covered all case of ir(3 downto 1).

- - - Updated - - -

I think it might be the line
Code:
when others=>null;
This causes the previous output value to be latched.

when write this process to covere all case of ir(3 downto 1) the below error occur



process(ir,mean_result,variance_result,st_dev_result,rms_result,covariance_result,mse_result)
begin

case ir(3 downto 1) is
when "000" =>output<=mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result(16)&mean_result;
when "001" =>output<=variance_result;
when "010" =>output<=st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result(19)&st_dev_result;
when "011" =>output<=rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result(19)&rms_result;
when "100" =>output<=covariance_result;
when "101" =>output<= mse_result;
when "110" =>NULL;
when "111" =>NULL;

end case;
end process;



ERROR:HDLParsers:812 - "G:/project/VHDL/project/again/step1/main.vhd" Line 219. A value is missing in case.



how can overcom this error and the same time covered all case of ir(3 downto 1).
 

Don't put "null" in your "when others" statement. Assign a value to output in that statement.

r.b.
 

Don't put "null" in your "when others" statement. Assign a value to output in that statement.

r.b.

Yes, try that...

- - - Updated - - -

Just to clear that up, you must have the when others=> part or you will get an error. Don't use null in it or you will make a latch.
 

Yes, try that...

- - - Updated - - -

Just to clear that up, you must have the when others=> part or you will get an error. Don't use null in it or you will make a latch.

i don't have value at output when ir(3 downto 01)=110 and 111
what i do to overcome the error??
 

i don't have value at output when ir(3 downto 01)=110 and 111

Are saying that ir(3 downto 1 ) will never, ever take on the value 110 and 111 by design? If that is the case, then use a synthesis pragma to declare the case statement "full case", but it is still good design practice to put in a default state (when others) with a default value of output.

If values 110 and 111 are achievable, then YOU might not have a value for output, but the real hardware definitely will. Therefore you have to declare a value for output. If you don't care about output on those states, then put any defined value value down (i.e. not X or Z). In order to avoid latches, you have to explicitly declare the value of every element on the left hand side of every statement for EVERY case. This is not optional.

Can you tri-state it? "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"

This is only useful if output will actually be an output of the FPGA. And there is more to making an output tristate than just making it all Z. If output is an internal signal, then that is a bad idea. FPGA's don't have internal tristate signals.

r.b.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top