1 What we want: execute High Level Language (HLL) programs What we have: computer hardware (a glorified calculator)

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

Machine cycle.
Instruction Set Design
Programming 68HC11.
Stored Program Concept: The Hardware View
RISC. Rational Behind RISC Few of the complex instructions were used –data movement – 45% –ALU ops – 25% –branching – 30% Cheaper memory VLSI technology.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Basic Computer Organization, CPU L1 Prof. Sin-Min Lee Department of Computer Science.
Processor Types And Instruction Sets Barak Perelman CS147 Prof. Lee.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
Computer Organization Computer Organization & Assembly Language: Module 2.
Assembly Language A Brief Introduction. Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming  Assembler  Machine Language.
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
1 Control Unit Operation and Microprogramming Chap 16 & 17 of CO&A Dr. Farag.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
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.
CMSC 104, Lecture 061 Stored Programs A look at how programs are executed.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
Lec 4-2 Five operations of the machine cycle Fetch- fetch the next program instruction from memory. (PC+1); instruction to IR Decode- decode the instruction.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Machine and Assembly Language
The Stored Program Computer
Control Unit Lecture 6.
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
CHAPTER 6: The Little Man Computer
ELEN 468 Advanced Logic Design
Architecture Review Instruction Set Architecture
Chapter 4 The Von Neumann Model
Chapter 4 The Von Neumann Model
CS/COE0447 Computer Organization & Assembly Language
Data Representation – Instructions
The fetch-execute cycle
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Chapter 4 The Von Neumann Model
CS/COE0447 Computer Organization & Assembly Language
Lecture 4: MIPS Instruction Set
Computer Programming Machine and Assembly.
Computer Organization and ASSEMBLY LANGUAGE
CSCE Fall 2013 Prof. Jennifer L. Welch.
MIPS Processor.
Processor Organization and Architecture
Computer Architecture and the Fetch-Execute Cycle
Unit 12 CPU Design & Programming
Computer Architecture
COMS 361 Computer Organization
Chapter 4 The Von Neumann Model
Computer Architecture
CSCE Fall 2012 Prof. Jennifer L. Welch.
COMS 361 Computer Organization
ECE 352 Digital System Fundamentals
Instructions in Machine Language
COMS 361 Computer Organization
The Stored Program Computer
Program Execution.
MIPS assembly.
CPU Structure CPU must:
COMS 361 Computer Organization
What You Will Learn In Next Few Sets of Lectures
MIPS Processor.
Algoritmos y Programacion
Chapter 4 The Von Neumann Model
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

1 What we want: execute High Level Language (HLL) programs What we have: computer hardware (a glorified calculator)

2 Machine Code

3 Assembly Language

4 computer hardware: executes instructions written in machine language HLL source code compiler assembler assembly language

5 compiler C source code C++ source code Pascal source code Fortran source code assembly language assembler machine code

6 assembly language assembler machine code the focus of this class MIPS R2000 assembly language (with occasional x86 examples)

7 I/O memoryCPU VonNeumann Diagram CPU  processor  P

8 Stored Program Concept memory

9 memory: addresses contents at address 3013

10  processor must fetch instruction load an operand store an operand (a result)  memory can read (given an address) write (given an address)  Therefore, fetch and load are read memory accesses, and store is a write memory access.

11 mult aa, bb, cc The number of operands is fixed for mnemonic each unique mnemonic (instruction). The meaning of the order of the operands is fixed. For this example, it could be aa  bb * cc cc  aa * bb or

12 somewhere in memory: machine code for mult aa, bb, cc

13 To fetch and execute a single instruction, FETCH THE INSTRUCTION (do a read memory access)

14 DECODE THE INSTRUCTION  look at the machine code to find the field representing the mnemonic (also called the op code), such that the processor knows what instruction it is executing  this also specifies the number of operands  for this example, it is a multiply instruction, and so there are 3 operands

15 LOAD THE OPERANDS  this could be 2 steps (for 2 operands)  read memory accesses  load only necessary operands read at address bb read at address cc

16 DO THE INSTRUCTION'S OPERATION  most often an arithmetic operation applied to the loaded operands  for the multiply instruction, the loaded operand value for bb is multiplied by the loaded operand for cc

17 STORE THE RESULTS  the result of the operation needs to go somewhere, so put it there!  for the multiply instruction, store the computed product at the memory location represented by aa

18 programs contain many sequential instructions... instr 1 addresses instr 2 instr 3 instr 4

19 Program Counter  usually called the PC  value maintained by the processor  the address of the next instruction to be fetched  Intel's terminology: Instruction pointer, or IP

20 Instruction Fetch and Execute Cycle 1. fetch instruction 2. update PC 3. decode 4. load operands 5. do the operation 6. store result(s)

21 Control Instructions  a category of instructions that may modify the PC, other than to update it  invented code example: here: beq x, y, elsewhere add z, y, x elsewhere: mult aa, bb, cc

22 Possible instruction sequences: 1. if x equals y beq x, y, elsewhere mult aa, bb, cc 2. if x does not equal y beq x, y, elsewhere add z, y, x mult aa, bb, cc

23 For this instruction, if x equals y, then 6. store result(s) places the third operand (the address elsewhere ) into the PC

24 beq x, y, elsewhere addresses add z, y, x mult aa, bb, cc ( x ) 8004 ( y ) 9300

25 The name that architectures give to the control instructions is most often  branch  jump In functionality, a further categorization is  conditional  unconditional

26 condition codes An alternative, but equivalent method for implementing control instructions A processor will have a minimum of 2 boolean variables 1. zero 2. negative

27 step 6. store results also changes the condition codes For example: add x, y, z if y = 1 and z = 2 then x is set to 3 and zero is set to False negative is set to False

28 bpos elsewhere if zero is False and negative is False then PC  elsewhere Must order the instructions such that the correct one to set the condition codes is directly before the one that depends on it...

29 Just for fun: Invent instructions and write assembly language code to do: for (i = 1; i < 10; i++ ) { a = a + i; }

30 Karen's first solution move i, 1 for: bge i, 10, end_for add a, a, i add i, i, 1 b for end_for: # next instruction would # go here

31 Karen's condition codes solution move i, 1 for: compare i, 10 # sets C.C. bgez end_for add a, a, i add i, i, 1 b for end_for: # next instruction would # go here