Unit-4 Q&A
Unit-4 Q&A
Unit-4 Q&A
With a neat diagram, show the memory address map of RAM and ROM for a computer system
(Assume 512 bytes )[Apply]
Main Memory
The main memory is the central storage unit in a computer system.
Primary memory holds only those data and instructions on which computer is currently
working.
It has limited capacity and data is lost when power is switched off.
It is generally made up of semiconductor device.
These memories are not as fast as registers.
The data and instruction required to be processed reside in main memory.
It is divided into two subcategories RAM and ROM.
The designer of a computer system must calculate the amount of memory required forthe
particular application and assign it to either RAM or ROM.
The interconnection between memory and processor is then established fromknowledge of the
size of memory needed and the type of RAM and ROM chips available.
The addressing of memory can be established by means of a table that specifies the
memory address assigned to each chip.
The table, called a memory address map, is a pictorial representation of assignedaddress space
for each chip in the system, shown in table 9.1.
To demonstrate with a particular example, assume that a computer system needs 512bytes
of RAM and 512 bytes of ROM.
The RAM and ROM chips to be used are specified in figure 9.1 and figure 9.2.
The component column specifies whether a RAM or a ROM chip is used.
The hexadecimal address column assigns a range of hexadecimal equivalent addressesfor
each chip.
The address bus lines are listed in the third column.
Although there are 16 lines in the address bus, the table shows only 10 lines because the other
6 are not used in this example and are assumed to be zero.
The small x's under the address bus lines designate those lines that must be connected to the
address inputs in each chip.
The RAM chips have 128 bytes and need seven address lines. The ROM chip has 512 bytes and
needs 9 address lines.
The x's are always assigned to the low-order bus lines: lines 1 through 7 for the RAM and lines 1
through 9 for the ROM.
It is now necessary to distinguish between four RAM chips by assigning to each a different
address. For this particular example we choose bus lines 8 and 9 to represent four distinct
binary combinations.
The table clearly shows that the nine low-order bus lines constitute a memory space for RAM
equal to 29 = 512 bytes.
The distinction between a RAM and ROM address is done with another bus line. Here we choose
line 10 for this purpose.
When line 10 is 0, the CPU selects a RAM, and when this line is equal to 1, it selects the ROM.
Auxiliary Memory
Magnetic Disks
A magnetic disk is a type of memory constructed using a circular plate of metal or plastic coated with
magnetized materials. Usually, both sides of the disks are used to carry out read/write operations.
However, several disks may be stacked on one spindle with read/write head available on each surface.
The following image shows the structural representation for a magnetic disk .
o The memory bits are stored in the magnetized surface in spots along the concentric circles called
tracks.
o The concentric circles (tracks) are commonly divided into sections called sectors.
Magnetic Tape
Magnetic tape is a storage medium that allows data archiving, collection, and backup for different
kinds of data. The magnetic tape is constructed using a plastic strip coated with a magnetic
recording medium.
The bits are recorded as magnetic spots on the tape along several tracks. Usually, seven or nine
bits are recorded simultaneously to form a character together with a parity bit.
Magnetic tape units can be halted, started to move forward or in reverse, or can be rewound.
However, they cannot be started or stopped fast enough between individual characters. For this
reason, information is recorded in blocks referred to as records .
(ii)Associative memory
An associative memory can be considered as a memory unit whose stored data can be identified
for access by the content of the data itself rather than by an address or memory location.
Associative memory is often referred to as Content Addressable Memory (CAM).
When a write operation is performed on associative memory, no address or memory location is
given to the word. The memory itself is capable of finding an empty unused location to store the
word.
On the other hand, when the word is to be read from an associative memory, the content of the
word, or part of the word, is specified. The words which match the specified content are located
by the memory and are marked for reading.
The following diagram shows the block representation of an Associative memory.
From the block diagram, we can say that an associative memory consists of a memory array and
logic for 'm' words with 'n' bits per word.
The functional registers like the argument register A and key register K each have n bits, one for
each bit of a word. The match register M consists of m bits, one for each memory word.
The words which are kept in the memory are compared in parallel with the content of the
argument register.
The key register (K) provides a mask for choosing a particular field or key in the argument word. If
the key register contains a binary value of all 1's, then the entire argument is compared with each
memory word. Otherwise, only those bits in the argument that have 1's in their corresponding
position of the key register are compared. Thus, the key provides a mask for identifying a piece of
information which specifies how the reference to memory is made.
3. A two-way set associative cache memory uses blocks of four words. The cache can accommodate a
total of 2048 words for main memory. The main memory size is 128K X 32
i)Formulate all pertinent information required to construct the cache memory.
ii)What is the size of the cache memory? [7M] June/July 2022[Create]
index for set associative= log(29 blocks / 2) =8 so bit bit reduced so tag is 6+1=7 bit
Cache memory
Cache is a fast small capacity memory that should hold those information which are most
likely to be accessed.
The basic operation of the cache is, when the CPU needs to access memory, the cache is
examined.
If the word is found in the cache, it is read from the fast memory. If the word addressedby the
CPU is not found in the cache, the main memory is accessed to read the word.
The transformation of data from main memory to cache memory is referred to as mapping
process
5. Describe the characteristics of Cache memory. Explain Write-through and Write-back methods.
[7M][SET-2] July2023[Understand]
Write Through
The simplest and most commonly used procedure is to update main memory with every
memory write operation.
The cache memory being updated in parallel if it contains the word at the specified
address. This is called the write-through method.
This method has the advantage that main memory always contains the same data as thecache.
This characteristic is important in systems with direct memory access transfers.
It ensures that the data residing in main memory are valid at all times so that an I/Odevice
communicating through DMA would receive the most recent updated data.
Write-Back (Copy-Back)
The second procedure is called the write-back method.
In this method only the cache location is updated during a write operation.
The location is then marked by a flag so that later when the word is removed from thecache
it is copied into main memory.
The reason for the write-back method is that during the time a word resides in thecache,
it may be updated several times.
However, as long as the word remains in the cache, it does not matter whether the copyin main
memory is out of date, since requests from the word are filled from the cache.
It is only when the word is displaced from the cache that an accurate copy need be
rewritten into main memory.
7.Explain the hardware organization of associative memory with a neat block diagram[7M][SET-
1] July 2023[Understand]
The time required to find an item stored in memory can be reduced considerably if stored data
can be identified for access by the content of the data itself rather than by an address.
A memory unit accessed by content is called an associative memory or contentaddressable
memory (CAM).
This type of memory is accessed simultaneously and in parallel on the basis of data
content rather than by specific address or location.
Figure 9.3: Block diagram of associative memory
It consists of a memory array and logic form words with n bits per word.
The argument register A and key register K each have n bits, one for each bit of a word.
The match register M has m bits, one for each memory word.
Each word in memory is compared in parallel with the content of the argument register.
The words that match the bits of the argument register set a corresponding bit in thematch
register.
After the matching process, those bits in the match register that have been set indicatethe
fact that their corresponding words have been matched.
Reading is accomplished by a sequential access to memory for those words whose
corresponding bits in the match register have been set.
Hardware Organization
The key register provides a mask for choosing a particular field or key in the argumentword.
The entire argument is compared with each memory word if the key register contains all1's.
Otherwise, only those bits in the argument that have 1st in their corresponding positionof the
key register are compared.
Thus the key provides a mask or identifying piece of information which specifies how the
reference to memory is made.
To illustrate with a numerical example, suppose that the argument register A and the key
register K have the bit configuration shown below.
Only the three leftmost bits of A are compared with memory words because K has 1's inthese
position.
A 101 111100
K 111 000000
Word1 100 111100 no match
Word2 101 000001 match
Word 2 matches the unmasked argument field because the three leftmost bits of the
argument and the word are equal.
Virtual Memory
A virtual memory system provides a mechanism for translating program-generated addresses
into correct main memory locations.
Address space
An address used by a programmer will be called a virtual address, and the set of such addresses
is known as address space.
Memory space
An address in main memory is called a location or physical address. The set of such locations
iscalled the memory space.
Program 2
Data 2,1
Figure 9.9: Relation between address and memory space in a virtual memory system
Supposes a computer which has a main-memory capacity of 64K words (K=1024). 16-bits are required to
specify a physical address in memory because 64K = 216. Assume that computer has auxiliary memory for
storing information equivalent to capacity of 16 main memories.
In a multiprogramming computer system, data and programs are transferred to and from auxiliary
memory and main memory based on demands obliged by CPU. Suppose program 1 is currently being
executed in CPU. Program 1 and a part of its associated data are moved from secondary memory in the
main memory as displayed in Figure Parts of programs and data require not being in contiguous locations
in memory because information is being moved in and out and empty spaces may be available in
scattered locations in memory.
In our illustration address field of an instruction code will comprise 20 bits however physical memory
addresses should be specified with just 16-bits. So CPU will reference data and instructions with a 20 bits
address though information at this address should be taken from physical memory since access to
auxiliary storage for particular words will be prohibitively long. A mapping table is then required as
displayed in Figure below to map a virtual address of 20 bits to a physical address of 16 bits. Mapping is a
dynamic operation that means every address is translated instantly as a word is referenced by CPU.
The organization of the memory mapping table in a paged system is shown in Fig.12-19. The
memory page table consists of eight word , one for each page. The address in the page
tabledenotes the page number and the content of the word gives the block number where
that page is stored in main memory. The table showsthat pages 1,2,5 and 6 are now available
in main memory in blocks 3,0,1 and 2, respectively.
11.Explain about Input-output interface with an example.[7M] June/July 2022[Understand]
I/O interface with example
An example of an I/O interface units is shown in block diagram from in figure 8.2.
It consists of two data registers called ports, a control register, a status register, busbuffers, and
timing and control circuit.
The interface communicates with the CPU through the data bus.
The chip select and register select inputs determine the address assigned to theinterface.
The I/O read and writes are two control lines that specify an input or output,respectively.
The four registers communicate directly with the I/O device attached to the interface.
The I/O data to and from the device can be transferred into either port A or port B.
If the interface is connected to a printer, it will only output data, and if it services a character reader,
it will only input data.
A magnetic disk unit transfers data in both directions but not at the same time, so the interface can
use bidirectional lines.
A command is passed to the I/O device by sending a word to the appropriate interface register.
The control register receives control information from the CPU. By loading appropriate bits into the
control register, the interface and the I/O device attached to it can be placed in a variety of
operating modes.
For example, port A may be defined as an input port and port B as an output port.
A magnetic tape unit may be instructed to rewind the tape or to start the tape moving inthe forward
direction.
The bits in the status register are used for status conditions and for recording errors thatmay occur
during the data transfer.
For example, a status bit may indicate that port A has received a new data item from theI/O device.
Another bit in the status register may indicate that a parity error has occurred during thetransfer.
The interface registers communicate with the CPU through the bidirectional data bus.
The address bus selects the interface unit through the chip select and the two registerselect
inputs.
A circuit must be provided externally (usually, a decoder) to detect the address assignedto the
interface registers.
This circuit enables the chip select (CS) input when the interface is selected by theaddress
bus.
The two register select inputs RS1 and RS0 are usually connected to the two leastsignificant lines
of the address bus.
These two inputs select one of the four registers in the interface as specified in the table
accompanying the diagram.
The content of the selected register is transfer into the CPU via the data bus when theI/O read
signal is enables.
The CPU transfers binary information into the selected register via the data bus when the I/O write
input is enabled.
12.What is Asynchronous Data Transfer? Explain any one method to achieve the asynchronous way of
data transfer[7M][SET-3]July 2023[Remember]
Strobe Control
The Strobe control method of asynchronous data transfer employs a single control line totime each
transfer.
Destination-initiated strobe for data transfer
Figure 8.4 shows a data transfer initiated by the destination unit. In this case thedestination unit
activates the strobe pulse, informing the source to provide the data.
The source unit responds by placing the requested binary information on the data bus.
The data must be valid and remain in the bus long enough for the destination unit toaccept it.
The falling edge of the strobe pulse can be used again to trigger a destination register.
The destination unit then disables the strobe. The source removes the data from the busafter a
predetermined time interval.
The transfer of data between the CPU and an interface unit is similar to the strobetransfer just
described.
13.Explain about asynchronous data transfer and asynchronous communication interface [7M][SET-
4]July2023[Understand]
The block diagram of the asynchronous communication interface is shown above. It functions both as a
transmitter and receiver.
15 Explain how Handshaking Asynchronous data transfer is advantageous over strobe control data
transfer[Understand]
It is used by the source unit to inform the destination unit whether there are valid data inthe bus.
The other control line is in the other direction from the destination to the source.
It is used by the destination unit to inform the source whether it can accept data.
The sequence of control during the transfer depends on the unit that initiates the transfer.
Figure 8.5 shows the data transfer procedure initiated by the source.
The two handshaking lines the data valid, which is generated by the source unit, anddata
accepted, generated by the destination unit, the timing diagram shows the exchange of signals
between the two units.
The sequence of events listed in figure 8.5 shows the four possible states that the system can be at any
given time.
The source unit initiates the transfer by placing the data on the bus and enabling its data valid signal.
The data accepted signal is activated by the destination unit after it accepts the datafrom the bus.
The source unit then disables its data valid signal, which invalidates the data on the bus.
The destination unit then disables its data accepted signal and the system goes into itsinitial state.
The source does not send the next data item until after the destination unit shows itsreadiness to
accept new data by disabling its data accepted signal.
This scheme allows arbitrary delays from one state to the next and permits each unit torespond at its
own data transfer rate.
Destination-initiated transfer using handshaking
The destination-initiated transfer using handshaking lines is shown in figure 8.6.
Note that the name of the signal generated by the destination unit has been changed toready for
data to reflect its new meaning.
The source unit in this case does not place data on the bus until after it receives theready for
data signal from the destination unit.
From there on, the handshaking procedure follows the same pattern as in the source-initiated
case.
Note that the sequence of events in both cases would be identical if we consider theready for
data signal as the complement of data accepted.
In fact, the only difference between the source-initiated and the destination-initiatedtransfer is in
their choice of initial state.
16. Discuss various possible modes of Data transfer to and from the peripherals in a computer
system[7M][SET-2]July 2023[Analyze]
Mode of Transfer:
The method that is used to transfer information between internal storage and external I/O devices is
known as I/O interface. The CPU is interfaced using special communication links by the peripherals
connected to any computer system
CPU merely processes the information but the source and target is always the memory unit. Data
transfer between CPU and the I/O devices may be done in different modes. Data transfer to and from
the peripherals may be done in any of the three possible ways
1 Programmed I/O.
2 Interrupt- initiated I/O.
3 Direct memory access( DMA).
Programmed I/O
In the programmed I/O method, the I/O device does not have direct access to memory.
An example of data transfer from an I/O device through an interface into the CPU isshown in figure
8.7.
When a byte of data is available, the device places it in the I/O bus and enables its datavalid line.
The interface accepts the byte into its data register and enables the data accepted line.
The interface sets a bit in the status register that we will refer to as an F or "flag" bit.
The device can now disables the data valid line, but it will not transfer another byte untilthe data
accepted line is disables by the interface.
A program is written for the computer to check the flag in the status register todetermine if a byte
has been placed in the data register by the I/O device.
This is done by reading the status register into a CPU register and checking the value ofthe flag bit.
Once the flag is cleared, the interface disables the data accepted line and the device canthen
transfer the next data byte.
Example of Programmed I/O:
A flowchart of the program that must be written for the CPU is shown in figure 8.8.
It is assumed that the device is sending a sequence of bytes that must be stored inmemory.
The transfer of each byte requires three instructions :
1. Read the status register.
2. Check the status of the flag bit and branch to step 1 if not set or to step 3 if set.
3. Read the data register.
Each byte is read into a CPU register and then transferred to memory with a storeinstruction.
A common I/O programming task is to transfer a block of words from an I/O device and store them
in a memory buffer.
Figure 8.8: Flowchart for CPU program to input data
Interrupt Initiated I/O
In programmed initiated, CPU stays in a program loop until the I/O unit indicates that itis ready for
data transfer.
This is a time consuming process since it keeps the processor busy needlessly.
It can be avoided by using an interrupt facility and a special command to inform theinterface to
issue an interrupt request signal when data are available from the device.
In the meantime CPU can proceed to execute another program.
The interface meanwhile keeps monitoring the device.
When the interface determines that the device is ready for data transfer, it generates an interrupt
request to the computer.
While the CPU is running a program, it does not check the flag. However, when the flag is set, the
computer is momentarily interrupted from proceeding with the current program and is informed of
the fact that the flag has been set.
The CPU deviates from what it is doing to take care of the input or output transfer.
After the transfer is completed, the computer returns to the previous program to continue what it
was doing before the interrupt.
The CPU responds to the interrupt signal by storing the return address from the program counter into
a memory stack and then control branches to a service routine that processes the required I/O
transfer.
The way that the processor chooses the branch address of the service routine varies from one
unit to another.
In non-vectored interrupt, branch address is assigned to a fixed location in memory.
In a vectored interrupt, the source that interrupts supplies the branch information tothe
computer. The information is called vector interrupt.
In some computers the interrupt vector is the first address of the I/O service routine.
In other computers the interrupt vector is an address that points to a location in memorywhere the
beginning address of the I/O service routine is stored.
DMA controller
DMA controller - Interface which allows I/O transfer directly between Memory and Device, freeing
CPU for other tasks
CPU initializes DMA Controller by sending memory address and the block size (number of words).
The DMA controller needs the usual circuits of an interface to communicate
with theCPU and I/O device.
In addition, it needs an address register, a word count register, and a set of address
lines.
The address register and address lines are used for direct communication with
thememory.
The word count register specifies the number of words that must be transferred.
The data transfer may be done directly between the device and memory under
controlof the DMA.
Figure 8.11 shows the block diagram of a typical DMA controller.
The unit communicates with the CPU via the data bus and control lines.
The register in the DMA are selected by the CPU through the address bus by
enabling theDS (DMA select) and RS (register select) inputs.
The RD (read) and WR (write) inputs are bidirectional.
When the BG (bus grant) input is 0, the CPU can communicate with the DMA
registers through the data bus to read from or write to the DMA registers.
When BG= 1, the CPU has relinquished the buses and the DMA can communicate
directly with the memory by specifying an address in the address but and
activating the RD orWR control.
The DMA communicates with the external peripheral through the request and
acknowledge lines by using a prescribed handshaking procedure.
The DMA controller has three registers: an address register, a word count register,
and a control register.
The address register contains an address to specify the desired location in memory.
The word count register holds the number of words to be transferred.
17 Explain Priority interrupt and Daisy chain interrupt system with necessary
diagrams[7M][SET-3]July 2023[Understand]
priority interrupt:
Determines which interrupt is to be served first when two or more requests are
madesimultaneously
Also determines which interrupts are permitted tointerrupt the computer
whileanother is being serviced
Higher priority interrupts can make requests while servicing a lower priority
interrupt.
Daisy Chaining Priority
CPU cannot do any work until the transfer is CPU can do any other work until it is
complete as it has to stay in the loop to interrupted by the command indicating
continuously monitor the peripheral device. the readiness of device for data transfer
19.Draw the block diagram of DMA controller and explain its key
components[7M][SET- 1]July 2023[Understand]
20.Explain in detail about Direct Memory Access in computer system[7M][SE-
4]July2023[Understand]
DMA controller
DMA controller - Interface which allows I/O transfer directly between Memory
andDevice, freeing CPU for other tasks
CPU initializes DMA Controller by sending memory address and the block size
(number ofwords).