Microprocessor Basic Questions

23
Q1. What is microprocessor? What are the fundamental blocks of the microprocessor? Ans. Microprocessor is a program controlled semiconductor device (IC) which fetches, decode and execute instructions. In the world of personal computers the terms microprocessors and CPUs are used interchangeably. Along with CPU a microprocessor chip contains certain set of registers (called the memory unit) along with the bus interfaces. The basic units or blocks of a microprocessor are ALU, CU, Registers, Bus Interface and Interfacing ports. Arithmetic and Logic Unit (ALU): ALU performs all arithmetic and logic operations on data. These operations Microproce ssor and Microproce ssor Developme nt System

description

These questions will help you to understand the basics of a microprocessor and also useful for RGPV exam.

Transcript of Microprocessor Basic Questions

Microprocessor and Microprocessor Development System

Q1. What is microprocessor? What are the fundamental blocks of the microprocessor? Ans. Microprocessor is a program controlled semiconductor device (IC) which fetches, decode and execute instructions. In the world of personal computers the terms microprocessors and CPUs are used interchangeably.Along with CPU a microprocessor chip contains certain set of registers (called the memory unit) along with the bus interfaces.

The basic units or blocks of a microprocessor are ALU, CU, Registers, Bus Interface and Interfacing ports.

Arithmetic and Logic Unit (ALU): ALU performs all arithmetic and logic operations on data. These operations may include addition, subtraction, increment, decrement etc. and logical operations like and, or, xor etc.Control Unit (CU): Thing CU basically performs two tasks- (i) Instruction Interpretation: It reads instruction from memory using PC, recognizes instruction types, get necessary operands and routes them to appropriate functional units. Then necessary signals are issued to perform desired operations.(ii) Instruction Sequencing: It determines the address of next instruction to be executed and also controls the timing of executing instructions. It maintains the synchronization in operation of different parts in the microprocessor.

Array of registers: There are several general purpose registers to store data or address for processing. Some special purpose registers are also present to facilitate processing of specific addresses and data.

Bus Interface: Buses are used to carry address, data and control signals to and from the microprocessor. Buses are high speed communication channels.

I/O Interfaces: The microprocessor needs to take input from the outside world through input devices and display the processed result to the users through output devices.

Q2. Explain the evolution of microprocessor.Ans. Intel 4004 was first microprocessor based on PMOS technology which came in 1971. It was of 4 bits. The processing speed was also very slow. Soon an enhanced version of 4004 was introduced by Intel itself. Since then, several other 4 bit microprocessors have been introduced such as Toshiba's T 3472.The first 8 bit microprocessor was again introduced by Intel itself in 1973. This was named 8008 which was followed by improved version 8080 by Intel. Intel also introduced its 8085 after it. Since that time many other companies came to market such as Motorola, Zilog, Fairchild, Hitachi etc.After the 8 bit processors, the 16 bit processors became more popular with their greater capacity and performance. Motorola's M68000, Intel's 8086 and 80286, and Zilog's Z8000 were some of the powerful 16 bit processors.Latest development in this sequence is the 32 bit microprocessors introduced by many companies. Intel introduced 80386 which is very powerful 32 bit microprocessor. A number of 64 bit microprocessors have also been developed, such as SUN's SPARC and ULTRASPARC, Intel-HP's PA8000 series etc. Evolution in the microprocessors from 1971 till today has been characterized by an improvement in the architecture and instruction set.Some of the famous Intel Microprocessors are:NameYearSpeed of Operation BitsMemory

Intel 40041971750 KHz4 bit1 Kb

Intel 808519763.07 MHz8 bit64 Kb

Intel 808619825-10 MHz16 bit1 Mb

Intel 80286/8038619856-12 MHz, 20-33 MHz16 bit16 Mb

Intel 80486198925-100 MHz32 bit4 Gb

Intel Pentium199360-200 MHz32 bit4-6 Gb

Intel Pentium II1997230-400 MHz32 bit4-6 Gb

Intel Pentium III,IV20001.3GHz, 1.5GHz32 bit4-6 Gb

Intel Itanium20012-3 GHz32bit/64bit4-12 Gb

Q3. Explain the architecture of a microprocessor.Ans. The block diagram includes three major logic devices:1. ALU: (from 1)2. Several Registers:*Program Counter: It gives the address of the memory location from where the next instruction is to be fetched.*Instruction Register: Instruction read from the memory is loaded into the I.R. It is then send to the instruction decoder, which decodes the instruction and gives decoded signal as an input to the control unit.*A Register (Accumulator): It holds one of the operands required for operation by the ALU and after performing operation the result is also stored in Accumulator.*Status Register: It is used to store the result of certain conditions such as if result is zero, if result is negative etc.3. CU: (from 1)

Q4. Give the four operations commonly performed by the MPU (Microprocessing Unit).Ans. The following operations are performed by the MPU:a. Memory Read- Reads data or instructions from the memory.b. Memory Write- Writes data or instructions into memory.c. I/O Read- Accepts data from input devices.d. I/O Write- Sends data to output devices.All these operations are part of the communication process between the MPU and peripheral devices.

Q5. Explain classification of memory.Ans. The memory module consists of two sections: an internal memory section for storage of active data and instructions and an external memory section for long term storage. The internal memory is also called primary memory or main memory as it can be directly accessed by the microprocessor with a random access.Due to this such memories are able to respond fast enough to synchronize with the execution speed of the microprocessor. On the other hand external memory devices cannot be directly accessed by the microprocessor. These devices are also called secondary device or secondary memory.Main memory: The main memory is also called the semiconductor memory. They are classified as:

(i) ROM (Read Only Memory) - We cannot write data in this memory. It is non-volatile memory i.e. it can hold data even if power is turned off. Generally ROM is used to store the information that doesn't change. There are 4 types of ROMs:

a> Masked ROM - A diode ROM consists of only diodes and a decoder. Nowadays ROMs use MOS technology instead of diode. Here, diodes and pull up resistors are replaced by MOS transistors. In IC a thin metallized layer connects the gates of some transistors to row select lines depending on data to be stored in ROM. Once the pattern or mask is decided it is possible to make thousands of such ROMs. Such ROMs are called Mask-Programmed ROMs. Masked ROMs are used in microprocessor based toys, TV games, home computers etc.

b> PROM (Programmable Read Only Memory) - It has diode in every bit position therefore the output is initially all 0s. Each diode however has a fusible link in series in series with it. By addressing bit and applying proper current pulse at the corresponding o/p, we can blow out the fuse, storing logic 1 at that bit position. For blowing the fuse it is necessary to pass around 20 to 50 mA of current for period 5 to 20 microseconds. The blowing of fuse according to the truth table is called programming of ROM. The PROMs are one time programmable. Once programmed, the information stored is permanent.

c> EPROM (Erasable Programmable ROM) - EPROM uses MOS circuitry. They stores 1s and 0s as a packet of charge in a buried layer of the IC chip. We can erase the stored data in the EPROMs by exposing the chip to ultraviolet light through its quartz window for 15 to 20 minutes. It is not possible to erase selective information, when erased the entire information is lost. The chip can be reprogrammed. It is ideally suitable for product development, experimental projects and college labs. When erased each cell in the EPROM contains 1. Data is introduced by selectively programming 0s into the desired bit locations.

d> EEPROM (Electrically EPROM) - EEPROM also uses MOS circuitry very similar to that of EPROM. Data is stored as charge or no charge on an insulated layer or an insulated floating gate in the device. The insulating layer is made very thin. Therefore, a voltage as low as 20 to 25 V can be used to move charges across the thin barrier in either direction for programming or erasing. It allows selective erasing at the register level rather than erasing all the information since the information can be changed by using electrical signals. It also has a special chip erase mode by which entire chip can be erased in 10 milliseconds. However, EEPROMs are most expensive and the least dense ROMs.

(ii)RAM (Random Access Memory) - Unlike ROM, we can read from or write into the RAM, so it is often called read/write memory. The data that are to be processed by the computer change frequently. These data must be stored in type of memory from which they can be read by the microprocessor, modified through processing and written back for storage. For this reason they are stored in RAM instead of ROM. But it is a volatile memory, i.e. it cannot hold data when power is turned off.There are two types of RAMs-

a> Static RAM - Memories that consists of circuits capable of retaining their state as long as power is applied are known as static memories. These are Random Access Memories and hence combinly called Static RAM memories. Memory cells are organized in the form of an array, in which each cell is capable of storing one bit of information.

b> Dynamic RAM - Dynamic RAM stores the data as a charge on the capacitor. A DRAM contains thousands of such memory cells. Since only a single MOSFET and capacitor are needed, the dynamic RAM contains more memory cells as compared to static RAM per unit area. The disadvantage of dynamic RAM is that it needs refreshing of on the capacitor after every few milliseconds.

Q6. Differentiate between SRAM and DRAM.Ans.Static RamDynamic Ram

1. SRAM contains less memory cells per unit area.1. DRAM contains more memory cells as compared to SRAM per unit area.

2. It has less access time hence faster memories.2. Its access time is greater than static RAM.

3. SRAM consists of no. of flip-flops. Each flip flop stores one bit.3. DRAM stores the data as a charge on the capacitor. It consists of MOSFET and the capacitor for each cell.

4. Refreshing circuitry is not required.4. Refreshing circuitry is required to maintain the charge on the capacitors after every few milliseconds.

5. Cost is more.5. Cost is less.

Q7. Explain register. What are shift registers and their types?Ans. Register- A group of flip-flops can be used to store a word, which is called register. A flip-flop can store 1-bit information. So an n-bit register has a group of n flip-flops and is capable of storing any binary information/number containing n-bits.Shift Register- The binary information in a register can be moved from stage to stage within the register or into or out of the register upon application of clock pulses. This type of movement or shifting is essential for certain arithmetic and logic operations used in microprocessors. This gives rise to a group of registers called 'shift registers'.The basic types of shift registers in terms of data movement are as follows:1. Serial Input Serial Output

Data bits are shifted by 1 position per clock cycle.

2. Serial Input Parallel Output

Data can be loaded into register by shift right serial operation in 4 clock cycles. It is then made available simultaneously at the output.3. Parallel Input Serial Output

All inputs can be loaded simultaneously. However, output is available on serial output bit by bit.4. Parallel Input Parallel Output

All input can be loaded simultaneously and register data is also available at the output simultaneously.

Q8. Explain Cache memory.Ans. In a computer system, the program which is to be executed is loaded in the main memory (DRAM). Processor then fetches the code and data from the main memory to execute the program. The DRAMs which form the main memory are slower devices. So it is necessary to insert wait states in memory read/write cycles. This reduces the speed of execution. To speed up the process, high speed memories such as SRAMs must be used. But considering the cost and space required for SRAMs, it is not desirable to use SRAMs to form the main memory. But considering the fact that most of the microprocessor programs work with only small sections of code and data at a particular time. In the memory system, small section of SRAM is added along with main memory, referred to as cache memory. The program which is to be executed is loaded in the main memory, but the part of program (code) and data that work at a particular time is usually accessed from the cache memory. This is accomplished by loading the active part of code and data from main memory to cache memory.When the data required for execution is found in the cache it is called cache hit otherwise a cache miss.The percentage of accesses where the processor finds the code or data word it needs in the cache memory is called the hit rate. Hit rate should be greater than 90%.

Q9. Explain magnetic memories.Ans. Magnetic memories are nonvolatile memory. They store information permanently. They are slower than semiconductor memory. The commonly used magnetic memories are of three types: hard disks, floppy disks and magnetic tapes. These devices are bulky storage devices. They are used to store information at a lower cost compared to semiconductor devices. These are not static devices. They are rotated while reading or writing information.

Hard Disk Memory: It is a magnetic memory and most common secondary storage device. Nowadays we are having removable hard disks. It consists of stack of magnetic disks. A magnetic disk is a thin, circular metal plate. It is coated with a thin magnetic film, usually on both sides. Digital information is stored on the magnetic disk by magnetizing the magnetic surface in a particular direction. The disks are mounted on a rotary drive so that the magnetized surface moves in close proximity to magnetizing coil or head.

Floppy Disk Memory: Floppy disks are smaller, simpler and cheaper disk units that consist of flexible, removable, plastic diskettes coated with magnetic material. The diskette is enclosed in a plastic jacket, which has an opening where the head makes contact with the diskette.Nowadays floppy disks are not in use because of arrival of flash drives that are much faster and have greater capacity than the floppy disks.Magnetic Tapes: It is one of the most popular storage medium for large data that are sequentially accessed and processed. The tape is formed by depositing magnetic film on a very thin plastic tape. Like audio tape, computer tape can be erased and reused indefinitely. Old data on a tape are automatically erased as new data are recorded in the same area.Q10. Explain the concept of virtual memory.Ans. In most modern computers, the physical main memory is not as large as the address space spanned by an address issued by the processor. Here, the virtual memory technique is used to extend the apparent size of the physical memory. It uses secondary storage such as disks, to extend the apparent size of the physical memory.When a program does not completely fit into the main memory, it is divided into segments. The segments which are currently being executed are kept in the main memory and remaining segments are stored in the secondary storage devices, such as a magnetic disk. If an executing program needs a segment which is not currently in the main memory, the required segment is copied from the secondary storage device. When a new segment of a program is to be copied into a main memory, it must replace another segment already in the memory. The addresses that processor issues to access either instruction or data are called virtual addresses. These addresses are translated into physical addresses by a combination of hardware and software components. The memory management unit controls the virtual memory system. It translates virtual addresses into physical addresses. A simple method for translating virtual addresses into physical addresses is to assume that all programs and data are composed of fixed length unit called pages.Address Translation: In virtual memory, the address is broken into a virtual page no. and a page offset. The physical page no. constitutes the upper portion of the physical address, while the page offset, which is not changed, constitutes the lower portion. The page table is used to keep the information about the main memory location of each page. To obtain the address of the corresponding entry in the page table the virtual page number is added with the contents of page table base register, in which the starting address of the page table is stored. The entry in the page table gives the physical page no., in which offset is added to get the physical address of the main memory.

If the page required by the processor is not in the main memory, the page fault occours and the required page is loaded into the main memory from the secondary storage memory by special routine called page fault routine. This technique of getting the desired page in the main memory is called demand paging.To avoid access time a small portion of the page table is accommodated in the memory management unit. This portion is called Translation Lookaside Buffer (TLB).Q11. What is bus? What are its types?Ans. A microprocessor communicates with memory and I/O devices with a common communication path called bus. A bus is basically a collection of wires which transmit binary nos., 1 bit per wire. There are three types of busses: 1. Address Bus: The address bus consists of 16, 20, 24, or 32 parallel signal lines. On these lines the CPU sends out the address of the memory location that is to be written to or read from. The number of memory locations that the CPU can address is determined by the number of address lines. If the CPU has N address lines, then it can directly address 2^N memory locations.2. Data Bus: The data bus consists of 8, 16, or 32 parallel signal lines. The microprocessor has to fetch (read) the data from memory or input device for processing and after processing, it has to store (write) the data to memory or output device. Hence data bus is bidirectional.3. Control Bus: The control bus consists of 4 to 10 parallel signal lines. The CPU sends out signals on the control bus to enable the outputs of addressed memory devices or port devices. Typical control bus signals are Memory Read, Memory Write, I/O Read, and l/O Write.

Q12. What are I/O ports? What are programmable and non-programmable ports?Ans. An input device is connected to the microprocessor through an input port. An input device unloads data into the port. An input port is a place for unloading data. The microprocessor reads from the input port. Thus data are transferred from the input device to the accumulator via input port. Similarly an output device is connected to the microprocessor through an output port. The microprocessor unloads data into an output port. As the output port is connected to the output device, data are transferred to the output device.

An I/O port may be programmable or non-programmable. A non-programmable port behaves as an input port if it has been designed and connected in input mode. Similarly, a port connected in output mode acts as an output port.But a programmable I/O port can be programmed to act either as an input port or output port; the electrical connections remain the same.

Q13. What are I/O interfacing techniques?Ans. The microprocessor partitions memory from I/O by having instructions that specifically access memory and others that specifically access I/O. When these instructions are decoded by the microprocessor, an appropriate control signal is generated to activate either memory or I/O operation.Input/output devices can be interfaced with microprocessor systems in two ways:1. I/O mapped I/O: In I/O mapped interfacing the devices are viewed as distinct I/O devices and are addressed accordingly. All the available address lines of a microprocessor may not be used for interfacing the devices. The processor 8086 has 20 address lines. The I/O mapped scheme may use at the most 16 address lines or even 8 address lines for address decoding. The 8086 has four special instructions IN, INS, OUT, OUTS to transfer data through the input/output ports in I/O mapped I/O system.2. Memory mapped I/O: In this scheme the devices are viewed as memory locations and are addressed likewise. All the available address lines are used for address decoding.

Q14. What are various schemes of data transfer from CPU/memory to I/O devices and vice versa?Ans. In I/O data transfer, the system requires the transfer of data between I/O devices and microprocessor using I/O interface. It uses various techniques to perform I/O operations. These are: 1. Program Controlled I/O or Programmed I/O or Polled I/OThe I/O operation will cause a data transfer between an I/O device and memory or between an I/O device and the processor. If in any computer system I/O operations are completely controlled by the processor then that system is said to be using Programmed I/O. It is the responsibility of the processor to periodically check the status of the I/O system until it finds that the operation is complete.The processor has to check each I/O device in sequence an in effect ask each one if it needs communication with the processor, this is called polling. The polling decreases the system throughput.2. Interrupt Driven I/OIn this scheme external asynchronous input is used to tell the processor that I/O device needs its service and hence processor does not have to check whether I/O device needs its service or not. The processor is allowed to execute its instructions in sequence and only stop to service I/O device when it is told to do so by the device itself. This increases system throughput. When the I/O device becomes ready to transfer data, it sends a signal to microprocessor through interrupt line. On receiving an interrupt the microprocessor completes the current instruction at hand and then attends the I/O device. It saves the contents of the program counter on the stack first and then takes up the subroutine. After completing the data transfer the microprocessor returns back to the main program it was executing before the interrupt occoured.

3. DMA (Direct Memory Access) Transfer or Hardware Controlled I/OIn DMA data transfer scheme CPU does not participate. Data are directly transferred from an I/O device to the memory or vice-versa. DMA data transfer scheme is a faster scheme as compared to Programmed I/O and Interrupt Driven I/O. An I/O device which wants to send data using DMA technique sends the HOLD signal to the CPU. On receiving a HOLD signal from an I/O device the CPU gives up the control of the buses as soon as the current machine cycle is completed. The CPU sends the HOLD acknowledgement signal to the I/O device to indicate that it has received the HOLD request and it has released the buses. The I/O device takes over the control of the buses and directly transfers data to the memory or reads data from the memory. a. Burst mode of DMA transfer: A scheme of DMA data transfer, in which the I/O device withdraws the DMA request only after all the data bytes have been transferred is called burst mode of data transfer. This technique is employed by magnetic disk drives because in magnetic disks the transfer cannot be stopped or slowed down without loss of data.b. Cycle Stealing Technique: In this method after transferring one byte or several bytes the I/O device withdraws DMA request. In this technique a long block of data is transferred by a sequence of DMA cycles. This method reduces interference in CPU activities.

Q15. What is tri- state logic? Why tri state logic is needed in microprocessor system?Ans. In tri-state logic, three logic levels are used and they are High, Low, and High impedance state. The High and Low are normal logic levels and high impedance state is electrical open circuit condition. In microprocessor system all devices are connected to a common (System) bus. But communication takes place between the master (microprocessor) and one slave (peripheral) at any time instant. During this time instant, all other devices should be isolated from the bus. Therefore, normally all the slaves (peripherals) will remain in high impedance state (in electrical isolation) the master will select a slave by sending address and chip select signal. When the slave is selected, it comes to normal logic and it communicates with master.

Q16. What are the functions of the following signals in a microprocessor: A)Reset B)Interrupt C)Ready D)Hold. ?Ans. A) Reset: when reset is activated all internal operations are suspended and the program counter is cleared.B) Interrupt: the Microprocessor can be interrupted from normal execution and asked to execute other instructions called "service routine" (emergency), Microprocessor resumes its operation after that.C) Ready: If the signal in the pin Ready is low Microprocessor enters into wait state, this signal is used to synchronize slower peripherals with Microprocessor. It is used by microprocessor to sense whether the peripheral device is ready to transfer the data or not.D) Hold: when hold pin activated by external signal Microprocessor relinquishes control buses and allows the external peripheral to use the. For example: Hold signal is used in direct memory access data transfer.