This example works on FinSim 10_0_6 and subsequent versions.
This example shows how to perform a fast autocorrelation
on two vectors of type VpFCartesian, which is a complex
number in cartesian coordinates, with fields of type real
module top;
parameter SIZE = 1024;
VpFCartesian t1[2*SIZE -1:0], t2[2*SIZE -1:0], prod[2*SIZE -1:0];
integer j;
initial begin
#1;
$InitM(t1, ($I1 < SIZE-1) ? 0 : $I1-SIZE+1, 0);
$PrintM(t1, "%e");
$InitM(t2, ($I1 < SIZE) ? 0 : 2*SIZE-$I1, 0);
$PrintM(t2, "%e");
$VpFft(t1, 0, 2*SIZE-1);
$VpFft(t2, 0, 2*SIZE-1);
for (j = 0; j < 2*SIZE; j = j + 1)
begin
prod[j] = t1[j] * t2[j];
end
$VpIfft(prod, 0, 2*SIZE-1);
$PrintM(prod, "%e");
end
endmodule