We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 22371

MicroBlaze - 32x32-bit multiply producing a 64-bit result via software


I am using the MicroBlaze processor and want to obtain a 64-bit result from a 32x32-bit multiply.

How can I do this and what is the cycle count on a 32x32-bit multiply?


By default, multiply in the MicroBlaze processor uses MUL assembly code which returns the least significant 32-bits of the 64-bit product. This is reasonable when 4 is expected for 2 x 2.

To get the MSB or the total 64-bit product, a type cast should be assigned in the multiply statement. For example:

int i,j = 0x01111111;
long long int k;
k = (long long int) i * (long long int) j

Use the link below to access a reference project of a custom multiply function for the MicroBlaze processor. The multiply generates a full precision product (64-bit) from two 32-bit operands. With the multiplier and barrel shifter enabled, the custom function "mult32x32" completes in 60 cycles compared to 1014 cycles if emulated in the software.

Reference project:http://www.xilinx.com/txpatches/pub/applications/refdes/microblazemultiply-ml403.zip

Based on this reference project, the following table provides the number of processor cycles required to execute:

Multiply Cycle Table
Multiply Cycle Table

* Using the same multiplier and barrel shifter configuration, the noted cycle count is the optimal solution.

AR# 22371
Date Created 09/04/2007
Last Updated 12/15/2012
Status Active
Type General Article
  • Microblaze