SEE3223 Microprocessors. 1: Embedded Systems. Muhammad Mun im Ahmad Zabidi

Similar documents
Microprocessor-Based Systems

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

Microcomputer Architecture and Programming


The Central Processing Unit

Microprocessors/Microcontrollers

Lecture Objectives. Introduction to Computing Chapter 0. Topics. Numbering Systems 04/09/2017

CS 101, Mock Computer Architecture

EE 308: Microcontrollers

MARIE: An Introduction to a Simple Computer

7/28/ Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc.

Computer Organization

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

3.1 Description of Microprocessor. 3.2 History of Microprocessor

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

5 Computer Organization

x86 Architectures; Assembly Language Basics of Assembly language for the x86 and x86_64 architectures

MARIE: An Introduction to a Simple Computer

EE 3170 Microcontroller Applications

Computer Architecture 2/26/01 Lecture #

Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad

Computer Systems Organization

CC312: Computer Organization

Computer Organization and Assembly Language (CS-506)

Chapter 4. MARIE: An Introduction to a Simple Computer

Introduction to Microprocessor

Lecture (01) Introducing Embedded Systems and the Microcontrollers By: Dr. Ahmed ElShafee

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Embedded Systems Design (630414) Lecture 1 Introduction to Embedded Systems Prof. Kasim M. Al-Aubidy Computer Eng. Dept.

CC411: Introduction To Microprocessors

COMPUTER ORGANIZATION AND ARCHITECTURE

Latches. IT 3123 Hardware and Software Concepts. Registers. The Little Man has Registers. Data Registers. Program Counter

Overview. Memory Classification Read-Only Memory (ROM) Random Access Memory (RAM) Functional Behavior of RAM. Implementing Static RAM

EMBEDDED SYSTEM BASICS AND APPLICATION

Calendar Description

Computers Are Your Future

IA-32 Architecture COE 205. Computer Organization and Assembly Language. Computer Engineering Department

COMP2121: Microprocessors and Interfacing. Introduction to Microprocessors

Microprocessor. Dr. Rabie A. Ramadan. Al-Azhar University Lecture 1

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

Chapter 4. Chapter 4 Objectives. MARIE: An Introduction to a Simple Computer

Computer Organization

Chapter 2 Logic Gates and Introduction to Computer Architecture

THE MICROCOMPUTER SYSTEM CHAPTER - 2

Week 1. Introduction to Microcomputers and Microprocessors, Computer Codes, Programming, and Operating Systems

ELEG3923 Microprocessor Ch.0 & Ch.1 Introduction to Microcontroller

Main Memory (RAM) Organisation

Dec Hex Bin ORG ; ZERO. Introduction To Computing

SAE5C Computer Organization and Architecture. Unit : I - V

5 Computer Organization

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

HCS12 Microcontroller and Embedded Systems: Using Assembly and C with CodeWarrior 1 st Edition

Segment 1A. Introduction to Microcomputer and Microprocessor

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Introduction to Microcontrollers

CHAPTER 4 MARIE: An Introduction to a Simple Computer

COA. Prepared By: Dhaval R. Patel Page 1. Q.1 Define MBR.

Assembly Language for Intel-Based Computers, 4 th Edition. Kip R. Irvine. Chapter 2: IA-32 Processor Architecture

INTRODUCTION TO INFORMATION & COMMUNICATION TECHNOLOGY (ICT) LECTURE 2 : WEEK 2 CSC-111-T

Components of a Computer System

Memory Study Material

Chapter One. Introduction to Computer System

In this tutorial, we will discuss the architecture, pin diagram and other key concepts of microprocessors.

INTRODUCTION TO COMPUTERS

Chapter 7: Processor and Memory

Computers and Microprocessors. Lecture 34 PHYS3360/AEP3630

MicroProcessor. MicroProcessor. MicroProcessor. MicroProcessor

In 8086 Carry flag, Parity flag, Auxiliary carry flag, Zero flag, Overflow flag, Trace flag, Interrupt flag, Direction flag, and Sign flag.

Memory classification:- Topics covered:- types,organization and working

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics

Chapter 4. Chapter 4 Objectives

Microprocessor Architecture. mywbut.com 1

Chapter 4 The Components of the System Unit

Concept of Memory. The memory of computer is broadly categories into two categories:

The x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language

Microcontrollers. Microcontroller

MICROPROCESSOR AND MICROCONTROLLER BASED SYSTEMS

Microcontroller Systems. ELET 3232 Topic 11: General Memory Interfacing

Introduction read-only memory random access memory

Wed. Aug 23 Announcements

Microcontroller Not just a case of you say tomarto and I say tomayto

machine cycle, the CPU: (a) Fetches an instruction, (b) Decodes the instruction, (c) Executes the instruction, and (d) Stores the result.

Microprocessors. Microprocessors and rpeanut. Memory. Eric McCreath

Microprocessors and rpeanut. Eric McCreath

Virtual Machines and Dynamic Translation: Implementing ISAs in Software

Chapter 9: A Closer Look at System Hardware

Chapter 9: A Closer Look at System Hardware 4

Computers Are Your Future

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

PDF created with pdffactory Pro trial version How Computer Memory Works by Jeff Tyson. Introduction to How Computer Memory Works

SYSTEM BUS AND MOCROPROCESSORS HISTORY

Microprocessor (COM 9323)

Chapter 4 The Components of the System Unit

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

CS429: Computer Organization and Architecture

Homeschool Enrichment. The System Unit: Processing & Memory

Lecture 2 Microcomputer Organization: Fig.1.1 Basic Components of Microcomputer

Processing Unit CS206T

Job Posting (Aug. 19) ECE 425. ARM7 Block Diagram. ARM Programming. Assembly Language Programming. ARM Architecture 9/7/2017. Microprocessor Systems

Transcription:

SEE3223 Microprocessors 1: Embedded Systems Muhammad Mun im Ahmad Zabidi (munim@utm.my)

Microprocessor-Based Systems Aims To review the main elements of a microprocessor system. Intended Learning Outcomes At the end of this module, students should be able to: Define and explain important terms associated with both hardware and software elements of a microprocessor system Tell the difference between general purpose computing and embedded computing List down the major components inside a computer & processor Tell the difference between computer, processor, microprocessor and microcontroller Explain instruction execution cycles of a generic microprocesso 1-2

SEE3223 Microprocessor Systems What s in this course: Assembly language programming Microprocessor concepts Hardware interfacing Pre-Requisites Number representation, coding, registers, state machines Realisation of simple logic circuits Integrated circuit technologies Designing with MSI components Flip-Flops Counters and sequential MSI components Register transfer logic 1-3

Reading List Required Text: Muhammad Mun im Ahmad Zabidi (2011), Sistem Terbenam dengan Mikropemproses 68000, Penerbit UTM Press. Recommended Readings: Antonakos, J.L. (2003), The 68000 Microprocessor: Hardware and Software Principles and Applications, 5 th Ed., Prentice Hall. Clements A.(1997), Microprocessor Systems Design: 68000 Software, Hardware and Intefacing, 3 rd Ed., PWS Kent Publishing. Walter A. Triebel, Avtar Singh (1991), The 68000 and 68020 Microprocessors, Prentice Hall. 1-4

Computing Systems Rapid pace of information technology is due to introduction of new microprocessors Most of us think of desktop computers PC Laptop Mainframe Server Maybe at most handheld computer (PDA) In this course, we will look at another type of computing system which is far more common that you ever imagined 1-5

Computer Classifications Classification of computers: Servers: Big, expensive, available 24x7 (read 24 by 7 or 24 hours a day, 7 days a week. Mainframes are old servers made by IBM. Desktops: computers on your desk Laptops: computers you carry in your bag PDA (personal digital assistants): computers you carry in your pocket Embedded systems: computers that don t look like computers! An embedded system is a type of computer 1-6

Embedded Systems Account for >99% of new microprocessors Consumer electronics Vehicle control systems Medical equipment Sensor networks Desktop processors (Intel Core, AMD Athlon, PowerPC, etc) combined is only 1% 1-7

Embedded Systems Simple definition: Computing systems embedded within electronic devices Nearly any computing system other than a desktop computer Designed to perform a specific function Billions of units produced yearly, versus millions of desktop units Take advantage of application characteristics to optimize the design As electrical or electronics engineers, you may be required to design an embedded system But you BUY (not design) a general purpose computer 1-8

General Purpose vs Embedded Systems General Purpose Intended to run a fully general set of applications End-user programmable Faster is always better Differentiating features: Speed (need not be fully predictable) Software compatibility Cost (eg RM3k vs RM5k per laptop) Embedded Runs a few applications often known at design time Not end-user programmable Operates in fixed run-time constraints, additional performance may not be useful/valuable Differentiating features: Power Cost (eg RM2 vs RM2.50) Size Speed (must be predictable) 1-9

A Computer System Simplified View CPU Memory Input/Output Address bus Data bus Control bus An embedded system also has the same structure but at a smaller size 1-10

Microprocessor Basic concept Address bus 16-bit / 32-bit / 64-bit wide CPU Data bus bidirectional 8-bit / 16-bit / 32-bit / 128-bit Control bus Timing signals, ready signals, interrupts etc Microprocessor, by-itself, completely useless must have external peripherals to Interact with outside world 1-11

Microprocessor Basic Concept Address Control CPU Boot ROM Used at startup Instruction (program) ROM Data RAM Transducers Keyboard Screen UART Parallel interface etc Data Microprocessor, by-itself, completely useless must have external peripherals to Interact with outside world 1-12

Glue Logic Every external device needs some glue logic to interface with the processor. Address Address Control External Device Address strobe Data strobe Read/write control Output Enable Interrupt signals etc Other Glue Logic Decode Logic Device itself with all necessary internal logic Control CS* chip select Data Data We ll study all the control signals when we study microprocessor hardware. 1-13

Microcontroller Basic concept Address Control CPU Boot ROM Program ROM Data RAM Transducers Some I/O Data Microcontroller - put a limited amount of most commonly used resources inside one chip 1-14

Microprocessor vs Microcontroller Microprocessor: A chip that contains only the processor Need other chips to make a working system More flexible Can have very few I/O or many I/O devices using the same processor chip Microcontroller: A chip that contains all the components of a computer processor, memory and input/ output Less flexibility Less component count in system Less powerful No matter what is the system size, the most important component is still the processor. 1-15

Other Processors in Embedded Systems Embedded Controllers: More powerful (32 bits) than microcontrollers (8 bits) Normally contains only processor and input/output, memory is external Digital Signal Processors: Embedded processors optimized for digital signal processing Commonly found in handphones, modems, communications systems Graphics Processors: Very powerful processors found in graphics cards of workstations Programmable Logic Controllers: Microprocessor boards usually found in industrial applications 1-16

To design a µp System, we must know Fundamentals: What s inside a computer What s inside a processor Programming: What happens in the processor when it s running a program What do we need to write a program How to create a program How to run a program How to fix a program error Hardware design: Timing diagrams Interfacing with other chips 1-17

Software Computer software Computer programs are known as software Program: Sequence of instructions that perform a task Think of it like playing music Instruction: The simplest operation performed by the processor Think of it as a note coming from a musical instrument How the computer works: Fetch an instruction from memory Decode the instruction Execute the instruction Repeat 1-18

Machine & Assembly Language Machine instruction A sequence of binary digits which can be executed by the processor, e.g. 0001 1011. Hard to understand for human being Assembly language An assembly program consists of assembly instructions An assembly instruction is a mnemonic representation of a machine instruction e.g. MUL may stand for multiply Assembly programs must be translated into object code before it can be executed -- translated by an assembler. Two types of assemblers: cross assembler and native assembler. Cross assembler runs on one computer and generates machine instructions that will be executed by another computer that has different instruction set Native assembler runs and generates instructions for the same computer. Drawbacks of assembly programs: Dependent on hardware organisation, difficult to understand long programs, low programmer productivity 1-19

High-level language (HLL) High-Level Language Syntax of a high-level language is similar to English A translator is required to translate the program written in a high-level language into object code -- done by a compiler. There are cross compilers that run on one one computer but translate programs into machine instructions to be executed on a computer with a different instruction set. Main drawback is slower execution speed of the machine code obtained after compiling an HLL program. However, C language has been extensively used in microcontroller programming in industry. 1-20

Central Processing Unit (CPU) Menyimpan maklumat Memproses Daftar Bas dalaman ALU Bas alamat Unit kawalan Bas data Bas kawalan Mengawal 1-21

Important Registers Program Counter (PC) Keeps track of program execution Address of next instruction to read from memory May have auto-increment feature or use ALU Some manufacturers call this register the Instruction Pointer (IP) Instruction Register (IR) Invisible to programmer Contains current instruction Includes ALU operation and address of operand Data Registers Stores data. For simple µp, it may be called accumulators. Address Registers Stores address of data. For special areas of memory, it may be called index registers, stack pointers or base registers. 1-22

The ALU Performs arithmetic & logic operations on several bits simultaneously The number of bits is a most important factor determining the capabilities of the processor Typical sizes: 4 bits (very small microcontroller: remote controllers) 8 bits (microcontrollers: 68HC05, 8051, PIC) 16 bits (low-end microprocessors: Intel 8086) 32 bits (most popular size today: Intel Core, PowerPC, 68000, ARM, MIPS) 64 bits (servers: IBM POWER & PowerPC G5, AMD Opteron, Intel Itanium) 1-23

Memory Looks like a very long list. Each row is called a memory location and has a unique address Each location stores the same number of bits, usually multiples of 8 bit (bytes) Number of addresses 2 N (where N is an integer). Alamat kedudukan Satu kedudukan 0 1 2 3 Satu sel 2 N -1 1-24

Memory Devices Read-Only Memory Non-volatile memory: contents is retained even without power In embedded systems, used to store application programs and test routines Contents can be set by fixing it during manufacturing or burning it using a programming device Common types include MROM, PROM, EPROM and flash memory Erasable types can only be rewritten a fixed number of times Random Access Memory Contents lost without power (volatile memory) Used to store temporary data. In embedded system, very little RAM is required. Some systems don t even have RAM at all! No limit to number of writes the device can handle Fast writes (unlike EPROM/EEPROM) Two major types are SRAM and DRAM 1-25

Memory Space and Address Bus Smallest transferable amount of data from memory to CPU (and vice versa) is one byte. Each byte has a unique location or address. The address of each byte is written in hexadecimal (hex). For 68000, the prefix $ means a hex value. The range of addresses accessible by the processor is the memory space. Limited by the size of the address bus From the programmer s point of view, 68000 address bus is 24 bits wide. Memory space is 0 to 2 24-1 (16777216 or 16 Megabyte) Written in hex as $000000 to $FFFFFF. 1-26

Word size and data bus size Width of data bus determines the amount of data transferable in one step Original 68000 has a 16 bit data bus Can transfer 1 word or 2 bytes at once A longword requires two transfers Current 68HC000 has a selectable bus width of 8 or 16 bits Selecting 8 bit data bus results in cheaper system but lower performance The maximum amount of memory for any 68000 system is 16 Mega locations x 1 byte/location = 16 Megabytes Can also be thought of 8 Megawords 1-27

Data & Address Buses 24-bit address bus CPU Memory 16-bit data bus Data bus 16 bits $000000 15 0 Address bus 24 bits 2 24-1= 8M locations $FFFFFF 1-28

Memory Read Operation 0000 10100000 0001 00110010 0002 01011111 Bas alamat 0003 11111111 0002 Bas data 01011111 0004 00000001 Perintah BACA FFFF 11111111 1-29

Memory Write Operation 0003 Bas alamat 10000001 Bas data 0000 0001 0002 0003 0004 10100000 00110010 01011111 11111111 00000001 10000001 Perintah TULIS FFFF 11111111 1-30

Memory Map System memory map summarizes the memory locations available to the programmer Must know the following before we can write any program RAM start and end ROM start and end I/O devices Very different from writing a program in C where we don t have to know all this $000000 $001FFF $002000 $01FFFF $002000 $01FFFF $020000 $FFFBFF $FFFC00 $FFFFFF Interrupt vectors ROM RAM Unused I/O devices The memory map of a typical system 1-31

Fetch-Execute Cycle The processor executes instructions one-by-one according to the sequence found in memory Everything is controlled by, what else, the control unit in the CPU. To execute an instruction, the processor must fetch it from memory. The complete steps the processor takes to execute one instruction is the instruction cycle or the fetch-execute cycle Fetch Execute 1-32

Instruction Cycle Details On program start: 0. Load the program counter (PC) with the address of the first instruction Fetch phase: 1. Read the instruction and put it into the instruction register (IR) 2. Control unit decodes the instruction; updates the PC for the next instruction Execute phase: 3. Find the data required by the instruction. 4. Perform the required operation. 5. Store the results. 6. Repeat from Step 1. 1-33

Instruction Sequencing Example an instruction to add the contents of two locations (A and B) and place result in a third register (C) Before you do anything: set PC to point to 1st instruction in the sequence Program Counter (PC) 12 Instruction Register (IR) Data Register 0 (D0) Addr Instructions 12 MOVE A,D0 14 ADD B,D0 16 MOVE D0,C 100 (A) = 4 102 (B) = 5 104 (C) 1-34

Instruction Sequencing Program Counter (PC) 14 Instruction Register (IR) MOVE A,D0 Data Register 0 (D0) 4 Addr Instructions 12 MOVE A,D0 14 ADD B,D0 16 MOVE D0,C 100 (A) = 4 102 (B) = 5 104 (C) 1-35

Instruction Sequencing Program Counter (PC) 16 Instruction Register (IR) ADD B,D0 Data Register 0 (D0) 9 Addr Instructions 12 MOVE A,D0 14 ADD B,D0 16 MOVE D0,C 100 (A) = 4 102 (B) = 5 104 (C) 1-36

Instruction Sequencing Program Counter (PC) 18 Instruction Register (IR) MOVE D0,C Data Register 0 (D0) 9 Addr Instructions 12 MOVE A,D0 14 ADD B,D0 16 MOVE D0,C 100 (A) = 4 102 (B) = 5 104 (C) = 9 1-37

Important ProcessorsYou Should Know Year Company Device Significance 1971 Intel 4004 1 st µp. A 4-bit device. 1974 Intel 8008 1 st 8-bit µp. Motorola 6800 1 st 8-bit µp from Motorola. Texas TMS 1000 First microcontroller. Can operate without support chips. 1978 Intel 8086 1 st 16-bit µp. 1979 Motorola 68000 16/32-bit µp : the data bus is 16 bits externally, but 32-bit internally. 1984 Motorola 68020 Full 32-bit µp derived from 68000. Has modern features such cache memory, floating-point unit & full support for modern operating systems. 1985 Intel 80386 32-bit µp from Intel, basically unchanged until Pentium of today. 1986 ARM ARM1 32-bit RISC chips designed for low-power. 1993 Apple/ Motorola/ IBM PowerPC 601 A RISC chip from Motorola derived from IBM POWER. Ended 68k s use as general purpose computing but the family continues to live in embedded systems until today. 1-38

Selecting a Microprocessor Choose the right one for your application Primary criteria: Cost, Power, Size, Speed Others: package options, integrated peripherals, potential for future growth Choose one with good software development support development environment - good compiler and debugger availability evaluation boards in-circuit emulators for those with deep pockets Operating system availability Other considerations Code density: affects power consumption, performance and system cost Hardware availability: make sure you can actually purchase the microcontroller before designing it in Prior expertise, licensing, etc 1-39

Summary Microprocessors and embedded controllers are a ubiquitous part of life today Concept of a microprocessor & microcontroller Understand how a µp works Headhunters report that EEs familiar with µc, µp design are in the highest possible demand Web Resources: How Microprocessors Work: http://computer.howstuffworks.com/microprocessor.htm http://www.intel.com/education/mpworks/ http://www.cse.psu.edu/~cg471/03f/hw/pj5/how-micro.html Great Microprocessors of the Past and Present: http://www.sasktelwebsite.net/jbayko/cpu.html Great Moments in Microprocessor History: http://www-128.ibm.com/developerworks/library/pa-microhist.html 1-40