EEC4133 Computer Organization & Architecture Chapter 6: Languages and the Machine by Muhazam Mustapha, May 2014.

Slides:



Advertisements
Similar presentations
Chapt.2 Machine Architecture Impact of languages –Support – faster, more secure Primitive Operations –e.g. nested subroutine calls »Subroutines implemented.
Advertisements

Target Code Generation
Computer Organization and Architecture
CSCI 4717/5717 Computer Architecture
Machine Instructions Operations
Data Dependencies Describes the normal situation that the data that instructions use depend upon the data created by other instructions, or data is stored.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
The Assembly Language Level
Chapter 3 Loaders and Linkers
The Functions and Purposes of Translators Code Generation (Intermediate Code, Optimisation, Final Code), Linkers & Loaders.
1 Starting a Program The 4 stages that take a C++ program (or any high-level programming language) and execute it in internal memory are: Compiler - C++
Programming Types of Testing.
Lab6 – Debug Assembly Language Lab
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Assembly.
Chapter XI Reduced Instruction Set Computing (RISC) CS 147 Li-Chuan Fang.
Chapter 12 Pipelining Strategies Performance Hazards.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
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.
Chapter 12 CPU Structure and Function. Example Register Organizations.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
Tannenbaum Machine. Key Features Simple architecture Simple instruction set Focus on –Input -> Higher Level Language –Output -> Machine Language Addressing.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Intro. to Game Programming Want to program a game?
Processor Structure & Operations of an Accumulator Machine
RISC:Reduced Instruction Set Computing. Overview What is RISC architecture? How did RISC evolve? How does RISC use instruction pipelining? How does RISC.
4-1 Chapter 4 - The Instruction Set Architecture Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring.
Chun Chiu. Overview What is RISC? Characteristics of RISC What is CISC? Why using RISC? RISC Vs. CISC RISC Pipelines Advantage of RISC / disadvantage.
4-1 Chapter 4 - The Instruction Set Architecture Department of Information Technology, Radford University ITEC 352 Computer Organization Principles of.
Introduction to Computing Systems from bits & gates to C & beyond Chapter 4 The Von Neumann Model Basic components Instruction processing.
9.2 Pipelining Suppose we want to perform the combined multiply and add operations with a stream of numbers: A i * B i + C i for i =1,2,3,…,7.
5-1 Chapter 5 - Languages and the Machine Department of Information Technology, Radford University ITEC 352 Computer Organization Principles of Computer.
4-1 Chapter 4 - The Instruction Set Architecture Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
6-1 Chapter 6 - Languages and the Machine Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
Objective At the conclusion of this chapter you will be able to:
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
4-1 Chapter 4 - The Instruction Set Architecture Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /29/2013 Lecture 13: Compile-Link-Load Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
EEC4133 Computer Organization & Architecture Chapter 5: Datapath & Control by Muhazam Mustapha, April 2014.
by Richard P. Paul, 2nd edition, 2000.
Chapter 1 Introduction. Chapter 1 -- Introduction2  Def: Compiler --  a program that translates a program written in a language like Pascal, C, PL/I,
ITEC 352 Lecture 19 Functions in Assembly. Functions + Assembly Review Questions? Project due on Friday Stacks Function activation / deactivation.
Introduction to OOP CPS235: Introduction.
EEC4133 Computer Organization & Architecture Chapter 7: Memory by Muhazam Mustapha, April 2014.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Hello world !!! ASCII representation of hello.c.
LECTURE 19 Subroutines and Parameter Passing. ABSTRACTION Recall: Abstraction is the process by which we can hide larger or more complex code fragments.
Binding & Dynamic Linking Presented by: Raunak Sulekh(1013) Pooja Kapoor(1008)
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Lecture 3 Translation.
Assembly language.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Chapter 9 a Instruction Level Parallelism and Superscalar Processors
Chapter 14 Instruction Level Parallelism and Superscalar Processors
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
Computer Programming Machine and Assembly.
CSCE Fall 2013 Prof. Jennifer L. Welch.
CSCE 121: Simple Computer Model Spring 2015
Computer Architecture and the Fetch-Execute Cycle
What time is it?. What time is it? Major Concepts: a data structure model: basic representation of data, such as integers, logic values, and characters.
CSCE Fall 2012 Prof. Jennifer L. Welch.
Chapter 6 Programming the basic computer
Target Code Generation
Procedures & Macros Introduction Syntax Difference.
Presentation transcript:

EEC4133 Computer Organization & Architecture Chapter 6: Languages and the Machine by Muhazam Mustapha, May 2014

Learning Outcome By the end of this chapter, students are expected to have some theoretical concept of how high performance assembly coding is done Most of the material in this slide set is adopted from Murdocca & Heuring 2007

Chapter Content Process of Generating Machine Code –Compile, Assemble, Link, Load –Macro High Performance Computing –Pipelining –Overlapping Register –Low Power Coding

Generating Machine Code

Compilation [Definition] Compilation is a process of converting high level language code into assembly language code The high level languages include: C, C++, C#, Java, Pascal, BASIC, etc These high level languages are machine (microprocessor) independent

Compilation Example (a C language code): –a = b+c; –This code may convert to: MOV A, [b]; ADD A, [c]; MOV [a], A;

Assembly [Definition] Assembly is a process of converting assembly language instructions into machine language opcode that consist of 1-s and 0-s Assembly language instruction and its corresponding machine language opcode is highly dependent to the microprocessor being used

Assembly Example: –MOV A, B; –This assembly code may convert to machine code: Op Addressing Type TargetSource

Macro [Definition] Macro is a piece of assembly code that is invoked like a subroutine but actually is expanded inline into the program during preprocessing before assembly Having macros in assembly language program while avoid overhead of subroutine calls (faster runtime), but the resulting machine code will be larger

Macro

Linking [Definition] Linking is a process after assembly to resolve (finalize) the resources pointer or location that have been defined in separate modules either in libraries or user defined After linking, all off module or clashing parameters will be resolved to the correct references

Loading A finished executable code will references within itself or external locations External references most likely is fixed Internal references will need to be adjusted as the code won’t have prior knowledge about the exact location where it is put in during execution

Loading [Definition] Loading is a process to load an executable into main memory and re- calculate the references to reflect the actual resources location at runtime

High Performance Computing

Pipelining In the fetch-execute cycle, one would realize that there is no need to wait for one instruction to complete the entire cycle before beginning the next one

Pipelining [Definition] Pipelining is an enhancement to the fetch-execute cycle, whereby a subsequent instruction can begin a stage in the cycle when the previous instruction is at the next stage, without waiting for that previous instruction to finish the entire cycle

Pipelining

Obviously pipelining can be smoothly done if the sequence of instructions are properly synchronized and do not depend on the result of the earlier ones before they complete the cycle The logic to automatically re-arrange the instructions so that pipelining is at its optimum level is done by the compiler –Sometimes forced delay might be needed

Pipelining

Overlapping Register Use With pipelining, a further improvement can be made if the microprocessor has a large no. registers that can be set to input registers and output registers [Definition] Overlapping register use is the use input registers by a second procedure call, while the first procedure call has NOT yet returned, but already finished using those input registers

Overlapping Register Use

Low Power Coding Consider the following code: ld [2096], %r16 ld [2100], %r17 ld [2104], %r18 ld [2108], %r19 The corresponding machine code is: 2

Low Power Coding The no. transitions in the previous code is 8, and can be reduced to 6 if they are re- arranged:

Low Power Coding With less transitions in the machine code there will be less power used This can be achieved by Gray code sequencing of instruction code This is just one way to power optimized our machine code