DPCO Unit3 2mark Q&A
DPCO Unit3 2mark Q&A
Ans.:Computer architecture is defined as the functional operation of the individual H/W unit in a
computer system and the flow of information among the control of those units.
Ans. : Computer H/W is the electronic circuit and electro mechanical equipment that constitutes the
computer.
1. Input unit
2. Output unit
3. Control unit
4. Memory unit
5. Arithmetic and logical unit
Ans. : The arithmetic and logic unit in conjunction with control unit is commonly called Central
Processing Unit (CPU).
Ans. : A computer accepts a digitally coded information through input unit using input devices such as
keyboard and mouse.
Ans. : The control unit co-ordinates and controls the activities amongst the functional units. The basic
function of control unit is to fetch the instructions stored in the main memory, identify the operations
and the devices involved in it, and accordingly generate control signals to execute the desired
operations.
Ans. : The Arithmetic and Logic Unit (ALU) is responsible for performing arithmetic operations such as
add, subtract, division and multiplication, and logical operations such as ANDing, ORing, Inverting etc.
6.2 Von Neumann Architecture
Ans. :•It uses stored program concept. The program (instructions) and data are stored in a single read-
write memory.
• The contents of read-write memory are addressable by location, without regard to the type of data
contained there.
• Execution of instructions occurs in a sequential manner (unless explicitly modified) from one
instruction to the next.
Ans. : Von Neumann Bottleneck Because of the stored program architecture of Von-Neumann machine,
the processor performance is tightly bound to the memory performance. That is, since we need to
access memory at least once per cycle to read an instruction, the processor can only operate as fast as
the memory. This is sometimes known as the Von Neumann bottleneck or memory wall.
Ans. : The MAR (memory address register) is used to hold the address of the location to or from which
data are to be transferred and the MDR(memory data register) contains the data to be written into or
read out of the addressed location.
Ans. : Instruction Register (IR) contains the instruction being executed. Its output is available to the
control circuits, which generate the timing signals for controlling the processing circuits needed to
execute the instructions.
Ans. :The Program Counter (PC) register keeps track of the execution of the program. It contains the
memory address of the instruction currently being executed. During the execution of the current
instruction, the contents of the PC are updated to correspond to the address of the next instructions to
be executed.
Q.13 Classify the instructions based on the operations they perform and give one example to each
category. AU: Dec.-18 Refer Book
• Arithmetic
• Data transfer
• Logical
• Conditional branch
• Unconditional jump.
6.4 Operands of the Computer Hardware
• In MIPS, the registers are 32-bit; hence, the word size is 32-bit (4 bytes).
• Since most memories are byte (8-bits) oriented, virtually all architectures today address individual
bytes. However, the byte should be the starting byte of the word.
• Therefore, in MIPS, words must start at addresses that are multiples of 4. This requirement is called an
alignment restriction and many architectures have it.
Q.15 Why are the most frequently used variables stored in registers ?
Ans. :Registers take less time to access and have higher throughput than memory. Hence, the compiler
tries to keep the most frequently used variables in registers.
Ans. :The process of putting less commonly used variables (or those needed later) into memory is called
spilling registers.
6.5 Instructions
• MIPS assembly language includes two decision-making instructions, similar to an if statement with a
go to.
• beq register1, register2, L1: This instruction means go to the statement labeled L1 if the value in
register1 equals the value in register2. The mnemonic beq stands for branch if equal.
• bne register1, register2, L1: It means go to the statement labeled L1 if the value in register1 does not
equal the value in register2. The mnemonic bne stands for branch if not equal. These two instructions
are called conditional branches.
Ans. : One of the most imporant abstraction is the interface between the hardware and the lowest-level
softwrae. Because of its importance, it is given a special name:The instruction set architecture of a
computer. It includes anything programmer needs to know to make a binary machine language program
work correctly, including instructions, I/O devices and so on.
Ans. : When lower byte addresses are used for the more significant bytes (the leftmost bytes) of the
word, addressing is called big endian.
Ans. : When the lower byte addresses are used for, the less significant bytes (the rightmost byte) of the
word, addressing is called little-endian.
Q.22 What are aligned addresses ?
Ans. : Word length is typically a multiple of 8, common CPU word length being 8, 16, 32 and 64-bits.
When word lengths are more than 8-bits, we must take special care while accessing words. In the case
of a 32-bit word length, natural word boundaries occur at addresses 0, 4, 8, In general, words are said to
be aligned in memory if they begin at the natural word boundaries. The addresses of such words are
called aligned addresses.
Q.23 What are the various types of operations required for instructions ?
Ans. :• Data transfers between the main memory and the CPU registers
• I/O transfers.
Ans. :The operation code field in the instruction specifies the operation to be performed. The operation
is specified by binary code, hence the name operation code or simply opcode.
Ans. : It is also possible to use instruction where the locations of all operand are defined implicitly. This
operand of the use of the method for storing the operand in which called push down stack. Such
instructions are sometimes referred to as zero address instructions.
Ans. : The different ways that a processor can access data are referred to as addressing schemes or
addressing modes.
Q.28 List different addressing modes.
Ans. : In direct addressing mode the address of the location of the operand is given explicitly as a part of
the instruction. On the other hand, in indirect addressing mode, the effective address of the operand is
the contents of a register or the main memory location whose address is given explicitly in the
instruction.
• Register addressing
• Immediate operand and
• Relative to PC addressing for branch instructions.
Q.31 What is relative addressing mode? When is it used? (Refer section 6.10) AU: June-12
Here, the referenced register is program counter (PC) and hence this addressing mode is also known as
PC-relative addressing.
The effective address is determined by adding the contents of PC to the address field. EA = PC + Address
part of instruction.
The address part is a signed number so that it is possible to have branch target location either before or
after the branch instruction. This addressing mode is commonly used to specify the target address in
branch instructions.
• Example: JNZ BACK: This instruction causes program execution to go to the branch target location
identified by the name BACK, if the branch condition is satisfied.
• An address computed by the processor when executing a memory access or branch instruction or
when fetching the next sequential instruction is known as Effective Address (EA). An effective address
can be made up from as many as three elements: The base, index and displacement.
• An addressing mode specifies how to calculate the effective of an operand by using elements of
effective information held in registers and/or constants contained within a machine instruction or
elsewhere.
• Example :MOV #20, A: This instruction copies operand 20 in the register A. The sign # in front of the
value of an operand is used to indicate that this value is an immediate operand.
In this addressing mode, the instruction contains the address of memory which refers the address of the
operand.
EA =Value + (R).
Three common variation of displacement addressing are :
• Relative addressing
• Base register addressing
• Index addressing.
• Example: MOV [R+8], A: This instruction copies the contents of memory whose address is determined
by adding the contents of register R and displacement 8 to the register A.
In this addressing mode, the address field references the main memory and the referenced register
contains a positive displacement from that address. EA = Memory address + (R).
The indexing is a technique that allows programmer to point or refer the data (operand) stored in
sequential memory locations one by one. It is an efficient mechanism for performing iterative
operations.
• Example: MOV [R1 + RI], R: In this instruction main memory address is given by register R1 and the
referenced register RI gives the positive displacement. The contents of the memory address generated
by the addition of main memory address and displacement is copied to register R.
Q.40 What is autoincrement addressing mode ?(Refer section 6.10) AU: May-16
The effective address of the operand is the contents of a register specified in the instruction. After
accessing the operand, the contents of this register are incremented to address the next location.
• Example: MOV R0, (R2)+: The above instruction copies the contents of register RO into the memory
location whose address is specified by the contents of register R2. After copy operation, the contents of
register R2 are automatically incremented by 1.
Q.41 What is autodecrement addressing mode ?(Refer section 6.10) AU: May-16
The contents of a register specified in the instruction are decremented and then they are used as an
effective address to access a memory location.
• Example: MOV - (R0), R1: This instruction, initially decrements the contents of register RO and then
the decremented contents of register RO are used to address the memory location. Finally, the contents
from the addressed memory location are copied into the register R1.
A stack is linear array of reserved memory locations. It is associated with a pointer called Stack Pointer
(SP).
In stack addressing mode, stack pointer always contains the address of Top Of Stack (TOS) where the
operand is to be stored or located. Thus, the address of the operand (source or destination) is the
contents of stack pointer.
This addressing mode is the special case of register indirect addressing where referenced register is a
stack pointer.
Usually, stack grows in the direction of descending addresses, (descending stack), starting from a high
address and progressing to lower one. In this stack, SP is decremented before any items are appended
(pushed) on stack and SP is incremented after any items popped from the stack.
• Example: PUSH R: This instruction decrements SP and copies the contents of register R on to the top of
stack pointed by stack pointer.
Q.43 Brief about relative addressing mode with an example. (Refer book)
Here, the referenced register is program counter (PC) and hence this addressing mode is also known as
PC-relative addressing.
The effective address is determined by adding the contents of PC to the address field. EA = PC + Address
part of instruction.
The address part is a signed number so that it is possible to have branch target location either before or
after the branch instruction. This addressing mode is commonly used to specify the target address in
branch instructions.
• Example: JNZ BACK: This instruction causes program execution to go to the branch target location
identified by the name BACK, if the branch condition is satisfied.
Q.44 What is meant by an addressing mode ? Mention most important of them. (Refer section 6.10) AU:
June-11
Part of the programming flexibility for each processor is the number and different kind of ways the
programmer can refer to data stored in the memory or I/O device. The different ways that a processor
can access data are referred to as addressing schemes or addressing modes.
An addressing mode specifies how to calculate the effective of an operand by using elements of
effective information held in registers and/or constants contained within a machine instruction or
elsewhere.
Q.45 Distinguish between autoincrement and autodecrement addressing mode. (Refer section 6.10)
AU: May-17
Autoincrement addressing mode: The effective address of the operand is the contents of a register
specified in the instruction. After accessing the operand, the contents of this register are incremented to
address the next location.
• Example: MOV R0, (R2)+: The above instruction copies the contents of register RO into the memory
location whose address is specified by the contents of register R2. After copy operation, the contents of
register R2 are automatically incremented by 1.
Autodecrement addressing mode: The contents of a register specified in the instruction are
decremented and then they are used as an effective address to access a memory location.
• Example: MOV - (R0), R1: This instruction, initially decrements the contents of register RO and then
the decremented contents of register RO are used to address the memory location. Finally, the contents
from the addressed memory location are copied into the register R1.
Q.46 State the need for indirect addressing mode. Give an example. AU : May-17
Ans. : In indirect addressing mode, the instruction specifies the address where the address of the
operand is located. In case of register indirect addressing, the address of the operand is specified by the
contents of the register. These operating modes are needed when we need to access arrays. Specifically,
in register indirect addressing, registers are used as pointers and they are very useful for dealing with
arrays or tables of simple data values.
Consider Fig. 6.13.1, where a data structure consists of a sequence of consecutive byte values. The
pointer register contains (1000) H, corresponding to the first item in the structure. To access item 2 in
the structure we only need to increment the value in the pointer register.
Q.47 Compare machine level, assembly level and high level languages. (Refer book)
Q.48 Define compiler.
Ans. :A compiler is a program which translates the source code written in a high-level language into
computer-readable machine language that can be directly loaded and executed.
Ans. :An interpreter translates a high-level language statement in a source program to a machine code
and executes it immediately, before translating the next source language statement. When an error is
found, the execution of the program is halted and an error message is displayed on the screen of the
computer.