1 COMS 261 Computer Science I Title: Computer Organization Date: September 1, 2005 Lecture Number: 2.

Slides:



Advertisements
Similar presentations
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Advertisements

Lecture 1: Overview of Computers & Programming
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Fundamentals and a Brief History of Computer Systems.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1.
The Analytical Engine Module 6 Program Translation.
Lecture 1: Intro to Computers Yoni Fridman 6/28/01 6/28/01.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Introduction to Microprocessors Number Systems and Conversions No /6/00 Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
Chapter 1: An Overview of Computers and Programming Languages
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Topic 1: Introduction to Computers and Programming
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
The CPU The Central Presentation Unit Language Levels Fetch execute cycle Processor speed.
Chapter 1 - Introduction. Ch 1Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
COMP Computer Basics Yi Hong May 13, 2015.
What is a Computer?  A computer is a device capable of performing computations and making logical decisions. It is a device for solving problems.  Some.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Introduction COMP104: Fundamentals and Methodology.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
Topics Introduction Hardware and Software How Computers Store Data
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
Computer Systems Organization CS 1428 Foundations of Computer Science.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization.
1 COMS 261 Computer Science I Title: C++ Fundamentals Date: September 05, 2005 Lecture Number: 4.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
8086/8088 Instruction Set, Machine Codes and Addressing Modes.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Chapter 1 An Overview of Computers and Programming Languages.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. Introduction to Computers and Computing.
Chapter 1: Introduction to Computers and Programming.
INTRODUCTION TO COMPUTER PROGRAMMING ITC-314. Computer Programming  Computer Programming means creating a sequence of instructions to enable a computer.
Computer Basics.
Chapter 1 Introduction 2nd Semester H
Computer Architecture and Number Systems
Computer Hardware What is a CPU.
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Computer Science I CSC 135.
Computers: Hardware and Software
Topics Introduction Hardware and Software How Computers Store Data
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
COMS 361 Computer Organization
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

1 COMS 261 Computer Science I Title: Computer Organization Date: September 1, 2005 Lecture Number: 2

2 Announcements Homework 1 –Due Monday, 9/5/05

3 Review Rules of the game –Any questions?

4 Outline Computing Terminology –Decimal to binary conversion –Fetch/Execute cycle –Programming High-Level language Assembly language Machine Language –Think – Edit – Compile - Test Cycle

5 Computing Terminology Computer system –Components Hardware: physical devices –Processor, disk drive, graphics card, RAM, … Software: tells the computer what to do –FireFox, Outlook, PowerPoint, Unreal Tournament, … –Development is difficult »Not just sitting at a computer and typing »Different methodologies have emerged, Object-Oriented

6 Computing Terminology Measurements –Important way Computer Scientists communicate –Machine performance Amount of time it takes a machine to perform a basic operation

7 Computing Terminology Measurements(Cont.) thousandths10 -3 milli, m millionths10 -6 micro, u billionths10 -9 nano, n trillionths pico, p quadrillionth femto, f quintillionth atto, a sextillionth zepto, z septillion yocto, y

8 Computing Terminology Measurements(Cont.) –Another (incorrect) measure of machine performance Clock rate –Measured in cycles/second, hertz (Hz)

9 Computing Terminology Measurements(Cont.) thousands10 3 kilo, K millions10 6 mega, M billions10 9 giga, G trillions10 12 tera, T

10 Computing Terminology –Caution Capacity measures are made using powers of 2’s, not 10’s The abbreviations are the same, K, M, G, … Scientific Units Latin SI Prefixes Computer Science Units 10 3 = 1,000thousandskilo, K2 10 = = 1,000,000millionsmega, M2 20 = 1,048, = 1,000,000,000billionsgiga, G2 30 = 1,073,741, = 1,000,000,000,000 trillionstera, T 2 40 = 1,099,511,627,776

11 Computing Terminology Scientific UnitsLatinSI Prefixes Computer Science Units = 1,000,000,000,000,000Quadrillionpeta, P 2 50 = = 1,000,000,000,000,000,000Quintillionexa, E 2 60 = = 1,000,000,000,000,000,000,000Sextillionzetta, Z 2 70 = = 1,000,000,000,000,000,000,000,000 Septillionyotta, Y 2 80 = = 1,000,000,000,000,000,000,000,000,000 OctillionNobi, Ni 2 90 = = 1,000,000,000,000,000,000,000,000,000,000 NonillionDebi, Di =

12 Computer Organization Most computers have 4 main parts Main Memory Input DevicesOutput Devices Central Processing Unit (CPU)

13 CPU Brains of the computer Consists of two components –Arithmetic calculations are performed using the Arithmetic/Logical Unit or ALU –Control unit decodes and executes instructions Arithmetic operations are performed using binary number system

14 Control Unit The CPU uses a fetch/execute cycle to execute instructions Performing the action specified by an instruction is known as executing the instruction The program counter (PC) holds the memory address of the next instruction –Special purpose register

15 Fetch/Execute Cycle Computers are stupid –They can only perform Simple Well defined Very specific tasks –Instructions: The tasks a computer can do Different programs or applications result from different sets (or sequences) of instructions –A computer (even the most powerful) simply get instructions and execute them

16 Fetch/Execute Cycle Fetch the next instruction from memory Execute the current instruction Program Counter (PC) Update the PC to reference the next instruction And Ya Don’t Stop, And Ya Don’t Quit

17 Number Systems Computers use a positional numbering system –Positions of digits in a number have meaning The decimal number system (base 10) is a positional system 28 has a different meaning than 82 –Even though the same digits are used Base raised to its positional power

18 Number Systems Likewise –The binary number system is also positional So, we learned that

19 Number Systems –Which of course does not make any sense unless you indicate the quantity 1011 is a binary representation 11 is a decimal representation –We denote numbers with their base Note: the smaller the base, the more the number of digits needed to represent the quantity

Windows ®, UNIX ®, Mac OS X ® Controls and manages the computing resources –Important services provided by an operating system File system –Directories, folders, files Operating System

–Commands that allow for manipulation of the file system Sort, delete, copy –Ability to perform input and output on a variety of devices –Management of the running systems Operating System

22 Decimal to Binary Conversion Convert Procedure –Find the highest power of the base (2) the number will divide Find the highest power so that the base raised to that power is less than or equal to the given number

23 Decimal to Binary Conversion 2 4 = is larger than 11 10, while 2 3 = 8 10 is less than or equal to –There is a 2 3 in the binary representation of the number –Subtract the base raised to the highest power from the number to convert

24 Decimal to Binary Conversion –Find the highest power of 2 the remainder will divide 2 2 = 4 is larger than 3 10 –There is not a 2 2 in the binary representation of = 2 is less than or equal to 3 10 –There is a 2 1 in the binary representation of –Subtract the base raised to the highest power from the remainder

25 Decimal to Binary Conversion –Find the highest power of the base (2) the remainder will divide 2 0 = 1 is the same as 1 10 –There is a 2 0 in the binary representation of 11 10

26 Decimal to Binary Conversion –Subtract the base raised to the highest power from the remainder No remainder, and no more powers of 2, therefore

27 Other Representations There are other representations of quantities –Octal: base 8 –Hexadecimal: base 16 Conversions between the representations

28 Two’s Complement Used by almost all computers Binary representation Includes negative numbers Contains one representation for the quantity 0 Arithmetic operations –Simpler to perform –Result in a two’s complement number No extra conversion must take place

29 Programming Programs are specific sequences of instructions –Instructions are primitive operations Move data from one place to another Add two items together Check a value for equivalence to zero …

30 Programming –Instructions have a binary representation or encoding Advantageous to have all instructions be a constant number of bits Typically composed of several fields (groups of bits)

31 Programming –Instruction set The set of legal instructions for a particular machine –MIPS –Intel –AMD Legal bit patterns recognized by the machine

32 Programming May mean add the contents of two registers and put the result in a third register in the MIPS processor, while it may no be a part of the instruction set for the Intel processor

33 Programming It is possible to write a program in binary instructions –The binary instruction set is also called machine language Varies from processor to processor

34 Programming Do software developers write programs in machine language? –NO Tedious Error prone, single bit out of place Specific to only one machine –Said to be not portable Difficult to maintain and change Impossible for someone else to work on the program

35 Machine Language Programs written using the binary instruction set are said to be written in machine language –The resulting list of instructions is called machine code, also called object code

36 Assembly Language Assembly language –A language directly related to machine language –each instruction has a unique symbol associated with it –Assembly language programmers use the symbols that represent instructions instead of the binary instructions –An assembler converts the symbols into machine language (instructions)

37 Assembly Language push ebp mov ebp,esp sub esp,0x8 mov eax,0xcccccccc mov dword ptr [esp],eax mov dword ptr [esp+0x4],eax mov dword ptr [ebp-0x4],0x6 mov eax,dword ptr [ebp-0x4] mov dword ptr [ebp-0x8],eax mov eax,0x0 leave ret near mnemonics arguments Example assembly language program

38 Assembly Programming Assembler Machine Language Program Execute (run) Program Assembly Language Program Think Editor Object Code Different Input Test Cases

39 Programming Machine language –Low-level programming –Binary language Assembly language –Higher-level programming Still pretty low-level –Mnemonics simplify programming

40 Programming Assembly language(Cont.) –May also include Pseudo instructions Mnemonics can encapsulate one or more machine instructions –Simpler than machine language Still tedious Error prone Not portable Difficult to maintain

41 HLL Programming High-level languages –More English like –Powerful constructs –Simpler to write and maintain code –More portable

42 HLL Programming High-level languages(Cont.) –Popular high-level languages C C++ Java Fortran Perl Smalltalk Scheme …

43 HLL Programming Code reusability –Many operations are common to most programs Printing to the console (screen) or a file Mathematical routines String processing Etc, …

44 HLL Programming Code reusability(Cont.) –Most useful to have common routines already compiled into machine language (object code) –Libraries are the object code for groups of related routines packaged into a single file

45 HLL Programming Code reusability(Cont.) –Libraries and different object files must be combined forming a single executable file Linking and the linker –Linking is the process of combining different files of object code into a single executable file –The linker is a program that performs the linking

46 HLL Programming Machine Language Program Think Assembler Editor Compiler Assembly Language Program C++/Fortran Language Program Math Library Object Code Linker Execute (run) Program

47 IDE’s Integrated Development Environments –Provides one user interface for the development process Editor, Compiler, Linker, Loader, Debugger, Viewer –We will be using the CodeWarrior IDE throughout this course