Instructions.

Slides:



Advertisements
Similar presentations
Instruction Set Design
Advertisements

ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
Infix, Postfix and Stacks
1 Lecture-2 CSIT-120 Spring 2001 Revision of Lecture-1 Introducing Computer Architecture The FOUR Main Elements Fetch-Execute Cycle A Look Under the Hood.
Basic Computer Organization, CPU L1 Prof. Sin-Min Lee Department of Computer Science.
Introduction to a Programming Environment
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 1, Lab.
SOFTWARE SYSTEMS SOFTWARE APPLICATIONS SOFTWARE PROGRAMMING LANGUAGES.
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
CSIT 301 (Blum)1 Recap so far (Not gotten to last time) So there were issues about the number of operands. –Recall that we have a fetch-execute cycle –
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Evolution of Programming Languages Generations of PLs.
Software Overview. Why review software? Software is the set of instructions that tells hardware what to do The reason for hardware is to execute a program.
What have mr aldred’s dirty clothes got to do with the cpu
Microcode Source: Digital Computer Electronics (Malvino and Brown)
CS 147 June 13, 2001 Levels of Programming Languages Svetlana Velyutina.
CSIT 301 (Blum)1 Software Based in part on material from Chapters 4 & 5 in Computer Architecture by Nicholas Carter.
PHY 201 (Blum)1 Microcode Source: Digital Computer Electronics (Malvino and Brown)
CSC 370 (Blum)1 Instructions From the Bottom Up Based in part on material from Chapters 4 & 5 in Computer Architecture by Nicholas Carter.
Instructions. Portability In addition to making hardware backward compatible, we have also made software portable. In describing software, “portable”
1.4 Representation of data in computer systems Instructions.
The Instruction Set Architecture. Hardware – Software boundary Java Program C Program Ada Program Compiler Instruction Set Architecture Microcode Hardware.
Computer Organization Instruction Set Architecture (ISA) Instruction Set Architecture (ISA), or simply Architecture, of a computer is the.
CSIT 301 (Blum)1 Instructions at the Lowest Level Some of this material can be found in Chapter 3 of Computer Architecture (Carter)
1 Processor design Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 11.3.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Evolution and History of Programming Languages
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Component 1.6.
Machine dependent Assembler Features
High and low level languages
Operating System Interface between a user and the computer hardware
Computer Programming.
Expressions and Assignment
CSE 3322 Computer Architecture
A Closer Look at Instruction Set Architectures
Instructions From the Bottom Up
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
A Closer Look at Instruction Set Architectures
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
Instructions at the Lowest Level
Compiler Construction
Instructions From the Bottom Up
About Instructions Based in part on material from Chapters 4 & 5 in Computer Architecture by Nicholas Carter PHY 201 (Blum)
Translators & Facilities of Languages
CSCE Fall 2013 Prof. Jennifer L. Welch.
College of Computer Science and Engineering
Fundamentals of Computer Organisation & Architecture
CSCE 121: Simple Computer Model Spring 2015
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
BIC 10503: COMPUTER ARCHITECTURE
CMP 131 Introduction to Computer Programming
Low Level Programming Languages
Branch instructions We’ll implement branch instructions for the eight different conditions shown here. Bits 11-9 of the opcode field will indicate the.
MARIE: An Introduction to a Simple Computer
CSCE Fall 2012 Prof. Jennifer L. Welch.
Mastering Memory Modes
Introduction to Microprocessor Programming
ECE 352 Digital System Fundamentals
Processor design Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 11.3.
Chapter 7 Expressions and Assignment Statements.
CISC101 Reminders Labs start this week. Meet your TA! Get help with:
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Target Code Generation
A Level Computer Science Topic 5: Computer Architecture and Assembly
PRESENTED BY ADNAN M. UZAIR NOMAN
Processor design Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 11.3.
Algoritmos y Programacion
Presentation transcript:

Instructions

Portability In addition to making hardware backward compatible, we have also made software portable. In describing software, “portable” means that the software can be run on a variety of computers. Another term used is independence, in this case machine or hardware independence. Assembly’s use of specifics of the registers makes it machine dependent. One has to program at a higher level to gain machine independence. Of course, someone must deal with the specifics of the hardware but it doesn’t have to be you (Layering).

High-level language Languages which are above assembly language, known as high-level languages, hide the details of the hardware and thus are portable or hardware independent. Of course, high-level language are not directly executed. There is an in-between process or processes (compiling, translating, interpreting, linking, etc.) necessary before they can be executed. CSIT 301 (Blum)

CSIT 301 (Blum)

Generations Another way of discussing this is to talk about generations. 1GL or first-generation language is machine language. 2GL or second-generation language is assembly. 3GL or third-generation language is a "high-level" programming language, Fortran, C, Java, Visual Basic, etc. 4GL or fourth-generation language is a more descriptive language, closer to human language usually used to query databases. 5GL or fifth-generation language is along Artificial Intelligence (AI) lines and is meant to solve more generic problems than 4GL CSIT 301 (Blum)

5th Generation Language CSIT 301 (Blum)

Instruction Set One aspect of processor design is to determine what instructions will be supported. There must be rules (syntax) for how instructions are expressed, so that the code can be parsed, one instruction distinguished from the next, the data (operand) separated from the action (operator). CSIT 301 (Blum)

Number of operands An example of syntax would be whether an operator is binary or unary Binary operators take two operands e.g. the Boolean operator AND (x<y) AND (i=j) Unary operators take one operand E.g. the Boolean operator NOT NOT(x<y) Some ops are context dependent - 5 (unary) versus 4-5 (binary) CSIT 301 (Blum)

Operation versus Instruction An operation such as addition, which is binary (takes two operands), can be coded using instructions that are unary (one operand) if there is a default location implied such as Accumulator A. 5 + 6 becomes Load 5 (places data in acc. A) Add 6 (adds number in Acc. A to new number) CSIT 301 (Blum)

Where does the answer go? Whether it’s 5 + 6 or (Load 5, Add 6), there’s the question of what to do with the result. We can again use the default location of Accumulator A to place the answer in, or we can include a third operand that indicates where the result should be placed. CSIT 301 (Blum)

Store Placing the result of an operation in memory is known as storing it. Thus with unary instructions, we would have Load 5 Add 6 Store 7 The operand of the store is an address indicating where to store the answer, which is held in Accumulator A. Or one might have just one instruction with three operands Add 7, 5, 6 CSIT 301 (Blum)

Addressing Modes The “7” in the previous example was clearly an address. But this raises the question as to what were the operands in the two previous instructions (Load and Add). For those instructions, the operand might have been the actual numbers one wanted added or the addresses of numbers one wanted added. CSIT 301 (Blum)

More than one kind of add By “Add” one typically means the latter case on the previous slide. The operand is not the number to be added but the address of the number to be added. (Think variables.) A designer can include a distinct add instruction, Add Immediate, in which the operand is the actual number to be added. CSIT 301 (Blum)

Add Indirect In another version of addition, the operand is an address, and the data at that address is also an address, and the actual number to be added is located at the second address. Think about passing a variable (by reference) to a function. The main program refers to the variable using an address The function refers to the variable by using the address of an address CSIT 301 (Blum)

A short program Acc. A: XXX Address Value LOAD 4 1 ADD INDIRECT 5 2 ADD IMMEDIATE 6 3 STOP 4 5 6 7 8 Acc. A: XXX The arrow indicates the program counter, we assume it has not executed the statement it points to. CSIT 301 (Blum)

A short program Address Value LOAD 4 1 ADD INDIRECT 5 2 ADD IMMEDIATE 6 3 STOP 4 5 6 7 8 Acc. A: 5 The Load 4 instruction has been executed. The value at location 4 (which is a 5) has been loaded into the accumulator. CSIT 301 (Blum)

A short program Address Value LOAD 4 1 ADD INDIRECT 5 2 ADD IMMEDIATE 6 3 STOP 4 5 6 7 8 Acc. A: 12 The Add Indirect 5 instruction has been executed. One goes to location 5 to find a value of 6. That 6 is an address, thus one goes to location 6 to find a value of 7 and that is added to the 5 waiting in the accumulator. The result of 12 is placed in the accumulator. CSIT 301 (Blum)

A short program Address Value LOAD 4 1 ADD INDIRECT 5 2 ADD IMMEDIATE 6 3 STOP 4 5 6 7 8 Acc. A: 18 The Add Immediate 6 instruction has been executed. The value 6 is data which is added to the 12 waiting in the accumulator. The result of 18 is placed in the accumulator. CSIT 301 (Blum)

The Stop Instruction Recall that in what is actually executed (machine code, not assembly) the instructions themselves are numbers. Thus it is crucial to know within a single instruction which numbers correspond to an operation and which numbers are operands. Similarly on the level of the program itself, the processor needs to know where the program ends as there may be data stored after it. In a machine with an operating system, it is more a notion of returning (control) than of stopping or halting. CSIT 301 (Blum)

Another to try Address Value LOAD IMMEDIATE 4 1 ADD 5 2 ADD INDIRECT 6 LOAD IMMEDIATE 4 1 ADD 5 2 ADD INDIRECT 6 3 STOP 4 5 6 7 8

Recap so far So there were issues about the number of operands. Recall that we have a fetch-execute cycle – first an instruction is retrieved from memory and then acted upon. With unary instructions adding two numbers and storing the result required three instructions, that’s three fetches and three executions. With ternary instructions it can be done with one instruction, one fetch and one execute. The execution is now more complicated but we have saved time on fetches. CSIT 301 (Blum)

Recap so far (Cont.) More operators means more complicated circuitry, the load and store aspects of the instruction would have to built into each separate instruction. There is a speed versus complexity issue. And complexity also brings the issue of cost along with it. CSIT 301 (Blum)

Recap so far (Cont.) After determining the number of operands, came the issue of what the operands mean. Are they data, addresses of data, or addresses of addresses of data? Either we can decide to support all of these types of instructions (addressing modes) and choose complexity. Or we can choose to support only some of them and sacrifice efficiency. You can eliminate Add Immediate if you always store the values you want to add. CSIT 301 (Blum)

Data Types Apart from addressing, another issue is the type of data the operation is acting on. The process for adding integers is different from the process for adding floating point numbers. So one may have separate ADD and FADD for the addition of integers and floats respectively. Furthermore, one may need to add instructions to convert from one type to another. To add an integer to a float, convert the integer to a float and then add the floats. CSIT 301 (Blum)

References Computer Architecture, Nicholas Carter Digital Computer Electronics, Albert P. Malvino and Jerald A. Brown http://www.webopedia.com CSIT 301 (Blum)