CSNB123 - Tutorial CSNB123 - Tutorial
CSNB123 - Tutorial CSNB123 - Tutorial
CSNB123 - tutorial
CSNB123 / CSNB2123
Computer Organization
Semester 1, 2020/2021
Tutorial 3
Instructions
Part A
Briefly Answer the following questions
Locality is a common behavior of all computational processes over prolonged time intervals,
they appear to refer repeatedly to subsets of their resources. System designers have exploited
this behavior in various ways to maximize performance, including caching, related object
clustering, search engines, database organization, spam filters, etc.
-Temporal locality It refers to the tendency for a processor to access recently used
memory locations.
3-For Cache mapping , what are the difference among direct mapping ,associative
mapping , and set-associative mapping in term of the fields of the main memory
address ?
For a direct-mapped cache , a main memory address is viewed as consisting of three fields.
List and define the three fields. The fields would be i, j, and m. I is the cache line number, j is
the main memory block number, and m is the number of lines in the cache .
For an associative cache , a main memory address is viewed as consisting of two fields.
List and define the two fields. Tag and Word fields. Tag field uniquely identifies a block of
main memory. The word is what is to be placed in the block of memory.
For a set-associative cache , a main memory address is viewed as consisting of three fields.
List and define the two fields. The fields are Tag, Set and Word The tag identifies a block of
main memory, the set specifies one of the 2^s blocks of main memory The word is what is to
be placed in the main memory.
4- what is the difference between DRAM and SRAM in terms of characteristics such
as speed , size , cost ?
5-Explain why one type of RAM is considered to be analog and the other digital .
-DRAM: analog device because it stores charge and uses a threshold to determine the binary
value
Basic method for detecting if an odd number of bits has been switched by accident.
Part B
1-two-way set-associative cache has lines of 16 bytes and a total size of 8 Kbytes . The 64-
Mbyte main memory is byte addressable .Show the format of main memory addresses .
Number of set = 8
Tag =26-8-4
Tag=14
14 8 4
2-Consider a 32-bit microprocessor that has an on-chip 16- KByte four-way set-associative
cache. Assume that the cache has a line size of four 32-bit words. Draw a block diagram
of this cache showing its organization and how the different address fields are used to
determine a cache hit/miss.
Where in the cache is the word from memory location
ABCDE8F8 mapped?
So we select set 143 because the input to decoder is 10001111 and the output from decoder is
set 143.
Consider a machine with a byte addressable main memory of 216 bytes and block size of 8 - 3
.bytes. Assume that a direct mapped cache consisting of 32 lines is used with this machine
(a) How many total bytes of memory can be stored in the cache? 28=255byte
(b) How is a 16-bit memory address divided into tag, line number, and byte number?
Tag Line Size
8 5 3
(b) Into what line would bytes with each of the following addresses be stored?
(i) 0001 0001 0001 1011 (ii)1100 0011 0011 0100 (iii) 1101 0000 0001 1101
(iv) 1010 1010 1010 1010
4. Design a 16-bit memory of total capacity 8192 bits using SRAM chips of size 64 *
1 bit. Give the array configuration of the chips on the memory
board showing all required input and output signals for assigning this memory to the
lowest address space. The design should allow for both byte
and 16-bit word accesses.
5. Assume an 8-bit data word stored in memory is 11000010. Using the Hamming
algorithm, determine what check bits would be stored in memory with the data word.
Show how you got your answer.
poistio 12 11 10 9 8 7 6 5 4 3 2 1
n
Bits D8 D7 D6 D5 C8 D4 D3 D2 C4 D1 C2 C1
Block 1 1 0 0 0 0 1 0
Cods 110 101 010
0 1 1
The check bits are in bit numbers 8,4,2and1
Check bit 8 calculated by values in bit numbers 12,11,10and 9
Check bit 4calculated by values in bit numbers 12,7,6and 5
Check bit 2calculated by values in bit numbers 11,10,7and 3
Check bit 1calculated by values in bit numbers 11,9,7,5and 3
The check bits are 0010
6. For the 8-bit word 00111001, the parity bits of hamming code stored and sent
together is 0111. If the parity bits are then calculated to be 1101.
Fin the error and the location of the error.
7. How many check bits are needed if the Hamming error correction code is used to
detect single bit errors in a 1024-bit data word?