data manipulation, part one

25
Data manipulation, Data manipulation, Part one Part one Introduction to computer, 2nd semester, 2010/2011 Mr.Nael Aburas [email protected] Faculty of Information Technology Islamic University of Gaza Islamic University Of Gaza, Nael Aburas 1

Upload: min

Post on 22-Jan-2016

40 views

Category:

Documents


0 download

DESCRIPTION

Data manipulation, Part one. Introduction to computer, 2nd semester, 2010/2011 Mr.Nael Aburas [email protected] Faculty of Information Technology Islamic University of Gaza. overview. In this chapter we will study how computer manipulates the data. Moving data from one location to another - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Data manipulation, Part one

Data manipulation, Part Data manipulation, Part oneone

Introduction to computer, 2nd semester, 2010/2011Mr.Nael Aburas [email protected] of Information TechnologyIslamic University of Gaza

Islamic University Of Gaza, Nael Aburas 1

Page 2: Data manipulation, Part one

overviewoverviewIn this chapter we will study how

computer manipulates the data.Moving data from one location to

anotherPerforming operations such as:

arithmetic calculations, text editing, and so on.

Islamic University Of Gaza, Nael Aburas 2

Page 3: Data manipulation, Part one

Computer architectureComputer architecture The circuitry in the computer that

control the manipulation of data is called the CPU.

CPUs were large units comprised of several racks of electronic circuitry.

Today's, CPUs are packaged as small flat squares whose connecting pins plug into a socket mounted in the main board.

Due to their small size, these processors are called microprocessor.

Islamic University Of Gaza, Nael Aburas 3

Page 4: Data manipulation, Part one

CPU basicsCPU basicsConsists of three parts

◦Arithmetic/Logic unit Performs operations on data (addition,

subtraction)

◦Control unit Coordinating the machine’s activities

◦Registers Contain data storage cell that are used to

temporary storage within the CPU. (similar to main memory cells)

Islamic University Of Gaza, Nael Aburas 4

Page 5: Data manipulation, Part one

CPU basicsCPU basics The registers hold the inputs to the

arithmetic/logic unit and provide storage space for results produced by that unit.

The control unit transfer data from a main memory into registers, inform the arithmetic/logic unit which the register hold the data, activates the appropriate circuitry within the arithmetic/logic unit, and tells the arithmetic/logic unit which register should receive the result.

Islamic University Of Gaza, Nael Aburas 5

Page 6: Data manipulation, Part one

BusBusFor the purpose of transferring bit, a CPU

and main memory are connected by a collection of wires called a bus. (wires connecting CPU and main memory)

Through this bus, the CPU read data from main memory by supplying the address of the pertinent memory cell along with an electronic signal telling the memory that it is supposed to retrieve the data in the indicated cell.

CPU writes data in memory by providing the address of the destination cell and the data to be stored together with electronic signal telling the main memory that it is supposed to store the data being sent to it.

Islamic University Of Gaza, Nael Aburas 6

Page 7: Data manipulation, Part one

BusBusCPU and main memory are connected via a

bus

Islamic University Of Gaza, Nael Aburas 7

Page 8: Data manipulation, Part one

Stored-program conceptStored-program concept The idea of storing a computer’s

program “instructions” in the main memory.

Storage of instructions in computer memory to enable it to perform a variety of tasks in sequence

Islamic University Of Gaza, Nael Aburas 8

Page 9: Data manipulation, Part one

Machine languageMachine language Machine language: The set

(collection) of all instructions recognized by a machine (CPU)

Machine instruction: An instruction (or command) encoded as a bit pattern recognizable by the CPU

Compilers and interpreters translate from high-level language to machine language

Islamic University Of Gaza, Nael Aburas 9

Page 10: Data manipulation, Part one

Machine languageMachine language RISC (reduced instruction set computer)

CPU should be designed to execute a minimal set of machine instructions.

(Few, simple, efficient, and fast instructions).In this architecture, such mahcine is efficent

and fast. CISC (complex instruction set computer)

Ability to excute a large number of complex instructions.

More complex cpu is easier to program because single instruction can be used to accomplish a task that would require a multi-instruction sequence in a RISC design.

Islamic University Of Gaza, Nael Aburas 10

Page 11: Data manipulation, Part one

Machine Instruction TypesMachine Instruction TypesMachine instruction can be

categorized into three grouping:◦Data transfer◦Arithmetic/logic◦control

Islamic University Of Gaza, Nael Aburas 11

Page 12: Data manipulation, Part one

Data transferData transfer Data transfer group consists of

instructions that request the movement of the data from one location to another.

Islamic University Of Gaza, Nael Aburas 12

Page 13: Data manipulation, Part one

Data transferData transferA special terms are used when

referring to the transfer of data between the CPU and the main memory◦A request to fill a register with the

contents of a memory cells is referred to as a LOAD instruction.

◦A request to transfer the contents of a register to a memory cell is called a STORE instruction.

Islamic University Of Gaza, Nael Aburas 13

Page 14: Data manipulation, Part one

Data transferData transferI/O instructions: the instructions

that handle the input/output activities of the machine

Islamic University Of Gaza, Nael Aburas 14

Page 15: Data manipulation, Part one

Arithmetic/logic groupArithmetic/logic groupThe instruction that tell the

control unit to request an activity within the arithmetic/logic unit.

The arithmetic/logic unit perform the Boolean operations

The instructions that allows the contents of registers to be moved to the right or the left within the register, such as SHIFT, ROTATE.

Islamic University Of Gaza, Nael Aburas 15

Page 16: Data manipulation, Part one

Control groupControl groupThese instructions direct the

execution of the program.This group contains many of the

instructions in the machine such as the family of JUMP instructions that used to direct the CPU to execute an instruction other than the next one in the list.

Islamic University Of Gaza, Nael Aburas 16

Page 17: Data manipulation, Part one

An illustrative machine An illustrative machine languagelanguage The machine instruction that will be described

consists of two parts: Op-code

◦ Indicates which of the operations such as (STORE, SHIFT…etc) are requested by the instruction.

Operand◦ Provide more detailed information about the operation

specified by the op-code The machine has 16 register and 256 main memory

cells, each of capacity eight bit. For referencing purposes, the registers are labeled 0

through F, and the main memory cells are addressed 00 through FF.

Islamic University Of Gaza, Nael Aburas 17

Page 18: Data manipulation, Part one

An illustrative machine An illustrative machine languagelanguage The machine language for our

illustrative machine is are shown in Appendix C.

Each of these instructions is encoded using total of 16 bit, represented by four hexadecimal digits.

As shown in appendix c, the instruction that begin with op-code 3refer to a STORE instruction, and which begn with A refers to a ROTATE instruction.

If the op-code is 3, then the next hexadecimal digit of the instruction indicate which register is to be stored.

Islamic University Of Gaza, Nael Aburas 18

Page 19: Data manipulation, Part one

An illustrative machine An illustrative machine languagelanguageExample: 35A7, translates to the

statement “ STORE the bit pattern found in register 5 in the main memory cell whose address is A7.

Islamic University Of Gaza, Nael Aburas 19

Page 20: Data manipulation, Part one

Figure 2.6 Decoding the Figure 2.6 Decoding the instruction 35A7instruction 35A7

Islamic University Of Gaza, Nael Aburas 20

Page 21: Data manipulation, Part one

Appendix C: A Simple Machine Appendix C: A Simple Machine LanguageLanguageOp-code Operand Description

1 RXY LOAD the register R with the bit pattern found in the memory cell whose address is XY.

3 RXY STORE the bit pattern found in register R in the memory cell whose address XY.

5 RST ADD the bit pattern in register S and T and leave the result in

register R. (2’s comp.)

Islamic University Of Gaza, Nael Aburas 21

Page 22: Data manipulation, Part one

Adding values stored in memoryAdding values stored in memory

Islamic University Of Gaza, Nael Aburas 22

Page 23: Data manipulation, Part one

An encoded version of the instructions in previous An encoded version of the instructions in previous slideslide

Islamic University Of Gaza, Nael Aburas 23

Page 24: Data manipulation, Part one

Exercise Exercise

The following are instructions written in the machine language described in appendix C rewrite them in English.a) 368Ab) BADEc) 803Cd) 40F4

Islamic University Of Gaza, Nael Aburas 24

Page 25: Data manipulation, Part one

Exercise Exercise Here are some instructions in English.

Translate each of them into the machine language of appendix Ca) LOAD register number 3 with the

hexadecimal value 56b) ROTATE register number 5 three bits to

the rightc) AND the contents of register A with the

contents of register 5 and leave the result in register 0

Islamic University Of Gaza, Nael Aburas 25