Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Newbie
fareed.ur
Posts: 1
Registered: ‎05-31-2008
0
Accepted Solution

xst 827 bad synchronous description. plz help me out .........

I have a bug in my code

that is i m not able to synthesis the code it works fine with model sim and even the syntax check is also correct

plz help in debugging the code

my code is as follows  

 

the code is for calculating one cycle of the ecgwave,,,,,,,

the ecgwave is sampled at the rate of divider......

and the reset switch to repeat the whole process again ......

and the two counters are used to count on time and off time samples ...........

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

 

----------------------------------------------------------------------------------
entity test2 is
    Port ( clk : in  STD_LOGIC;
           rst : in  STD_LOGIC;
     ecgwave : in  STD_LOGIC;
     display1 : out  STD_LOGIC_VECTOR(7 DOWNTO 0):="00000000");
end test2;
 
architecture Behavioral of test2 is
type signal_state is(normal,sinusbrad,sinustach,atrialtach,atrialflutter,juncescape,svt,vpb,vt,ventricularflutt,stayidle,svtsinus);
type state_type is(idle,initial ,part1,part2,part3,part4);
signal state123:state_type:=idle ;
signal clk_div:std_logic_vector(20 downto 0):="000000000000000000000";
--signal constart123:integer range 0 to 3000;
--signal counter: integer range 0 to 1000;
--signal counter2: integer range 0 to 2000;
signal state: signal_state:=stayidle;
signal divider: std_logic:='0';

 

begin

p1:process(clk)

begin
if rising_edge(clk) then clk_div<=clk_div + '1'; end if;  
divider<=clk_div(2);
end process p1;

 

p2:process(divider,rst,ecgwave)   --15

 


variable counter :integer range 0  to 1000;
variable counter2 :integer range 0 to 2000;
variable constart123:integer range 0 to 3000;
begin

case state123 is

when idle =>

if rst'event and rst = '1' then state123<= initial; else state123 <= idle ; end if;
counter:= 0 ;
counter2:= 0 ;


when initial =>

if ecgwave'event and ecgwave ='1' then
state123<= part1;
end if ;


when part1 =>

if divider'event and divider= '1' and ecgwave = '1'then

counter := counter + 1;
state123 <= part1;
else
state123 <= part2;
end if ; 
-- end if;


when part2 =>

if divider'event and divider= '1' and ecgwave='0' then
--if ecgwave = '0' then
counter2 := counter2 + 1;
else
state123 <= part3;
end if ;
--end if ;


when part3 =>

constart123 := counter + counter2;
state123 <= part4;


when part4 =>


state123 <= idle;

 

end case ;


end process p2;


end Behavioral;

Expert Contributor
gszakacs
Posts: 5,269
Registered: ‎08-14-2007
0

Re: xst 827 bad synchronous description. plz help me out .........

In a clocked process you can only use one edge of the clock or the other for synthesis.  For simulation it is O.K. to use both edges.  In your first process, divider is outside the if statement.  Thus it will try to update whenever the process variable, clk, changes state regardless of which edge.  Since clk_div(2) will only change on the rising edge of clk, I assume you don't really need divider to update on both edges.

 

For your second block, you have described logic that needs to use the edges of a different "clock" signal depending on the current state.  Think about how this might be implemented with D flip-flops and gates.  The synthesizer is only able to infer logic when the code matches a reasonable template for flip-flops gates or other structures available in the FPGA.

 

HTH,

Gabor 

-- Gabor
Expert Contributor
bassman59
Posts: 4,679
Registered: ‎02-25-2008
0

Re: xst 827 bad synchronous description. plz help me out .........

Indeed, the error message in this case is on the money. Your code is a very bad synchronous description!

----------------------------------------------------------------
Yes, I do this for a living.