Presentation is loading. Please wait.

Presentation is loading. Please wait.

Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.

Similar presentations


Presentation on theme: "Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission."— Presentation transcript:

1 Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission

2 Low Levels of Languages  Level L0:  The set of instructions that can be directly executed by the computer  Machine language  Level L1:  A set of instructions that are easier to use than L0  Assembly language  Cannot be directly executed by the computer  Need to translate L1 programs into equivalent L0 programs

3 Compilers (translators)  A L0 program that reads lines of a L1 program, and outputs copies of them in L0 language  Performs a one-time translation from L1 to L0  The translation process is fairly simple  Substitutes each L1 command with an equivalent L0 command  We will have two copies of the program (one in L1 language and one in L0)  If program changes are needed, you change the L1 program and then you must re-translate

4 Interpreters (Virtual Machines)  A L0 program that reads L1 programs and executes them directly  L1 line 1  read by the interpreter  executed by the interpreter  L1 line 2  read by the interpreter  executed by the interpreter  L1 line 3  read by the interpreter  executed by the interpreter  Execution is done by performing an equivalent set of L0 instructions  Will not have a copy of the L1 program in L0 language  “Translation” is performed every time the program executes  Two programs execute: the interpreter + the L1 program (data to the interpreter)  If changes are needed, you simply change the L1 program (no translation step)

5 Low Level Languages (summary)  L0 = machine language / L1 = assembly language  One-to-one translation of the lines  i.e. a 7-line L1 program will produce a 7-line L0 program  Easy to translate  Translation is performed by fairly simple substitution  Programs are long (many steps required to do simple tasks)  Machine dependent

6 Level L0: Machine Language  The set of instructions that can be directly executed by the computer  Language of 1’s and 0’s  Commands are combinations of 1’s and 0’s  Ex: a command to perform addition: 10110  Data are combinations of 1’s and 0’s  Ex: the data to be added: 10110 and 11100  Memory cells are addressed with combinations of 1’s and 0’s  Ex: put the answer from the addition into memory cell 10110  Can’t distinguish the data from the commands or memory cells

7 Level L1: Assembly Language  A set of instructions that are easier to use than L0  Uses words to represent machine language commands  Ex: a command to perform addition: ADD  Uses numbers for data  Ex: the data to be added: 22 and 28  Can use also use words for data (strings)  Uses words to represent memory cells (variables)

8 Level L1: Translation  Translation from assembly language into machine language is done by a type of compiler called an assembler Level L1 ADD 22 28 Level L0 10110 10110 11100

9 How Assemblers Use Variables Program without variables 00: Add mem cells 04 and 06 02: Halt 04: 0005 06: 0008 Program with variables Add mem cells X and Y Halt X: 0005 Y: 0008  Adding a line to this program will require updating the memory cells used in line 04 and 06  Adding a line to this program will not require updating any memory cell references

10 Low Level vs. High Level Languages Low Level Languages  One-to-one translation  Easy to translate  Programs are long  Machine dependent High Level Languages  One high level line translates into several lower level lines  A 5-line L3 program might translate into a 50-line L0 program  Harder to translate  Translation often requires looking at the meaning of several lines of code rather than just performing a simple substitution  Programs are much shorter  Machine Independent  Programs written in a high level language can be moved to a different machine architecture and will still work

11 High Level Languages  Level L2:  Uses sentences to 1) say what you want to do and 2) explain how to do it  Ex: C, C++, Java, Basic, Pascal, Fortran, COBOL, php  Level L3:  Uses sentences to say what you want to do  Ex: SQL, *Prolog  Level L4:  Natural language  Ex: English, Spanish, Pictures * note: many references classify Prolog as Level L4 language

12 High Level Language Comparison Level L4 Print the last name of all customers whose balance is above 100 Level L3 SELECT LastName FROM Customer WHERE Balance > 100 Level L2 try { in = new Scanner(new FileReader(“customer.txt”); while (in.hasNext()) { name = in.next(); balance = in.nextInt(); if (balance > 100) System.out.println(name); } … Requires some knowledge of the data file structure Requires no knowledge of the data file structure Requires a lot of knowledge of the data file structure English SQL Java

13 Generations of Languages 1 st 2 nd 3 rd 4 th 5 th Machine Language Machine Language Assembly Language Assembly Language Easier for humans to read Natural Language Natural Language generationgenerationgenerationgenerationgeneration Easier to translate to machine language Software Development Language Software Development Language Problem Solving Language Problem Solving Language Low Level Languages High Level Languages

14 Architecture  The set of “items” that can be seen and directly used at any particular level  Includes things like how much memory is available  Does not include things like what kind of technology is used to implement the memory  Levels of architecture  Defines different sets of items with which to work  High levels of architecture “hide” the low level items  Makes the entire system easier to work with

15 Architecture Levels – L0  Digital logic level (digital systems course)  AND, OR, and NOT gates  These gates are assembled to create larger circuits (which can be packaged into a single chip)  Arithmetic Circuits, Counters, Multiplexers, Encoders, etc.  Memory  Flip-flops  hold 1 bit of information each  Registers  a combination of several flip-flops working together to store multiple bits  Ex: A 32-bit register = a combination of 32 flip-flops where each store a single bit at the same time

16 Architecture Levels – L1  Microarchitecture level (architecture course)  ALU (arithmetic logic unit)  A chip capable of performing arithmetic and logic operations  Programming involves using binary numbers to select an operation  Ex: 2-wires (input to the ALU) used to select an operation to perform 00 = ADD01 = SUB10 = MUL11 = DIV  Registers  Memory cells to hold commands and data

17 Architecture Levels – L1 (cont)  Data Path  The path that data follows when flowing from circuit to circuit  Often forms a complete circle  Programming involves using binary numbers to:  Turn on some circuit outputs while turning off others This allows data to flow out of some circuits while blocking the flow of data from others  Turn on some circuit inputs while turning off others This allows data to be stored into some circuits, while preventing it from being stored in others

18 Architecture Levels – L1 (cont)  Microprogram (possibly)  A program which controls the ALU, data path and registers to make them work properly  Usually embedded in a ROM (read only memory) chip  In a special purpose computer (ex: a microwave), this is the only program that the computer ever executes  In this computer, a RAM chip would be used to hold data needed by the program, such as user inputer  In a general purpose computer (ex: a PC), this program is an interpreter  Interpreter = a program which fetches, decodes, and executes instructions from a higher level language  This interpreter is what allows the PC to execute different programs  In this computer, a RAM chip holds both a program to be executed and the data the program needs

19 Architecture Levels – L2  ISA level (Instruction Set Architecture) (architecture/assembly language courses)  Machine Language Level  Registers  Memory cells to hold commands and data  A different set, and by different names, than the ones from L1  ALU

20 Architecture Levels – Higher Levels  Level 3: Operating System level (operating systems course)  Combination of level 2 + some new instructions  Usually has a different memory organization  Ability to execute two concurrent programs  Level 4: Assembly Language level (assembly language course)  Level 5: High Level Languages (traditional programming courses)

21 von Neumann Architecture Memory Control Unit Arithmetic Logic Unit Input Output

22 Omnibus Architecture CPU Memory Console Tape I/O  Bus: a collection of parallel wires connecting various computer components


Download ppt "Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission."

Similar presentations


Ads by Google