1 machine language alex ostrovsky. 2 introduction hierarchy of computer languages: 1....

16
1 Machine Language Alex Ostrovsky

Upload: kerrie-underwood

Post on 28-Dec-2015

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

1

Machine Language

Alex Ostrovsky

Page 2: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

2

Introduction

Hierarchy of computer languages:1. Application-Specific Language (Matlab

compiler)

2. High-Level Programming language (C++, Java)

3. Assembly Language (Machine dependent)

4. Machine Language (Machine dependent)

Page 3: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

3

Introduction (Cont.)

There is nothing “below” machine language – only hardware.

Machine Language is the only language understood by computers (i.e. it’s native to processor)

Impossible for humans to read. Consists of only 0’s and 1’s.• 0001001111110000

Page 4: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

4

History

1943 – Colossus Computer. Based on the same working principles as modern computers.

British mathematician Max Newman was one of the main founders of Colossus.

Page 5: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

5

History: Colossus - Visual insight

Page 6: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

6

Architecture

Modern computers are using Von Neumann Architecture (also called stored-program concept)

It was derived by Von Neumann (obviously), John Mauchly, and Presper Eckert.

See picture on a next page for structural design of simple CPU based on Von Neumann Architecture

Page 7: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

7

Page 8: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

8

Requirements Every machine language must contain

following commands:• Load instruction (CPU loads data directly from

memory into ac register) consists of:• Operation code (opcode)• Address of main memory cell from which ac register will

be loaded0010000111100011

• Store instruction stores computed information into a memory cell or CPU(ALU) register

Opcode address

Page 9: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

9

Requirements

Normally even the simplest instruction set includes:• Arithmetic operations – ADD, SUB (subtract),

MUL (multiply), DIV (divide), INC (increment), DEC (decrement)

• Logic operations – AND, OR. XOR, NOT

• Additional operations like SHIFT, ROTATE

Page 10: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

10

Assembly Language To program in assembly you need to understand

concepts behind machine language and execution-fetch cycle of CPU.

Assembly is a mnemonic form of machine language. As noted before, assembly is a machine specific

language. Although Assembly and machine language might look

similar, they are in fact two different types of languages.• Assembly consists of both binary and simple words

• Machine code composed only of 0’s and 1’s

Page 11: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

11

Assembly language (cont.) It is possible to code machine language

directly, thus bypassing assembly instructions. This is done by replacing Assembly instructions by machine instruction numbers directly.• For example:

• Instead of load instruction we might say 0004; thus load001000110001 is equal to 0004001000110001

• Add might equal to 2005 Execution speed remains the same because

basic instructions (like ADD, SUB, LOAD, STORE, and etc.) are hardwired into CPU.

Page 12: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

12

ALU Registers

Simplest ALU design usually includes:• Program counter register

• Accumulator register

• Stack pointer register

Memory and ALU exchange information in words. Word is a fixed chunk of data and depends on system design. Usually it is chosen so that one word fits into one memory slot.

Page 13: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

13

Execution Process

Page 14: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

14

Future of Machine Language With the introduction of 64-bit CPUs (Itanium, Itanium-2,

AMD 64, new assembly language instructions have to be added, old ones have to be either redesigned or eliminated. This also puts stress on compiler designers as well as hardware implementation.

Most recent introduction of Intel’s family of dual-core CPUs puts even higher demands on proper hardware and software implementation.

Possibly current 16 and 32-bit instruction set will become obsolete in near future in order to avoid backward compatibility problems and minimize production costs.

Page 15: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

15

References courses.cs.deu.edu.tr/cse122/Machine%20Language.ppt www.cs.rpi.edu/~hollingd/cpp/lectures/Background.ppt www.cis.ksu.edu/classes/450/jason/arch_overview.ppt www.cs.kent.edu/~kschaffe/teaching/f04/chap1.ppt williams.comp.ncat.edu/COMP375/MachineLanguage.pdf www.cc.gatech.edu/classes/AY2002/cs2130_spring/

cs2130pres02_moreintrohistorycintro.ppt www2.hawaii.edu/~walbritt/ ics312/basicConcepts/lecture.ppt www.cen.uiuc.edu/~cs101/spr04/lect10.ppt cs2.cs.brown.edu/lectures/lecture8.pdf www.andrew.cmu.edu/course/ 45-870/powerpoint/45870wk2-1.ppt http://www.codesandciphers.org.uk/lorenz/colossus.htm http://www.coledd.com/electronics/cpu/arch.png http://www.fact-index.com/m/ma/machine_language.html

Page 16: 1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming

16

Thank You

Education is what remains after one has forgotten everything he learned in school.

A. Einstein