Coa 2
Coa 2
Coa 2
As shown in the figure, there are two types of input to the combinational logic :
1. External inputs which are not controlled by the circuit.
2. Internal inputs, which are a function of a previous output state.
Secondary inputs are state variables produced by the storage elements, whereas
secondary outputs are excitations for the storage elements.
Types of Sequential Circuits:
There are two types of sequential circuits:
Type 1: Asynchronous sequential circuit: These circuits do not use a clock
signal but uses the pulses of the inputs. These circuits are faster than synchronous
sequential circuits because there is clock pulse and change their state immediately
when there is a change in the input signal. We use asynchronous sequential circuits
when speed of operation is important and independent of internal clock pulse.
But these circuits are more difficult to design and their output is uncertain.
Type2: Synchronous sequential circuit: These circuits uses clock signal and level
inputs (or pulsed) (with restrictions on pulse width and circuit propagation). The
output pulse is the same duration as the clock pulse for the clocked sequential
circuits. Since they wait for the next clock pulse to arrive to perform the next
operation, so these circuits are bit slower compared to asynchronous. Level output
changes state at the start of an input pulse and remains in that until the next input
or clock pulse.
Flip Flop
Flip flop is a sequential circuit which generally samples its inputs and changes its
outputs only at particular instants of time and not continuously. Flip flop is said to be
edge sensitive or edge triggered rather than being level triggered like latches.
S-R Flip Flop
It is basically S-R latch using NAND gates with an additional enable input. It is also
called as level triggered SR-FF. For this, circuit in output will take place if and only if the
enable input (E) is made active. In short this circuit will operate as an S-R latch if E = 1
but there is no change in the output if E = 0.
Block Diagram
Circuit Diagram
Truth Table
Operation
S.N. Condition Operation
1 S = R = 0 : No change
If S = R = 0 then output of NAND gates 3 and 4 are
forced to become 1.
Hence R' and S' both will be equal to 1. Since S' and R'
are the input of the basic S-R latch using NAND gates,
there will be no change in the state of outputs.
2 S = 0, R = 1, E = 1
Since S = 0, output of NAND-3 i.e. R' = 1 and E = 1 the
output of NAND-4 i.e. S' = 0.
Hence Qn+1 = 0 and Qn+1 bar = 1. This is reset condition.
3 S = 1, R = 0, E = 1
Output of NAND-3 i.e. R' = 0 and output of NAND-4 i.e.
S' = 1.
Hence output of S-R NAND latch is Qn+1 = 1 and Qn+1 bar
= 0. This is the reset condition.
4 S = 1, R = 1, E = 1
As S = 1, R = 1 and E = 1, the output of NAND gates 3
and 4 both are 0 i.e. S' = R' = 0.
Hence the Race condition will occur in the basic NAND
latch.
Truth Table
Operation
S.N. Condition Operation
1 J = K = 0 (No change)
When clock = 0, the slave becomes active and master is
inactive. But since the S and R inputs have not changed,
the slave outputs will also remain unchanged. Therefore
outputs will not change if J = K =0.
2 J = 0 and K = 1 (Reset)
Clock = 1 − Master active, slave inactive. Therefore
outputs of the master become Q1 = 0 and Q1 bar = 1.
That means S = 0 and R =1.
Clock = 0 − Slave active, master inactive. Therefore
outputs of the slave become Q = 0 and Q bar = 1.
Again clock = 1 − Master active, slave inactive. Therefore
even with the changed outputs Q = 0 and Q bar = 1 fed
back to master, its output will be Q1 = 0 and Q1 bar = 1.
That means S = 0 and R = 1.
Hence with clock = 0 and slave becoming active the
outputs of slave will remain Q = 0 and Q bar = 1. Thus
we get a stable output from the Master slave.
3 J = 1 and K = 0 (Set)
Clock = 1 − Master active, slave inactive. Therefore
outputs of the master become Q1 = 1 and Q1 bar = 0.
That means S = 1 and R =0.
Clock = 0 − Slave active, master inactive. Therefore
outputs of the slave become Q = 1 and Q bar = 0.
Again clock = 1 − then it can be shown that the outputs
of the slave are stabilized to Q = 1 and Q bar = 0.
4 J = K = 1 (Toggle)
Clock = 1 − Master active, slave inactive. Outputs of
master will toggle. So S and R also will be inverted.
Clock = 0 − Slave active, master inactive. Outputs of
slave will toggle.
These changed output are returned back to the master
inputs. But since clock = 0, the master is still inactive. So
it does not respond to these changed outputs. This
avoids the multiple toggling which leads to the race
around condition. The master slave flip flop will avoid
the race around condition.
Circuit Diagram
Truth Table
Operation
S.N. Condition Operation
1 E=0
Latch is disabled. Hence no change in output.
2 E = 1 and D = 0
If E = 1 and D = 0 then S = 0 and R = 1. Hence irrespective of
the present state, the next state is Qn+1 = 0 and Qn+1 bar = 1. This
is the reset condition.
3 E = 1 and D = 1
If E = 1 and D = 1, then S = 1 and R = 0. This will set the latch
and Qn+1 = 1 and Qn+1 bar = 0 irrespective of the present state.
Symbol Diagram
Block Diagram
Truth Table
Operation
S.N. Condition Operation
1 T = 0, J = K = 0 The output Q and Q bar won't change
Accumulator:
This is the most frequently used register used to store data taken from
memory. It is in different numbers in different microprocessors.
So, these are the different registers which are operating for a specific purpose.
System Bus in Computer Architecture
Computer Organization and Architecture
A bus is a set of electrical wires (lines) that connects the various hardware components
of a computer system.
It works as a communication pathway through which information flows from one
hardware component to the other hardware component.
A bus that connects major components (CPU, memory and I/O devices) of a computer system is called as
a System Bus.
1. Data Bus
2. Address Bus
3. Control Bus
1) Data Bus-
As the name suggests, data bus is used for transmitting the data / instruction from CPU
to memory/IO and vice-versa.
It is bi-directional.
The width of a data bus refers to the number of bits (electrical wires) that the bus can carry at a
time.
Each line carries 1 bit at a time. So, the number of lines in data bus determine how many bits can be
transferred parallely.
The width of data bus is an important parameter because it determines how much data can be
transmitted at one time.
The wider the bus width, faster would be the data flow on the data bus and thus better would be
the system performance.
Examples-
A 32-bit bus has thirty two (32) wires and thus can transmit 32 bits of data at a time.
A 64-bit bus has sixty four (64) wires and thus can transmit 64 bits of data at a time.
2) Control Bus-
As the name suggests, control bus is used to transfer the control and timing signals from
one component to the other component.
The CPU uses control bus to communicate with the devices that are connected to the
computer system.
The CPU transmits different types of control signals to the system components.
It is bi-directional.
Other control signals hold by control bus are interrupt, interrupt acknowledge, bus
request, bus grant and several others.
The type of action taking place on the system bus is indicated by these control signals.
Example-
When CPU wants to read or write data, it sends the memory read or memory write
control signal on the control bus to perform the memory read or write operation from the
main memory. Similarly, when the processor wants to read from an I/O device, it
generates the I/O read signal.
3) Address Bus-
As the name suggests, address bus is used to carry address from CPU to memory/IO
devices.
It is used to identify the particular location in memory.
It carries the source or destination address of data i.e. where to store or from where to
retrieve the data.
It is uni-directional.
Example-
When CPU wants to read or write data, it sends the memory read or memory write
control signal on the control bus to perform the memory read or write operation from the
main memory and the address of the memory location is sent on the address bus.
If CPU wants to read data stored at the memory location (address) 4, the CPU send the
value 4 in binary on the address bus.
Address Bus Width
The width of address bus determines the amount of physical memory addressable by the processor.
In other words, it determines the size of the memory that the computer can use.
The wider is the address bus, the more memory a computer will be able to use.
The addressing capacity of the system can be increased by adding more address lines.
Examples-
An address bus that consists of 16 wires can convey 2 16 (= 64K) different addresses.
An address bus that consists of 32 wires can convey 2 32 (= 4G) different addresses.
2. Double Bus Structure: In a double bus structure, one bus is used to fetch
instructions while other is used to fetch data, required for execution. It is to
overcome the bottleneck of a single bus structure.
Differences between Single Bus and Double Bus Structure :
S.
No. Single Bus Structure Double Bus Structure
One common bus is used for Two buses are used, one for communication
communication between from peripherals and the other for the
2. peripherals and processors. processor.
Instructions and data both are Instructions and data both are transferred in
4. transferred in same bus. different buses.
S.
No. Single Bus Structure Double Bus Structure
Advantages- Advantages-
Less expensive Better performance
11. Simplicity Improves Efficiency
Opcode
Specifies the operation to be performed by the instruction
Eg:ADD,SUB,MOV,etc.
It can be a value or register number on which the operation is performed.
Mandatory part of every instruction.
2. Address Field
Adress of operand/Operand Reference
Refers to a location (address) where the operand is stored.
The address may be a memory address or a register address.
The format of an instruction is usually depicted in a rectangular box symbolizing the bits of the
instruction as they appear in memory words or in a control register. The bits of the instruction are
divided into groups called fields.
The most common fields found in instruction formats are:
1 An operation code field that specifies the operation to be performed.
2. An address field that designates a memory address or a processor registers.
3. A mode field that specifies the way the operand or the effective address is determined. Other special
fields are sometimes employed under certain circumstances, as for example a field that gives the
number of shifts in a shift-type instruction.
A stack-based computer does not use the address field in the instruction. To
evaluate an expression first it is converted to reverse Polish Notation i.e. Postfix
Notation.
Expression: X = (A+B)*(C+D)
Postfixed : X = AB+CD+*
TOP means top of stack
M[X] is any memory location
PUSH A TOP = A
PUSH B TOP = B
PUSH C TOP = C
PUSH D TOP = D
Expression: X = (A+B)*(C+D)
AC is accumulator
M[] is any memory location
M[T] is temporary location
LOAD A AC = M[A]
ADD B AC = AC + M[B]
STORE T M[T] = AC
LOAD C AC = M[C]
ADD D AC = AC + M[D]
MUL T AC = AC * M[T]
STORE X M[X] = AC
MOV R2, C R2 = C
ADD R2, D R2 = R2 + D
MUL R1, R2 R1 = R1 * R2
MOV X, R1 M[X] = R1
Expression: X = (A+B)*(C+D)
R1, R2 are registers
M[] is any memory location
As display in the figure, the halt condition appears when the device receive turned off,
on the circumstance of unrecoverable errors, etc.
Fetch Cycle
The address instruction to be implemented is held at the program counter. The
processor fetches the instruction from the memory that is pointed by the PC.
Next, the PC is incremented to display the address of the next instruction. This
instruction is loaded onto the instruction register. The processor reads the instruction
and executes the important procedures.
Execute Cycle
The data transfer for implementation takes place in two methods are as follows −
And in computer the address of operand i.e., the address where operand is actually
found is known as
“Effective Address”.
Now, in addition to this, the two most prominent reason of why addressing modes
are so important are:
1. First, the way the operand data are chosen during program execution is
dependent on the addressing mode of the instruction.
2. Second, the address field(or fields) in a typical instruction format are
relatively small and sometimes we would like to be able to reference a large
range of locations, so here to achieve this objective i.e., to fit this large range
of location in address field, a variety of addressing techniques has been
employed. As they reduce the number of field in the addressing field of the
instruction.
Thus, Addressing Modes are very vital in Instruction Set Architecture(ISA).
Now, before discussing various addressing modes, I will give here some notations
that will use in throughout of this section.These are:
Although most Addressing modes need the address field of the instruction, but
implied and immediate addressing modes are the only addressing modes
that need no address field at all.Now we will discuss each of them in detail one
by one.
The instruction format for direct and indirect addressing mode is shown below:
It consists of 3-bit opcode, 12-bit address and a mode bit designated as( I).The
mode bit (I) is zero for Direct Address and 1 for Indirect Address. Now we will
discuss about each in detail one by one.
Direct Addressing Mode:
In this mode, the address field of instruction gives the memory address where on,
the operand is stored in memory.That is, in this mode, the address field of the
instruction gives the address where the “Effective Address” is stored in
memory. i.e., EA=(A)
Means, here, Control fetches the instruction from memory and then uses its
address part to access memory again to read Effective Address.
As an example: Consider the instruction:
ADD (A) Means adds the content of cell pointed to contents of A to
Accumulator.
In Register Addressing Mode, the operands are in registers that reside within the
CPU.That is, in this mode, instruction specifies a register in CPU, which contain
the operand.It is like Direct Addressing Mode, the only difference is that
the address field refers to a register instead of memory location.
i.e., EA=R
From above example, it is clear that, the instruction(MOV AL, [BX]) specifies a
register[BX], and in coding of register, we see that, when we move
register [BX], the register contain the address of operand(1000H) rather
than address itself.
5.Auto-increment and Auto-decrement Addressing Modes :
These are similar to Register indirect Addressing Mode except that the register is
incremented or decremented after(or before) its value is used to access
memory.
These modes are required because when the address stored in register refers to a
table of data in memory, then it is necessary to increment or decrement the
register after every access to table so that next value is accessed from
memory.Thus, these addressing modes are common requirements in computer.
Now, we will discuss each separately in detail.
Auto-increment Addressing Mode:
In this mode, the content of the Base Register is added to the direct address
part of the instruction to obtain the effective address.Means, in it the register
indirect address field point to the Base Register and to obtain EA, the
contents of Instruction Register, is added to direct address part of the
instruction.This is similar to indexed addressing mode except that the register is
now called as Base Register instead of Index Register.
That is, the EA=A+Base
It looks like as shown in fig. below:
Thus, the difference between Base and Index mode is in the way they are used
rather than the way they are computed.An Index Register is assumed to hold
an index number that is relative to the address part of the instruction.And a
Base Register is assumed to hold a base address and the direct address field
of instruction gives a displacement relative to this base address.
Thus, the Base register addressing mode is used in computer to facilitate the
relocation of programs in memory.
Means, when programs and data are moved from one segment of memory to
another, then Base address is changed, the displacement value of instruction
do not change.So, only the value of Base Register requires updation to
reflect the beginning of new memory segment.