0

I'm trying to implement a signal processing algorithm in Vitis HLS. For this, I read in a few variables via AXI Stream and AXI Lite.

Simulation and synthesis did already work with the complete project.

Now I wanted to make the center frequency 'fc' adjustable via AXI Lite. I noticed, that at some point all my AXI Lite variables are marked as unused in the synthesis report (resource utilization does also drop - so they probably are really not used by the synthesis tool).

I was able to track the issue down to a single change: changing the datatype of 'fc' from float to 'ap_fixed<32,27>'.

However, I don't understand in the slightest how this would result in the observed error and couldn't find any information in that direction.

Below is a code snipped of the only function where 'fc' is actually used. All other functions only pass the read value from the top function to CalculateElement().

void CalculateElement(in2_t phi, float fc,  in3_t xpos, in1_t &w_real, in1_t &w_imag){
    constexpr double pi = 3.14159265359;
    constexpr double c_0 = 299792458; // in m/s
    constexpr double mm_to_m = 1000; // adjust xpos from mm to m
    float temp = 2*pi/c_0*mm_to_m;
    in3_t k = temp*fc;

    // -1 in complex exponent and -1 from propagation direction (incoming wave) 
    // cancel each other out
    w_real = hls::cos(k*hls::cos(phi)*xpos)/4;
    w_imag = hls::sin(k*hls::cos(phi)*xpos)/4;
}

I would be really thankful for any help.

1 Answer 1

1

I found the problem. The fixed point precision was too low. This resulted in temp*fc always evaluating to zero. The compiler then optimized everything away as multiplication with zero is zero again - and sin(0) or cos(0) can also be calculated at compile time, therefore no CORDIC-Hardware was inferred. After playing a bit with the fixed point ranges everything works as it should.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.