Date post: | 13-Jan-2016 |
Category: |
Documents |
Upload: | susanna-stephens |
View: | 220 times |
Download: | 1 times |
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
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
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
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
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
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
BusBusCPU and main memory are connected via a
bus
Islamic University Of Gaza, Nael Aburas 7
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
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
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
Machine Instruction TypesMachine Instruction TypesMachine instruction can be
categorized into three grouping:◦Data transfer◦Arithmetic/logic◦control
Islamic University Of Gaza, Nael Aburas 11
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
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
Data transferData transferI/O instructions: the instructions
that handle the input/output activities of the machine
Islamic University Of Gaza, Nael Aburas 14
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
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
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
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
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
Figure 2.6 Decoding the Figure 2.6 Decoding the instruction 35A7instruction 35A7
Islamic University Of Gaza, Nael Aburas 20
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
Adding values stored in memoryAdding values stored in memory
Islamic University Of Gaza, Nael Aburas 22
An encoded version of the instructions in previous An encoded version of the instructions in previous slideslide
Islamic University Of Gaza, Nael Aburas 23
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
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