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.

[SOLVED] infering latches in case statement??

Status
Not open for further replies.

me0414013

Junior Member level 3
Junior Member level 3
Joined
Aug 30, 2012
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
ongole
Visit site
Activity points
1,504

i have no idea why i am getting latch infer warnings in this code below
and i made sure that all cases covered including default case.


library ieee;
library work;
use ieee.std_logic_1164.all;
use ieee.std_logic_misc.all;
use ieee.numeric_std.all;
entity freqdomaintrainingseqmem is
port (
state : in std_logic;
seq_addr : in unsigned( 5 downto 0 );
sign : out signed( 1 downto 0 )
);
end entity;


architecture rtl of freqdomaintrainingseqmem is
begin

process(state,seq_addr)
begin

case ( state ) is
when
'0' =>
case (to_integer( seq_addr)) is
when
0 =>

sign <= to_signed(0,2) ;

when
1 =>
sign <= to_signed(0,2) ;
when
2 =>
sign <= to_signed(0,2) ;
when
3 =>
sign <= to_signed(0,2) ;
when
4 =>
sign <= to_signed(0,2) ;
when
5 =>
sign <= to_signed(0,2) ;
when
6 =>
sign <= to_signed(0,2) ;
when
7 =>
sign <= to_signed(0,2) ;
when
8 =>
sign <= to_signed(1,2) ;
when
9 =>
sign <= to_signed(0,2) ;
when
10 =>
sign <= to_signed(0,2) ;
when
11 =>
sign <= to_signed(0,2) ;
when
12 =>
sign <= ( to_signed(-1,2) ) ;
when
13 =>
sign <= to_signed(0,2) ;
when
14 =>
sign <= to_signed(0,2) ;
when
15 =>
sign <= to_signed(0,2) ;
when
16 =>
sign <= to_signed(1,2) ;
when
17 =>
sign <= to_signed(0,2) ;
when
18 =>
sign <= to_signed(0,2) ;
when
19 =>
sign <= to_signed(0,2) ;
when
20 =>
sign <= ( to_signed(-1,2) ) ;
when
21 =>
sign <= to_signed(0,2) ;
when
22 =>
sign <= to_signed(0,2) ;
when
23 =>
sign <= to_signed(0,2) ;
when
24 =>
sign <= ( to_signed(-1,2) ) ;
when
25 =>
sign <= to_signed(0,2) ;
when
26 =>
sign <= to_signed(0,2) ;
when
27 =>
sign <= to_signed(0,2) ;
when
28 =>
sign <= to_signed(1,2) ;
when
29 =>
sign <= to_signed(0,2) ;
when
30 =>
sign <= to_signed(0,2) ;
when
31 =>
sign <= to_signed(0,2) ;
when
32 =>
sign <= to_signed(0,2) ;
when
33 =>
sign <= to_signed(0,2) ;
when
34 =>
sign <= to_signed(0,2) ;
when
35 =>
sign <= to_signed(0,2) ;
when
36 =>
sign <= ( to_signed(-1,2) ) ;
when
37 =>
sign <= to_signed(0,2) ;
when
38 =>
sign <= to_signed(0,2) ;
when
39 =>
sign <= to_signed(0,2) ;
when
40 =>
sign <= ( to_signed(-1,2) ) ;
when
41 =>
sign <= to_signed(0,2) ;
when
42 =>
sign <= to_signed(0,2) ;
when
43 =>
sign <= to_signed(0,2) ;
when
44 =>
sign <= to_signed(1,2) ;
when
45 =>
sign <= to_signed(0,2) ;
when
46 =>
sign <= to_signed(0,2) ;
when
47 =>
sign <= to_signed(0,2) ;
when
48 =>
sign <= to_signed(1,2) ;
when
49 =>
sign <= to_signed(0,2) ;
when
50 =>
sign <= to_signed(0,2) ;
when
51 =>
sign <= to_signed(0,2) ;
when
52 =>
sign <= to_signed(1,2) ;
when
53 =>
sign <= to_signed(0,2) ;
when
54 =>
sign <= to_signed(0,2) ;
when
55 =>
sign <= to_signed(0,2) ;
when
56 =>
sign <= to_signed(1,2) ;
when
57 =>
sign <= to_signed(0,2) ;
when
58 =>
sign <= to_signed(0,2) ;
when
59 =>
sign <= to_signed(0,2) ;
when
60 =>
sign <= to_signed(0,2) ;
when
61 =>
sign <= to_signed(0,2) ;
when
62 =>
sign <= to_signed(0,2) ;
when
63 =>
sign <= to_signed(0,2) ;
when others=>null;
end case;

when
'1' =>
case (to_integer( seq_addr) ) is
when
0 =>
sign <= to_signed(0,2) ;
when
1 =>
sign <= to_signed(0,2) ;
when
2 =>
sign <= to_signed(0,2) ;
when
3 =>
sign <= to_signed(0,2) ;
when
4 =>
sign <= to_signed(0,2) ;
when
5 =>
sign <= to_signed(0,2) ;
when
6 =>
sign <= to_signed(1,2) ;
when
7 =>
sign <= to_signed(1,2) ;
when
8 =>
sign <= ( to_signed(-1,2) ) ;
when
9 =>
sign <= ( to_signed(-1,2) ) ;
when
10 =>
sign <= to_signed(1,2) ;
when
11 =>
sign <= to_signed(1,2) ;
when
12 =>
sign <= ( to_signed(-1,2) ) ;
when
13 =>
sign <= to_signed(1,2) ;
when
14 =>
sign <= ( to_signed(-1,2) ) ;
when
15 =>
sign <= to_signed(1,2) ;
when
16 =>
sign <= to_signed(1,2) ;
when
17 =>
sign <= to_signed(1,2) ;
when
18 =>
sign <= to_signed(1,2) ;
when
19 =>
sign <= to_signed(1,2) ;
when
20 =>
sign <= to_signed(1,2) ;
when
21 =>
sign <= ( to_signed(-1,2) ) ;
when
22 =>
sign <= ( to_signed(-1,2) ) ;
when
23 =>
sign <= to_signed(1,2) ;
when
24 =>
sign <= to_signed(1,2) ;
when
25 =>
sign <= ( to_signed(-1,2) ) ;
when
26 =>
sign <= to_signed(1,2) ;
when
27 =>
sign <= ( to_signed(-1,2) ) ;
when
28 =>
sign <= to_signed(1,2) ;
when
29 =>
sign <= to_signed(1,2) ;
when
30 =>
sign <= to_signed(1,2) ;
when
31 =>
sign <= to_signed(1,2) ;
when
32 =>
sign <= to_signed(0,2) ;
when
33 =>
sign <= to_signed(1,2) ;
when
34 =>
sign <= ( to_signed(-1,2) ) ;
when
35 =>
sign <= ( to_signed(-1,2) ) ;
when
36 =>
sign <= to_signed(1,2) ;
when
37 =>
sign <= to_signed(1,2) ;
when
38 =>
sign <= ( to_signed(-1,2) ) ;
when
39 =>
sign <= to_signed(1,2) ;
when
40 =>
sign <= ( to_signed(-1,2) ) ;
when
41 =>
sign <= to_signed(1,2) ;
when
42 =>
sign <= ( to_signed(-1,2) ) ;
when
43 =>
sign <= ( to_signed(-1,2) ) ;
when
44 =>
sign <= ( to_signed(-1,2) ) ;
when
45 =>
sign <= ( to_signed(-1,2) ) ;
when
46 =>
sign <= ( to_signed(-1,2) ) ;
when
47 =>
sign <= to_signed(1,2) ;
when
48 =>
sign <= to_signed(1,2) ;
when
49 =>
sign <= ( to_signed(-1,2) ) ;
when
50 =>
sign <= ( to_signed(-1,2) ) ;
when
51 =>
sign <= to_signed(1,2) ;
when
52 =>
sign <= ( to_signed(-1,2) ) ;
when
53 =>
sign <= to_signed(1,2) ;
when
54 =>
sign <= ( to_signed(-1,2) ) ;
when
55 =>
sign <= to_signed(1,2) ;
when
56 =>
sign <= to_signed(1,2) ;
when
57 =>
sign <= to_signed(1,2) ;
when
58 =>
sign <= to_signed(1,2) ;
when
59 =>
sign <= to_signed(0,2) ;
when
60 =>
sign <= to_signed(0,2) ;
when
61 =>
sign <= to_signed(0,2) ;
when
62 =>
sign <= to_signed(0,2) ;
when
63 =>
sign <= to_signed(0,2) ;
when others=>null;
end case;
when others=>null;
end case;
end process;
end;
 

Looks like yo're paid per line. Pretty much of text to write a simple translation table that can be written as a simple constant array.

A simple way to avoid unintentional latch inference is to place an unconditional default assignment before the conditional code.
Code:
sign <= to_signed(0,2) ;
case ( state ) is 
....
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top