Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "ECE 3561 - Lecture 1 1 The Hardware Multiplier Department of Electrical and Computer Engineering The Ohio State University ECE 2560."— Presentation transcript:

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

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

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 3

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 4

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 5

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 6

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 7

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

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 9

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 10

11 Execution time If interrupts are disabled (DINT) – 1 cycle Set up Rx for results addr – 2 cycles Move operands to hw multipler - 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 11

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 12

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 13

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

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

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


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

Similar presentations


Ads by Google