1 / 16

The Hardware Multiplier

ECE 2560. The Hardware Multiplier. Department of Electrical and Computer Engineering The Ohio State University. HLL to Assembler. The multiply routine The hardware multiplier Details on it How to use it Speed. Had done a multiply routine.

john
Download Presentation

The Hardware Multiplier

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE 2560 The Hardware Multiplier Department of Electrical and Computer Engineering The Ohio State University ECE 3561 - Lecture 1

  2. HLL to Assembler • The multiply routine • The hardware multiplier • Details on it • How to use it • Speed ECE 3561 - Lecture 1

  3. Had done a multiply routine • Dumb – recursive add to multiply • Better – Shift and add – finite fixed time • Even better – • a dedicated hardware multiplier • MSP 430 does not have a multiplier or multiply instruction • MSP 430 chip has more than a small processor on it. There are also peripheral devices, one of which is a multiplier and available on some versions. (reference documentation) ECE 3561 - Lecture 1

  4. The hardware multiplier • Supports • Unsigned multiply • Signed multiply • Unsigned multiply accumulate • Signed multiply accumulate • How is operation determined? • The type of operation is selected by the address the first operand is written to. ECE 3561 - Lecture 1

  5. The operands • The first operand written to the multiplier periperal. • Determines the operation • 0130h – multiply (unsigned) (MPY) • 0132h – signed multiply (MPYS) • 0134h – multiply accumulate (unsigned) (MAC) • 0136h – signed multiply accumulate (MACS) • The second operand OP2 • Written to address 0138h • All are words (16 bits) and are read/write locations. ECE 3561 - Lecture 1

  6. The results • When using indirect or indirect autoincrement addressing mode to access the result (32 bits), at least one instruction is needed between loading of OP2 and accessing one of the result registers, RESLO, RESHI • RESLO – address 013Ah • RESHI – address 013Ch ECE 3561 - Lecture 1

  7. Accessing result example • Accessing results with indirect addressing • mov #RESLO,R5 • mov &oper1,&MPY • mov &oper2,&OP2 • nop • mov @R5+,&svreslo • mov @R5,&svreshi ECE 3561 - Lecture 1

  8. The overall architecture • Figure 7-1 from manual ECE 3561 - Lecture 1

  9. Other concerns • Interrupts • The multiplier does not use interrupts • However – Using the hardware multiplier requires several instruction to set up the multiplier and get results. • If an interrupt occurs during this period and interrupt routine uses multiplier then results will be invalid. • SOLUTION? • Disable interrupts before use if there is an interrupt service routine that uses the multiplier. ECE 3561 - Lecture 1

  10. Other concerns (2) • The SUMEXT register contents – • at address 013Eh • SUMEXT contains for • MPY – always 0000h • MPYS – result positive or zero – 0000h • result negative – FFFFh • MAC – no carry for result – 0000h • result has carry – 0001h • MACS - result positive or zero – 0000h • result negative – FFFFh ECE 3561 - Lecture 1

  11. Execution time • If interrupts are disabled (DINT) – 1 cycle • Set up Rx for results addr – 2 cycles • Move operands to hwmultipler • - 6 each – 12 cycles total • The NOP – 1 cycle • Retrieve results – 12 cycles • Re-enable interrupt (EINT) – 1 cycle • TOTAL TIME = 29 cycles ECE 3561 - Lecture 1

  12. Comparison • Hardware multiplier – 29 cycles • Shift and multiply routine – 83 cycles • As is typical of such operations, dedicated hardware support can improve performance. ECE 3561 - Lecture 1

  13. Demonstration of use • A short program can be written to demonstrate use. - DEMO • This also demonstrates the use of I/O ports as the hardware multiplier is a peripheral. ECE 3561 - Lecture 1

  14. The program • mov #0x013A,R5 • mov #3,&0x0130 • mov #3,&0x0138 • nop • mov @R5+,R6 • mov @R5,R7 ECE 3561 - Lecture 1

  15. What happened • It does not seem to work. What to do? • Look at the documentation. • msp430g2553 Data Sheet ECE 3561 - Lecture 1

  16. Summary - Assignment • When encountering issues look to documentation on the specific chip. • Manual are for the family typically. ECE 3561 - Lecture 1

More Related