HDL coder sharing factor and axi-stream valid signal
3 views (last 30 days)
Dear HDL coder experts,
please help me to understand how to combine the axi-stream interface and resource sharing at the same time.
Imagine hypothetical 8 taps symmetric FIR filter with 4 multipliers. The FIR has 2 inputs, data_in, and valid_in. The data rate is 24 kHz, the FPGA clock rate is 122.88 MHz, 5120 times higher than the data rate. I can use an enabled subsystem and connect the valid_in signal to the enable port of this subsystem. In this case, the enabled subsystem would run only when an external valid signal is on. So far so good except for the use of 4 multipliers which is resource wasting.
When I enable resource sharing the HDL coder shares one multiplier 4 times and updates the DUT base rate to 24*4=192 kHz. In order to do that the optimizer creates a timing controller which divides the FPGA clock 4 times.
There are two problems here. First, my actual FPGA clock rate is 122.88 MHz, not 192 kHz. The solution is to explicitly point out the oversampling factor at Workflow Advisor. Second, the phase of this timing controller's signal is not related to the external valid_in signal. In other words, the FIR accepts new data only when the internal state machine dictates that. If the state machine and the external valid signal are not in sync, nothing is at the output.
Is it possible to synchronize the external valid signal and the resource sharing counter by means of HDL-coder settings? My vision: the positive edge of the valid_in signal should trigger the counter which counts 4 times and then stops providing 4 high-speed clocks to fulfill mult sharing.
Bharath Venkataraman on 14 Oct 2021
I will likely need a little more information on exactly which FIR block you are using, but you can put in a sharing factor on the subsystem containing the FIR to be the ratio of 122.88MHz/24KHz=5120. The subsystem will end up using only 4 clocks out of the possible 5120.
You can also use the FIR HDL Optimized block where you can put in this sharing factor of 5120. It has the added benefit of having a valid input port as well.