fpmul - 2022.2 English

Vitis Tutorials: AI Engine Development

Document ID
XD100
Release Date
2022-12-01
Version
2022.2 English

The simple floating-point multiplier comes in many different flavors mixing or not float and cfloat vector data types. When two cfloat are involved, the intrinsic results in two microcode instructions that must be scheduled. The first buffer can be either 512 or 1024-bit long (v32float, v16float, v16cfloat, v8cfloat), the second buffer is always 256-bit long (v8float, v4cfloat). Any combination is allowed.

v8float fpmul(v32float xbuf, int xstart, unsigned int xoffs, v8float zbuf, int zstart, unsigned int zoffs)

Returns the multiplication result.

Parameter Comment
xbuf First multiplication input buffer.
xstart Starting offset for all lanes of X.
xoffs 4 bits per lane, additional lane-dependent offset for X.
zbuf Second multiplication input buffer.
zstart Starting offset for all lanes of Z. This must be a compile time constant.
zoffs 4 bits per lane, additional lane-dependent offset for Z.
for (i = 0 ; i < 8 ; i++)
  ret[i] =  xbuf[xstart + xoffs[i]] * zbuf[zstart + zoffs[i]]