R

Chapter 3: PicoBlaze Instruction Set

 

 

 

 

 

18x18 Multiplier

 

 

 

 

 

A[17:8]

1

PicoBlaze Microcontroller

 

 

A[7:0]

 

 

 

 

 

IN_PORT[7:0]

OUT_PORT[7:0]

 

EN

P[15:8]

 

 

 

0

SEL

PORT_ID[7:0]

[0]

 

P[7:0]

 

READ_STROBE

 

 

 

 

 

B[17:8]

 

 

 

 

 

 

 

 

 

 

 

WRITE_STROBE

 

 

 

 

 

 

 

 

B[7:0]

 

 

 

 

EN

 

 

 

 

 

 

UG129_c3_02_052004

Figure 3-15:8-bit by 8-bit Hardware Multiplier Using the FPGA’s 18x18 Multipliers

;Multiplier Routine (8-bit x 8-bit = 16-bit product)

;===================================================

;Connects to embedded 18x18 Hardware Multiplier via ports

;

 

mult_8x8io:

 

NAMEREG s0, multiplicand

; preserved

NAMEREG s1, multiplier

; preserved

NAMEREG s3, result_msb

; most-significant byte (MSB) of result, modified

NAMEREG s4, result_lsb

; least-significant byte (LSB) of result, modified

;

 

; Define

the port ID numbers as constants for better clarity

CONSTANT

multiplier_lsb,

00

CONSTANT

multiplier_msb,

01

;

 

 

;Output multiplicand and multiplier to FPGA registers connected to the inputs of

;the embedded multiplier.

OUTPUT multiplicand, multiplier_lsb

OUTPUT multiplier, multiplier_msb

;

; Input the resulting product from the embedded multiplier. INPUT result_lsb, multiplier_lsb

INPUT result_msb, multiplier_msb

;

 

 

 

RETURN

;

multiplier result

now available in result_msb

 

;

and result_lsb

 

Figure 3-16:8-bit by 8-bit Multiply Routine Using Hardware Multiplier

Division

The PicoBlaze microcontroller core does not have a dedicated hardware divider. However, the PicoBlaze microcontroller performs division using the available arithmetic and shift instructions. Figure 3-17demonstrates a subroutine that divides an unsigned 8-bit number by another unsigned 8-bit number to produce an 8-bit quotient and an 8-bit remainder in 60 to 74 instruction cycles, or 120 to 144 clock cycles.

30

www.xilinx.com

PicoBlaze 8-bit Embedded Microcontroller

UG129 (v1.1.2) June 24, 2008

Page 30
Image 30
Xilinx UG129 manual Division, bit by 8-bit Multiply Routine Using Hardware Multiplier