L3 Lecture 1 - Data Representation & Arithmetic.pptx

# L3 Lecture 1 - Data Representation & Arithmetic.pptx -...

• Notes
• 34

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

1 Adapted from originals by Y. Zhu of Uni. of Maine EECS 3100 Embedded Systems Data Representation

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

Bit, Byte, Half-word, Word, Double-Word 2
Binary, Octal, Decimal and Hex 3 Decimal Binary Octal Hex 0 0000 00 0x0 1 0001 01 0x1 2 0010 02 0x2 3 0011 03 0x3 4 0100 04 0x4 5 0101 05 0x5 6 0110 06 0x6 7 0111 07 0x7 8 1000 010 0x8 9 1001 011 0x9 10 1010 012 0xA 11 1011 013 0xB 12 1100 014 0xC 13 1101 015 0xD 14 1110 016 0xE 15 1111 017 0xF

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

Unsigned Integers 5 Convert from Binary to Decimal: Five-bit binary code

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

Unsigned Integers 6 Convert Decimal to Binary 52 10 = 110100 2 Example 1 32 10 = 100000 2 Example 2
Carry/borrow flag bit for unsigned numbers 7 When adding two unsigned numbers in an n -bit system, a carry occurs if the result is larger than the maximum unsigned integer that can be represented ( i.e. ). When subtracting two unsigned numbers, borrow occurs if the result is negative , smaller than the smallest unsigned integer that can be represented ( i.e. 0). On ARM Cortex-M processors, the carry flag and the borrow flag are physically the same flag bit in the status register. For an unsigned subtraction: Carry = NOT Borrow

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

Carry/borrow flag bit for unsigned numbers 8 A carry occurs when adding 28 and 6 If the traverse crosses the boundary between 0 and , the carry flag is set on addition and is cleared on subtraction . Carry flag = 1 , indicating carry has occurred on unsigned addition. The carry flag is 1 because the result crosses the 31-0 boundary
Carry/borrow flag bit for unsigned numbers 9 A borrow occurs when subtracting 5 from 3. If the traverse crosses the boundary between 0 and , the carry flag is set on addition and is cleared on subtraction . Carry flag = 0 , indicating borrow has occurred on unsigned subtraction. For subtraction: carry = NOT borrow.

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

10 Three ways to represent signed binary integers: Signed magnitude One’s complement () Two’s complement () Signed Integer Representation Overview Two zeroes () Two zeroes () Unique Sign-and- Magnitude One’s Complement Two’s Complement Range Zero One zero Unique Numbers
11 Example: in a 5-bit system +7 10 = 0 0111 2 -7 10 = 1 0111 2 Two ways to represent zero +0 10 = 0 0000 2 -0 10 = 1 0000 2

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

This is the end of the preview. Sign up to access the rest of the document.
• Fall '08
• Staff

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern