Chap7-arith

# Chap7-arith - Overview ° C operators operands ° Variables...

This preview shows pages 1–4. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Overview ° C operators, operands ° Variables in Assembly: Registers ° Comments in Assembly ° Data Processing Instructions ° Addition and Subtraction in Assembly Review C Operators/Operands (#1/2) ° Operators: + , - , * , / , % (mod); • 7/4==1 , 7%4==3 ° Operands: • Variables: lower , upper , fahr , celsius • Constants: , 1000 , -17 , 15.4 ° Assignment Statement: Variable = expression • Examples: celsius = 5*(fahr-32)/9; a = b+c+d-e; C Operators/Operands (#2/2) ° In C (and most High Level Languages) variables declared frst and given a type • Example: int fahr, celsius; char a, b, c, d, e; ° Each variable can ONLY represent a value oF the type it was declared as (cannot mix and match int and char variables). Assembly Design: Key Concepts ° Keep it simple! • Limit what can be a variable and what can ʼ t • Limit types oF operations that can be done to absolute minimum- iF an operation can be decomposed into a simpler operation, don ʼ t include it.- ¡or example 7%4 operation is complex. We break it into simpler operations in Assembly Assembly Variables: Registers (#1/4) ° Unlike HLL, assembly cannot use variables • Why not? Keep Hardware Simple ° Assembly Operands are registers • limited number of special locations built directly into the hardware • operations can only be performed on these! ° BeneFt: Since registers are directly in hardware, they are very fast Assembly Variables: Registers (#2/4) ° Drawback: Since registers are in hardware, there are a predetermined number of them • Solution: ARM code must be very carefully put together to efFciently use registers ° 16 registers in ARM • Why 16? Smaller is faster ° Each ARM register is 32 bits wide • Groups of 32 bits called a word in ARM Assembly Variables: Registers (#3/4)...
View Full Document

## This note was uploaded on 12/20/2010 for the course CSC CSCC85 taught by Professor Lorincz during the Spring '10 term at University of Toronto.

### Page1 / 10

Chap7-arith - Overview ° C operators operands ° Variables...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online