This example shows how to create a complex number multiplier. The following shows the xlcpxmult.m file which specifies the xlcpxmult function.
function [xr, xi] = xlcpxmult(ar, ai, br, bi)
xr = ar * br - ai * bi;
xi = ar * bi + ai * br;
The following diagram shows the subsystem:
Figure 1. Complex Multiplier Subsystem
The example adds two delay blocks after the MCode block. Selecting the Implement using behavioral HDL option on the Delay blocks allows the downstream logic synthesis tool to perform appropriate optimizations for higher performance.