Cao

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

cao

**Part A**

**1. Explain in brief the categories in which Computer Architecture is divided.**

Computer Architecture is typically divided into three categories: Instruction Set Architecture (ISA),
Microarchitecture, and System Design.

**2. What are the types of interrupts in a Microprocessor System?**

The types of interrupts in a Microprocessor System are Software Interrupts, Hardware Interrupts,
and External Interrupts.

3. Name different types of fields that are part of an instruction.

The different types of fields that are part of an instruction include Opcode, Source Operand,
Destination Operand, and Addressing Mode fields.

4. What is a register file? What is a multiprocessor?

A register file is a small, fast memory array used for temporary storage of data and addresses. A
multiprocessor is a computer system with multiple processors working together.

5. Which term refers to the same instruction applied to multiple data streams?

Single Instruction Multiple Data (SIMD) refers to the same instruction applied to multiple data
streams.

6. What is an ALU?

An ALU (Arithmetic Logic Unit) is a digital circuit that performs arithmetic and logical operations on
binary data.
7. What are basic data types in computer organization?

The basic data types in computer organization are integers, real numbers, characters, and booleans.

8. How a compliment of a no is calculated.

The complement of a number is calculated by inverting each bit of the number and adding 1 to the
result.

9. What is machine language?

Machine language is a low-level programming language consisting of binary digits (0s and 1s) that a
computer can directly understand and execute.

10. What is assembly language?

Assembly language is a low-level programming language that uses symbolic representations of


machine language instructions and memory addresses.

11. What is assembler?

An assembler is a program that translates assembly language code into machine code (binary
instructions) that a computer can execute.

12. What is microoperation?

A microoperation is a basic operation performed by the control unit of a computer system at the
digital logic level.

13. Define arithmetic micro-operation.

Arithmetic micro-operations are microoperations that perform arithmetic calculations, such as


addition, subtraction, multiplication, and division, on binary data.
14. What is computer instruction?

A computer instruction is a command given to a computer processor by a computer program to


perform a specific operation or action.

15. What is register transfer?

Register transfer refers to the movement of data between registers within a computer system, which
is a basic operation in digital systems.

16. What is memory transfer?

Memory transfer refers to the movement of data between memory and registers or between
different memory locations within a computer system.

17. What is control unit?

The control unit is a component of a computer's central processing unit (CPU) that directs the
operation of the computer by generating control signals that coordinate the activities of other
components.

Part B

1. **Fixed Point Representation**:

In fixed point representation, the radix point (binary point) is fixed at a specific position within the
data word. The position of the radix point is predetermined, and it does not change during arithmetic
operations. Fixed point representation is suitable for representing integers and fractions with a
limited range and precision.

2. **Floating Point Representation**:

Floating point representation is a way of representing real numbers in a computer system. It employs
a mantissa (significant digits) and an exponent to represent a wide range of values with a limited
number of digits. The mantissa holds the significant digits, and the exponent represents the power of
the radix (base) to which the mantissa must be raised. This representation allows for a wide range of
values to be represented accurately within the available memory space.
3. **Arithmetic Microoperations**:

Arithmetic microoperations are the basic operations performed by the Arithmetic Logic Unit (ALU)
within a computer's processor. These operations include:

- Addition

- Subtraction

- Multiplication

- Division

- Increment

- Decrement

- Negation

- Comparison (e.g., equal, greater than, less than)

4. **Logical Microoperations**:

Logical microoperations are bitwise operations performed on binary data. These operations include:

- AND

- OR

- XOR (Exclusive OR)

- NOT (Complement)

- Shift (left, right)

- Rotate (left, right)

5. **Arithmetic Shift vs. Logical Shift**:

- Arithmetic Shift: An arithmetic shift is used to multiply or divide binary numbers by a power of 2. It
preserves the sign bit and shifts the remaining bits accordingly.

- Right arithmetic shift: Shifts bits to the right, preserving the sign bit.

- Left arithmetic shift: Shifts bits to the left, filling vacant positions with the sign bit.

- Logical Shift: A logical shift is used for general bit manipulation. It does not preserve the sign bit.

- Right logical shift: Shifts bits to the right, filling vacant positions with zeros.

- Left logical shift: Shifts bits to the left, filling vacant positions with zeros.

6. **General Purpose Register**:


A general purpose register is a highly flexible register within a CPU that can store data, memory
addresses, or temporary results. These registers are not dedicated to specific tasks and can be used
for various purposes, such as arithmetic operations, data transfer, and address calculations. Examples
include registers like AX, BX, CX, and DX in the x86 architecture.

7. **Special Purpose Register**:

Special purpose registers are dedicated registers within a CPU that serve specific functions or hold
specific values. These registers are designed for particular tasks and cannot be used for general
purposes. Examples include:

- Program Counter (PC): Holds the address of the next instruction to be executed.

- Instruction Register (IR): Stores the current instruction being executed.

- Stack Pointer (SP): Holds the address of the top of the stack.

- Status Register: Contains flags that indicate the results of arithmetic and logical operations.

8. **Assembly Language with 6 Symbols and Descriptions**:

Assembly language is a low-level programming language that provides a symbolic representation of


machine code instructions. Here are six common symbols and their descriptions:

- MOV: Move data from one location to another.

- ADD: Add two operands and store the result.

- SUB: Subtract one operand from another and store the result.

- JMP: Jump to a specified memory location (unconditional jump).

- CMP: Compare two operands and set flags accordingly.

- LOOP: Repeat a block of instructions a specified number of times.

9. **Rules of Assembly Language**:

Assembly language follows certain rules and conventions, including:

- Instructions and operands must be specified in a specific format and order.

- Comments are denoted by a specific character or sequence (e.g., `;` in x86 assembly).

- Labels are used to mark memory locations for branching and referencing.

- Directives are used to provide instructions to the assembler (e.g., defining variables, allocating
memory).

- Register names and instruction mnemonics follow a predefined syntax.


10. **Multiplication Program in Assembly Language (x86)**:

```

section .text

global _start

_start:

; Load operands into registers

mov eax, 5 ; First operand

mov ebx, 10 ; Second operand

; Multiply

mul ebx ; EAX = EAX * EBX

; Exit program

mov eax, 1

xor ebx, ebx

int 0x80

```

This program loads the values 5 and 10 into the EAX and EBX registers, respectively. The `mul`
instruction multiplies the values in EAX and EBX, storing the result in EAX. Finally, the program exits
using the system call `int 0x80`.

11. **Subroutine**:

A subroutine, also known as a procedure or function, is a separate section of code within a program
that performs a specific task. It can be called from multiple locations within the program, reducing
code duplication and promoting modularity. Subroutines can take input parameters and return
values. They are typically used to encapsulate related operations or algorithms, making the code
more organized and maintainable.

12. **Program to Subtract Two Double-Precision Numbers (x86 Assembly)**:

```
section .text

global _start

_start:

; Load operands into registers

fld qword [op1] ; Push first operand onto FPU stack

fld qword [op2] ; Push second operand onto FPU stack

fsub ; Subtract top two values on FPU stack

; Store result

fstp qword [result] ; Pop result from FPU stack to memory

; Exit program

mov eax, 1

xor ebx, ebx

int 0x80

section .data

op1 dq 3.14159265358979 ; First operand

op2 dq 1.618033988749895 ; Second operand

result dq 0.0 ; Result storage

```

This program loads two double-precision floating-point numbers (`op1` and `op2`) onto the Floating-
Point Unit (FPU) stack using the `fld` instruction. The `fsub` instruction subtracts the top two values
on the FPU stack, leaving the result on the stack. Finally, the `fstp` instruction pops the result from
the FPU stack and stores it in the `result` memory location.

Note: This example assumes an x86 architecture with a Floating-Point Unit (FPU) for performing
floating-point operations.

Part C
Here are detailed responses to your questions:

1. **Common Bus System for Four Registers**

A common bus system allows multiple registers to transmit data over a shared set of wires (the bus)
by using bus control logic. In a four register system, there are typically four registers (A, B, C, D)
connected to a common data bus.

The steps are:

- Bus control logic enables one register onto the bus by activating its output buffers

- The enabled register transmits its data onto the bus lines

- The destination register enables its input to read the data on the bus

This system allows any register to transfer its data to any other register using the shared bus,
reducing the number of connections required.

2. **Three-State Bus Buffers**

Three-state bus buffers are bi-directional buffers that connect a device (register, memory, I/O etc.) to
the system bus. They have three states:

- Buffer enabled to bus as output

- Buffer enabled to device as input

- High impedance state (disabled)

The high impedance third state allows multiple devices to be connected to the bus by disabling their
bus buffers when not transmitting data. Only one buffer can be enabled as output at a time to avoid
bus conflicts.

Three-state buffers use a control line (output enable) to enable data flow from device to bus when
HIGH, and another control (input enable) to enable data from bus to device.

3. **Instruction Cycle**
The instruction cycle is the sequence of steps the CPU executes to complete one instruction. It
consists of:

- Fetch Cycle:

- Fetch the instruction from memory into the CPU

- Decode Cycle:

- Decode the fetched instruction

- Execute Cycle:

- Execute the decoded instruction, reading/writing data as needed

- Interrupt Cycle (if interrupt occurred)

This fetch-decode-execute cycle repeats for every instruction.

4. **Basic Computer Design**

The basic components of a computer are:

- CPU: Performs data processing and controls operations

- Memory: Stores instructions and data

- Input/Output: Interfaces with external devices

- System Interconnections: Buses to transfer data between components

The CPU has registers, an arithmetic logic unit (ALU) and a control unit. It fetches instructions and
data from memory, decodes instructions, performs arithmetic/logic in the ALU, and controls
dataflow.

The memory is used for storing programs and data. I/O interfaces connect peripherals. The system
bus(es) connect all components.

5. **Types of Shift Microoperations**


There are four basic types of shift microoperations:

1) Logical Shift Left

- All bits shifted left by 1 bit position

- 0 inserted on right side (LSB)

2) Logical Shift Right

- All bits shifted right by 1 bit

- 0 inserted on left side (MSB)

3) Arithmetic Shift Left

- Same as Logical Shift Left

4) Arithmetic Shift Right

- All bits shifted right by 1 bit

- Sign bit (MSB) is replicated on left

The arithmetic shifts preserve the sign bit, while logical shifts introduce 0s from the side the bits are
shifted towards.

There are also circular shift variations where the bits shifted off at one end are re-introduced at the
other end.

6. **First Pass of Assembler Flowchart**

```

+--------------+

| Start |

+--------------+

+----------------------------+

| Read Next Source Line |

+----------------------------+

+---------------------------+
| Strip Comments/White Space|

+---------------------------+

+---------------------------+

| Parse Statements |

+---------------------------+

+----------------------------+

| Lookup Opcodes/Pseudo-Ops |

+----------------------------+

+-------------------------------+

| Process Symbols/Address Modes |

+-------------------------------+

+-------------------------------+

| Build Initial Symbol Table |

+-------------------------------+

+-------------------------------+

| Write Headers/Text Records |

+-------------------------------+

No

+-------------------------------+

| Any More Source Lines? |

+-------------------------------+

Yes|

+-------------------------------+

| End First Pass |

+-------------------------------+
```

The first pass reads the source code, parses statements, looks up opcodes/pseudo-ops, processes
symbols/address modes, builds the initial symbol table, and writes headers/text records to an object
file.

7. **Compare Two Words Program**

```

COMPR START 0

LDA WORDA Load first word to AC

CMA WORDB Compare with second word

BUN NEQUAL Branch if not equal

... Words are equal, do processing

STOP

NEQUAL ... Words not equal, take other action

STOP

WORDA WORD X'000A' First word

WORDB WORD X'000B' Second word

END COMPR

```

This program:

1) Loads the first word WORDA into the AC register

2) Compares it with the second word WORDB using CMA (Complement and Add)

3) If the result is 0 (A=B), no branch occurs, else it branches to NEQUAL

4) Appropriate actions are then taken based on the compare result

8. **Service an Interrupt Program**

```

START LDA INTVEC Load interrupt vector address


STA TEMP Store it temporarily

LDCH INTID Load interrupt ID

... Process interrupt ID

NEXT LDB TEMP Get interrupt vector address

SVCR B Transfer control to ISR

; Interrupt Service Routines follow

ISR1 ... Code for interrupt service 1

RETT Return from interrupt

ISR2 ... Code for interrupt service 2

RETT

INTVEC WORD ISR1 Interrupt vector address

INTID BYTE X'01' Interrupt ID

TEMP RESW 1 Temporary storage

END START

```

This program first loads the interrupt vector address from INTVEC into TEMP.

The INTID is loaded to determine which interrupt occurred.

The SVCR B instruction transfers control to the corresponding ISR routine.

The ISR code services the interrupt and returns using RETT.

This demonstrates how an interrupt is handled - the CPU loads the vector address, identifies the
interrupt, and transfers control to the specific ISR.

You might also like