Computer Organization and Programming

Similar documents
User. Application program. Interfaces. Operating system. Hardware

Computer Organization and Levels of Abstraction

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

EE292: Fundamentals of ECE

Information Science 1

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Computer Organization and Levels of Abstraction

Definitions. 03 Logic networks Boolean algebra. Boolean set: B 0,

Assembly Language. Prof. Dr. Antônio Augusto Fröhlich. Sep 2006

Logic Design: Part 2

Computer Architecture and Assembly Language. Spring

1. Draw general diagram of computer showing different logical components (3)

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

CC411: Introduction To Microprocessors

A Review of Chapter 5 and. CSc 2010 Spring 2012 Instructor: Qian Hu

ECE232: Hardware Organization and Design

Arab Open University. Computer Organization and Architecture - T103

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

Mark II Aiken Relay Calculator

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

Combinational Logic Circuits

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

1. Mark the correct statement(s)

Computer Organization

M1 Computers and Data

Chapter 2 Data Manipulation

Lecture 3: Binary Subtraction, Switching Algebra, Gates, and Algebraic Expressions

5 Computer Organization

Computer Organization

Representation of Information

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

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.


Computer Architecture 2/26/01 Lecture #

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Chapter. Computer Architecture

IB Computer Science Topic.2-

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

2c. Content of Computer systems (Component 01)

Review. EECS Components and Design Techniques for Digital Systems. Lec 05 Boolean Logic 9/4-04. Seq. Circuit Behavior. Outline.

EE 3170 Microcontroller Applications

Computer Organization MIPS ISA

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Chapter Overview. Welcome to Assembly Language

Introduction. Arizona State University 1

Digital Systems. John SUM Institute of Technology Management National Chung Hsing University Taichung, ROC. December 6, 2012

Electricity: Voltage. Gate: A signal enters the gate at a certain voltage. The gate performs operations on it, and sends it out was a new signal.

CS 261 Fall Binary Information (convert to hex) Mike Lam, Professor

Unit-IV Boolean Algebra

Chapter One. Introduction to Computer System

Typical Processor Execution Cycle

Learning objectives. Computer principles The characteristics of contemporary processors, input, output and storage devices

Introduction to Computers - Chapter 4

Computer Architecture

17. Instruction Sets: Characteristics and Functions

Processor design - MIPS

Why Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

STRUCTURE OF DESKTOP COMPUTERS

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

5 Computer Organization

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...

Code No: R Set No. 1

LECTURE 4. Logic Design

Computer Architecture Dr. Charles Kim Howard University

N.B. These pastpapers may rely on the knowledge gained from the previous chapters.

ECE232: Hardware Organization and Design

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Operations, Operands, and Instructions

CN310 Microprocessor Systems Design

Computer Organization Question Bank

l l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

Instruction Set Architectures. CS301 Prof. Szajda

Practical Malware Analysis

World Inside a Computer is Binary

M. Sc (CS) (II Semester) Examination, Subject: Computer System Architecture Paper Code: M.Sc-CS-203. Time: Three Hours] [Maximum Marks: 60

Computer Organization

An Introduction to Computers and Java CSC 121 Spring 2015 Howard Rosenthal

CS 105 Review Questions #3

Computer Organization

About the Presentations

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

Diskrečioji matematika

COMPUTER SYSTEM. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U

Microcontrollers. Microcontroller

CPE300: Digital System Architecture and Design

Computer Architecture

Introduction to Computer Architecture

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

SWITCHING THEORY AND LOGIC CIRCUITS

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

ECED3204: Microprocessor Part I--Introduction

2. BOOLEAN ALGEBRA 2.1 INTRODUCTION

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

EC 413 Computer Organization

2.6 BOOLEAN FUNCTIONS

DIGITAL ELECTRONICS. P41l 3 HOURS

Transcription:

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 8 Computer Organization and Programming Prof. Dr. Antônio Augusto Fröhlich guto@lisha.ufsc.br http://www.lisha.ufsc.br/~guto Sep 2006

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 9 Outline Computer Organization and Programming Data Representation Boolean Algebra Basic Computing System Components Instruction Set Architecture Program translation into machine language (lab)

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 10 Numbering Systems Decimal System (humans) Base 10 123 = 1 x 10 2 + 2 x 10 1 + 3 x 10 0 123.456 = 1 x 10 2 + 2 x 10 1 + 3 x 10 0 + 4 x 10 1 + 5 x 10 2 + 6 x 10 3 Binary System (computers) Base 2 Represented in digital systems by two voltage levels 11001010 = 1 x 2 7 + 1 x 2 6 + 0 x 2 5 + 0 x 2 4 + 1 x 2 3 + 0 x 2 2 + 1 x 2 1 + 0 x 2 0 = 128 + 64 + 8 + 2 = 202

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 11 Numbering Systems Hexadecimal System (assembly) Base 16 (0..9, A, B, C, D, E, F) 1234 = 1 x 16 3 + 2 x 16 2 + 3 x 16 1 + 4 x 16 0 = 4096 + 512 + 48 + 4 = 4660 Hexadecimal < > Binary Four bits hold an hexadecimal digit 0x0 = 0000, 0x1 = 0001,..., 0xf = 1111

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 12 Numbering Systems Two's Complement Binary System Base 2 Signed integers Most significant bit holds the sign 0 => positive, number stored as ordinary binary 1 => negative, number stored as two's complement Two's complement operation Invert all bits (NOT) Add 1 4 bit 0000 = 0, 0001 = 1, 1000 = 8, 1111 = 1

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 13 Numbering Systems Two's Complement Binary System Computers can implement subtraction using the adder circuitry 5 3 = 5 + 3 = 0101 + 1101 = 0010 = 2 Sign extension n bit number to m bit number, with m > n 3 Copy the sign bit into the extra bits Semantics is always preserved 4 bit 8 bit 16 bit => 1101 (0xd) => 11111101 (0xfd) => 1111111111111101 (0xfffd)

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 14 Bits and Bytes Bit (Binary digit) Smallest unit of information in computing A bit has a single binary value, either 0 or 1 Bits group to form nibbles (4 bits), bytes (8 bits) and words (2 (n >= 3) bits) Byte Eight bit value (today, was not always like that) Bit 0 is the low order bit or least significant bit Bit 7 is the high order bit or most significant bit Can hold an ASCII character

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 15 Bytes and Words Word Natural unit of data in a computer Fixed size group of bits that are handled together by the machine Influence the size of registers, ULA, memory and I/O buses Typical sizes: 8, 16, 32, 64 bits 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 high order byte low order byte

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 16 Endianness Big endian (Motorola, SPARC, PowerPC) Most significant byte (MSB) is stored at the memory location with the lowest address 0x12345678 at 100 Little endian (Intel) Least significant byte (LSB) is stored at the memory location with the lowest address 0x12345678 at 100 99 100 101 102 103 104 12 34 56 78 99 100 101 102 103 104 78 56 34 12

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 17 Boolean Algebra: Definition A Boolean algebra is a set A, supplied with two binary operations (AND), (OR), a unary operation (NOT) and two elements 0 (zero) and 1 (one), such that, for all elements a, b and c of set A, the following axioms hold:

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 18 Boolean Algebra: Axioms Associativity a (b c) = (a b) c a (b c) = (a b) c Commutativity a b = b a a b = b a Absorption a (a b) = a a (a b) = a Distributivity a (b c) = (a b) (a c) a (b c) = (a b) (a c) Complements

Boolean Algebra: Identities Idempotency a a = a a a = a Boundedness a 0 = a a 1 = a a 1 = 1 a 0 = 0 Complements 0 = 1 1 = 0 De Morgan's laws (a b) = a b (a b) = a b Involution a = a Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 19

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 20 Truth Tables Can represent boolean functions OR OR 0 1 AND AND 0 1 0 0 1 0 0 0 1 1 1 1 0 1 Four varible function F = AB + CD BA 00 01 10 11 00 0 0 0 1 01 0 0 0 1 DC 10 0 0 0 1 11 1 1 1 1

Truth Tables Alternative representation BA F = AB + C 00 01 10 11 0 0 0 0 1 C 1 1 1 1 1 Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 21

Truth Tables Alternative representation C B A F = ABC F = AB + C F = A + BC 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 22

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 23 Canonical Forms Allows for function simplification For any given boolean function there exists a unique canonical form Disjunction of minterms (sums of products) Minterm is a logical expression of n variables consisting of only the logical conjunction operator and the complement operator Three variables: A'B'C', AB'C', A'BC', ABC', A'B'C, AB'C, A'BC, ABC F = AB + C = ABC+A'BC+AB'C+A'B'C+ABC'

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 24 Canonical Forms Conjunction of maxterms (product of sums) Maxterm is a logical expression of n variables consisting of only the logical disjunction operator and the complement operator Three variables: A'+B'+C', A+B'+C', A'+B+C', A+B+C', A'+B'+C, A+B'+C, A'+B+C, A+B+C F = AB + C = (A+B+C) (A'+B+C) (A+B'+C)

Basic Computer Organization Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 25

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 26 Central Processing Unit Processor Interprets instructions and operates on data Elements Control Unit Controls the CPU, fetches instructions and data for the ALU Arithmetic and Logic Unit (ALU) Perform arithmetic and logic operations on data stored in registers Registers Holds data being manipulated by the ALU

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 27 Main Memory Stores data and instructions Von Neumann: single memory Harvard: separate memories Read/write access Usually byte addressed (not word addressed anymore) Technologies RAM, ROM, EEPROM, Flash

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 28 I/O Devices Connect the computer to the world Devices are usually connected through secondary buses (i.e. ISA, PCI, VME, USB) Input Storage Keyboard, mouse Output Monitor, printer Disk, DVD, flash Network Ethernet, Wi Fi

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 29 System Bus Interconnect system components CPU Memory I/O devices Signals Addresses Data Control R/W, I/O, INT, REQ, GRANT, CLOCK

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 30 Instruction Set Architecture An instruction set, or instruction set architecture (ISA), is the part of the computer architecture related to programming, including the native data types, instructions, registers, addressing modes, memory architecture, interrupt and exception handling, and external I/O. An ISA includes a specification of the set of opcodes (machine language), the native commands implemented by a particular CPU design. (Wikipedia)

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 31 Instruction Sets X CPU Storage Internal storage in the CPU Stack (operands on the top of the stack) Accumulator (single accumulator register ) Set of registers C = A + B Stack Accumulator Register push A load A load r1, A push B add B add r1, B add store C store C, r1 pop C

Sep 2006 Prof. Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 32 Register Machines Number of operands for ALU instructions add r1, r2 (r1 < r1 + r2) add r1, r2, r3 (r1 < r2 + r3) Number of memory operands for ALU instructions Zero (register register) add r1, r2 (r1 < r1 + r2) One (register memory) add r1, B (r1 < r1 + B) Many (memory memory) add C, A, B (C < A + B)