EKT 422: Computer Architecture Answer Scheme: Tutorial 1 1. Define what is a stored program computer? Computer is supplied with a new set of control signals instead of rewiring the hardware for each new program (hardwired program). The control signals usually supplied via a program that is comprises of a sequence of steps. At each step, some arithmetic or logical operation is performed on some data. For each step, a new set of control signals is needed. 2. List THREE (3) methods of measuring computer performance and briefly explain each of them. MIPS (millions of instructions per second) It is measured by dividing the number of instructions executed for a program over the time required to run it. - Less useful due to :- - Different systems often require different number of instructions to implement a given program. - MIPS does not provide number of instructions require to perform a given task. CPI (Cycles per instruction (CPI)/IPC (instructions executed per clock cycle) It is calculated by dividing the number of clock cycles required to execute the program by the number of instructions executed in running the program. For systems that can execute more than one instruction per clock cycle, the number of (IPC) is often used. The lower the value of CPI, the better the system performance. Benchmark Suites A benchmark suite is a set of programs that are believed to be typical of the programs that will be run on the system. Score of the system on benchmark suite is based on how long it takes the system to execute all of the programs in the suite. 3. A given computer program consists of a 100-instruction loop that is executed 42 times. If it takes 16,000 cycles to execute the program on a given system, what are that system’s CPI and IPC values for the program? Total number of instructions executed = 100 x 42 = 4200. It takes 16,000 cycles to execute the program, so CPI = 16,000 / 4,200 = 3.81 IPC is the reciprocal of the CPI, getting an IPC = 0.26. 4. List FOUR (4) main components of any general purpose computer and briefly explain the function of each unit. - Central processing unit (CPU) – controls the operation of the computer and performs its data processing functions-processor. - Main memory – stores data and instructions - I/O – moves data between the computer and its external environment - System interconnection – some mechanism that provides for communication among CPU, main memory and I/O. 5. Briefly explain Moore’s law. Moore observed that the number of transistors that could be put on a single chip was doubling every year 6. Briefly explain Amdahl’s law. Amdahl’s Law: Make the common case (frequently used task) faster. Overall Speed up of a System =1/ [(fraction unused) + (fraction used) / speed up] Where fraction unused is the fraction of time for which the task is not in use, fraction used is the fraction of time for which the task is in use and speed up is the performance improvement for the task. 7. A student wants to improve the overall performance of a computer by 1.5 times. He intends to do this by changing the cache architecture. If the processor spends 45% of the time in accessing memory for a given program, calculate the speed up of the cache in the new design to achieve his goal. Overall speed up = 1.5; Fraction of time memory used = 0.45, and fraction unused = 0.55 Applying Amdahl’s law, 1.5 = 1/ [0.55 + 0.45/ x] where x is the speed up of the cache in the new design. Therefore, 0.175x = 0.675 or x = 3.857 The student has to improve the cache performance by 3.857 times in the new design. 8. Give the key distinguishing feature of a microprocessor In a microprocessor, all of the components of the CPU are on a single chip 9. Represent a machine code instruction for IAS architecture using the following command. Load the contents of memory address 2. 10. If an IAS architecture computer needs to read a value from memory, list the steps involved in terms of what is put into the MAR, MBR, address bus, data bus and control bus. Repeat for write a value to memory operation. To read a value from memory, the CPU puts the address of the value it wants into the MAR. The CPU then asserts the Read control line to memory and places the address on the address bus. Memory places the contents of the memory location passed on the data bus. This data is then transferred to the MBR. To write a value to memory, the CPU puts the address of the value it wants to write into the MAR. The CPU also places the data it wants to write into the MBR. The CPU then asserts the Write control line to memory and places the address on the address bus and the data on the data bus. Memory transfers the data on the data bus into the corresponding memory location. 11. A benchmark program is running on a 40MHz processor. The object code consists of 100000 instructions with the following instruction mix and clock cycle count: Instruction Type Instruction Count Clock cycle Count Integer arithmetic 45000 1 Data transfer 32000 2 Floating point 15000 2 Control transfer 8000 2 Determine the effective CPI, MIPS rate and execution time for this program. CPI = 1.55; MIPS rate = 25.8; Execution time = 3.87 ns. 12. Translate into equivalent assembly language code for the memory contents of the IAS computer shown below. Address Contents 08A 010FA210FB 08B 010FA0F08D 08C 020FA210FB 13. What is the function of main memory in computer? Stores data and instructions 14. Define the term interrupt and explain why interrupt is needed? Interrupt is a signal or an event used to request the CPU to suspend the current program execution. It occurs when an event inside a computer system requiring some urgent action by the CPU. Interrupts are provided as a way to improve processing efficiency because most external devices are much slower than the processor. 15. What is the benefit of using a multiple bus architecture compared to a single bus architecture. Lots of devices on one bus lead to propagation delays which will degrade the overall system performance. 16. Based on Figure 1, explain the instruction cycle. Figure 1: Instruction cycle. 17. Busses can be classified into three functional groups: data address and control lines. Briefly explain each of the mentioned groups. Data bus Provide a path for moving data between system modules. Address bus Identify the source or destination of data Control bus Transmit both command and timing information between system modules. Timing signal indicate the validity of data and address information. Command signal specify operations to be performed 18. Figure 2 shows the timing diagram for the PCI read operation. Briefly explain the significant events, labeled a-i on the diagram. (Refer Stallings text book page 83-85) Figure 2: PCI Read Timing Diagram. Based on the timing diagram as shown in Figure 3, explain the operation for each label a g. (Refer Stallings text book page 85-87) Figure 3: PCI Bus Arbitration 19. List and briefly define THREE approaches to dealing with interrupts. Disable all interrupts while an interrupt is being processed. Define priorities for interrupts and to allow an interrupt of higher priority to cause a lower-priority interrupt handler to be interrupted. 20. What is interrupt and why interrupt is needed? In computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution. A hardware interrupt causes the processor to save its state of execution and begin execution of an interrupt handler. Software interrupts are usually implemented as instructions in the instruction set, which cause a context switch to an interrupt handler similar to a hardware interrupt. Interrupts are a commonly used technique for computer multitasking, especially in real-time computing. 21. Write and draw the stack (zero-addressing format) operation for the following expression F = A+ B x C + (D x E) x F 22. An address field in an instruction contains decimal value 14. Where is the corresponding operand located for a) Immediate addressing? The address field b) Direct addressing? Memory location 14 c) Indirect addressing? The memory location whose address is in the memory location 14. d) Register addressing? Register 14 e) Register indirect addressing? The memory location whose address is in register 14