bad synchronous

P

Pedro Claro

Guest
Greetings,

While trying to synthetize my project in Xilinx 5.1 I get the
following error:

ERROR:Xst:827 - C:/Utils/5ano/Projecto/vhdl/scheduller/Sched_Policy.vhd
line 29: Signal userarray<0>.tokens<0> cannot be synthesized, bad
synchronous description.

I can't figure out this one. Can anyone help me here?

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

-- Uncomment the following lines to use the declarations that are
-- provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;

entity Sched_Policy is
Port ( dstIP: in std_logic_vector(127 downto 0);
packet_ready: in std_logic;
packet_size: in std_logic_vector(15 downto 0);
traffic_cl: in std_logic_vector(7 downto 0);
counter1us: in std_logic_vector(31 downto 0);
allow_packet: out std_logic;
main_clk: in std_logic;
clear_packet: out std_logic;
enq_sucess: in std_logic;
enq_fail: in std_logic);
end Sched_Policy;

architecture Behavioral of Sched_Policy is

begin

prPolicy:process(main_clk)


variable UserArray: USERAR;
constant current_users: integer range 0 to MAX_USERS:=1;
variable user: integer range 0 to MAX_USERS;
variable p_size: integer range 0 to 65335;
variable init: integer range 0 to 1:=0;
variable pck_ready_last: std_logic:='0';
variable enq_sucess_last: std_logic:='0';
variable enq_fail_last: std_logic:='0';
variable packet_ready_last: std_logic:='0';
variable cnt_last:std_logic_vector(31 downto
0):="00000000000000000000000000000000";

variable temp_div: std_logic_vector(COUNTER_BITS-1 downto 0);

begin

-- Inicializaçăo da estrutura

if(init=0) then
UserArray(0).IPAddress:=conv_std_logic_vector(255,128);
UserArray(0).Tokens:=0;
UserArray(0).DataRate:=8192;
UserArray(0).Next_Token_Time:=conv_std_logic_vector(0,COUNTER_BITS);
UserArray(0).MaxTokens:=5;
init:=1;
end if;


if(rising_edge(main_clk)) then

--Evitar que fiquem UNASSERTED
allow_packet<='0';
clear_packet<='0';

-- prPolicy - TESTED |1|
if(packet_ready='1' and pck_ready_last='0') then
pck_ready_last:='1';
user:=MAX_USERS;
p_size:=conv_integer(packet_size);
for i in 0 to current_users loop
if(dstIP=UserArray(i).IPAddress) then
user:=i;
end if;
end loop;
-- Efeitos de teste
-- user:=0;

if(user/=MAX_USERS) then
if( UserArray(user).Tokens >= p_size / TOKEN_VALUE )then
allow_packet<='1';
clear_packet<='0';
else
allow_packet<='0';
clear_packet<='1';
end if;
end if;
if(user=MAX_USERS) then
allow_packet<='0';
clear_packet<='1';
end if;
end if;
if(packet_ready='0') then
pck_ready_last:='0';
end if;



-- prTokenGen
if(counter1us/=cnt_last) then
cnt_last:=counter1us;
for j in 0 to current_users loop
if(UserArray(j).Next_Token_Time=conv_std_logic_vector(0,COUNTER_BITS)) then
temp_div:= conv_std_logic_vector( (TOKEN_VALUE*1000000/ 8192)+1,
COUNTER_BITS);
-- temp_div:= conv_std_logic_vector( (TOKEN_VALUE*1000000/
8000000)+1, COUNTER_BITS);
UserArray(j).Next_Token_Time:= temp_div;
if(UserArray(j).Tokens < UserArray(j).MaxTokens) then
UserArray(j).Tokens:=UserArray(j).Tokens + 1;
end if;
end if;
UserArray(j).Next_Token_Time:=UserArray(j).Next_Token_Time-1;
end loop;
end if;

--prDone - TESTED |1|
if(packet_ready_last='1' and packet_ready='0') then
allow_packet<='0';
clear_packet<='0';
packet_ready_last:='0';
end if;
if(packet_ready='1') then
packet_ready_last:='1';
end if;

--prTokenSub - TESTED |1|

if(enq_sucess_last='0' and enq_sucess='1') then
UserArray(user).Tokens:=UserArray(user).Tokens - p_size /TOKEN_VALUE;
clear_packet<='1';
enq_sucess_last:='1';
end if;
if(enq_sucess='0') then
enq_sucess_last:='0';
end if;

--prReject - TESTED |1|

if(enq_fail_last='0' and enq_fail='1') then
clear_packet<='1';
enq_fail_last:='1';
end if;
if(enq_fail='0') then
enq_fail_last:='0';
end if;



end if;

end process prPolicy;

end Behavioral;


The structures are defined as:



type USER is
record
IPAddress :std_logic_vector(127 downto 0);
MaxTokens:integer range 0 to 32767;
Tokens: integer range 0 to 32767;
DataRate: integer range 0 to 65535;
Next_Token_Time: std_logic_vector(COUNTER_BITS-1 downto 0);
end record;

type USERAR is array(MAX_USERS downto 0) of USER;

And the constants are:


constant MAX_USERS : integer:=10;

Thanks in advance,

Pedro Claro
 
Pedro Claro wrote:

line 29: Signal userarray<0>.tokens<0> cannot be synthesized, bad
synchronous description.

Use synch template:

if <reset bool> then <reset statements>
elsif rising_edge(clk) then <main statements>
end if;

-- Mike Treseler

---------------
if(init=0) then
UserArray(0).IPAddress:=conv_std_logic_vector(255,128);
UserArray(0).Tokens:=0;
UserArray(0).DataRate:=8192;
UserArray(0).Next_Token_Time:=conv_std_logic_vector(0,COUNTER_BITS);
UserArray(0).MaxTokens:=5;
init:=1;
-- end if;
-- if(rising_edge(main_clk)) then

elsif(rising_edge(main_clk)) then
 

Welcome to EDABoard.com

Sponsor

Back
Top