L3 Lecture 1 - Data Representation & Arithmetic.pptx

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

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

View Full Document Right Arrow Icon
1 Adapted from originals by Y. Zhu of Uni. of Maine EECS 3100 Embedded Systems Data Representation
Image of page 1

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

View Full Document Right Arrow Icon
Bit, Byte, Half-word, Word, Double-Word 2
Image of page 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
Image of page 3

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

View Full Document Right Arrow Icon
Magic 32-bit Numbers 4 Used as a special pattern for debug Used as a special pattern of memory values during allocation and de-allocation 0xDEADBEEF Dead Beef 0xBADDCAFE Bad Cafe 0xFEE1DEAD Feel Dead 0x8BADF00D Ate Bad Food 0xBAADF00D Bad Food 0xDEADC0DE Dead Code 0xFACEB00C Facebook 0xDEADD00D Deade Dude
Image of page 4
Unsigned Integers 5 Convert from Binary to Decimal: Five-bit binary code
Image of page 5

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

View Full Document Right Arrow Icon
Unsigned Integers 6 Convert Decimal to Binary 52 10 = 110100 2 Example 1 32 10 = 100000 2 Example 2
Image of page 6
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
Image of page 7

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

View Full Document Right Arrow Icon
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
Image of page 8
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.
Image of page 9

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

View Full Document Right Arrow Icon
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
Image of page 10
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
Image of page 11

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

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern