Cao
Cao
Cao
**Part A**
Computer Architecture is typically divided into three categories: Instruction Set Architecture (ISA),
Microarchitecture, and System Design.
The types of interrupts in a Microprocessor System are Software Interrupts, Hardware Interrupts,
and External Interrupts.
The different types of fields that are part of an instruction include Opcode, Source Operand,
Destination Operand, and Addressing Mode fields.
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.
The complement of a number is calculated by inverting each bit of the number and adding 1 to the
result.
Machine language is a low-level programming language consisting of binary digits (0s and 1s) that a
computer can directly understand and execute.
An assembler is a program that translates assembly language code into machine code (binary
instructions) that a computer can execute.
A microoperation is a basic operation performed by the control unit of a computer system at the
digital logic level.
Register transfer refers to the movement of data between registers within a computer system, which
is a basic operation in digital systems.
Memory transfer refers to the movement of data between memory and registers or between
different memory locations within a computer system.
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
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.
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
4. **Logical Microoperations**:
Logical microoperations are bitwise operations performed on binary data. These operations include:
- AND
- OR
- NOT (Complement)
- 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.
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.
- 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.
- SUB: Subtract one operand from another and store the result.
- 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).
```
section .text
global _start
_start:
; Multiply
; Exit program
mov eax, 1
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.
```
section .text
global _start
_start:
; Store result
; Exit program
mov eax, 1
int 0x80
section .data
```
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:
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.
- 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.
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:
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:
- Decode Cycle:
- Execute Cycle:
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.
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.
```
+--------------+
| Start |
+--------------+
+----------------------------+
+----------------------------+
+---------------------------+
| Strip Comments/White Space|
+---------------------------+
+---------------------------+
| Parse Statements |
+---------------------------+
+----------------------------+
| Lookup Opcodes/Pseudo-Ops |
+----------------------------+
+-------------------------------+
+-------------------------------+
+-------------------------------+
+-------------------------------+
+-------------------------------+
+-------------------------------+
No
+-------------------------------+
+-------------------------------+
Yes|
+-------------------------------+
+-------------------------------+
```
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.
```
COMPR START 0
STOP
STOP
END COMPR
```
This program:
2) Compares it with the second word WORDB using CMA (Complement and Add)
```
RETT
END START
```
This program first loads the interrupt vector address from INTVEC into TEMP.
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.