An Introduction to Microprocessors

Slides:



Advertisements
Similar presentations
Logic Gates Flip-Flops Registers Adders
Advertisements

ADDER, HALF ADDER & FULL ADDER
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
Number Representation and Logic Design CS 3220 Fall 2014 Hadi Esmaeilzadeh Georgia Institute of Technology Some slides adopted from.
LOGIC GATES ADDERS FLIP-FLOPS REGISTERS Digital Electronics Mark Neil - Microprocessor Course 1.
2-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Fundamentals of Digital.
Digital Circuits. Analog and Digital Signals Noise margins in Logic Circuits VMVM.
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
CSU0014 Assembly Languages Homepage: Textbook: Kip R. Irvine, Assembly Language for Intel-Based Computers,
Binary Numbers.
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Assembly Language for x86 Processors 7th Edition
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers citation and following credit line is included:
ELE22MIC Lecture 3 Paul Main’s Office Location has moved to Pysical Sciences 2 Room 107 Will be available for 2 hours consultation 10am - 12am after Tuesday.
CS1Q Computer Systems Lecture 9 Simon Gay. Lecture 9CS1Q Computer Systems - Simon Gay2 Addition We want to be able to do arithmetic on computers and therefore.
Foundations of Computer Science Computing …it is all about Data Representation, Storage, Processing, and Communication of Data 10/4/20151CS 112 – Foundations.
1 DIGITAL ELECTRONICS. 2 OVERVIEW –electronic circuits capable of carrying out logical (boolean) and arithmetic operations on information stored as binary.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
1 DLD Lecture 18 Recap. 2 Recap °Number System/Inter-conversion, Complements °Boolean Algebra °More Logic Functions: NAND, NOR, XOR °Minimization with.
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
Logic Design / Processor and Control Units Tony Diep.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
Number Representation and Arithmetic Circuits
WORKING PRINCIPLE OF DIGITAL LOGIC
4–1. BSCS 5 th Semester Introduction Logic diagram: a graphical representation of a circuit –Each type of gate is represented by a specific graphical.
Explain Half Adder and Full Adder with Truth Table.
LOGIC CIRCUITLOGIC CIRCUIT. Goal To understand how digital a computer can work, at the lowest level. To understand what is possible and the limitations.
Appendix C Basics of Logic Design. Appendix C — Logic Basic — 2 Logic Design Basics §4.2 Logic Design Conventions Objective: To understand how to build.
REGISTER TRANSFER AND MICROOPERATIONS
Chapter 1 Digital Systems and Binary Numbers
3 – Boolean Logic and Logic Gates 4 – Binary Numbers
Invitation to Computer Science, C++ Version, Fourth Edition
Combinational Circuits
Prof. Sin-Min Lee Department of Computer Science
Computer Code.
Chapter 4 Operations on Bits.
Digital Logic and Computer Organization
Computer Organisation
Assembly Language (CSW 353)
REGISTER TRANSFER AND MICROOPERATIONS
Data Representation Binary Numbers Binary Addition
Lesson Objectives Aims
Computer Architecture & Operations I
Chapter 1 Digital Systems and Binary Numbers
University of Gujrat Department of Computer Science
Invitation to Computer Science, Java Version, Third Edition
An Introduction to Microprocessors
Binary – Octal - Hexadecimal
CS105 Introduction to Computer Concepts GATES and CIRCUITS
Data Representation Data Types Complements Fixed Point Representation
Digital Electronics & Logic Design
CS/COE0447 Computer Organization & Assembly Language
ELL100: INTRODUCTION TO ELECTRICAL ENGG.
Number Systems Decimal (base 10) { }
Week 7: Gates and Circuits: PART II
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
C1 Number systems.
Binary Numbers.
COMS 361 Computer Organization
AWIM Series Lawndale High School Experiment 6 Dec, 2017
Logic Circuits I Lecture 3.
Combinational Circuits
Copyright © Cengage Learning. All rights reserved.
Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter) CSIT 301 (Blum)
Digital Circuits and Logic
Computer Architecture
Two’s Complement & Binary Arithmetic
Presentation transcript:

An Introduction to Microprocessors 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 Outline: Numerical representations Registers and Adders ATmega103 architecture AVR assembly language Elementary example program STUDIO3.52 AVR Assembler Downloading with PonyProg 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 Numbers in a computer: Computers store arithmetic units called bits.  Each bit is represented by an electrical signal which is either high or low (voltage levels). high  1 and low  0 Often high  0 and low  1 Normal Logic Inverse Logic 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 High and Low In this course we use TTL or TTL-like (CMOS) technology : Transistor Transistor Logic (TTL) NO MAN’S LAND 74LSxx 0.8 – 0.4 Volts 2.0 – 2.4 Volts CMOS NO MAN’S LAND 74HCxx 1.0 – 0.1 Volts 3.5 – 4.9 Volts ‘High’ 1 ‘Low’ 0 It is actually a bit more complicated than this since there are actually different thresholds for inputs and outputs and noise margins (indicated here in RED) but this may be addressed later If time permits. 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Making a Zero or and One How do you actually make a 0 or 1 ? It is clear that depending upon the switch position the line will be either ‘0’ or ‘1’ Logic Signal 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Storing Zeros and Ones: Registers Registers are electronic devices capable of storing 0 or 1 D-FLIP-FLOPs are the most elementary registers which can store one bit 8 DFFs clocked together make an one byte register 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 The D-Flip-Flop (DFF) STORED O DAT S Q D S,R, Q-bar are Signals with Complement Logic 74F74 CLK Q R O CLK D S R Q !Q X L H  One can Set or Reset (Clear) the DFF using S or R On the rising edge of the clock the data are transferred and stored in Q. 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 Byte Register Byte register that stores a byte DAT-7 Q-7 S Q       D Q R Byte coming in Byte Stored O O O O Q-0 DAT-0 S Q D Q R CLK O 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 Byte Register I It exists in one package : E DAT-7 Q-7       74F374 Byte coming in Byte Stored Q-0 DAT-0 CLK 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 Bits & Bytes : Bit 1,0 Nibble 4 bits Byte 8 bits Word 16 bits or 2 bytes 1Kbyte = 1024 Bytes = 8Kbits 1Mbyte = 1024 Kbytes = 8*1024 Kbits 1Gbyte = 1024 Mbytes =…… 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Binary Representation This representation is based on powers of 2. Any number can be expressed in terms of 0 and 1 Example: 5 = 1012 = 1* 22 + 0*21 + 1*20 Example: 9 = 10012 = 1* 23 + 0* 22 + 0*21 + 1*20 Exercise: Convert any way you can the numbers 19, 38, 58 from decimal to binary. (use calculator or C program) 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Hexadecimal Representation This representation is based on powers of 16. Any number can be expressed in terms of: 0, 1, 2,…,9,A,B,C,D,E,F (0,1,2,…,9,10,11,12,13,14,15) Example: 256 = 10016 = 1* 162 + 0*161 + 0*160 Example: 1002 = 3EA16 = 3* 162 + 14*161 + 10*160 Exercise: Convert any way you can the numbers 1492, 3481, 558 from decimal to hex. (use calculator or C program) 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 Boolean Operations NOT: NOT(101) = 010 AND: AND(10101 ; 01010) = 0 OR : OR(10101; 01010) = 11111 SHIFT L: SHIFT L(111) = 1110 SHIFT R: SHIFT R(111) = 011 Why shift is Important ? Try SHIFT R(011) Exercise: (1) Find NOT(AAA) (2) Find OR(AAA; 555) (3) Find AND (AEB123; FFF000) 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 Negative Numbers How do you represent negative numbers ? Using 2’s Complement Arithmetic Recipe : Take the complement of the number and add 1. Example: Consider the number 3 = 0112 Then –3 is NOT(011) + 1 = 100 + 1 = 101 Exercise: Consider a 4 bit machine. Derive all possible positive and negative numbers 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 4-bit Negative Numbers Integer Sign Magnitude 2’s complement +7 0111 +6 0110 +5 0101 +4 0100 +3 0011 +2 0010 +1 0001 0000 -1 1001 1111 -2 1010 1110 -3 1011 1101 -4 1100 -5 -6 -7 -8 1000 (-0) 1000 Consider a 4 bit machine. Find all positive and negative numbers you can have: 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 Characters The English characters you see on your computer screen are made also by using numbers. There is an one-to-one correspondence between all characters and a set of byte numbers world-wide. The computers know to interpret these bytes as characters. 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Characters and the ASCII System 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

How do the computers do all these ? You may remember from the first year the gates that form an AND, OR, NOT: Any Digital device can be made out of either ORs and NOTs or ANDs and NOTs. Truth Tables : A B AND 1 A B OR 1 A NOT 1 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 DeMorgan’s Theorem You can swap ANDs with ORs if at the same time you invert all inputs and outputs : = Exercise: Write to truth table for both and prove that this is correct 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

An AND out of NOTs and ORs Exercise: Test the claim that you can make any logic device exclusively out of NOTs and ORs by making and AND out of NOTs and ORs: = f( , ) 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 Answer: One can test explicitly that this device has an identical truth table as the AND gate. 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Exercise: Exclusive OR Construct an exclusive OR gate using OR, AND, AND NOT: A B XOR 1 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 The Exclusive OR Solution: = A B XOR 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 The D-Flip Flop Making a DFF using gates A A B X Y H L Undefined X B A Y B X Y 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Costas Foudas, Imperial College, Rm: 508, x47590 How do Computers Add ? Make a 2 bit adder with a carry_in and a carry out : Cin A B SUM Cout 1 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Two Bit Adder with Carry Answer: 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

Arithmetic Logic Unit (ALU) Center of every computer: 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590

You can actually design one yourself with what you already know The Arithmetic Overflow Flag is stored here The result is stored in this register Eight Bits Wide Bus. 2 Bit adders with carry-in and carry-out 7/5/2019 Costas Foudas, Imperial College, Rm: 508, x47590