Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 3430 – Intro to Microcomputer Systems

Similar presentations


Presentation on theme: "ECE 3430 – Intro to Microcomputer Systems"— Presentation transcript:

1 ECE 3430 – Intro to Microcomputer Systems
ECE 3430 – Introduction to Microcomputer Systems University of Colorado at Colorado Springs Lecture #8 Agenda Today Integer multiplication and division. How is it done if hardware doesn’t explicitly know how? MUL, SMULL, UMULL, UDIV, SDIV instructions. Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

2 Multiplication and Division
Some CPU architectures have integer multiplication and integer division instructions. Some do not. Some have unsigned integer only and some have signed and unsigned integer multiplication and division instructions. Some have floating point and some don’t. Some have 8-by-8, some 16-by-16, some 16-by-8, et cetera. When instructions are missing, there is always a way to pull of the operation using other instructions—often times less efficiently. Our ARM Cortex-M4F CPU core has: Signed and unsigned integer multiply and divide. Floating point support. Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

3 ECE 3430 – Intro to Microcomputer Systems
Multiplication Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

4 ECE 3430 – Intro to Microcomputer Systems
Multiplication Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

5 ECE 3430 – Intro to Microcomputer Systems
Multiplication Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

6 ECE 3430 – Intro to Microcomputer Systems
Division Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

7 ECE 3430 – Intro to Microcomputer Systems
Division Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

8 Multiplication and Division (Algorithms)
Much better multiplication and division algorithms have been designed for computers (other than shift/add or shift/subtract). Horner’s Method: Provides ways to perform calculations using fewer operations (polynomial math). Booth’s Algorithm: Provides algorithms to work directly with two’s complement integers without conversion to unsigned first. Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

9 Multiplication Shortcuts (Avoid It If Possible)
Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

10 Example of a Hardware Multiplier (Use Dedicated Hardware If Available)
Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

11 Arithmetic Instructions: Considerations
Is this arithmetic operation signed or unsigned? Addition and Subtraction: If the precision of the two numbers is the same, it doesn’t matter. The answer is right either way. It is all in how you interpret the binary. If the precision of the two numbers is different, the smaller needs to be extended to match the precision of the other. Signed numbers must be sign-extended and unsigned numbers zero padded. Multiplication and Division: Multiplication algorithms need to know if the numbers are signed or unsigned when the resulting precision is larger than what we started with (typical). Division algorithms are always signed or unsigned. When it matters, you’ll find an instruction designated as “signed” or “unsigned”. Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

12 Arithmetic Instructions: Multiply and Divide
Integer Multiplication: MUL: 32-bit x 32-bit -> 32-bit (doesn’t care if numbers are signed or unsigned) SMULL: 32-bit x 32-bit -> 64-bit (signed) UMULL: 32-bit x 32-bit -> 64-bit (unsigned) The latter two have signed and unsigned versions because the resulting precision (64-bit) is greater than the original precision (32-bit). Normally the resulting precision of a multiply instruction must be greater—but sometimes (for DSP applications) MUL is useful. Integer Division: SDIV: 32-bit / 32-bit -> 32-bit (signed) UDIV: 32-bit / 32-bit -> 32-bit (unsigned) Both give a quotient only. The remainder (if needed) can be calculated with an additional multiply and subtract operation. Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

13 ECE 3430 – Intro to Microcomputer Systems
End of Exam 1 Material This is the end of the exam 1 material. Prepare questions for next lecture. Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

14 ECE 3430 – Intro to Microcomputer Systems
Exam #1 Review Number Systems - Base Conversion. - Two’s Compliment Negation / Range / Arithmetic / Overflow. - BCD (know what it is). - Ways to represent signed numbers in computers. Computer Hardware (HW) and Software (SW) - Differences between microprocessors and microcontrollers. - Definition of a microcomputer. - Fundamental components of a microcomputer. - CPU (registers, ALU, control unit). - Types of Memory (RAM, ROM). - Terminology (cross-assembler, native assembler, machine code, etc…). - Ways to represent characters in computer memory (ASCII/Unicode). MSP432 - ARM/MSP432 programming model. - Basic familiarity with the MSP432 block diagram. - Peripheral Interfacing (active-high and active-low sensor and actuator interfacing). Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

15 ECE 3430 – Intro to Microcomputer Systems
Exam #1 Review MSP432 (cont)… - Definition of opcodes and operands (instruction codes). - Load/Store/Move instructions (restrictions and allowed addressing modes). - MSP432 and LaunchPad port availability and I/O. - Assembler Fields. - Assembler Directives (AREA, END, SPACE, DCB, DCW, DCD, EQU, …). - Listing files. Instruction Execution - Program counter’s role in execution. - Encoding and Decoding machine code. Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

16 ECE 3430 – Intro to Microcomputer Systems
Exam #1 Review Other - N, Z, V, and C flags in program status register (what they represent). - Data direction registers and input/output registers for port I/O. - Logical instructions: AND, ORR, EOR, BIC. - Arithmetic instructions: Addition and subtraction. - Be familiar with multiplication and division algorithms discussed and associated ARM instructions. Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015

17 ECE 3430 – Intro to Microcomputer Systems
Exam #1 Review Review all presentations on the web and your notes. Review first three homework exercises. Lecture #8 ECE 3430 – Intro to Microcomputer Systems Fall 2015


Download ppt "ECE 3430 – Intro to Microcomputer Systems"

Similar presentations


Ads by Google