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.
Based on this reference project, the following table provides the number of processor cycles required to execute:
* Using the same multiplier and barrel shifter configuration, the noted cycle count is the optimal solution.