CS 147 June 13, 2001 Levels of Programming Languages Svetlana Velyutina.

Slides:



Advertisements
Similar presentations
Instruction Set Design
Advertisements

1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 2: Data types and addressing modes dr.ir. A.C. Verschueren.
INSTRUCTION SET ARCHITECTURES
10/9: Lecture Topics Starting a Program Exercise 3.2 from H+P Review of Assembly Language RISC vs. CISC.
Instruction Set Architecture Classification According to the type of internal storage in a processor the basic types are Stack Accumulator General Purpose.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
Instruction Set Architecture
1 Registers and MAL - Part I. Motivation So far there are some details that we have ignored instructions can have different formats most computers have.
Instruction Set Architecture & Design
TK 2633 Microprocessor & Interfacing
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
By Tien Phung CS 147 Dr. Sin-Min Lee. High-level Languages Assembly Languages Machine Languages.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
What is an instruction set?
Embedded Systems: Hardware Computer Processor Basics ISA (Instruction Set Architecture) RTL (Register Transfer Language) Main reference: Peckol, Chapter.
Parul Polytechnic Institute Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name.
Assembly & Machine Languages
Operand Addressing and Instruction Representation
Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name of Unit : Introduction to Microprossor.
Programming Models CT213 – Computing Systems Organization.
Instruction Set Design by Kip R. Irvine (c) Kip Irvine, All rights reserved. You may modify and copy this slide show for your personal use,
Machine Instruction Characteristics
COMPUTER ORGANIZATIONS CSNB123 May 2014Systems and Networking1.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Instruction Set Architecture
Computer Systems Organization CS 1428 Foundations of Computer Science.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 7.
Instruction Set Architecture The portion of the machine visible to the programmer Issues: Internal storage model Addressing modes Operations Operands Encoding.
Computer Architecture and Organization
Computer Architecture EKT 422
Operand Addressing And Instruction Representation Cs355-Chapter 6.
Instructions. Portability In addition to making hardware backward compatible, we have also made software portable. In describing software, “portable”
COMPUTER ORGANIZATIONS CSNB123 NSMS2013 Ver.1Systems and Networking1.
A compiler is a computer program that translate written code (source code) into another computer language Associated with high level languages A well.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
Lecture 5 A Closer Look at Instruction Set Architectures Lecture Duration: 2 Hours.
The Instruction Set Architecture. Hardware – Software boundary Java Program C Program Ada Program Compiler Instruction Set Architecture Microcode Hardware.
Getting Started With Java September 22, Java Bytecode  Bytecode : is a highly optimized set of instructions designed to be executed by the Java.
What is a program? A sequence of steps
8086/8088 Instruction Set, Machine Codes and Addressing Modes.
Ass. Prof. Dr Masri Ayob TK 2123 Lecture 14: Instruction Set Architecture Level (Level 2)
Instruction Sets: Characteristics and Functions  Software and Hardware interface Machine Instruction Characteristics Types of Operands Types of Operations.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Instruction sets : Addressing modes and Formats
Instruction Set Architecture
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
A Closer Look at Instruction Set Architectures
Microprocessor Systems Design I
Introduction to 8085 Instructions
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
Microcomputer Programming
A Closer Look at Instruction Set Architectures: Expanding Opcodes
THE sic mACHINE CSCI/CMPE 3334 David Egle.
CSCE Fall 2013 Prof. Jennifer L. Welch.
ECEG-3202 Computer Architecture and Organization
Introduction to Micro Controllers & Embedded System Design
Chapter 9 Instruction Sets: Characteristics and Functions
Low Level Programming Languages
Computer Instructions
ECEG-3202 Computer Architecture and Organization
CSCE Fall 2012 Prof. Jennifer L. Welch.
COMPUTER ORGANIZATION AND ARCHITECTURE
Chapter 4 The Von Neumann Model
Presentation transcript:

CS 147 June 13, 2001 Levels of Programming Languages Svetlana Velyutina

Overview Levels of programming languages. Their relationship to each other. How they’re converted into executable form. How Java applets are converted to run on a computer. Attributes of assembly language instructions.

High- Level Languages Assembly Languages Machine Languages LANGUAGE CATEGORIES

platform independent highest level of abstraction Java, C++, FORTRAN High- Level Languages

Assembly Languages lower level of abstraction specific to each microprocessor usually backward compatible can directly manipulate data stored in a microprocessors internal components platform-specific

contain binary values platform specific each microprocessor has own language may be backward compatible Machine Languages

High-level Language Programs are Compiled

Assembly Language Programs are Assembled

Java Applets are Compiled into Bytecode Applet is a Java program running inside a browser.

Bytecode Bytecode is generated by Java compiler to be later interpreted by Java Virtual Machine and translated into machine code at run-time. JVM interprets the bytecode for its specific platform and executes it. Therefore, bytecode is platform independent. JVM can be a hardware chip but usually it is a program, often part of Web browser. Most browsers are Java-enabled and most operating systems have JVM ported on them.

Bytecode Bytecode can not be directly executed by microprocessor - code runs much slower Therefore it would not be efficient to do CPU-intensive tasks with JVM interpreter Still Java can easily keep up with the data rate of network connection. Many platforms have just-in-time bytecode compilers that compile code once, cach the results and call it again if needed. Just-in-time compilers will speed up the program times compare to interpreter.

Attributes of Assembly Language Instructions instruction types data types addressing modes instruction formats

Assembly Language Instruction Types data transfer instructions data operation instructions program control instructions interrupts halt instruction

most common microprocessor operation copy the value to its destination perform following transfers: –Load data from memory into the microprocessor –Store data from microprocessor into memory –Move data within the microprocessor –Input data to the microprocessor –Output data from the microprocessor Data Transfer Instructions

Data Operation Instructions Arithmetic, Logic and Shift instructions modify their data values perform operation on one or two data values and store result

Program Control Instructions jump or branch instructions used to go to another part of program absolute jump is always taken: jr $ra conditional jump is taken if condition is met: bne $t0, $t1, endloop instructions to call and return from subroutines: jal calcsqrt

Interrupts tells microprocessor to stop and execute another instruction software interrupts are generated by assembly language instructions hardware interrupts are triggered by devices outside of microprocessor

Halt instruction causes microprocessor to stop executing instructions used at the end of program

Most Common Data Types Integers Floating point numbers Boolean values Characters

Integers range from 0 to 2^n - 1 for unsigned from -2^n to 2^(n-1)-1 for signed

Floating Point Numbers include fractional portion of the value may be assigned special registers and instructions by microprocessor

Boolean Type true or false values zero is false, non-zero is true can be used to perform logical operations Ex.: result of 0010 AND 0001 is true

Characters stored as binary values encoded using ASCII, EBCDIC, UNICODE or other encoding standard

Addressing Modes Direct Mode: LDAC 5 (loads value into accumulator from memory location 5) Indirect Mode: (loads value from the memory address stored at memory location 5) Register Direct Mode: LDAC R (copies value stored in register R) Register Indirect Mode: (copies value from the memory address stored in register R) Assume LDAC loads data from memory into microprocessor’s AC register.

Addressing Modes Immediate Mode: LDAC #5 (moves value 5 into accumulator) Implicit Mode: LDAC (gets an operand from stack, don’t have to specify an operand) Relative Mode: LDAC $5 (the operand supplies offset from the program counter to generate address) Index Mode: LDAC 5(X) (loads the data from X+5 memory location) Address Mode: LDAC 5(X) (loads the data from memory address(X+5))

Instruction Formats Instructions code - binary value representing an assembly language instruction after it is converted into machine code. Different instructions may have different formats. Groups of bits in a format correspond to the opcode and the operands.

Example for the operation A=B+C This instruction has one operation, two source operands and one destination operand. Microprocessor performing 16 different operations will need 4 bits to specify one operation. Assume bit pattern 1010 corresponds to addition. Assume that there are only 4 possible operands for this operation A, B, C and D. Corresponding bit patterns for the operands: 00 for A, 01 for B, 10 for C and 11 for D.

Instruction Formats opcode operand #1 operand #2 4 bits 2 bits 2 bits MOVE A,B (A=B) ADD A,C (A=A+C) opcode operand #1 operand #2 operand #3 4 bits 2 bits 2 bits 2 bits ADD A,B,C (A=B+C) assembly code machine code Format for three-operand instruction. Format for two-operand instruction.

Instruction Formats opcode operand 4 bits 2 bits LOAD B (Acc=B) ADD C (Acc=Acc+C) STORE A (A=Acc) opcode 4 bits PUSH B (Stack=B) 0101 PUSH C (Stack=C,B) 0110 ADD (Stack=B+C) 1010 POP A (A=Stack) 1100 assembly code machine code One-operand instruction. The accumulator register is always used as destination and one of source registers. Zero-operand instruction. All operands are drawn from the stack.

Instruction Formats Microprocessor may be designed to work with instructions that specify 3, 2, 1 or 0 operands. Microprocessor that uses two-operand instructions is more limited than one using three-operand instructions.

Microprocessors with Fewer Operand Instructions Drawbacks: more instructions needed for the same task Benefits: instruction codes use fewer bits hardware to implement microprocessor is less complex microprocessors whose instructions specify fewer operands can usually execute instructions more quickly