1. Skeebopstop

    Thread Starter Active Member

    Jan 9, 2009
    358
    3
    Dear All,

    I am reasonably new to VHDL (this is my first big project) and my tools are throwing up lots of warnings around how I'm using count_buf_v and count_cnt_v in this example code pasted below. In simulation everything works fine.

    Here is an example warning:

    WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <count_buf_v_8> (without init value) has a constant value of 0 in block <PWM_assymetric_1>. This FF/Latch will be trimmed during the optimization process.

    Here is the code:

    Code ( (Unknown Language)):
    1. BEGIN
    2.  
    3.     PWM_GENERATE : PROCESS(clk, rst_n) IS
    4.         variable count_buf_v : unsigned(COUNTER_SIZE-1 DOWNTO 0);
    5.         variable count_cnt_v : unsigned(COUNTER_SIZE-1 DOWNTO 0);
    6.     BEGIN
    7.         IF rst_n = '0' THEN
    8.             pwm         <= '0';
    9.             count_max   <= (OTHERS => '1');
    10.             count_buf_v := unsigned(count_set);
    11.             count_cnt_v := conv_unsigned(0, COUNTER_SIZE);            
    12.         ELSIF rising_edge(clk) THEN
    13.             count_cnt_v := count_cnt_v + 1;
    14.  
    15.             IF (reset_set = '1') THEN
    16.                 pwm <= '0';
    17.                 count_buf_v := conv_unsigned(0, COUNTER_SIZE); -- Shadow registration override
    18.             ELSIF (count_cnt_v = conv_unsigned(0, COUNTER_SIZE)) THEN -- Natural wrapping
    19.                 count_buf_v := unsigned(count_set); -- Shadow registration
    20.                 pwm <= '0';
    21.             ELSIF (count_cnt_v <= count_buf_v) AND (count_cnt_v <= count_max) THEN
    22.                 pwm <= '1';
    23.             ELSIF (count_cnt_v >  count_buf_v) AND (count_cnt_v <= count_max) THEN
    24.                 pwm <= '0';
    25.             END IF;            
    26.            
    27.         END IF;
    28.     END PROCESS PWM_GENERATE;
    29.  
    30. END ARCHITECTURE rtl;
    Any input as to whether I should be worried or not would be much appreciated.

    Thanks in advance,

    James
     
  2. guitarguy12387

    Active Member

    Apr 10, 2008
    359
    12
    Hi James,

    Maybe, maybe not! Depends on if you expect the trimming or not :)

    If you are using count_buf_v(8) somewhere and you don't expect it to be constant at all times, then this is probably bad. For trimming warnings, you should begin by trying to trace the warnings back to the first FF that gets trimmed and figure out why XST is trimming it by looking at the HDL code that is related to the warning.
     
  3. Skeebopstop

    Thread Starter Active Member

    Jan 9, 2009
    358
    3
    Weeeell it gets set to different values depending on the state of reset_set. I am getting the same warnings on count_cnt_v which is a counter being incremented frequently.... Is it perhaps related to them being variables?
     
  4. Skeebopstop

    Thread Starter Active Member

    Jan 9, 2009
    358
    3
    Just following up on this one. I've reviewed in detail these optimizations and they all seem valid, but it's a good point in case to those who are also new like me to always review your warnings thoroughly.
     
Loading...