4-1 EE 319K Introduction to Microcontrollers Lecture 4: Debugging, Arithmetic Operations, Condition Code Bits.

Slides:



Advertisements
Similar presentations
Microprocessors A Beginning.
Advertisements

Ch.3 Representation and Manipulation of Information From Introduction to Embedded Systems: Interfacing to the Freescale 9s12 by Valvano, published by CENGAGE.
Microprocessors.
Parul Polytechnic Institute
4-1 EE 319K Introduction to Embedded Systems Lecture 4: Arithmetic overflow, Branches, Control Structures, Abstraction & Refinement Bard, Erez, Gerstlauer,
Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
The 8051 Microcontroller and Embedded Systems
Machine Instructions Operations 1 ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson Slides4-1.ppt Modification date: March 18, 2015.
Programming Types of Testing.
Introduction CS212 Dick Steflik. What is CS-212 Primarily an introduction to linear and non-linear data structures  arrays  stacks and queues  lists.
Lecture Roger Sutton CO331 Visual programming 15: Debugging 1.
General Computer Science for Engineers CISC 106 Lecture 21 Dr. John Cavazos Computer and Information Sciences 04/10/2009.
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
1-1 Embedded Software Development Tools and Processes Hardware & Software Hardware – Host development system Software – Compilers, simulators etc. Target.
EE 319K Introduction to Embedded Systems
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
Design and Analysis of Algorithms
Cortex-M3 Debugging System
Atmega32 Architectural Overview
P51UST: Unix and Software Tools Unix and Software Tools (P51UST) Compilers, Interpreters and Debuggers Ruibin Bai (Room AB326) Division of Computer Science.
1-1 EE 319K Introduction to Microcontrollers Lecture 1: Introduction, Embedded Systems, ARM Programming.
Simple Data Type Representation and conversion of numbers
Topics Introduction Hardware and Software How Computers Store Data
The 8051 Microcontroller and Embedded Systems
Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.
Slides created by: Professor Ian G. Harris Test and Debugging  Controllability and observability are required Controllability Ability to control sources.
Computer Processing of Data
Introduction to Computing: Lecture 4
Basic Architecture Lecture 15. In general, if the number of bits is n, then the number of different combinations of 0s and 1s that can be made is 2 n.
Computer Systems Organization CS 1428 Foundations of Computer Science.
1 Lab 1: Introduction. 2 Configure ATMEL AVR Starter Kit 500 (STK500), a prototyping/development board for Lab1. ATmega16 ( V) is the chip used.
Chapter 4 - Implementing Standard Program Structures in 8086 Assembly Language from Microprocessors and Interfacing by Douglas Hall.
8-1 Embedded Systems Fixed-Point Math and Other Optimizations.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Introduction to AVR Chapter 1
Lecture 2: Basic Instructions EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer Engineering Spring 2014, Dr.
Debugging and Profiling With some help from Software Carpentry resources.
3-1 EE 319K Introduction to Microcontrollers Lecture 3: Addressing modes, Memory Operations, Subroutines, I/O, Logical/Shift Operations.
Computer Architecture Lecture 32 Fasih ur Rehman.
 Lecture 2 Processor Organization  Control needs to have the  Ability to fetch instructions from memory  Logic and means to control instruction sequencing.
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
HOW a Computer Works ? Anatomy of Microprocessor.
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
Introduction to Microprocessors - chapter3 1 Chapter 3 The 8085 Microprocessor Architecture.
CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
Embedded Systems Introduction. Microprocessor building blocks 1. ALU (Arithmetic Logic Unit): The ALU is a sequential logic circuitry that is intended.
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
Embedded Systems Lecture 4 January 20, 2016.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
AVR Architecture Prepared By: Avdhesh Soni ( ) Sarthak Patel ( ) Akshay Parekh ( ) Fenil Sachla ( ) Guided.
Programming and Debugging with the Dragon and JTAG Many thanks to Dr. James Hawthorne for evaluating the Dragon system and providing the core content for.
ADDING AND SUBTRACTING MULTIPLYING AND DIVIDING REAL NUMBERS.
1 The user’s view  A user is a person employing the computer to do useful work  Examples of useful work include spreadsheets word processing developing.
The 8085 Microprocessor Architecture
ECE 3430 – Intro to Microcomputer Systems
Gunjeet Kaur Dronacharya Group of institutions
The 8085 Microprocessor Architecture
Computer Organization
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Arithmetic operations Programming
Debugging Debug environments Debug via serial
Chapter 2: Computer Hardware
The 8085 Microprocessor Architecture
ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS
COMS 361 Computer Organization
Computer Architecture Assembly Language
Prof. Dr. Kalle Tammemäe Prof. Dr.-Ing. Thomas Hollstein
Presentation transcript:

4-1 EE 319K Introduction to Microcontrollers Lecture 4: Debugging, Arithmetic Operations, Condition Code Bits

4-2 Ramesh Yerraballi Debugging  Aka,Testing, Diagnostics, Verification  Debugging Actions  Functional debugging, input/output values  Performance debugging, input/output values with time  Tracing, measure sequence of operations  Profiling, omeasure percentage for tasks, otime relationship between tasks  Performance measurement, how fast it executes  Optimization, make tradeoffs for overall good oimprove speed, oimprove accuracy, oreduce memory, oreduce power, oreduce size, oreduce cost

4-3 Ramesh Yerraballi Debugging Intrusiveness  Intrusive Debugging  degree of perturbation caused by the debugging itself  how much the debugging slows down execution  Non-intrusive Debugging  characteristic or quality of a debugger  allows system to operate as if debugger did not exist  e.g., logic analyzer, ICE, BDM  Minimally intrusive  negligible effect on the system being debugged  e.g., dumps(ScanPoint) and monitors  Highly intrusive  print statements, breakpoints and single-stepping

4-4 Ramesh Yerraballi Debugging Aids in TExas Interface  uc – ViewBox, BreakPoints  stk – StackField, MemoryBox  Modes  FollowPC  CycleView  InstructionView  LogRecord  Single Step, Few, StepOver, StepOut, Run  Breakpoint versus ScanPoint Run time errors  Read from un- programmed ROM  Write to ROM  Read from un- initialized RAM  Read/write unimplemented I/O

4-5 Ramesh Yerraballi … Debugging  Instrumentation: Code we add to the system that aids in debugging  E.g., print statements  Good practice: Define instruments with specific pattern in their names  Use instruments that test a run time global flag oleaves a permanent copy of the debugging code ocausing it to suffer a runtime overhead osimplifies “on-site” customer support.  Use conditional compilation (or conditional assembly) oTExaS does not support conditional assembly oEasy to remove all instruments  Visualization: How the debugging information is displayed  We will look at the following examples *  Simple_DP512asm.zip  Square_DP512asm.zip *: Downloadable from Jon’s site:

4-6 Ramesh Yerraballi TExas in Real Mode We will run Simple in both Simulation mode and Real Mode. Note:  Use the cutout sheet between the 9S12 board and the breadboard to help identify pins  If you do not know the COM port then enter 0  Make all connections/disconnections with power supply off  Place 9S12 board in “LOAD” mode when loading and debugging code  To use embedded system mode(8 MHz) switch the board to RUN mode and you may disconnect the RS232 cable interface.  Is your PP7 light flashing three times slower in RUN mode

4-7 Ramesh Yerraballi Arithmetic Operations  Question 1. How many bits does it take to store the result of two unsigned 8-bit numbers added together?  Question 2. How many bits does it take to store the result of two unsigned 8-bit numbers subtracted?  Question 3. How many bits does it take to store the result of two unsigned 8-bit numbers multiplied together?

4-8 Ramesh Yerraballi … Arithmetic Operations  Question 4. How many bits does it take to store the result of two unsigned 8-bit numbers added together?  = 0, = to 510 is 9 bits  Question 5. How many bits does it take to store the result of two unsigned 8-bit numbers subtracted?  = -255, = to +255 is 9 bits  Question 6. How many bits does it take to store the result of two unsigned 8-bit numbers multiplied together?  0 * 0 = 0, 255*255 = to is 16 bits

4-9 Ramesh Yerraballi Add and Subtract Operations INH

4-10 Ramesh Yerraballi +,-: Condition Code Register  C set after an unsigned add if the answer is wrong  V set after a signed add if the answer is wrong

4-11 Ramesh Yerraballi Unsigned number wheel C bit Cleared C bit Set The carry bit, C, is set after an unsigned addition or subtraction when the result is incorrect.

4-12 Ramesh Yerraballi Trick  Whenever you directly add 2 unsigned 8-bit numbers and the answer is more than 255, C bit is SET. The final answer is obtained by subtracting 256 from the direct addition. For example: = 260, C = 1 and the actual answer is = 4

4-13 Ramesh Yerraballi Unsigned Number Wheel C bit ClearedC bit Set The carry bit, C, is normally set when we cross over from 255 to 0 while adding, or cross over from 0 to 255 while subtracting.

4-14 Ramesh Yerraballi Trick  Whenever you directly subtract 2 unsigned 8-bit numbers and the answer is negative, C bit is SET. The final answer is obtained by adding 256 to the direct subtraction. For example: = -250, C = 1 and the actual answer is = 6

4-15 Ramesh Yerraballi Signed Number Wheel V bit ClearedV bit Set The overflow bit, V, is set after a signed addition or subtraction when the result is incorrect.

4-16 Ramesh Yerraballi Signed Number Wheel V bit Cleared V bit Set The overflow bit, V, is normally set when we cross over from 127 to -128 while adding or cross over from -128 to 127 while subtracting.

4-17 Ramesh Yerraballi Addition Summary 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  V bit is set after a signed addition if result is incorrect  V =  C bit is set after an unsigned addition if result is incorrect  C =

4-18 Ramesh Yerraballi Subtraction Summary 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  V bit is set after a signed subtraction if result is incorrect  V =  C bit is set after an unsigned subtraction if result is incorrect  C =

4-19 Ramesh Yerraballi Problem When you perform (32 – 129) in an 8-bit system what is the status of the NZVC bits? Answer = 159 NZVC = 1011

4-20 Ramesh Yerraballi Unsigned Promotion  Promotion involves increasing the precision of the input numbers, and performing the operation at that higher precision decimal 8-bit 16-bit , ,0000,1110, , ,0000,0100, , ,0001,0010,0000

4-21 Ramesh Yerraballi Unsigned Ceiling and Floor

4-22 Ramesh Yerraballi Signed Promotion  To promote a signed number, we duplicate the sign bit decimal 8-bit 16-bit , ,1111,1010, , ,0000,0100, , ,1111,0110,0000

4-23 Ramesh Yerraballi Signed Ceiling and Floor