Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Analytical Engine Module 6 Program Translation.

Similar presentations


Presentation on theme: "The Analytical Engine Module 6 Program Translation."— Presentation transcript:

1 The Analytical Engine Module 6 Program Translation

2 The Binary Machine Computers store their programs and information in binary code. A program must be understandable to both the user and the machine.

3 The Binary Machine Translation from high-level language (English) to low-level language (binary) is accomplished through a program: – Compiler – Interpreter – Assembler High-level  Low-level Source code  Object code

4 The Binary Machine All computers have a hard-wired instruction set that is unique to a specific microprocessor. Therefore, compilers, interpreters, and assemblers must be written for a specific machine.

5 The Binary Machine An instruction is a unique set of binary patterns that cause the circuitry of the machine to behave in a certain way. These circuits are etched into the microprocessor chip.

6 Binary Representations Binary architecture – Bit – Binary Digit – Nibble(?) – 4 bits – Byte – 8 bits – Word – 2 bytes – 16 bits (at least)

7 Binary Representations Most modern desktop PCs and Macs measure their memory size in bytes. – 1 MB = 1 million bytes – 12 MB = 12 million bytes or 96 million bits! – 1 GB = 1 gigabyte or 1 billion bytes.

8 Binary Representations To a computer, binary digits can represent: – Simple binary code Integers - 0000 0000 0000 0010 = 2 Integers – 0111 1111 1111 1111 = 32767 Real Numbers (32 bits) – sign(1 bit), Exponent (8) bits, Mantissa (23 bits)

9 Binary Representations To a computer, binary digits can represent: – Binary Coded Decimal Numbers (BCD) 0000 0011 0001 0110 = 316 – Hexadecimal Numbers (Hex) 1111 0101 0011 1011 = F53B

10 Binary Representations To a computer, binary digits can represent: – ASCII Code 0100 0001 = “A” 0010 0001 = “!” – Check ASCII table handout. – Adopted so computers could represent character (non-numeric) data.

11 Binary Representations Instruction Codes – Arbitrary – Ex. Is PIPPIN 0001 0100 = LOD (Load accumulator) 0000 0101 = STO (Store accumulator contents) – A 256-instruction set can be encoded in 8 bits. – Trend was to richer instruction sets. – Trend now to reduced instruction sets.

12 The Binary Machine Observe the demonstration of the PIPPEN machine carefully.

13 A Simple Computer RAM – Random Access Memory – Data – 8, 16, 32 bits – Instructions 8-bit instruction code 8-bit address PC – Program Counter – Keeps address of current instruction

14 A Simple Computer Accumulator – Special memory location that stores intermediate results of computations. IR – Instruction Register – Holds a copy of the current instruction to be executed. Decoder – takes a single input and transfers to multiple outputs.

15 A Simple Computer MUX – Multiplexor – Routes multiple inputs to a single output. ALU – Arithmetic Logic Unit – Performs mathematical operations on its input.

16 A Simple Computer Assembler – translates mne-monic represen- tations of instructions into binary code. (LOD, ADD, SUB, STO, etc.) Very fast Programmer is responsible for data storage One instruction – One operation correspondance

17 Language Implementation Scanning – breaking a string of characters into meaningful pieces called tokens. – W = X – Y ; Like breaking down a sentence into words.

18 Language Implementation Parsing – Arranging tokens into a sensible logical structure. – W = X + Y * Z; E1 = Y * Z E2 = X + E1 E2  W – Result is called a Parse Tree. Code Generation – generating one or more machine language instructions based on the Parse Tree.

19 Language Types Interpreted Languages – BASIC, LISP, JavaScript Program Line  Interpreter  Binary Code  Execution Next Line  Interpreter  Binary Code  Execution – Fairly slow Lines translated repeatedly One line may generate multiple instructions, some unnecessary – User does not need to know details of the machine. Programs run on any machine that has the interpreter.

20 Language Types Compiled Languages – COBOL, FORTRAN, C, C++, Java Entire program  Compiler  Binary Code  Execution – Fairly fast after compilation Better error detection. Object program can be stored and run repeatedly without recompilation. – User does not need to know details of the machine. Programs run on any machine that has a compiler.

21 Language Groups Imperative – fundamental unit is the procedure which is called by a main program. – Pascal, FORTRAN, Ada Functional – processes are defined in terms of functions with no main program. – LISP

22 Language Groups Declarative – Input/Output oriented; limited procedure/function support. – COBOL, Prolog Object-Oriented – processes controlled by “events” which communicate with “objects” via “messages”. – C++, Smalltalk, JavaScript, Java

23 Language Design Syntax & Semantics Data Types – Strongly Typed – Weakly Typed Data Structures – Arrays – Lists Decision statements – IF – IF – ELSE Control Statements – FOR – WHILE – WHILE – DO

24 Language Implementation Generating Code Observe the demon- stration carefully. Check the course web page and then complete Lab 6.3.

25 Language Generations First Generation – machine language Second Generation – assemblers Third Generation – interpreted and compiled languages. Fourth Generation – object-oriented languages

26 Language Implementation Symbols & Bits Observe the demon- stration carefully. Check the course web page for special instructions. Complete Lab 6.4.

27 The End Program Translation


Download ppt "The Analytical Engine Module 6 Program Translation."

Similar presentations


Ads by Google