aLec08_Arithmetic - Introduction to Embedded Microcomputer...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Introduction to Embedded Microcomputer Systems Lecture 8.1 Jonathan W. Valvano Computers in the future may weigh no more than 1.5 tons Popular Science, 1949 Recap Debugging: Monitor, dump TExaS Real 9S12DP512 Overview Addition and subtraction set CCR bits Subtraction used for conditional branching Condition code register (CC or CCR) C set after an unsigned add if the answer is wrong V set a signed add if the answer is wrong bit name meaning after add or sub N negative result is negative Z zero result is zero V overflow signed overflow C carry unsigned overflow Table 3.16. Condition code bits. 96+64 224+64 64 128 192 255 96 160 +64 32 224 +64 64 128 192 255 Figure 3.20. Unsigned number wheel. 160-64 32-64 -64-64 64 128 192 255 96 160 32 224 64 128 192 255 Figure 3.22. Unsigned number wheel. Observation: The carry bit, C, is set after an unsigned addition or subtraction when the result is incorrect. -32+64 96+64 -1 +64 64 127-64-128 32-32 96-96-1 64 127-64-128 +64 Figure 3.23. Signed number wheel. Introduction to Embedded Microcomputer Systems Lecture 8.2 Jonathan W. Valvano 32-64 -96-64 -64-64-1 64 127-64-128 32-32 96-96-1 64 127-64-128 Figure 3.24. Signed number wheel Observation: The overflow bit, V, is set after a signed addition or subtraction when the result is incorrect. Let the result R be the result of the addition A+B. N bit is set if unsigned result is above 127 or if signed result is negative. N = R7 Z bit is set if result is zero. Z = R0 & R1 & R2 & R3 & R4 & R5 & R6 & R7 V bit is set after a signed addition if result is incorrect V = R7 & B7 & A7 R7 & B7 & A7 + C bit is set after an unsigned addition if result is incorrect C = R7 & B7 R7 & A7 B7 & A7 + + Let the result R be the result of the subtraction A-B....
View Full Document

This note was uploaded on 09/19/2010 for the course E E 16280 taught by Professor Valvano during the Fall '10 term at University of Texas at Austin.

Page1 / 6

aLec08_Arithmetic - Introduction to Embedded Microcomputer...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online