# Lec19 - ECE 212 Lec 19 ECE 212 Digital Circuits II...

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

ECE 212 Lec 19 ECE 212 Digital Circuits II Wednesday, 9 April 2008 HW Set 19 : Problem 1 No presenter. Problem 2 No presenter. Problem 3 Humberto A. Problem 4 Rhodes B. Problem 5 Andy B. Problem 6 Alyssa B. Lecture 19 Goals To understand the 6812 flag response. To understand the proper use of conditional branch instructions. To understand how to set or clear specified bits of a Byte in memory. To understand how to make a decision based on the value of a bit or bits of a Byte in memory.

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

View Full Document
ECE 212 Lec 19 68HC12 Flags Condition Code Register (CCR) An 8-bit Special Purpose Register. Contains condition codes (Flags). C V Z N I H X S N = Negative Flag. Z = Zero Flag V = ( Signed number) Overflow Flag. C = Carry (or Borrow) Flag. Flag Response after Addition N = 8th bit of the result Z = ( all 8 bits of the result are zero ) V = Signed number overflow occurs C = The 9th bit of the sum A = a7 a6 a5 a4 a3 a2 a1 a0 (data) = + g7 g6 g5 g4 g3 g2 g1 g0 = ( z7' ·z6'·z5'·z4 '·z3 '·z2 '·z1 '·z0' ) = z7 = ( a7 ·g7 ·z7') + ( a7 '·g7' ·z7 ) = z8 z8 z7 z6 z5 z4 z3 z2 z1 z0 adda (data): The hardware always responds this way, regardless of the data type (unsigned or signed). Flag significance: depends the data type.
ECE 212 Lec 19 Example ldaa #0xA9 adda #0xDC Problem: Determine the values of the Z, C, N, V flags after the adda instruction executes. Solution: A9 = 1010 1001 + DC = + 1101 1100 1 1000 0101 C V Z N I H X S 0 Result is not zero. Example ldaa #0xA9 adda #0xDC Problem: Determine the values of the Z, C, N, V flags after the adda instruction executes. Solution: A9 = 1010 1001 + DC = + 1101 1100 1 1000 0101 C V Z N I H X S 0 1

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

View Full Document
ECE 212 Lec 19 Example ldaa #0A9h adda #0DCh Problem: Determine the values of the Z, C, N, V flags after the adda instruction executes. Solution: A9 = 1010 1001 + DC = + 1101 1100 1 1000 0101 C V Z N I H X S 01 1 Example ldaa #0A9h adda #0DCh Problem: Determine the values of the Z, C, N, V flags after the adda instruction executes. Solution: A9 = 1010 1001 + DC = + 1101 1100 1 1000 0101 C V Z N I H X S 1 0
ECE 212 Lec 19 Flags and Arithmetic Overflow ( a7 ·g7 ·z7') + ( a7 '·g7' ·z7 ) = 1 A = a7 a6 a5 a4 a3 a2 a1 a0 (data) = + g7 g6 g5 g4 g3 g2 g1 g0 z8 z7 z6 z5 z4 z3 z2 z1 z0 Unsigned Data: Overflow iff Signed Data: Overflow iff z8 =1 iff C = 1 iff V = 1

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.

## This note was uploaded on 04/17/2008 for the course ECE 212 taught by Professor Greco during the Spring '08 term at Lafayette.

### Page1 / 17

Lec19 - ECE 212 Lec 19 ECE 212 Digital Circuits II...

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

View Full Document
Ask a homework question - tutors are online