Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

problem with value 'X' in VHDL

Dear my best friends

I used vhdl to calculate SVPWM algorithm. I used LPM library for divider. I'd already initial value for all of signal, but It still has "X" value.

This is LPM library

m0 : lpm_divide----------divide component
GENERIC MAP (LPM_WIDTHN=>32, LPM_WIDTHD =>32, LPM_PIPELINE=>1,LPM_NREPRESENTATION =>"SIGNED", LPM_DREPRESENTATION =>"SIGNED")
port map (numer=>A,denom=>B,clock=>clk_120n,quotient=>sat); 

these are initial value:

signal TTA,TTB,T_sum	: STD_LOGIC_VECTOR(31 downto 0):=(others =>'0');
signal A,B,sat			: STD_LOGIC_VECTOR(31 downto 0):=(others =>'0');
signal T1,T2			: STD_LOGIC_VECTOR(15 downto 0):=(others =>'0');
signal TAA,TBB          : STD_LOGIC_VECTOR(15 downto 0):=(others =>'0');

these are my code:

if clk_120n'event and clk_120n='1' then
	CNT<=CNT+1;
if CNT=x"00" then 
	SECT  <= not (Vref3(11) & Vref2(11) & Vref1(11) );
elsif CNT=x"01" then
	TX<=Vref1;
	TY<=-Vref2;
	TZ<=-Vref3;
ELSIF CNT=x"02" THEN
case SECT is
when "011" =>    
	T1  <=  -TZ;
	T2  <=  TX;
when "001" =>    
	T1  <=  TZ;
	T2  <=  TY;
when others =>
	T1  <=  T1;  
	T2  <=  T2;  
end case;
elsif CNT=x"03" then
	T_sum <=x"0000"& (T1+T2); 
	if T_sum>= x"410" then --X"410"      
		TTA <=T1*x"0410";
		TTB <=T2*x"0410";
	else
		TAA <=T1;
		TBB <=T2;
	end if;
elsif CNT=x"04" then 
	if T_sum>=x"410" then        
		A <=TTA;
		B <=T_sum;
	end if;   
elsif CNT=x"05" then
	if T_sum>=x"410" then 
		TAA <= sat(15 downto 0);
	end if;   
elsif CNT=x"06" then
	if T_sum>=x"410" then 
		A <=TTB;
		B <=T_sum;
	end if;   
elsif CNT=x"07" then
	if T_sum>=x"410" then 
		TBB <= sat (15 downto 0);
	end if;   
elsif CNT=x"08" then
	TAM  <= x"410" -TAA -TBB;    
elsif CNT=x"09" then
	TAO  <= '0' & TAM(15 downto 1);  
elsif CNT=x"0A" then
	TBO  <= TAO + TAA;
elsif CNT=x"0B" then
	TCO  <= TBO + TBB;        
end if;
end if; 

The value get "X" value is SAT (result of divider command). I attached the waveforms in this message. I spent a lot of time for it but I still had not found the error.

Please could you help me?

Thank you very much.

23 Replies