coa mod 2 BTECH
coa mod 2 BTECH
Bus Transfer
In a digital computer, there are multiple registers, and data frequently needs
to be transferred between them. If each register were connected to every
other register with dedicated wires, the number of connections would be
excessive, leading to increased hardware complexity and cost.
To address this, a more efficient approach is used: the bus system.
What is a Bus?
A bus is a group of shared communication lines that multiple components
use to transfer binary information. Instead of having separate connections
between each register, a bus allows all registers to share a single data
pathway.
Each bit in a register is connected to a corresponding bus line, and control
signals determine which register is allowed to place data on the bus at a
given time.
Structure of a Bus System
A bus system consists of three main components:
1. Data Bus – Transfers actual data between components.
2. Control Bus – Carries control signals that specify read, write, or
transfer operations.
3. Address Bus – Holds the address of the memory location being
accessed (used for memory operations).
One way to construct a common bus system is by using multiplexers
(MUX). A multiplexer is a digital circuit that selects one input from multiple
sources and forwards it to the output.
In the context of a bus system, multiplexers control which register places its
data onto the bus at any given time.
Example of a 4-bit Bus System
Assume we have four registers (R1, R2, R3, and R4) each of 4 bits.
Each register’s first bit (bit 0) is connected to MUX 0.
Each register’s second bit (bit 1) is connected to MUX 1.
Each register’s third bit (bit 2) is connected to MUX 2.
Each register’s fourth bit (bit 3) is connected to MUX 3.
When a register is selected, its bits are transferred to the bus through the
multiplexers.
Working of the Bus Transfer System
A control unit generates control signals that activate the correct
multiplexers and registers.
The selected register places its data on the data bus.
The destination register then loads the data from the bus.
This ensures that data is transferred efficiently without requiring direct
connections between all registers.
Advantages of the Bus System
Reduces hardware complexity by minimizing the number of wires.
Efficiently transfers data between multiple registers.
Allows expansion without excessive rewiring.
Memory Transfer
Memory transfer refers to moving data between the CPU and memory.
There are two main types of memory operations:
1. Read Operation – Data is transferred from memory to a register.
Read: MBR←M
2. Write Operation – Data is transferred from a register to memory.
Write: M ← MBR
A computer system typically has multiple registers (such as R1, R2, R3,
R4), and these registers communicate with memory using buses. Here's how
it works:
1. Address Bus:
o The Address Bus is responsible for carrying the memory
addresses.
o One of the registers connected to the address bus (such as
AR) can supply the address to the memory unit.
2. Data Bus:
o The Data Bus is used for transferring data between the
memory unit and the registers.
o The data can come from the memory and be transferred to a
register or vice versa.
3. Decoder:
o The Decoder is responsible for selecting which register will
receive the data from memory or which register will supply
the data to memory.
o The decoder ensures that only one register receives the data
at a time to avoid conflicts.
The address bus connects four registers (R1, R2, R3, R4), and any
one of these registers can supply the address to the memory unit.
The memory unit sends data to the appropriate register through the
data bus. A decoder selects which register will receive the data.
The data bus also connects to the memory unit, allowing data to be
written from one of the registers to memory.
A⊕B(
Bit Position A B
F)
1st bit 1 1 0
2nd bit 0 1 1
3rd bit 1 0 1
4th bit 0 0 0
Thus, after performing the XOR operation:
F = 0110
The result of F ← A ⊕ B is 0110, which is the bit-by-bit exclusive-OR of
the two registers. This kind of operation is particularly useful in bit
manipulation tasks and making logical decisions, though they are rarely
used in scientific computations.
Logic and Shift Micro-Operations:
Logic and shift operations refer to the manipulation of individual bits or
groups of bits in a register. Some common logic operations include:
1. AND Operation (∧): A bitwise AND operation compares each bit of
two registers and outputs 1 if both bits are 1, otherwise it outputs 0.
2. OR Operation (∨): A bitwise OR operation compares each bit of two
registers and outputs 1 if either bit is 1, otherwise it outputs 0.
3. Exclusive-OR (⊕): As shown in the previous example, XOR outputs
1 if the bits are different, and 0 if they are the same.
4. NOT Operation (¬): A bitwise NOT operation inverts the bits,
turning 1 to 0 and 0 to 1.
5. Shift Operations: These operations move the bits of a register to the
left or right. For example, a left shift operation moves the bits to the
left by a specified number of positions, which is equivalent to
multiplying the value by 2.
2. Circular Shift:
o Description: In a circular shift, the bit shifted out of the
register is reintroduced at the opposite end. This means the
data circulates around the register.
o Circular Shift Left (rotate left): The leftmost bit is transferred
to the rightmost position.
o Circular Shift Right (rotate right): The rightmost bit is
transferred to the leftmost position.
Example:
o A = 1011 (before)
o A ← shl (circular) A
Result: A = 1101 (leftmost bit 1 is transferred to the
rightmost position)
o B = 1101 (before)
o B ← shr (circular) B
Result: B = 1110 (rightmost bit 1 is transferred to the
leftmost position)
3. Arithmetic Shift:
o Description: Arithmetic shifts are used with signed binary
numbers (usually in 2's complement form). The main
difference with logical shifts is that the leftmost bit (sign bit)
is preserved during shifts to maintain the correct sign.
o Arithmetic Shift Left (shl): This is similar to the logical shift
left, where the leftmost bit is discarded and 0 is added to the
rightmost position.
o Arithmetic Shift Right (shr): In this case, the leftmost bit
(sign bit) is preserved, meaning that 1 will be added to the
left if the number is negative (sign bit is 1), and 0 if the
number is positive.
Example:
o A = 1011 (signed 2's complement representation of -5)
o A ← shr A (arithmetic)
Result: A = 1101 (sign bit is preserved, negative
number remains negative)
o B = 0110 (signed 2's complement representation of +6)
o B ← shr B (arithmetic)
Result: B = 0011 (sign bit is preserved, positive
number remains positive)
Shift Operation and Timing:
Timing Variable Example for Shift Left:
o T1: A ← shl A
The contents of A are shifted left, and the new value
is stored in A.
The bit from the serial input is transferred to the
rightmost bit of A.
Timing Variable Example for Shift Right:
o T2: B ← shr B
The contents of B are shifted right, and the new value
is stored in B.
The bit from the serial input is transferred to the
leftmost bit of B.
Processor Organization
Processor as Data Path:
o The processor in a CPU is often referred to as the data path
because it forms the pathways for data transfers between the
various registers within the CPU.
Data Path Control:
o The data paths are controlled by gates that open specific
paths for data flow and close all other paths to prevent
interference.
Design Flexibility:
o A processor unit can be designed to meet the specific
requirements of an application, enabling customized data
paths for different tasks.
Formation of Data Paths:
o Data paths are formed using buses and other common lines,
which are shared communication channels for transferring
data between components.
Control Gates:
o The control gates that regulate the data paths are primarily
multiplexers and decoders. These components decide which
path the data will take based on control signals.
Multiplexers and Decoders:
o Multiplexers (MUX): Select which input line will be
connected to the output, based on control signals.
o Decoders: Help in selecting the right component (register,
memory, etc.) by interpreting the control signals.
Data Processing:
o The actual processing of information is carried out by a
common digital function (e.g., the ALU) which performs
operations like arithmetic or logic operations.
Selection Variables:
o The path for data to move through the processor is defined by
a set of common selection variables that dictate how data is
routed through the system. These variables help the processor
determine which registers or functional units should be used
for each operation.
Bus Organization
In a processor system with a bus organization, multiple registers are
connected to a shared set of buses and functional units. Here’s an
explanation of how it works, breaking down the process of performing
operations like R1 ← R2 + R3:
A. Registers and Multiplexers (MUX):
a. Each register is connected to two multiplexers (MUX) that
form two separate buses: bus A and bus B.
b. These multiplexers choose which register's data will be sent
to the respective bus (A or B). Each register has a selection
line that determines which register's value will be placed on
the bus.
B. Arithmetic Logic Unit (ALU):
a. The A and B buses are connected to the Arithmetic Logic
Unit (ALU). The ALU can perform operations (like addition,
subtraction, etc.) on the data that comes from these buses.
b. The operation to be performed in the ALU is determined by
the ALU function selector.
C. Shift Operations:
a. The processor may perform shift micro-operations using a
shifter. If no shift operation is needed, the data flows directly
from the ALU output to the S output bus.
D. Output Bus (S):
a. The result of the operation (whether from the ALU or shift
operation) goes through the output bus (S). This bus connects
the results to all the registers.
E. Register Selection:
a. To determine which register will receive the data from the
output bus, a decoder is used. The decoder activates the load
input of the selected register, allowing the transfer of the data
from the S bus into that register.
F. External Data Input:
a. One of the inputs of MUX A or MUX B can receive data
from an external source. This allows the processor to input
data from outside the CPU if needed.
G. Control Unit:
a. The control unit manages the entire process. It sends out
control signals to direct the flow of information in the
system. It sets the selection lines of the multiplexers, the
ALU function, the shifter, and the destination register
decoder.
H. Example: Performing R1 ← R2 + R3
I. MUX A Selection:
a. The MUX A selector will be set to choose R2 (the contents of
register R2) to place it on bus A.
II. MUX B Selection:
a. The MUX B selector will be set to choose R3 (the contents
of register R3) to place it on bus B.
III. ALU Operation:
a. The ALU function selector will instruct the ALU to perform
the addition (A + B) operation using the values from buses A
and B.
IV. Shift Selector:
a. Since no shift operation is required for this example, the shift
selector is set for direct transfer from the ALU output to the
output bus S (no shift).
V. Destination Register:
a. The decoder destination selector will activate the load input
of R1, which will receive the result from bus S. In this case,
R1 ← R2 + R3 will be executed.
Scratchpad Memory
Two-Port Memory:
Some processors use 2-port memory to avoid delays when reading two
source registers. This type of memory has two separate address lines that
allow two memory locations to be accessed simultaneously, improving the
speed of read operations.
Accumulator Register
Primary Function:
1. T1: A ← 0
o This step clears the accumulator (sets it to zero) before
starting the addition.
2. T2: A ← A + R1
o The contents of register R1 are added to the accumulator (A).
Now, A holds the value of A + R1.
3. T3: A ← A + R2
o The contents of register R2 are added to A. The accumulator
now holds the sum of A + R1 + R2.
Result Usage:
Status Registers
A status register is a special-purpose register that holds flag bits, which are
used to indicate the result of an arithmetic or logical operation performed in
the ALU (Arithmetic Logic Unit). These bits, often referred to as condition-
code bits or flag bits, help determine the relative magnitude of two numbers
and provide information about the operation's result.
1. C (Carry):
o Set if the ALU generates an output carry (i.e., if there is a
carry out of the most significant bit during an addition
operation).
2. S (Sign):
o Set to 1 if the highest order bit (most significant bit) of the
result is 1, indicating a negative number in a signed
operation.
3. Z (Zero):
o Set to 1 if the ALU output is all 0s (i.e., the result of the
operation is zero).
4. V (Overflow):
o Set if the exclusive-OR of the carry bits C8 and C9 is 1,
indicating an overflow condition when the numbers are in
signed 2's complement representation.
o For example, for an 8-bit ALU, V is set if the result is greater
than 127 or less than -128.
The status bits can be used to understand the relationship between two
values (A and B) after an operation. Here's how each flag bit is used:
C (Carry):
o C = 1: A ≥ B (A is greater than or equal to B).
o C = 0: A < B (A is less than B).
Z (Zero):
o Z = 1: A = B (The result of A - B is zero, so A and B are
equal).
o Z = 0: A ≠ B (A is not equal to B).
S (Sign):
o S = 1: The result is negative (the most significant bit is 1).
o S = 0: The result is positive (the most significant bit is 0).
V (Overflow):
o V = 1: Overflow condition for signed 2's complement
numbers, indicating that the result is out of the representable
range (greater than 127 or less than -128 in an 8-bit system).
o V = 0: No overflow condition.
Functions of ALU
Selection of Operations
The ALU has a set of selection lines that determine which operation
will be performed.
These selection lines are decoded internally, allowing the ALU to
execute up to 2ᵏ operations, where k is the number of selection lines.
By integrating both arithmetic and logic functions into a single unit, the
ALU enables a processor to execute a wide range of computations
efficiently.
The number of bits in the parallel adder determines how many bits
can be processed simultaneously.
The input A is fed directly into the parallel adder.
The input B is modified based on the required arithmetic operation.
The function table for the arithmetic circuit is given below.
The circuit consists of four logic gates: AND, OR, NOT, and XOR.
The multiplexer selects one of these operations based on the
selection variables.
For an n-bit logic unit, the circuit is repeated n times to process all
bits simultaneously.
The arithmetic unit (parallel adder) and logic unit (logic circuit) can
be merged into a single ALU.
The selection variable S2 is used to choose between the two:
o S2 = 0 → Selects arithmetic operation.
o S2 = 1 → Selects logic operation.
Optimizing the ALU Design
F=X⊕Y⊕Cin
F=X⊕Y
The ALU is designed using three selection variables (S2, S1, S0):
This final step is not always straightforward and often requires innovative
thinking.
Each bit position in the ALU consists of a full-adder circuit, where the
inputs are controlled based on the selection variables.
The Boolean expressions defining the ALU’s input signals at each bit
position are:
For S2 = 1, the ALU operates in logic mode, and for specific values of S1,
S0, we get:
The first two stages of the ALU are illustrated in the block diagram
(which can be extended for more stages).
The full-adder circuits are controlled by the selection variables,
allowing seamless switching between arithmetic and logic operations
The function table for the Arithmetic and Logic Unit is shown below
combinational logic shifter is a circuit that transfers data from the ALU to
the output bus while also providing shifting operations. It eliminates the
need for sequential clock pulses, making shifting operations faster and more
efficient compared to using shift registers.
The shifter can operate in four different modes, depending on the control
signals:
Instead of using a shift register, which requires multiple clock pulses for
loading and shifting data, a combinational shifter can be built using
multiplexers (MUX). This design:
Each bit of the data is passed through a multiplexer, which selects one of the
four possible operations based on the values of H1 and H0.
Processor Unit
Design Of Accumulator
IC Design Considerations