250 likes | 389 Views
Data manipulation, Part one. Introduction to computer, 2nd semester, 2010/2011 Mr.Nael Aburas nras@iugaza.edu.ps 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
E N D
Data manipulation, Part one Introduction to computer, 2nd semester, 2010/2011 Mr.NaelAburasnras@iugaza.edu.ps Faculty of Information Technology Islamic University of Gaza Islamic University Of Gaza, NaelAburas
overview • In this chapter we will study how computer manipulates the data. • Moving data from one location to another • Performing operations such as: arithmetic calculations, text editing, and so on. Islamic University Of Gaza, Nael Aburas
Computer 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
CPU basics • Consists 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
CPU 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
Bus • For 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
Bus • CPU and main memory are connected via a bus Islamic University Of Gaza, Nael Aburas
Stored-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
Machine 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
Machine 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
Machine Instruction Types • Machine instruction can be categorized into three grouping: • Data transfer • Arithmetic/logic • control Islamic University Of Gaza, Nael Aburas
Data 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
Data transfer • A 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
Data transfer • I/O instructions: the instructions that handle the input/output activities of the machine Islamic University Of Gaza, Nael Aburas
Arithmetic/logic group • The 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
Control group • These 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
An illustrative machine language • 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
An illustrative machine language • 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
An illustrative machine language • Example: 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
Figure 2.6 Decoding the instruction 35A7 Islamic University Of Gaza, Nael Aburas
Appendix C: A Simple Machine Language Op-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
Adding values stored in memory Islamic University Of Gaza, Nael Aburas
An encoded version of the instructions in previous slide Islamic University Of Gaza, Nael Aburas
Exercise The following are instructions written in the machine language described in appendix C rewrite them in English. • 368A • BADE • 803C • 40F4 Islamic University Of Gaza, Nael Aburas
Exercise • Here are some instructions in English. Translate each of them into the machine language of appendix C • LOAD register number 3 with the hexadecimal value 56 • ROTATE register number 5 three bits to the right • 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