Operational concepts, Instruction codes, Computer Registers, Computer Instructions, Memory locations and addresses, Instruction cycle, Timing and control, Bus organization Von Neumann Architecture Basic Operational Concepts • The primary function of a computer system is to execute a program, sequence of instructions. These instructions are stored in computer memory. • These instructions are executed to process data which are already loaded in the computer memory through some input devices. • After processing the data, the result is either stored in the memory for further reference, or it is sent to the outside world through some output port. • To perform the execution of an instruction, in addition to the arithmetic logic unit, and control unit, the processor contains a number of registers used for temporary storage of data and some special function registers • The special function registers include program counter (PC), instruction register (IR), memory address register (MAR) and memory and memory data register (MDR). • The Program counter is one of the most critical registers in CPU. • The Program counter monitors the execution of instructions. It keeps track on which instruction is being executed and what the next instruction will be. • The instruction register IR is used to hold the instruction that is currently being executed • The contents of IR are available to the control unit, which generate the timing signals that control, the various processing elements involved in executing the instruction. • The two registers MAR and MDR are used to handle the data transfer between the main memory and the processor. • The MAR holds the address of the main memory to or from which data is to be transferred. • The MDR contains the data to be written into or read from the addressed word of the main memory. • Whenever the processor is asked to communicate with devices, we say that the processor is servicing the devices. The processor can service these devices in one of the two ways. • One way is to use the polling routine, and the other way is to use an interrupt. • Polling enables the processor software to check each of the input and output devices frequently. During this check, the processor tests to see if any devices need servicing or not. • Interrupt method provides an external asynchronous input that informs the processor that it should complete whatever instruction that is currently being executed and fetch a new routine that will service the requesting device Instruction codes • Computer instructions are a set of machine language instructions that a particular processor understands and executes. • A computer performs tasks on the basis of the instruction provided. • An instruction comprises of groups called fields. These fields include: 1. The Operation code (Opcode) field which specifies the operation to be performed. 2. The Address field which contains the location of the operand, i.e., register or memory location. 3. The Mode field which specifies how the operand will be located. Instruction Code Formats • A basic computer has three instruction code formats 1. Memory - reference instruction 2. Register - reference instruction 3. Input-Output instruction 1.Memory - reference instruction • In Memory-reference instruction, • First 12 bits ( 0 to 11 bits) of memory is used to specify an address • Next 3 bits (12 to 14) bit to specify the opode (from 000 to 110) • Last 1 bit (15th bit ) addressing mode 'I‘ ( can be either 0(direct) or 1(in-direct) ) 2. Register - reference instruction • It specifies an operation on the Accumulator register • Operand from memory is not needed • First 12 bits are used to represent operation to be executed • 12th to 14th bits for the opcode representation (111 always) • 15th bit is always 0 3. Input-Output instruction • I/O instructions are needed for transferring information to and from AC register, for checking the flag bits, & controlling the interrupt facility • First 12 bits are used to specify the type of I/O operation performed • Identified by the opcode 111(12th to 14th) • and a 1 in the 15th bit, which is always 1 Computer Registers • Registers are a type of computer memory used to quickly accept, store, and transfer data and instructions that are being used immediately by the CPU. The registers used by the CPU are often termed as Processor registers. • A processor register may hold an instruction, a storage address, or any data (such as bit sequence or individual characters). • The computer needs processor registers for manipulating data and a register for holding a memory address. The register holding the memory location is used to calculate the address of the next instruction after the execution of the current instruction is completed Register and Memory configuration for a basic computer. • The Memory unit has a capacity of 4096 words, and each word contains 16 bits. • The Data Register (DR) contains 16 bits which hold the operand read from the memory location. • The Memory Address Register (MAR) contains 12 bits which hold the address for the memory location. • The Program Counter (PC) also contains 12 bits which hold the address of the next instruction to be read from memory after the current instruction is executed. • The Accumulator (AC) register is a general purpose processing register. • The instruction read from memory is placed in the Instruction register (IR). • The Temporary Register (TR) is used for holding the temporary data during the processing. • The Input Registers (IR) holds the input characters given by the user. • The Output Registers (OR) holds the output after processing the input data. Stored program organization • The simplest way to organize a computer is to have one processor register and an instruction code format with two parts. • The first part specifies the operation to be performed and the second specifies an address. • The memory address tells the control where to find an operand in memory. Memory locations and addresses
• Memory consists of many millions of storage cells (flip-flops).
• Each cell can store a bit of information i.e. 0 or 1 (Figure). • Each group of n bits is referred to as a word of information, and n is called the word length. • The word length can vary from 8 to 64 bits. • A unit of 8 bits is called a byte. • Accessing the memory to store or retrieve a single item of information (word) requires distinct addresses for each item location. (It is customary to use numbers from 0 through 2ˆn-1 as the addresses of successive-locations in the memory). • If 2ˆn = no. of addressable locations; then 2ˆn addresses constitute the address-space of the computer. For example, a 24-bit address generates an address-space of 2ˆ24 locations (16 MB) Instruction Cycle • A program residing in the memory unit of a computer consists of a sequence of instructions. These instructions are executed by the processor by going through a cycle for each instruction. • In a basic computer, each instruction cycle consists of the following phases: 1. Fetch instruction from memory. 2. Decode the instruction. 3. Read the effective address from memory. 4. Execute the instruction. Fetch & Decode • Initially PC is loaded with the address of the first instruction in the program • The micro operations during fetch & decode are; • T0: AR<-PC • T1: IR<-M[AR], PC->PC+1 • T2: DO,D1,D2…D7 <- Decode IR(12-14), AR<-IR (0-11), I<-IR(15) • After decoding the instruction, the next step is to determine the type of the instruction @ timing signal T3 1.Memory reference • If D7=0 and I=1, the indirect • else if D7=0 and I=0, it is direct 2. Register reference OR I/O • If D7=1 and I=0 , Register • If D7=1 and I=1, I/O • The micro operations during T3 • D7’ I T3 :- AR<- M[AR] (memory reference & indirect) • D7’ I’ T3 :- Nothing (memory reference & direct) • D7 I’ T3 :- Execute register reference • D7 I T3 :- Execute I/O instruction Types of Instructions / Instruction Classification • Most computer instructions can be classified into three categories. 1. Data Transfer 2. Data manipulation 3. Program control Data transfer instructions • Data transfer instructions move data from one place in the computer to another without changing the data. • Typical transfers are between memory and processor registers, between processor registers and input and output registers, and among the processor registers themselves Data manipulation instructions • Data manipulation instructions perform operations on data and provide the computational capabilities for the computer. • The data manipulation instructions in a typical computer usually divided into three basic types as follows. 1. Arithmetic instructions. 2. Logical and bit manipulation instructions. 3. Shift instructions. Program control instructions • Program Control Instructions are the machine code that are used by machine or in assembly language by user to command the processor act accordingly. Timing and Control Bus organization • Bus is a subsystem that is used to transfer data and other information between devices. • Means various devices in computer like(Memory, CPU, I/O and Other) are communicate with each other through buses. • In general, a bus is said to be as the communication pathway connecting two or more devices. • A key characteristics of a bus is that it is a shared transmission medium, as multiple devices are attached to a bus. • Typically, a bus consists of multiple communication Pathways or lines which are either in the form of wires or metal lines etched in a card or board(Printed Circuit Board). • Each line is capable of transmitting binary 1 and binary 0. • Computer System Contains a number of different buses that provide pathways between components at various levels of computer system hierarchy. • But before discussing them i.e., types of buses , i will first describe here one of the most important aspect of buses which is described below- 1. Address bus: Address bus is used to carry the address. It is unidirectional bus. The address is sent to from CPU to memory and I/O port and hence unidirectional. It consists of 16, 20, 24 or more parallel signal lines. 2. Data bus: Data bus is used to carry or transfer data to and from memory and I/O ports. They are bidirectional. The processor can read on data lines from memory and I/O port and as well as it can write data to memory. It consists of 8, 16, 32 or more parallel signal lines. 3. Control bus: Control bus is used to carry control signals in order to regulate the control activities. They are bidirectional. The CPU sends control signals on the control bus to enable the outputs of addressed memory devices or port devices. Some of the control signals are: MEMR (memory read), MEMW (memory write), IOR (I/O read), IOW (I/O write), BR (bus request), BG (bus grant), INTR (interrupt request), INTA (interrupt acknowledge), RST (reset), RDY (ready), HLD (hold), HLDA (hold acknowledge),