Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Within the first afternoon I found 2 of the 3 needed solutions, and the 3rd came to me over the weekend!..."

Geography

Where in the world do Tek-Tips members come from?
gemstar (Programmer)
29 Oct 08 16:52
hi there, am trying to synthesis a generic clock divider I have created.  it works fine in simulation with modelsim but xilinx syntheses tool xst is not happy. - see code below:


library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.NUMERIC_STD.all;


entity generic_clk_divider is
    generic
    (
        g_DIV_VALUE : integer := 5
    );
    
    port
    (
        n_RST   : in  std_logic;
        CLK_IN  : in  std_logic;
        CLK_OUT : out std_logic
    );
end entity generic_clk_divider;

architecture RTL of generic_clk_divider is

    subtype t_COUNTER is natural range 0 to g_DIV_VALUE*2 - 1;
    
    signal count : t_COUNTER := 0;

begin

    clk_gen : process(n_RST, CLK_IN, count)
    begin
        if((rising_edge(CLK_IN) or falling_edge(CLK_IN)) and count < t_COUNTER'high) then    
            count <= count + 1;
        elsif((rising_edge(CLK_IN) or falling_edge(CLK_IN)) and count = t_COUNTER'high) then    
            count <= t_COUNTER'low;
        end if;
        
        if(count >= (t_COUNTER'HIGH +1)/2) then
            CLK_OUT <= '0';
        else
           CLK_OUT <= '1';
        end if;
        
        if(n_RST = '0') then
           count <= 0;
        end if;
    end process clk_gen;
    
end architecture RTL;

error i get is:

ERROR:Xst:818 - <path_to_File> LAST_VALUE must be used with clk'event condition.

So... i tried changing the lines

if((rising_edge(CLK_IN) or falling_edge(CLK_IN)) and count < t_COUNTER'high) then...

to

if(((CLK_IN'event and CLK_IN = '1') or (CLK_IN'event and CLK_IN = '0')) and count < t_COUNTER'high) then...

but get the same error, so i added the last_value attribute:

if(((CLK_IN'event and CLK_IN = '1' and LAST_VALUE = '0') or (CLK_IN'event and CLK_IN = '0' and LAST_VALUE = '1')) and count < t_COUNTER'high) then..

but now i get an error on the same line saying:
ERROR:HDLParsers:808 - <path_to_File> can not have such operands in this context.

I cannot work out what is going on atall - don't know what the actual initial problem was anyway and am having bigger problems trying to resolve it.

Can anybody enlighten me.. my brain is starting to melt

cheers


 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close