Professional Documents
Culture Documents
Complete-Unit-01-Soft Copy of Notes - Computer Data Representations - CAO
Complete-Unit-01-Soft Copy of Notes - Computer Data Representations - CAO
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.
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)
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.
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
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.
Example:
Original binary number: 101001
Left-shifted by 2 positions: 100100 (filled with 0s on the right)
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.
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:
Example:
Original binary number: 11011
Right-shifted by 2 positions: 11110 (filled with copies of the sign bit on the left)
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 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.
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.
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.
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.
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.