Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

PARUL INSTITUTE OF ENGINEERING AND

TECHNOLOGY (DIPLOMA STUDIES)


COMPUTER ENGINEERING DEPARTMENT

3RD SEMESTER QUESTION BANK WITH SOLUTION

COMPUTER SYSTEM ORGANIZATION


(03606215)
COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

UNIT-1 (STRUCTUR OF COMPUTER)

1. Basic functional units of computer system. [4 MARKS]


2. What is bus structure? Explain with neat diagram. [4 MARKS]
3. Explain Von-Neumann architecture with neat diagram. [3 MARKS]
4. What is bus structure? Explain with diagram. [3 MARKS]
5. What are error detecting codes? Explain VRC, LRC and CHECKSUM. [4
MARKS]
6. Explain data representation fixed- and floating-point representation with example.
[4 MARKS]

UNIT 2 (REGISTER TRANSFER AND MICRO-OPERATION)

1. What is register? [ 2 MARKS]


2. What is register transfer and what is micro-operation? [2 MARKS]
3. Give the list of micro-operation. [2 MARKS]
4. What is logic micro-operation? [3 MARKS]
5. Explain Arithmetic micro-operation. [3 MARKS]
6. What is bus transfer and memory transfer? [ 3 MARKS]
7. What is RTL? Explain in detail. [2 MARKS]
8. Explain Shift micro-operation and explain arithmetic logic shift unit. [3 MARKS]

UNIT-3 (Programming the Basic Computer)


1. What is machine language? [ 2 MARKS]
2. Explain machine language format. [ 2 MARKS]
3. Briefly explain Single-byte, Two-byte and Three-byte instruction [ 3 MARKS]
4. What do you mean by opcode and operand. [ 2 MARKS]
5. List Addressing modes and explain it with example. [2 MARKS]
6. What is data transfer operation? Explain its instruction. [3 MARKS]
7. Briefly explain logical operation and its instruction. [ 3 MARKS]
8. Explain branch and stack operation with diagram. [ 4 MARKS]

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

9. I/O operation. [ 3 MARKS]


10. What is ALP? Usage of it. [ 2 MARKS]

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

UNIT-1 (Structure of computers)

1. What is computer functional units?

A computer in its simplest form comprises of five units namely input unit, output
unit, memory unit, arithmetic and logical unit and control unit.

INPUT UNIT

Input units are used by the computer to read the data. The most commonly used
input devices are keyboards, mouse, joysticks, trackballs, microphones, etc.
CENTRAL PROCESSING UNIT

Central processing unit commonly known as CPU can be referred to as an electronic


circuitry within a computer that carries out the instructions given by a computer
program by performing the basic arithmetic, logical, control and input/output (I/O)
operations specified by the instructions.

MEMORY UNIT
The Memory unit can be referred to as the storage area in which programs are kept
which are running, and that contains data needed by the running programs.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

The Memory unit can be categorized in two ways namely, primary memory and
secondary memory.

• It enables a processor to access running execution applications and services that are
temporarily stored in a specific memory location.
Primary storage is the fastest memory that operates at electronic speeds. Primary
memory contains a large number of semiconductor storage cells, capable of storing
a bit of information. The word length of a computer is between 16-64 bits.

Cache memory is also a kind of memory which is used to fetch the data very soon.
They are highly coupled with the processor.

The most common examples of primary memory are RAM and ROM.
Secondary memory is used when a large amount of data and programs have to be
stored for a long-term basis.

The most common examples of secondary memory are magnetic disks, magnetic
tapes, and optical disks

• Examples of input devices:


• Joysticks
• Trackballs
• Mouse
• scanner

ARITHMETIC AND LOGICAL UNIT

Most of the computer operators are executed in ALU of the processor like addition,
subtraction, division, multiplication, etc. the operands are brought into the ALU from
memory and stored in high-speed storage elements called register. Then according to
the instructions, the operation is performed in the required sequence.

The control and the ALU are many times faster than other devices connected to a
computer system. This enables a single processor to control a number of external
devices such as keyboards, displays, magnetic and optical disks, sensors and other
mechanical controllers.

CONTROL UNIT

It effectively is the nerve centre that sends signals to other units and senses their states.
The actual timing signals that govern the transfer of data between input unit,

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

processor, memory and output unit are generated by the control unit.

OUTPUT UNIT

These actually are the counterparts of the input unit. Its basic function is to send the
processed results to the outside world.

Examples shown below:


Printers
Speakers and Monitors

2. What is bus structure? Explain with neat diagram.

The simplest and most common way of interconnecting various parts of the
computer. To achieve a reasonable speed of operation, a computer must be
organized so that all its units can handle one full word of data at a given time. A
group of lines that serve as a connecting port for several devices is called a bus.

Since the bus can be used for only one transfer at a time, only two units can actively
use the bus at any given time. Bus control lines are used to arbitrate multiple requests
for use of one bus.

Single bus structure is,


Low cost
Very flexible for attaching peripheral devices

Performance:

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Let us examine the flow of program instructions and data between the memory and
the processor. At the start of execution, all program instructions and the required
data are stored in the main memory. As the execution proceeds, instructions are

fetched one by one over the bus into the processor, and a copy is placed in the cache
later if the same instruction or data item is needed a second time, it is read directly
from the cache.

For example:
Suppose a number of instructions are executed repeatedly over a short period of time
as happens in a program loop. If these instructions are available in the cache, they
can be fetched quickly during the period of repeated use. The same applies to the
data that are used repeatedly.

3. What is bus structure? Explain with neat diagram.


Von-Neumann proposed his computer architecture design in 1945 which was later
known as Von-Neumann Architecture. It consisted of a Control Unit, Arithmetic,
and Logical Memory Unit (ALU), Registers and Inputs/Outputs.

Von Neumann architecture is based on the stored-program computer concept, where


instruction data and program data are stored in the same memory. This design is still
used in most computers produced today.

A Von Neumann-based computer:

Uses a single processor.


Uses one memory for instructions and data.
Executes programs following fetch-decode-execute-cycle.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Components of Von-Neumann model:

• Central processing unit


• ALU and buses
• Memory unit

I. Central processing unit


The part of the computer that performs bulk operations in a single unit is known as
CPU (Central processing unit).

The Central Processing Unit can also be defined as an electric circuit responsible
for executing the instructions of a computer program.

The major components of CPU are Arithmetic and Logic Unit (ALU), Control Unit
(CU) and a variety of registers.

ALU (Arithmetic logical unit)


The Arithmetic and Logic Unit (ALU) performs the required micro-operations for
executing the instructions. In simple words, ALU allows arithmetic (add, subtract,
etc.) and logic (AND, OR, NOT, etc.) operations to be carried out.

1. CU (Control Unit)
The Control Unit of a computer system controls the operations of components
like ALU, memory and input/output devices.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

2. Registers
Registers refer to high-speed storage areas in the CPU. The data processed by
the CPU are fetched from the registers.

Following is the list of registers that plays a crucial role in data processing.

3. Buses
Buses are the means by which information is shared between the registers in a
multiple-register configuration system.

A bus structure consists of a set of common lines, one for each bit of a register,
through which binary information is transferred one at a time. Control signals
determine which register is selected by the bus during each particular register
transfer.

Von-Neumann Architecture comprised three major bus systems for data


transfer.

II. Memory unit

• A memory unit is a collection of storage cells together with associated circuits


needed to transfer information in and out of the storage. The memory stores
binary information in groups of bits called words. The internal structure of a
memory unit is specified by the number of words it contains and the number of
bits in each word.

• Two major types of memories are used in computer systems:

1. RAM (Random Access Memory)


2. ROM (Read Only Memory)

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

3.What bus and memory transfer? Explain common bus system with neat

diagram.

Bus and memory transfers:

1. A more efficient scheme for transferring information between registers in a


multiple-register configuration is a Common Bus System.

2. A common bus consists of a set of common lines, one for each bit of a register.

3. Control signals determine which register is selected by the bus during each
particular register transfer.

Different ways of constructing a Common Bus System.

o Using Multiplexers
o Using Tri-state Buffers

Common bus system is with multiplexers:

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

The multiplexers select the source register whose binary information is then placed
on the bus.

The construction of a bus system for four registers is shown in the Figure.

Block diagram of Common bus system with multiplexer

The bus consists of four 4 x 1 multiplexers each having four data inputs, 0
through 3, and two selection inputs, S1 and S0.

1. For example, output 1 of register A is connected to input 0 of MUX 1 because


this input is labelled A1.

2. The diagram shows that the bits in the same significant position in each
register are connected to the data inputs of one multiplexer to form one line of
the bus.

3. Thus MUX 0 multiplexes the four 0 bits of the registers, MUX 1 multiplexes
the four 1 bits of the registers, and similarly for the other two bits.
4. The two selection lines Si and So are connected to the selection inputs of all
four multiplexers.

The selection lines choose the four bits of one register and transfer them into the
four-line common bus.

When S1S0 = 00, the 0 data inputs of all four multiplexers are selected and applied
to the outputs that form the bus.

This causes the bus lines to receive the content of register A since the outputs of
this register are connected to the 0 data inputs of the multiplexers.

Similarly, register B is selected if S1S0 = 01, and so on. Table 4-2 shows the
register that is selected by the bus for each of the four possible binary value of the
selection line as shown in example

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

In general bus system has:


o multiplex “k” Registers
o each register of “n” bits
o to produce “n-line bus”
o no. of multiplexers required = n
o size of each multiplexer = k x 1

When the bus is includes in the statement, the register transfer is symbolized as
follows:

BUS← C, R1← BUS

The content of register C is placed on the bus, and the content of the bus is loaded
into register R1 by activating its load control input. If the bus is known to exist in
the system, it may be convenient just to show the direct transfer.

R1← C

4. What is error detecting codes? Explain error detecting techniques (LRC,


VRC and checksum).

Error-detecting codes are a sequence of numbers generated by specific procedures


for detecting errors in data that has been transmitted over computer networks.

When bits are transmitted over the computer network, they are subject to get
corrupted due to interference and network problems. The corrupted bits lead to
spurious data being received by the receiver and are called errors.

Error – detecting codes ensures messages to be encoded before they are sent over
noisy channels. The encoding is done in a manner so that the decoder at the receiving
end can detect whether there are errors in the incoming signal with high probability
of success.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Features of error detecting codes:

Error detecting codes are adopted when backward error correction techniques are
used for reliable data transmission. In this method, the receiver sends a feedback
message to the sender to inform whether an error-free message has been received
or not. If there are errors, then the sender retransmits the message.

1. Error-detecting codes are usually block codes, where the message is divided into
fixed-sized blocks of bits, to which redundant bits are added for error detection.

2. Error detection involves checking whether any error has occurred or not. The
number of error bits and the type of error does not matter.

Error detecting techniques:

VRC(vertical Redundancy Check)

LRC(Longitudinal Redundancy Check)

Checksum

1. VRC/Parity Bit Check:

Parity check is done by adding an extra bit, called parity bit to the data to make
number of 1s either even in case of even parity, or odd in case of odd parity.
While creating a frame, the sender counts the number of 1s in it and adds the parity
bit in following way
In case of even parity: If number of 1s is even then parity bit value is 0. If number
of 1s is odd then parity bit value is 1.

In case of odd parity: If number of 1s is odd then parity bit value is 0. If number of
1s is even then parity bit value is 1.

On receiving a frame, the receiver counts the number of 1s in it. In case of even
parity check, if the count of 1s is even, the frame is accepted, otherwise it is
rejected. Similar rule is adopted for odd parity check.
LRC (Longitudinal Redundancy Check)

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

LRC generally applies to a single parity bit per bit stream. Although simple
longitudinal parities only detect errors, a combination with additional error control
coding, such as a transverse redundancy check, are capable of correcting errors

1 1 1

1 0 0

0 1 1

111 and 100 are the segments:

Blue row defines the result as per shown flowchart:

2. Checksum (Most reliable method)

This is a block code method where a checksum is created based on the data values
in the data blocks to be transmitted using some algorithm and appended to the data.
When the receiver gets this data, a new checksum is calculated and compared with
the existing checksum. A non-match indicates an error.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Error Detection by Checksums


For error detection by checksums, data is divided into fixed sized frames or
segments.
• Sender’s End − The sender adds the segments using 1’s complement arithmetic to
get the sum. It then complements the sum to get the checksum and sends it along
with the data frames.

• Receiver’s End − The receiver adds the incoming segments along with the
checksum using 1’s complement arithmetic to get the sum and then complements
it.

Suppose that the sender wants to send 4 frames each of 8 bits, where the frames
are 11001100, 10101010, 11110000 and 11000011.

The sender adds the bits using 1s complement arithmetic. While adding two
numbers using 1s complement arithmetic, if there is a carry over, it is added to the
sum.

After adding all the 4 frames, the sender complements the sum to get the checksum,
11010011, and sends it along with the data frames.

The receiver performs 1s complement arithmetic sum of all the frames including
the checksum. The result is complemented and found to be 0. Hence, the receiver
assumes that no error has occurred.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

5. Explain Fixed- and floating-point representation with example.

Fixed and Floating-Point Number: In digital technology, data is stored in


memory registers with binary bits 0’s and 1’s because the computer only
understands binary language. When we enter data in the system, it is converted
into binary bits, and it is processed and used in the CPU in different ways. Memory
registers have a format and a specific range to store data. Scientists have designed
a real number representation method in memory registers of 8-bit, 16 bits, 32bit.
Digital Computers use Binary number system to represent all types of information
inside the computers. Alphanumeric characters are represented using binary bits
(i.e., 0 and 1). Digital representations are easier to design, storage is easy, accuracy
and precision are greater.
There are various types of number representation techniques for digital number
representation, for example: Binary number system, octal number system, decimal

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

number system, and hexadecimal number system etc. But Binary number system
is most relevant and popular for representing numbers in digital computer system.

Fixed-point representation:

This representation has fixed number of bits for integer part and for fractional
part. For example, if given fixed-point representation is IIII.FFFF, then you can
store minimum value is 0000.0001 and maximum value is 9999.9999. There are
three parts of a fixed-point number representation: the sign field, integer field,
and fractional field.

1 00010011 10010101

Sign bit Integer Number Fractional part

Floating-point representation:

This representation does not reserve a specific number of bits for the integer part
or the fractional part. Instead, it reserves a certain number of bits for the number
(called the mantissa or significand) and a certain number of bits to say where
within that number the decimal place sits (called the exponent).

The floating number representation of a number has two parts: the first part
represents a signed fixed-point number called mantissa. The second part of
designates the position of the decimal (or binary) point and is called the exponent.
The fixed-point mantissa may be fraction or an integer.
Representation

Single Precision

Double Precision

• Single Precision Format Representation

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

1 00010011 10010101

1 bit 8 bits 23 bits

Sign bit Exponent Mantissa

• Double Precision Format Representation

1 00010011011 10010101.. N

1 bit 11 bits 52 bits

Sign bit Exponent Mantissa

• How we can distinguish base, mantissa and exponent here in floating-


point:

Number Mantissa Exponent Base

10 * 5^4 10 4 5

254756.145 254756145 -3 10

1.N * 2 ^ E-127
• Single Precision

1.N * 2 ^ E-1023
• Double Precision
• Formula for single and double precision format.

• Example:
1. 85.125

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

2. 85 = 1010101
3. 0.125 = 001
4. 85.125 = 1010101.001 = 1.010101001 x 2^6
5. sign = 0
6. Single precision: biased exponent 127+6=133
7. 133 = 10000101
8. Normalized mantissa = 010101001
9. We will add 0's to complete the 23 bits
10. The IEEE 754 Single precision is:

0 10000101 01010100100000000000000

Number Sign Exponent Mantissa


Bit
254756.145 0 10000101 01010100100000000000000

• can be written in hexadecimal form 42AA4000

UNIT-2 (Structure of computers)

1. What is register?
Computer registers are designated by upper case letters (and optionally followed
by digits or letters) to denote the function of the register.

For example, the register that holds an address for the memory unit is usually
called a memory address register and is designated by the name MAR.

Other designations for registers are PC (for program counter), IR (for instruction
register, and R1 (for processor register).

The individual flip-flops in an n-bit register are numbered in sequence from 0


through n-1, starting from 0 in the rightmost position and increasing the numbers
toward the left.

Figure shows the representation of registers in block diagram form.

The most common way to represent a register is by a rectangular shape with the
name of the register inside.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

2. What is register transfer and what is micro-operation?


Register transfer:

Information transfers from one register to another register in a symbolic form by


means of a replacement operator.

The statement R2← R1 denotes a transfer of the content of register R1 into register
R2.

It designates a replacement of the content of R2 by the content of R1.

By definition, the content of the source register R 1 does not change after the
transfer.

If we want the transfer to occur only under a predetermined control condition then
it can be shown by an if-then statement. if (P=1) then R2← R1.

P is the control signal generated by a control section.

We can separate the control variable from the register transfer operation by
specifying a control function.

Control function is a Boolean variable that is equal to 0 or 1.

control function is included in the statement as P: R2← R1.

Control condition is terminated by a colon implies transfer operation be executed


by the hardware only if P=1.

Every statement written in a register transfer notation implies a hardware


construction for implementing the transfer.

Figure shows the block diagram that depicts the transfer from R1

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

The n outputs of register R1 are connected to the n inputs of register R2.

The letter n will be used to indicate any number of bits for the register. It will be
replaced by an actual number when the length of the register is known.

Register R2 has a load input that is activated by the control variable P.

It is assumed that the control variable is synchronized with the same clock as the
one applied to the register.

The basic symbols of the register transfer notation are listed in below table

A comma is used to separate two or more operations that are executed at the same
time.

The statement T: R2← R1, R1← R2 (exchange operation) denotes an operation


that exchanges the contents of two registers during one common clock pulse
provided that T=1.

Give the list of micro-operation


In computer central processing units, micro-operations (also known as micro-ops)
are the functional or atomic operations of a processor.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

They transfer data between registers and between external buses of theCPU and
also perform ALU (Arithmetic and logical operations) on registers.

Execution of program consists of sequential execution of instructions and each


execution is executed during an instruction cycle made up of shorter sub cycle, For
E.g., (fetch, Indirect, execute and interrupt)

The performance of each cycle involves one or more operation, knows as


microoperation

1. Register Transfer
This type of microoperations is used to transfer from one register to another binary
information

2. Arithmetic Micro-operation
This type of microoperations is used to perform on numeric data stored on registers
some arithmetic operation

3. Logic Micro-operation
This type of microoperation used to perform bit style operation/manipulation on
non-numeric data

4. Shift Micro-operation
As name suggest this operation is used to perform for shift operation in data stored
in register

1. What is logic micro-operation?


Definition of Micro-operation

In computer architecture and digital logic design, micro-operations refer to the basic
operations performed by a computer's control unit. These operations are typically
low-level and involve manipulating individual bits or groups of bits within the
computer's registers and memory.

A micro-operation, also known as a micro-op, refers to a low-level operation or


instruction executed by the control unit of a processor or a microprocessor. It is the
smallest unit of work performed by the processor and represents a specific operation
on data stored in registers or memory.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

2. Explain Arithmetic micro-operation.


Arithmetic microoperations are basic operations performed on individual binary
digits or groups of binary digits within a microprocessor or computer. These
operations are typically performed on data stored in registers and are fundamental
for executing arithmetic calculations.
Some common arithmetic microoperations include:
1. Addition: Two binary numbers are added together, and the result is stored in a
destination register. The carry-out from the most significant bit position can be used
for subsequent calculations.

2. Subtraction: Similar to addition, subtraction involves subtracting one binary


number from another and storing the result in a destination register. Borrow or
overflow flags may be set depending on the outcome of the operation.

3. Increment: The value stored in a register is increased by 1. This operation is often


used for iterative operations or addressing.

4. Decrement: The value stored in a register is decreased by 1. Like increment,


decrement is useful for iterative operations or addressing.

5. Multiplication: Binary multiplication involves multiplying two binary numbers


together to produce a product. Depending on the microprocessor architecture,
multiplication can be implemented using a series of addition, shifting, and masking
operations.

6. Division: Binary division divides one binary number by another to obtain a


quotient and a remainder. Similarly, to multiplication, division can be implemented
using a combination of subtraction, shifting, and conditional branching.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

7. Logical operations: These include bitwise operations such as AND, OR, XOR
(exclusive OR), and NOT (complement). These operations manipulate individual
bits within binary numbers.

These arithmetic microoperations are the building blocks for executing more
complex arithmetic and logical computations within a microprocessor or computer
system. They are performed at the digital logic level, often using arithmetic and
logic units (ALUs) or specialized arithmetic processing units within the CPU.

3. What is bus transfer and memory transfer?


4. What is RTL? Explain in detail.
RTL stands for register transfer language and it works on opcode an d operands.
In RTL, data transfers between registers are represented by statements called
register transfer statements. These statements define the source and destination
registers, the operations to be performed, and any control signals associated with
the transfer. RTL statements can include arithmetic operations, logical
operations, data movement operations, and control operations.

R1 <- R2 + R3
As you can see three registers one for storing the result and rest of two are used
for the addition operation and as an explanation R1 is the register which stores
the result of addition of R2 and R3 register.

5. Explain Shift micro-operation and explain arithmetic logic shift unit.

A shift microoperation is a fundamental operation that involves shifting the bits


of a binary number to the left or right. This operation is commonly used in digital
systems and computer architectures for various purposes, such as multiplying or

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

dividing by powers of 2, extracting or inserting specific bit patterns, and


repositioning data within registers.

There are two types of shifts microoperations:

1. Logical Shift:
Left Logical Shift (LSL): In an LSL operation, the bits of a binary number are
shifted to the left by a specified number of positions. The vacant bits on the right are
filled with zeros, and the bits on the leftmost side are discarded.

Example: If we perform a left logical shift by 2 positions on the binary number


110101, the result would be 010100.

Right Logical Shift (LSR): In an LSR operation, the bits of a binary number are
shifted to the right by a specified number of positions. The vacant bits on the left are
filled with zeros, and the bits on the rightmost side are discarded.

Example: If we perform a right logical shift by 2 positions on the binary number


110101, the result would be 001101.

2. Arithmetic Shift:
Left Arithmetic Shift (ASL): In an ASL operation, the bits of a binary number
are shifted to the left by a specified number of positions. The vacant bits on the
right are filled with zeros, and the bits on the leftmost side are discarded. The
leftmost bit, also known as the sign bit, remains unchanged.

Example: If we perform a left arithmetic shift by 2 positions on the binary number


110101, the result would be 010100.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Right Arithmetic Shift (ASR): In an ASR operation, the bits of a binary number
are shifted to the right by a specified number of positions. The vacant bits on the
left are filled with the value of the sign bit (the leftmost bit), preserving the sign of
the number. The bits on the rightmost side are discarded.

Example: If we perform a right arithmetic shift by 2 positions on the binary


number 110101, the result would be 111101.

Shift microoperations are often used in combination with other microoperations to


perform various tasks, such as manipulating data, implementing algorithms, and
managing registers within a digital system or computer architecture.

UNIT-3 (Programming the Basic Computer)


1. What is machine language?
Machine language is the lowest level of programming language that directly
corresponds to the computer's hardware architecture.

2. Explain machine language format.


Instructions in machine language are represented in binary form.

The length of machine language instructions can vary, including single-byte, two-
byte, or three-byte instructions.

The length of an instruction determines the amount of data it can operate on and the
complexity of the operation it performs.
3. Briefly explain Single-byte, Two-byte, and Three-byte instructions.
Single-byte Instructions: Single-byte instructions are machine language instructions
that consist of only one byte.

They are generally used for simple and basic operations that don't require large
amounts of data or complex calculations.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Two-byte Instructions: Two-byte instructions are machine language instructions that


consist of two bytes.

They allow for a wider range of operations and can handle larger data values.
Three-byte Instructions: Three-byte instructions are machine language instructions
that consist of three bytes.

They provide even more versatility and complexity in terms of operations and data
manipulation.

4. What do you mean by opcode and operand.


Opcode: The term "opcode" stands for "operation code."
The opcode determines the type of operation, such as arithmetic, logical, or data
movement, that the CPU should execute.
Operand: An operand is the data or the memory location upon which the operation
specified by the opcode operates.
For example:

ADD R1, R2

In this instruction, "ADD" is the opcode that indicates an addition operation.

R1 and R2 are operands.

5. List Addressing modes and explain them with examples.


Addressing modes specify how the operands (data) for instructions are accessed
and processed.

Different addressing modes allow for flexibility in manipulating data and


accessing memory.

Common addressing modes include immediate addressing, register addressing,


direct addressing, indirect addressing, and indexed addressing.

Immediate addressing The operand value is directly specified within the


instruction.
Register transfer The operand value is stored in a register.
addressing
Direct addressing The operand value is accessed from a memory
location.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Indirect addressing The operand value is accessed indirectly through a


memory address.
Indexed addressing The operand value is obtained by adding an offset
to a base address.
Examples:
Immediate Addressing:
Example: ADD R1, #10 (Add the value 10 to the content of register R1)
Register transfer addressing:

Example: ADD R1, R2 (Add the content of register R2 to the content of register
R1)

Direct Addressing:

Example: LOAD R1, 0x1000 (Load the value from memory address 0x1000 into
register R1)

Indirect Addressing:

Example: LOAD R1, (R2) (Load the value from the memory address stored in
register R2 into register R1)

Indexed Addressing:

Example: LOAD R1, 0x1000(R2) (Load the value from the memory address
calculated by adding the content of register R2 with the displacement 0x1000
into register R1)

6. What is data transfer operation? Explain its instruction.


Data transfer operations involve moving data between memory locations, registers,
and input/output devices.
Instructions for data transfer include load, store, input, and output operations.

Load Copies data from memory to a register or a memory location.


Store Copies data from a register or a memory location to memory.
Input Transfers data from an input device to a register or memory.
Output Transfers data from a register or memory to an output device.
Examples:

Load (LD):
Example: LD A, B - copies the contents of register B to register A.
Store (ST):

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Example: ST A, 2000 - copies the contents of register A to memory location 2000.


Move (MOV):
Example: MOV A, B - moves the contents of register B to register A.
Input (IN):
Example: IN A, Port1 - reads data from input port "Port1" and stores it in register
A.
Output (OUT):
Example: OUT Port2, A - sends the contents of register A to output port "Port2".

7. Briefly explain logical operation and its instruction.


Logical operations perform logical calculations on data, usually at the bit level.
Instructions for logical operations include AND, OR, XOR, and NOT.

AND Performs a bitwise AND operation between two operands.


OR Performs a bitwise OR operation between two operands.
XOR Performs a bitwise XOR operation between two operands.
NOT Performs a bitwise negation operation on an operand.

Examples:

AND (Bitwise AND):


Example: AND A, B - performs a bitwise AND operation between the contents of
register A and register B, storing the result in register A.
OR (Bitwise OR):
Example: OR A, B - performs a bitwise OR operation between the contents of
register A and register B, storing the result in register A.
XOR (Bitwise XOR):
Example: XOR A, B - performs a bitwise XOR operation between the contents of
register A and register B, storing the result in register A.
NOT (Bitwise NOT):
Example: NOT A - performs a bitwise NOT operation on the contents of register
A, storing the result in register A.

8. Explain branch and stack operation with diagram.


Branch operations control the flow of program execution by altering the sequence
of instructions.
Instructions for branch operations include conditional and unconditional
branching.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Conditional Branch Branches to a different location based on a specific


condition.
Unconditional Branch Unconditionally branches to a different location.

Conditional Branch:
Example: BEQ Label - Branch to the instruction at "Label" if the previous
comparison resulted in equality (zero flag set).
Unconditional Branch:
Example: JMP Label - Unconditionally jump to the instruction at "Label".

Fig. Conditional Branch


The stack is a region of memory used for temporary data storage and function call
management.

• Instructions for stack operations include push and pop.

Push Stores data onto the stack.


Pop Retrieves data from the stack.
Push:

Example: PUSH A - Pushes the value of register A onto the stack.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Example: POP A - Pops the value from the top of the stack and stores it in register
A.

9. I/O operation.
Input/Output (I/O) operations involve communication between the computer and
external devices.
Machine control operations manage the execution and control of the computer.
Input/Output instructions facilitate the transfer of data between the computer and
input/output devices.
Machine control instructions manage the flow of execution, such as starting or
stopping the execution of a program or handling interrupts.
Input/Output Operations:
Input (IN): Reads data from an input device, such as a keyboard, and stores it in a
register or memory location.
Output (OUT): Sends data from a register or memory location to an output device,
such as a display or printer.
Example: IN A, Port1 - Reads data from input port "Port1" and stores it in register
A.
OUT Port2, A - Sends the contents of register A to output port "Port2".

10. What is ALP? Usage of it.


Assembly language is a low-level programming language closely related to a
specific computer's architecture and instruction set.

Assembly language uses mnemonics to represent machine instructions and


provides a more human-readable representation of machine code.

Assembly-level language programming involves writing programs using


mnemonic instructions corresponding to the target computer's machine language
instructions.

Assembly language programs are translated into machine code using an assembler.

Assembly language programming allows for direct control over the computer's
hardware and is used in situations where the performance or low-level access is
critical.

COMPUTER ENGINEERING PIET DS


COMPUTER ARCHITECTURE AND ORGANIZATION (03606215)

Assembly language programming requires a good understanding of the computer's


architecture, instruction set, and memory organization. It offers fine-grained
control but can be more complex and time-consuming than high-level languages.

Assembly language is often used for device drivers, embedded systems, and
performance-critical applications.

COMPUTER ENGINEERING PIET DS

You might also like