Tom Simpson
Published © Apache-2.0

High-performance small FFT library for Versal AI Engine

The FFTs 4 Fun (FFT4F) library delivers optimized small-size FFTs (8–64 points) for AMD Versal AI Engines

BeginnerProtip103
High-performance small FFT library for Versal AI Engine

Things used in this project

Hardware components

AMD Versal AI Core
×1

Software apps and online services

Vitis Unified Software Platform
AMD Vitis Unified Software Platform

Story

Read more

Code

generate_data

Python
Usage: python generate_data.py <number_of_input_plio> <number_of_samples>
import sys
import random

def write_array_to_file(filename, array):
    with open(filename, 'w') as f:
        for i in range(0, len(array), 4):
            line = ' '.join(str(x) for x in array[i:i+4])
            f.write(line + '\n')

def main():
    if len(sys.argv) != 3:
        print("Usage: python generate_data.py <number_of_input_plio> <number_of_samples>")
        return

    try:
        num_outputs = int(sys.argv[1])
        num_samples = 2*int(sys.argv[2])
    except ValueError:
        print("Both arguments must be integers.")
        return

    random.seed(int(0))
    data = [random.randint(-16383, 16384) for _ in range(num_samples)]

    if num_outputs == 2:
        even_index_data = []
        odd_index_data = []
        toggle = True
        for i in range(0, len(data), 2):
            chunk = data[i:i+2]
            if toggle:
                even_index_data.extend(chunk)
            else:
                odd_index_data.extend(chunk)
            toggle = not toggle
        write_array_to_file("input_even.txt", even_index_data)
        write_array_to_file("input_odd.txt", odd_index_data)
    elif num_outputs == 1:
        write_array_to_file("input.txt", data)
    else:
        print("Invalid number of input PLIO. Please specify 1 or 2.")

if __name__ == "__main__":
    main()

Credits

Tom Simpson
7 projects • 83 followers
DSP & Versal AI Engine specialist at Avnet

Comments