You are on page 1of 19

Final Exam Spring-2021

FACULTY OF ENGINEERING, SCIENCES & TECHNOLOGY

Subject: Computer Organization & Assembly LanguageSubmission Day: Monday


Instructor: Dr. Mansoor/ Dr. Asim Ali Submission Date: 31May 2021
Program: BS (CS/SE) Max. Marks: 40
Maximum Time: 2.5 Hours

NAME: REG NO:

Please follow the instructions carefully:


1. Write your answers directly on the Black Board (recommended) or upload word file
before the due date on Blackboard.
2. Write your name and registration ID on the first page of your Word file.
3. Answer scripts can only be uploaded onBlackboardonly during the submission time.
4. To avoid any unforeseen problems, you are advisedto follow the Guide lines
communicated by the Faculty Members.
5. Submission of answer copy(ies) will be considered acceptable through Blackboard only.
Therefore, do not submit your document through email or any other medium.
6. Use 12 pt. font size and Times New Roman font style along with 1-inch page margins.
7. Follow the requirements of the word limit and the marking criteria while writing your
answers.
8. Provide relevant, original and conceptual answers, as this exam aims to test your ability to
examine, explain, modify or develop concepts discussed in class.
9. Do not copy answers from the internet or other sources. The plagiarism of your answers
may be checked through Turnitin.
10. Double check your word file before uploading it on BlackBoard to ensure that you have
uploaded the correct file with your answers.
Question No. 1:Computer Architecture [5 Marks]
Refer to the following block diagram of a computer system, considering yourself as an architect
of this system

a. Identify the main functions of a computer?


b. List and briefly define the main structural components of this computer
c. List and briefly define the main structural components a processor.
d. Describe the function of each unit and
e. Explain working of this system with the help of a flow chart

ANSWER:

The 5 basic operations of a computer system. These usually include:

Input or inserting data and instructions.


Processing
Output or retrieving data or information.
Storing data or information/file management.
Controlling of devices and functions.
Even the most basic models of computers are compatible with software that can handle
billing and accounting, word processing, record keeping and other operations that help your
business run smoothly.

Data Input

Data input is the most basic function of a computer. It's what allows you to transfer
information into the system via a mouse, keyboard, scanner, external hard drive, HDMI
port, USB drive or software. Users can enter this data into a spreadsheet, database, online
forms and more.
The latest computer systems allow you to enter and process data remotely via Bluetooth or
vocal dictation. However, this function is usually performed manually via peripherals.

Data Output

The computer monitor, printer, speakers and 3D printers are known as output devices.
Their role is to display the information processed by the computer system. Data output
makes it possible to print 3D models, view photos on your PC, listen to audio files and
print documents.

Core Function of a Computer

Data processing is the most important function of the system unit. Without this feature, you
would not be able to convert raw data into meaningful information. The Central Processing
Unit (CPU), which is the "brain" of the computer, manipulates and controls data over the
entire system.

The CPU can handle complex tasks, such as combining multiple pieces of data, arranging
items in different sets and ensuring that supplied data is accurate and useful. Its capabilities
depend on the type of computer. The more advanced your system is, the more it can do.
Modern computers, for instance, have multiple CPUs and can streamline the most time-
consuming business operations.

Data Storage

Whether you're creating a website or doing accounting work, you want to have the finished
product stored for future use. That's where data storage comes in. Today, any computer can
store information both temporarily and permanently on its hard drive, an external hard
drive or a USB drive.
Even though nowadays you can save data in the cloud and access it from any device, you
still need enough storage space on your computer. How much information you can store
will depend on the computer type, operating system and memory.

Main Structural Component of a Computer System The main elements associated with a
computer system are as follows:

1. Central Processing Unit (CPU)

2. Main Memory

3. Secondary Storage Devices

4. Input and Output (I/O) Devices

Arithmetic and Logic Unit (ALU): Performs arithmetic and logical operations. For
example, it can add together two binary numbers either from memory or from some of the
CPU registers.

Control Unit: controls the action of the other computer components so that instructions are
executed in the correct sequence.

Main Memory: used to store information for immediate access by the CPU. Main Memory
is also referred to as Primary Storage or Main Store.

 Closely connected to the processor.

 The contents are quickly and easily changed.

 Stores the programs that the processor is actively working with.


Input/Output Devices: Input/output devices provide an interface between the computer and
the user. There is at least one input device (e.g. keyboard, mouse, measuring device such as
a temperature sensor) and at least one output device (e.g. printer, screen, control device
such as an actuator). Input and output devices like keyboards and printers, together with the
external storage devices, are referred to as peripherals.

Structure Of The Processor:

A processor contains the following components,

Control Unit - fetches, decodes, executes instructions.


Arithmetic & Logic Unit - performs arithmetic and logical operations on data.
Registers - fast, on-chip memory inside the CPU, dedicated or general purpose.
Internal Clock - derived directly or indirectly from the system clock
Internal Buses - to connect the components
Logic Gates - to control the flow of information
What Is A Register?

Registers are storage locations within the circuitry of the CPU. They are very fast on-chip
memory storing binary values using 32 or 64 bits. Information is held there while it is being
interpreted or manipulated. Registers are dedicated or general purpose.

General Purpose Registers

Can be used by programmers to store data temporarily. Some computers may have up to 16
general purpose registers (R1...R16). Processor designers have assigned no specific role to
these registers.

Stack Pointer (SP)

Points to a stack data structure holding return addresses, procedure or function parameters
and local variables. Used when a procedure or function is called. Also used when an
interrupt is serviced. (Interrupt = a signal from a source (hardware or software) requesting
the attention of the processor)

Program Counter (PC)

Holds the address in main memory of the next instruction to be executed.

AKA Sequence Control Register (SCR) or Sequence Register.

Status Register (SR)

Contains bits that are set and cleared based on the results of an instruction. Allows the CPU
to store information such as the occurrence of an overflow. This information can be used to
decide whether or not to branch out of a given sequence of instructions.

The Accumulator

Holds the result of the current set of calculations. The instruction ADD #25 means add the
value 25 to the contents of the accumulator and store the result in the accumulator.

Current Instruction Register (CIR)

Stores operator and operand for the current instruction.

Eg LDA 1000 (Load location 1000 into Accumulator)

LDA operator what you do


1000 operand what you do it to

Memory Address Register (MAR)


Holds the address of the memory location from or to which data is to be read or written.
This could be the address of an instruction to be fetched or the address of data to be used in
the instruction. When fetching instructions, copies the contents of the Program Counter.

Memory Buffer Register (MBR)

AKA Memory Data Register (MDR) Temporarily stores data read from or written to
memory. CPU and Memory operate at different speeds (hence buffer)

Eg LDA 1000 placed here en route to the CIR for decoding.

Operand (1000) placed in MAR. Contents of 1000 copied to the MBR.


Question No. 2: Interrupts [5 Marks]
A user program starts execution at t=0sec, a scanner interrupt is call at t=16 sec during interrupt
handling another camera interrupt has been call at t=21 sec and returns at t=35 sec, at a same
time another printer interrupt is call and return at=43sec to scanner interrupt handler. Scanner
interrupt returns at t=53 sec. Calculate the total time required to process interrupt.

ANSWER:
Total time to process interrupt = total time for scanner interrupt + total time for camera interrupt
+ total time for printer interrupt

total time for scanner interrupt = (21-16) + (53-43) = 15s

total time for camera interrupt = 35-21 = 14s

total time for printer interrupt = 43-35 = 8s

Total time to process interrupt = 15 + 14 + 8 = 37s

Question No. 3: Arithmetic’s Algebra [5 Marks]


Given X=0101 and Y=1010 in twos complement notation.Compute the product P=X x Y with
booth’s algorithm.

ANSWER:
A = 0101 0000 0
S = 1011 0000 0
P = 0000 1010 0

We have to perform the loop of booth's algorithm 4 times.


1 Step:
the last two bits of P are 00
Therefore P should be used without any change
Upon right shift we get P = 0000 0101 0

2 Step:
the last two bits of P are 10
Therefore P should be P + S which gives P = 1011 0101 0
Upon right shift we get P = 1101 1010 1

3 Step:
the last two bits of P are 01
Therefore P should be P + A which gives 0010 1010 1
Upon right shift we get P = 0001 0101 0

4 Step:
the last two bits of P are 10
Therefore P should be P + S which gives 1100 0101 0
Upon right shift we get P = 1110 0010 1
Therefore the result is 11100010
which is equal to -128+64+32+2 = -30
therefore the product is 11100010
Question No. 4: Memory Mapping [5 Marks]
Interface a 32 MB memory with 16K line cache with example using
a. Direct mapping,
b. Associative and
c. set associative mapping

ANSWER:

:
Question No. 5: Memory Design [5 Marks]
a. It is desired to have memory of 64K given that a 13-bit address bus is used to address
memory location. Design the decoding architecture in order to access complete 64 K
memory also calculates address ranges for each memory chip.
b. Design 16 bit of SRAM memory using 4X2 cell array also calculate each cell address.

ANSWER:

A:

Desired to have memory of = 64K bytes.


No of bits in address bus to address memory location = 13 bits

Maximum memory location addressed by n bits address bus = 2n


Maximum memory location addressed by 1 bit address bus = 21 = 2
Maximum memory location addressed by 13 bits address bus = 213 = 8192 bytes
In 1 memory chip memory location = 8192 bytes = 8192/1024 = 8KB
No of memory chips required for 64 KB of memory = 64/8 = 8 chips

So, 8 memory chips of 8KB memory location and 13 bits address busses will help to access
complete 64 Kbytes memory.

Input Lines = 8 memory chips each with 13 address bus


Output Lines = 8 memory chips each with 2^13 = 8K.

Calculating address ranges for each memory chip.

Chip Number Starting RangeEnding Range


Chip 1 0 8K-1
Chip 2 8K 16K-1
Chip 3 16K 24K-1
Chip 4 24K 32K-1
Chip 5 32K 40K-1
Chip 6 40K 48K-1
Chip 7 48K 56K-1
Chip 8 56K 64K-1

B:
Four two input AND gates are used in the design of first stage of the 4*2 decoder and those inputs are
interlinked to the input wires A, B. For accessing the outputs, again four two-input AND gates are used
by the 4*2 decoder in the second stage. 4*2 two-input AND gate networks are used to get the outputs.
Figure 5 represents the diagrammatic structure and its execution. By the time the ENABLED pin is in OFF
state (ENABLE=0), all outputs are observed to be null. But when ENABLE is ON (ENABLE = 1), the results
show in connections to input pins A, B. The suggested 4*2 decoder consists of 361 cells having
consumed an area of 0.44 µm2.
Question No. 6: External Memory [5 Marks]
Consider a 5-drive, 120GB-per-drive RAID array. What is the available data storage capacity
for each of the RAID levels 0, 1, 3, 4, 5, and 6?

ANSWER:
Question No. 7: Pipelining [5 Marks]
In a computing system there are five phases of computation that is instruction fetch, Instruction
decode, execute, memory access and write back. It has been recorded that is instruction fetch
take 40 seconds, Instruction decode takes 50 seconds, execute takes 300 seconds, memory access
take 20 second and write back takes 10 second. If there are 6 instruction need to execute how
much time can be save using pipelining also find the number of pipeline stages.

ANSWER:
Question No. 8: Assembly Language [5 Marks]
For A, B, C, D, E as random variables, compute the followingusing assembly code instructions
a. Y= (B-A) / (C x E+D)
b. Y= A+D*E

ANSWER:

b. Y= A+D*E assembly code instructions: By three address

MPY T, D, E

ADD Y, T, A

Comment

You might also like