VHDL query

Thread Starter

Skeebopstop

Joined Jan 9, 2009
358
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:

Rich (BB code):
BEGIN
 
    PWM_GENERATE : PROCESS(clk, rst_n) IS
        variable count_buf_v : unsigned(COUNTER_SIZE-1 DOWNTO 0);
        variable count_cnt_v : unsigned(COUNTER_SIZE-1 DOWNTO 0);
    BEGIN
        IF rst_n = '0' THEN
            pwm         <= '0';
            count_max   <= (OTHERS => '1');
            count_buf_v := unsigned(count_set);
            count_cnt_v := conv_unsigned(0, COUNTER_SIZE);            
        ELSIF rising_edge(clk) THEN
            count_cnt_v := count_cnt_v + 1;

            IF (reset_set = '1') THEN
                pwm <= '0';
                count_buf_v := conv_unsigned(0, COUNTER_SIZE); -- Shadow registration override
            ELSIF (count_cnt_v = conv_unsigned(0, COUNTER_SIZE)) THEN -- Natural wrapping
                count_buf_v := unsigned(count_set); -- Shadow registration
                pwm <= '0';
            ELSIF (count_cnt_v <= count_buf_v) AND (count_cnt_v <= count_max) THEN 
                pwm <= '1';
            ELSIF (count_cnt_v >  count_buf_v) AND (count_cnt_v <= count_max) THEN
                pwm <= '0';
            END IF;            
            
        END IF;
    END PROCESS PWM_GENERATE;

END ARCHITECTURE rtl;
Any input as to whether I should be worried or not would be much appreciated.

Thanks in advance,

James
 

guitarguy12387

Joined Apr 10, 2008
359
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.
 

Thread Starter

Skeebopstop

Joined Jan 9, 2009
358
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?
 

Thread Starter

Skeebopstop

Joined Jan 9, 2009
358
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.
 
Top