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

Unit-1: Computer Data Representations

Register Transfer language


Register Transfer Language (RTL) is a notation used to describe the flow of data between registers
and operations performed on that data within a digital system. It provides a concise and formal way
to specify the sequence of actions in a hardware design. Here's some information about RTL along
with three simplified examples:

Syntax: RTL uses a set of symbols and notations to represent operations and data transfers. It
typically consists of statements in the form of "source register → destination register" to indicate the
transfer of data from the source register to the destination register.

Example 1: Addition Operation


RTL notation: A ← B + C
Explanation: This example represents an addition operation. The value stored in register B is added
to the value stored in register C, and the result is stored in register A.

Example 2: Data Transfer


RTL notation: A ← B
Explanation: This example represents a data transfer operation. The value stored in register B is
copied or transferred to register A.

Example 3: Logical Operation


RTL notation: A ← B AND C
Explanation: This example represents a logical AND operation. The value stored in register B is
bitwise ANDed with the value stored in register C, and the result is stored in register A.

Few more examples:


 Addition: A ← B + C (Add the values in registers B and C and store the result in register A).
 Subtraction: A ← B - C (Subtract the value in register C from register B and store the result in
register A).
 Multiplication: A ← B * C (Multiply the values in registers B and C and store the result in register
A).
 Division: A ← B / C (Divide the value in register B by the value in register C and store the result in
register A).
 Bitwise AND: A ← B AND C (Perform a bitwise AND operation between the values in registers B
and C and store the result in register A).
 Bitwise OR: A ← B OR C (Perform a bitwise OR operation between the values in registers B and C
and store the result in register A).
 Bitwise XOR: A ← B XOR C (Perform a bitwise XOR operation between the values in registers B
and C and store the result in register A).
 Bitwise NOT: A ← NOT B (Perform a bitwise negation of the value in register B and store the
result in register A).
 Shift left: A ← B << C (Shift the value in register B left by C bits and store the result in register A).
 Shift right: A ← B >> C (Shift the value in register B right by C bits and store the result in register
A).
 Increment: A ← A + 1 (Increment the value in register A by 1).
 Decrement: A ← A - 1 (Decrement the value in register A by 1).
 Clear: A ← 0 (Set the value in register A to 0).
 Load Immediate: A ← Immediate (Load a constant value into register A).
 Load from Memory: A ← Memory*Address+ (Load the value from a specific memory address into
register A).
 Store to Memory: Memory*Address+ ← A (Store the value in register A to a specific memory
address).
 Conditional Branch: If A = B, PC ← Address (If the value in register A is equal to the value in
register B, jump to the specified address).
 Unconditional Jump: PC ← Address (Jump to the specified address without any condition).
 Call Subroutine: Push PC; PC ← Address (Save the current program counter on the stack and
jump to the specified subroutine address).
 Return from Subroutine: PC ← Pop (Restore the program counter from the top of the stack to
return from a subroutine).

Arithmetic Micro-Operations
Arithmetic micro-operations, in the context of Computer Architecture Organization (CAO), refer to
the fundamental operations performed on binary numbers within a digital system's arithmetic logic
unit (ALU). These micro-operations manipulate the data stored in registers and perform arithmetic
calculations.
Here are some common arithmetic micro-operations:

1. Addition: The addition micro-operation performs binary addition between two binary numbers.
It involves adding corresponding bits from two operands and generating a sum along with a
carry-out.
Example 1: Performing binary addition of two numbers: 1011 + 0110, Result: 10001 (carry-out:
1)
Example 2: Performing binary addition of two numbers: 1101 + 0101, Result: 10010 (carry-out:
0)
2. Subtraction: The subtraction micro-operation performs binary subtraction between two binary
numbers. It involves subtracting corresponding bits from two operands and generating a
difference along with a borrow-out.
Example 1: Performing binary subtraction of two numbers: 1101 – 0101, Result: 1000 (borrow-
out: 0)
Example 2: Performing binary subtraction of two numbers: 1010 – 0111, Result: 101 (borrow-
out: 1)

3. Increment: The increment micro-operation increases the value of a binary number by 1. It


involves adding 1 to the binary value stored in a register.
Example 1: Incrementing a binary number: 0101, Result: 0110
Example 2: Incrementing a binary number: 1111, Result: 0000 (with overflow or wrap-around)

4. Decrement: The decrement micro-operation decreases the value of a binary number by 1. It


involves subtracting 1 from the binary value stored in a register.
Example 1: Decrementing a binary number: 1001, Result: 1000
Example 2: Decrementing a binary number: 0000, Result: 1111 (with underflow or wrap-around)

5. Multiplication: The multiplication micro-operation performs binary multiplication between two


binary numbers. It involves multiplying corresponding bits from two operands and generating a
product.
Example 1: Performing binary multiplication: 101 * 011, Result: 11111
Example 2: Performing binary multiplication: 110 * 010, Result: 11000

6. Division: The division micro-operation performs binary division between two binary numbers. It
involves dividing corresponding bits from two operands and generating a quotient and
remainder.
Example 1: Performing binary division: 1011 ÷ 010, Quotient: 101, Remainder: 1
Example 2: Performing binary division: 1110 ÷ 011, Quotient: 100, Remainder: 10

7. Shift: The shift micro-operation shifts the bits of a binary number to the left or right. It can be
used for arithmetic or logical purposes, such as multiplying or dividing by powers of 2 or shifting
bits for data alignment.
Example 1: Left-shifting a binary number: 101001 << 2, Result: 100100 (shifted left by 2
positions)
Example 2: Right-shifting a binary number: 110010 >> 3, Result: 000110 (shifted right by 3
positions)
Logic Micro Operations
Logic micro-operations, also known as bitwise operations, are fundamental operations performed on
individual bits or groups of bits within a digital system. These operations manipulate the logical
values (0 and 1) of binary data, allowing for logical comparisons, combinations, and transformations.
Logic micro-operations are commonly performed in the arithmetic logic unit (ALU) of a processor.

Here are the key logic micro-operations:

1. AND:
The AND operation takes two binary inputs and produces an output that is 1 only when both
corresponding input bits are 1; otherwise, it produces a 0. It can be represented using the Boolean
expression: Output = A AND B.
A B Output
0 0 0
0 1 0
1 0 0
1 1 1

2. OR:
The OR operation takes two binary inputs and produces an output that is 1 when at least one of the
corresponding input bits is 1; otherwise, it produces a 0. It can be represented using the Boolean
expression: Output = A OR B.
A B Output
0 0 0
0 1 1
1 0 1
1 1 1

3. NOT:
The NOT operation, also known as inversion or complement, takes a single binary input and
produces an output that is the logical complement of the input value. If the input bit is 0, the output
will be 1, and vice versa. It can be represented using the Boolean expression: Output = NOT A.
NOT:
A Output
0 1
1 0
4. XOR:
The XOR (exclusive OR) operation takes two binary inputs and produces an output that is 1 only
when the corresponding input bits are different; otherwise, it produces a 0. It can be represented
using the Boolean expression: Output = A XOR B.

A B Output
0 0 0
0 1 1
1 0 1
1 1 0

5. NAND:
The NAND operation is the combination of the AND operation followed by the NOT operation. It
takes two binary inputs and produces an output that is the complement of the result of the AND
operation. It can be represented using the Boolean expression: Output = NOT (A AND B).
A B Output
0 0 1
0 1 1
1 0 1
1 1 0

6. NOR:
The NOR operation is the combination of the OR operation followed by the NOT operation. It takes
two binary inputs and produces an output that is the complement of the result of the OR operation.
It can be represented using the Boolean expression: Output = NOT (A OR B).
A B Output
0 0 1
0 1 0
1 0 0
1 1 0

Shift Micro Operations


Shift micro-operations are used to shift the bits of a binary number to the left or right. These
operations allow for the movement of bits within a binary value, enabling data manipulation,
multiplication or division by powers of 2, and data alignment. Shift micro-operations are commonly
performed in the arithmetic logic unit (ALU) of a processor.
There are two types of shift micro-operations:

Logical Shift:
Logical shifts move the bits in a binary number without considering the sign or the value of the
number. Logical shifts introduce 0s into the shifted positions.

a. Left Shift (Logical):


The left shift operation shifts the bits of a binary number to the left by a specified number of
positions. The vacant positions on the right are filled with 0s. This effectively multiplies the binary
number by 2 raised to the power of the shift count.

Example:
Original binary number: 101001
Left-shifted by 2 positions: 100100 (filled with 0s on the right)

b. Right Shift (Logical):


The right shift operation shifts the bits of a binary number to the right by a specified number of
positions. The vacant positions on the left are filled with 0s. This effectively divides the binary
number by 2 raised to the power of the shift count.

Example:
Original binary number: 101001
Right-shifted by 2 positions: 001010 (filled with 0s on the left)

Arithmetic Shift:
Arithmetic shifts preserve the sign of a signed binary number during shifting. These shifts maintain
the sign bit (the leftmost bit) while shifting the remaining bits.

a. Left Shift (Arithmetic):


The left shift operation shifts the bits of a binary number to the left by a specified number of
positions. The vacant positions on the right are filled with 0s. The sign bit remains unchanged.

Example:
Original binary number: 11011
Left-shifted by 2 positions: 01100 (filled with 0s on the right, sign bit remains unchanged)
Let's perform an arithmetic left shift by 2 positions on each of the given binary numbers:

 Arithmetic left shift on 100110:


Original binary number: 1 0 0 1 1 0
Left-shifted by 2 positions: 0 1 1 0 0 0
 Arithmetic left shift on 101010:
Original binary number: 1 0 1 0 1 0
Left-shifted by 2 positions: 1 0 1 0 1 0 0

 Arithmetic left shift on 110110:


Original binary number: 1 1 0 1 1 0
Left-shifted by 2 positions: 1 0 1 1 0 0

b. Right Shift (Arithmetic):


The right shift operation shifts the bits of a binary number to the right by a specified number of
positions. The vacant positions on the left are filled with copies of the sign bit. This preserves the
sign of the number.

Example:
Original binary number: 11011
Right-shifted by 2 positions: 11110 (filled with copies of the sign bit on the left)

 Arithmetic right shift on 100110: [by one position]


Original binary number: 1 0 0 1 1 0
Right-shifted by 1 position: 1 1 0 0 1 1

 Arithmetic right shift on 101010:


Original binary number: 1 0 1 0 1 0
Right-shifted by 1 position: 1 1 0 1 0 1

 Arithmetic right shift on 110110:


Original binary number: 1 1 0 1 1 0
Right-shifted by 1 position: 1 1 1 0 1 1

Shift micro-operations are used in various scenarios, including:


 Shifting bits for multiplication or division by powers of 2, which is a faster alternative to actual
multiplication or division operations.
 Data alignment, where bits are shifted to align data with specific memory locations or processing
requirements.
 Extracting or inserting specific bit patterns within a binary number.
 Implementing logical or arithmetic operations that involve shifting as a key component.
 These micro-operations provide flexibility in manipulating binary data and play a crucial role in
various computational tasks within digital systems.
The design of a basic computer
The design of a basic computer involves the arrangement and interconnection of various hardware
components to create a functional system. Here are the key components and their roles in the
design:

1. Central Processing Unit (CPU): The CPU is often considered the brain of the computer. It
performs the majority of the data processing and executes instructions. The CPU consists of an
Arithmetic Logic Unit (ALU) for performing mathematical and logical operations, and a Control
Unit (CU) that manages the execution of instructions.

2. Memory: Memory is used to store both instructions and data that the CPU needs to access
during operation. There are two main types of memory:
 Random Access Memory (RAM): This is the primary memory used by the computer to store
data and instructions that are currently being processed. RAM is volatile, meaning its
contents are lost when the computer is powered off.
 Read-Only Memory (ROM): This type of memory contains firmware or permanent
instructions that are essential for booting up the computer. ROM is non-volatile, so its
contents are retained even when the power is turned off.

3. Input/Output (I/O) Devices: These devices allow interaction between the computer and the
outside world. Common examples include keyboards, mice, displays, printers, and storage
devices like hard drives or solid-state drives. I/O devices enable users to input data into the
computer and receive output or results from it.

4. System Bus: The system bus provides a communication pathway for transferring data and
control signals between the CPU, memory, and I/O devices. It consists of address lines, data
lines, and control lines. The address lines specify the memory location or I/O device being
accessed, the data lines carry the actual data being transferred, and the control lines manage
the timing and coordination of the communication.

5. Instruction Set Architecture (ISA): The ISA defines the set of instructions that a computer can
execute and the way those instructions are encoded. It specifies the registers available, the data
types supported, and the addressing modes for accessing memory. The ISA serves as a contract
between the hardware and software, enabling different software programs to run on different
computer architectures.

6. Clock: The clock generates a steady stream of electronic pulses that synchronize the activities of
the computer's components. It ensures that instructions and data are processed at the correct
rate and allows for the orderly execution of operations.
The design of an accumulator unit
The design of an accumulator unit is an essential component of a computer's central processing unit
(CPU). The accumulator is a special-purpose register that plays a vital role in arithmetic and logical
operations. Here's some information about the design and function of an accumulator unit:

1. Purpose: The primary purpose of an accumulator unit is to store and manipulate data during
arithmetic and logical operations. It acts as a temporary storage location for intermediate results
and final outcomes of calculations performed by the CPU.

2. Architecture: The accumulator is typically implemented as a register within the CPU. It is directly
accessible by the arithmetic logic unit (ALU), which performs mathematical and logical
operations. The size of the accumulator register determines the range and precision of the data
that can be stored and processed.

3. Operation: The accumulator unit receives data from various sources within the CPU, such as
registers, memory, or input/output devices. The ALU performs computations on the data stored
in the accumulator based on the instructions provided by the control unit. The result of the
computation is then stored back into the accumulator or transferred to other registers or
memory locations as needed.

4. Arithmetic Operations: The accumulator unit supports basic arithmetic operations such as
addition, subtraction, multiplication, and division. These operations involve retrieving data from
the accumulator, performing the specified arithmetic operation using the ALU, and storing the
result back into the accumulator.

5. Logical Operations: In addition to arithmetic operations, the accumulator unit also supports
logical operations such as bitwise AND, OR, XOR, and logical shifts. These operations are
performed on the binary representation of the data stored in the accumulator.

6. Accumulator as an Operand: The accumulator can also serve as one of the operands in
arithmetic and logical operations. This feature enables efficient and concise programming by
allowing repeated operations on the accumulator without the need for explicitly specifying other
operands.
7. Program Control: The accumulator unit may also be involved in program control operations. For
example, it can store flags or status bits indicating the outcome of previous computations or
conditions met during program execution.

Instruction Codes
Instruction codes (also known as opcodes), are binary patterns that represent different instructions
in a computer's instruction set architecture (ISA). Each instruction code corresponds to a specific
operation that the computer can perform, such as arithmetic, logic, data transfer, or control
operations. Instruction codes are stored in memory and fetched by the CPU during the instruction
execution phase.

The instruction code typically consists of two parts:


The Opcode
(The opcode specifies the operation to be performed)

The Operand
(The operand specifies the data or memory location on which the operation should be applied)

For example, in the instruction "ADD R1, R2," the opcode would indicate the addition operation,
while the operands R1 and R2 would represent the registers involved.
EX-
Opcode Operand
ADD R1, R2,

Arithmetic Instructions:
 ADD: Performs addition of two operands.
 SUB: Subtracts one operand from another.
 MUL: Multiplies two operands.
 DIV: Divides one operand by another.
 INC: Increments the value of an operand.
 DEC: Decrements the value of an operand.

Logical Instructions:
 AND: Performs a bitwise AND operation between two operands.
 OR: Performs a bitwise OR operation between two operands.
 XOR: Performs a bitwise XOR (exclusive OR) operation between two operands.
 NOT: Performs a bitwise complement operation on an operand.

Data Transfer Instructions:


 MOV: Moves data from one location to another.
 LOAD: Loads data from memory into a register.
 STORE: Stores data from a register into memory.
 PUSH: Pushes data onto a stack.
 POP: Pops data from a stack.

Control Transfer Instructions:


 JMP: Jumps to a specified memory address or label.
 JZ: Jumps to a specified memory address or label if the zero flag is set.
 JNZ: Jumps to a specified memory address or label if the zero flag is not set.
 CALL: Calls a subroutine at a specified memory address.
 RET: Returns from a subroutine.

I/O Instructions:
 IN: Reads data from an input device into a register.
 OUT: Writes data from a register to an output device.
 READ: Reads data from a file or I/O device into memory.
 WRITE: Writes data from memory to a file or I/O device.

Computer Registers [high-speed memory locations that hold data & instructions]
Computer registers are high-speed memory locations within the CPU that hold data, instructions,
and intermediate results during processing. Registers are much faster to access than main memory,
allowing for efficient execution of instructions. Different types of registers serve specific purposes:

 Program Counter (PC): The program counter holds the address of the next instruction to be
fetched from memory.
 Instruction Register (IR): The instruction register stores the currently fetched instruction.
 Accumulator: The accumulator is a register that holds intermediate results during arithmetic and
logic operations.
 General-Purpose Registers (GPR): General-purpose registers are used to store data during
computation and serve various purposes as dictated by the programmer.
 Memory Address Register (MAR): The memory address register holds the address of the memory
location being accessed.
 Memory Data Register (MDR): The memory data register stores the data being read from or
written to memory.
Registers play a crucial role in the execution of instructions and the flow of data within the CPU.

Computer Instructions [commands or operations that the CPU can execute]


Computer instructions are the commands or operations that the CPU can execute. Instructions are
encoded as binary patterns, which are interpreted by the CPU to perform specific tasks. Instructions
can perform a range of operations, including arithmetic calculations, logic operations, data
movement, control flow alterations, and I/O operations.

Common types of instructions include:


 Arithmetic Instructions: Perform arithmetic operations like addition, subtraction, multiplication,
and division.
 Logical Instructions: Perform logical operations like AND, OR, XOR, and NOT.
Data Transfer Instructions: Move data between registers, memory, and I/O devices.
 Control Transfer Instructions: Change the sequence of instructions executed based on conditions,
such as jumps and branches.
 I/O Instructions: Perform input and output operations to communicate with external devices.
The ISA defines the specific instructions available in a computer system and the format in which they
are encoded.

Timing and Control [for accuracy and sequence of data]


Timing and control in a computer system involve coordinating the flow of instructions and data
within the CPU and other system components. It ensures that each instruction is executed in the
correct sequence and that data is transferred accurately.

The control unit generates control signals that synchronize the activities of different components.
These signals indicate operations such as instruction fetch, decode, execution, memory read/write,
I/O operations, and bus transfers. The timing of these signals determines when specific actions
occur within the computer system.

Timing and control are critical to ensure the proper execution of instructions and the efficient
functioning of the computer system as a whole.
Instruction Cycle
The instruction cycle, also known as the fetch-decode-execute-update cycle or the instruction
execution cycle, is the fundamental sequence of operations performed by the CPU to execute
instructions. It consists of the following steps:

 Fetch-1: The control unit fetches the next instruction from memory by accessing the address
stored in the program counter (PC). The instruction is then stored in the instruction register (IR).
 Decode-2: The control unit decodes the fetched instruction to determine the operation to be
performed and the operands involved.
 Execute-3: The CPU performs the necessary operation indicated by the instruction, using the ALU,
registers, and data paths. The result may be stored in registers, memory, or transferred to I/O
devices.
 Update-4: The program counter (PC) is updated to point to the address of the next instruction in
memory.
The instruction cycle repeats for each instruction in the program, allowing the CPU to execute a
sequence of instructions.

Memory Reference Instruction


Memory reference instructions are a type of instruction that involve accessing or manipulating data
stored in memory. These instructions typically include operations like loading data from memory to
registers or storing data from registers to memory.

Examples of memory reference instructions include:


 LOAD: Transfers data from memory to a register.
 STORE: Stores data from a register to memory.
 MOVE: Moves data from one memory location to another.
 LOAD IMMEDIATE: Loads a constant value directly into a register.
 PUSH/POP: Used for stack operations, pushing data onto the stack or popping data from the
stack.
Memory reference instructions play a vital role in data manipulation and storage within a computer
system.

Input/Output and Interrupts


Input/Output (I/O) operations involve transferring data between the computer system and external
devices such as keyboards, mice, printers, and disks. I/O instructions enable the CPU to
communicate with these devices. The control unit generates appropriate control signals to initiate
and manage I/O operations.

Interrupts are signals that interrupt the normal execution of a program and temporarily divert the
CPU's attention to handle a specific event. Interrupts can occur due to various reasons, such as I/O
completion, error conditions, or timer expiration. When an interrupt occurs, the CPU suspends its
current execution, saves the necessary information, and transfers control to the interrupt handler
routine. Interrupts allow for multitasking and handling of time-sensitive events.

Complete Computer Description


A complete computer system description encompasses the entire architecture and organization of a
computer system. It includes the design and integration of all components required for the system
to function.

A computer system typically consists of the following components:


 Central Processing Unit (CPU): Includes the ALU, control unit, registers, and data paths.
 Memory: Comprises different levels of memory hierarchy, such as cache, main memory, and
secondary storage.
 Input/Output (I/O) System: Involves devices, interfaces, controllers, and drivers for data transfer
between the computer and external devices.
 System Bus: Connects the CPU, memory, and I/O devices, allowing for the transfer of data and
control signals.
 Operating System: Manages the overall operation and resources of the computer system,
providing services and interfaces to application software.
The complete computer description includes the specifications of each component, their
interconnections, and their behaviors. It forms the basis for computer architecture design and
implementation.
Assignment
1. What is Register Transfer Language? Explain with examples.
2. Explain 5 Arithmetic Micro=-Operations in Computer Architecture with examples.
3. Name at least 5 Uses of Logic Micro-Operations in Computer Architecture.
4. How many types of Logical Micro-Operations are there in Computer Architecture?
5. Explain Shift Micro-Operations with example.
6. What is Design of a Basic Computer? Explain with Diagram.
7. What is Design of an Accumulator Unit in Computer Architecture?
8. Explain Instruction Codes with examples. Also, add the Uses of Instruction codes in answer.
9. What are the different types of computer registers?
10. What is difference between instruction codes and Computer Instructions? Name 10 differences.
11. Explain Timing and control in Computer Architecture.
12. What is an Instruction Cycle in Computer Architecture?
13. What is the Memory reference instruction? Explain with example.
14. What is Input/Output Interrupt in Computer Architecture?
15. Explain Complete Computer Description with Diagram.

This Assignment needs to be completed on 5th of July 2023. Feel free to use this PDF or any other
sources for your information and help.
All the best.

You might also like