1 CS/COE0447 Computer Organization & Assembly Language Pre-Chapter 2.

Slides:



Advertisements
Similar presentations
DAP teaching computer architecture at Berkeley since 1977
Advertisements

Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
Chapter 2 — Instructions: Language of the Computer — 1 Branching Far Away If branch target is too far to encode with 16-bit offset, assembler rewrites.
Instruction Set Architecture Classification According to the type of internal storage in a processor the basic types are Stack Accumulator General Purpose.
Chapter 2 Instructions: Language of the Computer Part III.
Midterm Wednesday Chapter 1-3: Number /character representation and conversion Number arithmetic Combinational logic elements and design (DeMorgan’s Law)
Level ISA3: Information Representation
Instruction Representation II (1) Fall 2007 Lecture 10: Instruction Representation II.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
The central processing unit and main memory chapter 4, Exploring the Digital Domain The Development and Basic Organization of Computers.
State Machines Used to Design Sequential Circuits.
Lecture 7: Instruction Set Architecture CSE 30: Computer Organization and Systems Programming Winter 2014 Diba Mirza Dept. of Computer Science and Engineering.
CEG 320/520: Computer Organization and Assembly Language Programming1 CEG 320/520 Computer Organization and Assembly Language Programming.
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
CSU0014 Assembly Languages Homepage: Textbook: Kip R. Irvine, Assembly Language for Intel-Based Computers,
Numbering Systems. CSCE 1062 Outline What is a Numbering System Review of decimal numbering system Binary representation range Hexadecimal numbering system.
Overview of Computing. Computer Science What is computer science? The systematic study of computing systems and computation. Contains theories for understanding.
Instruction Set Architecture
Comp Sci 251 Intro 1 Computer organization and assembly language Wing Huen.
Computer Systems Organization CS 1428 Foundations of Computer Science.
COMP3221 lec04--prog-model.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 4: Programmer’s Model of Microprocessors
Number Systems What is the Standard Base we
Chapter 4 MARIE: An Introduction to a Simple Computer.
Chapter 2: The Logic of Compound Statements 2.5 Application: Number Systems and Circuits for Addition 1 Counting in binary is just like counting in decimal.
CMSC 104, Lecture 051 Binary / Hex Binary and Hex The number systems of Computer Science.
CSC321 Making a Computer Binary number system → Boolean functions Boolean functions → Combinational circuits Combinational circuits → Sequential circuits.
COMP 1321 Digital Infrastructure Richard Henson University of Worcester October 2013.
Computer Architecture And Organization UNIT-II General System Architecture.
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
Computer Architecture CPSC 350
Number Bases and Representation. Denary Number System (Base 10) Our number system uses 10 digits (0-9) As you move from right to left each number is worth.
COMP 1321 Digital Infrastructure Richard Henson University of Worcester October 2012.
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
 Lecture 2 Processor Organization  Control needs to have the  Ability to fetch instructions from memory  Logic and means to control instruction sequencing.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
1.4 Representation of data in computer systems Instructions.
Basic Memory Management 1. Readings r Silbershatz et al: chapters
Sahar Mosleh California State University San MarcosPage 1 Assembly language and Digital Circuit By Sahar Mosleh California State University San Marcos.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Lecture 16: 10/29/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
1 TM 1 Embedded Systems Lab./Honam University ARM Microprocessor Programming Model.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
CMSC 1041 Binary / Hex Binary and Hex The number systems of Computer Science.
Computer Organization IS F242. Course Objective It aims at understanding and appreciating the computing system’s functional components, their characteristics,
First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.
Algorithms in Programming Computer Science Principles LO
1 What we want: execute High Level Language (HLL) programs What we have: computer hardware (a glorified calculator)
Processor/Memory Chapter 3
Control Unit Lecture 6.
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
2.0 COMPUTER SYSTEM 2.2 Number System and Representation
Computer Architecture CSCE 350
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
CSCI206 - Computer Organization & Programming
September 5 Fang-Yi’s Office Hours Friday 10am  12pm (and another TBD) Programming Language Issues (JAVA vs. C, Pointers vs. Arrays) Representations Instructions.
ECEG-3202 Computer Architecture and Organization
A primer on Computers and Programs
CS/COE0447 Computer Organization & Assembly Language
August 29 New address for Fang-Yi
MARIE: An Introduction to a Simple Computer
MARIE: An Introduction to a Simple Computer
A Discussion on Assemblers
ECE 352 Digital System Fundamentals
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

1 CS/COE0447 Computer Organization & Assembly Language Pre-Chapter 2

2 “C Program” Down to “Numbers” swap: muli$2, $5, 4 add$2, $4, $2 lw$15, 0($2) lw$16, 4($2) sw$16, 0($2) sw$15, 4($2) jr$31 void swap(int v[], int k) { int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } … … … … … … … compiler assembler

3 “Numbers” in Memory … … … … … … …

4 Stored Program Concept processor main memory hard disk program A program B program C program A program B data A data B program fetch data load/store disk I/O program counter

5 Stored Program Concept Programs (instructions) are stored in memory as a stream of bits (numbers) –Indistinguishable from data –More than one program can reside in memory at the same time –Programs can be modified by the processor or I/O just as data can be modified Instructions are fetched by the processor and decoded; they determine processor actions Program Counter determines which instruction is fetched next

6 Stored Program Concept In fact, one of the great ideas in computer science is the idea that programs could be stored just as data is stored. Before that, people envisioned the hardware running a fixed program, and data being stored in memory.

7

8 …

9

10

11

12 Addresses and Contents shown in Hex

13 Number Systems Actual machine code is in binary –O, 1 are high and low signals to hardware Hex (base 16) is often used by humans (code, simulator, manuals, …) because: 16 is a power of 2 (while 10 is not); mapping between hex and binary is easy It’s more compact than binary We can write, e.g., 0x in programs rather than

14 Base 10 (Decimal) Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (10 of them) Example: –3217 = (3  10 3 ) + (2  10 2 ) + (1  10 1 ) + (7  10 0 ) –A shorthand form we’ll also use:

15 Numbers and Bases in General Number Base B  B unique values per digit –Base 10: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} –Base 2: {0, 1} –Base 16: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} (Unsigned) number representation –d 31 d 30 …d 1 d 0 is a 32-digit non-negative number –Value = d 31  B 31 + d 30  B 30 + … + d 1  B 1 + d 0  B 0 N-digit base B  B N unique values in N digits of base B

16 Example: Base 2 (Binary) Digits: 0, 1 (2 of them) “Binary digit” = “Bit” Example: –11010 two = (1  2 4 ) + (1  2 3 ) + (0  2 2 ) + (1  2 1 ) + (0  2 0 ) = = 26 ten Choice for machine implementation! –1 = on, 0 = off

17 Base Conversion Let’s do decimal-to-binary conversion: A ten = d n-1 d n-2 …d 1 d 0two Given a base-10 number A, come up with n-digit binary number that has the same value! –X = the number –Let N be the largest power of 2 that fits into X –Put a 1 in that position –X = X – 2^N –Repeat until you are done!

18 Base Conversion, cont’d From binary to decimal From decimal to binary From binary to hexadecimal From hexadecimal to binary From decimal to hexadecimal? (more complicated; later)

19 Base Conversion, cont’d Binary to hex (base 16), or hex to binary base conversion: –Take 4 bits in binary and convert them into one hex digit and vice versa –For binary  hex: 4-bit groups, starting from the right –For hex  binary: translate each hex digit into 4 bits, starting from the right Since binary notation tends to be long, hex notation is frequently used in assembly language (and in C programs). More on binary number representation will be discussed when we study arithmetic

20 Before moving on to chapter 2…. We’ll mention some concepts in program performance, so you have ideas in mind We’ll return to this material later in the course.

21 Program Performance Program performance is measured in terms of time! Program execution time depends on: Number of instructions executed to complete a job How many clock cycles are needed to execute a single instruction The length of the clock cycle (clock cycle time)

22 Clock, Clock Cycle Time Circuits in computers are “clocked” At each clock rising (or falling) edge, some specified actions are done, usually within the next rising (or falling) edge Instructions typically require more than one cycle to execute Function block (made of circuits) clock clock cycle time

23 Program Performance time = (# of clock cycles)  (clock cycle time) # of clock cycles = (# of instructions executed)  (average cycles per instruction) We’ll do specific calculations later But now, let’s move on to Chapter 2