Digital Computer Organization
Digital Computer Organization
of
Under Guidance of
An Alumni of IIT-Delhi
Unit I:-
Data representation Data Types and Number Systems, Binary Number System, Octal
& Hexa-Decimal Number System, Fixed Point Representation, 1's & 2's Complement, Binary,
Representation, Codes, ASCII, EBCDIC Codes, Gray Code, Excess-3 & BCD, Error Detection
Unit II:-
Boolean algebra and digital logic circuits -Logic Gates, AND, OR, NOT,, NOR,
NAND & XOR Gates and their Truth Tables, Boolean Algebra, Basic Definition and Properties,
Basic Boolean Law's, Demorgan's Theorem, Minimization Techniques, K Map Two, Three
and More Variables maps, Sum of Product & Product of Sums, Dont care conditions.
Unit III:-
Combination Circuits - Half adder & Full adder, Half Subtractor, Full Subtractor ,
Code Conversion, Multilevel NAND and NOR Circuits, Decimal adder, decoders, Multiplexers
and Demultiplexers.
Unit IV:-
Analysis of Clocked Sequential Circuits, State Reduction and Assignment, flip flop excitation
Unit V:-
Registers, Counters and the memory unit, Shift registers, Ripple counters and
Synchronous counters, Inter-register Transfer, Arithmetic Logic and Shift Micro Operation,
computer.
Digital Computer Organization
Decimal number systems its 10digits;0,1,2,3,4,5,6,7,8 and 9.These are called ARABIC
NUMERAL.
a a a ... a a . a a ... a
n n-1 n-2 1 0 -1 -2 -m
where
n n-1 n-2 1 0
-1 -2 -m
Base or Radix:-
Digital Computer Organization
number of difference digits which can occur in each position in the number systems.
Radix Conversion
ten or occasionally denary) has ten as its base. It is the numerical base most widely used by
modern civilizations.
Positional decimal systems include a zero and use symbols (called digits) for the ten values (0, 1,
2, 3, 4, 5, 6, 7, 8, and 9) to represent any number, no matter how large or how small. These digits
are often used with a decimal separator which indicates the start of a fractional part, and with a
symbol such as the plus sign + (for positive) or minus sign (for negative) adjacent to the
Digital Computer Organization
NOTES:-
Hexadecimal Base 16 H
You have been using the decimal (base 10) numbering system for so long that you often take it
for granted. When you see a number like "123", you don't think about the value 123. Instead, you
generate a mental image of how many items this value represents. In reality, however, the
1 * 100 + 2 * 10 + 3 * 1 =
100 + 20 + 3 =
Digital Computer Organization
123
Each digit appearing to the left of the decimal point represents a value between zero and nine
times power of ten represented by its position in the number. Digits appearing to the right of the
decimal point represent a value between zero and nine times an increasing negative power of ten.
725.194
science and electrical engineering. Transistors operate from the binary system, and transistors are
found in practically all electronic devices. A 0 means no current, and a 1 means to allow current.
With various transistors turning on and off, signals and electricity is sent to do various things
Computers and electronics work with bytes or eight digit binary numbers. Each byte has encoded
information that a computer is able to understand. Many bytes are stringed together to form
a binary number system, there are only two symbols used to represent numbers: 0 and 1. When
we count up from zero in binary, we run out of symbols much more frequently.
0, 1,
From here, there are no more symbols. We do not go to 2 because in binary, a 2 doesn't exist.
Decimal 0 1 2 3 4 5 6 7 8 9 10
Digital Computer Organization
Just like in decimal, we know that the more digits there are, the larger the number. However, in
binary, we use powers of two. In the binary number 1001101, we can create a chart to find out
26 25 24 23 22 21 20
1 0 0 1 1 0 1
64+0+0+8+4+0+1
87
Since this is base two, however, the numbers don't get quite as large as it does in decimal. Even
still, a binary number with 10 digits would be larger than 1000 in decimal.
Binary Fractions
When you are dealing with fractions you multiply the number by 2 then
hence (0.85)10=(0.110110)2
Double-Dabble Method
Divide-By-Two Method, is used to convert a large decimal number into its binary equivalent. In
this method, the decimal number is repeatedly divided by 2 and the reminder after each division
is used to indicate the co-efficient of the binary number to be formed. Notice that the binary
992 = 49 + reminder 1
492 = 24 + reminder 1
Digital Computer Organization
242 = 12 + reminder 0
122 = 6 + reminder 0
62 = 3 + reminder 0
32 = 1 + reminder 1
12 = 0 + reminder 1
that they used. When the base numbers is 10 that means the digits being used are from 0, 1, 2, 3,
4, 5,.....10. The number system called binary because they used only number 1 or 0. The octal
number system has a base of 8. It is customary to use the first eight digits:
0, 1, 2, 3, 4, 5, 6, 7
Number system that uses 8 digits 0,1,2,3,4,5,6 and 7 is called Ocatal Number systems.
Digital Computer Organization
Octal Odometer
odometer of a car except each display wheel contains only eight digits, number from 0 to 7.
When a wheel turns from 7 back to 0, the odometer sends carry to the next wheel.
0 000 000 0
1 000 001 1
2 000 010 2
3 000 011 3
4 000 100 4
5 000 101 5
6 000 110 6
7 000 111 7
8 001 000 10
9 001 001 11
10 001 010 12
11 001 011 13
12 001 100 14
13 001 101 15
14 001 110 16
15 000 111 17
Digital Computer Organization
Can you think of a way how to convert octal numbers to decimal numbers? In the octal number
systems each digit position corresponds to the power of 8 like shown below:
Suppose you want to change the octal 23 to decimal. You should proceed as follows:
2(81) + 3(80) = 16 + 3 = 19
Fractions
When you convert decimal fraction to octal fraction you multiply instead of divide.
Now suppose you want to convert decimal 0.23 into an octal fraction.
Read the number from top to bottom. This gives the octal fraction of 0.165
convert octal to binary in a binary number systems you change the octal number number direct to
When you convert from octal to binary you obtained three binary
number. Thus for conversion from binary to octal you have to reverse the process. You grouped
one that has three binary numbers. For example the binary number 1011.01101 can be converted
into
1 3. 3 2
As you can see above that you have to add 00 to the first binary to make it 3 binary in one group.
microprocessors and microcontroller. They are chosen than binary numbers due to their shorter
length than binary numbers. Hexadecimal numbers are easy to write and remember. You can
mentally convert hexadecimal numbers of a number systems into binary numbers whenever
possible. The hexadecimal numbers in a number systems have base 16. Even though any 16
Hexadecimal Digits
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
9 A F
hexadecimal number systems you have to reverse the process. Take 4 binary into one group then
E 8 D 6
Digital Computer Organization
convert to decimal number systems will take weight to a power of 16. The weight of the digits in
decimal.
= 63,718.2227
number systems conversion is done through hex dabble. Divide the number successively by 16.
sign and magnitude representation. In this scheme, the most significant bit is reserved to
represent the sign of the integer and the remaining bits used to represent its magnitude.
+127 = 01111111
- 127 = 11111111
Ones complement is found by inverting all bits with the exception of the sign bit. For twos
complement, we perform the same operation and in addition, 1 is added to the least significant
bit position.
1. Sign bit
2. Exponent (Abscissa)
To represent a real number using single precision 4 bytes are used, i.e. 4*8=32 bits.
However for the IEEE16 standard, the mantissa is composed of 24 bits as indicated in the below
table.
Mantissa 24
Exponent 8
Digital Computer Organization
Sign 1
Simple arithmetic indicates that it would take 33 bits to store a 4-byte single precision number
Although the mantissa is quoted as 24 bits only 23 bits are used. Normalization
allows us to discard the single 1 bit to the left of the radix point (i.e. binary point for base 2).
To illustrate, let us convert the decimal number 12 to binary and then normalize.
(12)10 = (1100)2
1.?????x2 and as a result the integer part does not have to be stored. The bits after the radix
Another alteration is made to the Real number representation. In this instance, the
Let us now look at a few examples of how Real numbers are represented.
Digital Computer Organization
1. +12 (decimal)
Sign = 0 (+ve)
Mantissa = .1
To represent a real number using single precision 8 bytes are used, i.e. 8*8=64 bits.
There are 2 exceptions to the rules for floating point numbers (whether single or double
precision)
2. The number infinity is stored as all ones in the exponent and all zeros in the
mantissa.
Binary Arithmetic
Addition
Subtraction
Binary Addition
also called as Binary Adder. Binary numbers are the numeric codes to represent the numbers. The
numeric codes are group of bits 0s and 1s 0 and 1 which are weighted by the specific values
based on their places. In digital circuits, binary arithmetic operations are important because the
digital circuits do not process decimal numbers; only works based on the binary numbers. The
below binary addition logic is used in this binary addition calculator to perform the addition
Digital Computer Organization
between binary numbers. The equivalent decimal addition also done by this binary adder for
(S)
1 0 + 0 0 0 0
2 0 + 1 0 1 1
3 1 + 0 0 1 1
4 1 + 1 1 0 10
0+0=0
0+1=1
1+0=1
For example,
0 0 0 1 1 0 1 0 = 26(base 10)
+ 0 0 0 0 1 1 0 0 = 12(base 10)
Digital Computer Organization
0 0 0 1 0 0 1 1 = 19(base 10)
+ 0 0 1 1 1 1 1 0 = 62(base 10)
Note: The rules of binary addition (without carries) are the same as the truths of the XOR gate.
Binary Subtraction
necessary to establish procedure for subtraction a large digit from a small digit. The only case in
which this occurs with binary numbers is when 1 is subtracted from 0.The reminder is 1, but it is
necessary to borrow 1 from the next column to the left. the rules of binary subtraction is given
below.
(A) (B)
1 0 - 0 0
2 0 - 1 0 (with a
borrow 1)
Digital Computer Organization
3 1 - 0 1
4 1 - 1 0
0-0=0
1-0=1
1-1=0
10-1=01
For example,
0 0 1 0 0 1 0 1 = 37(base 10)
- 0 0 0 1 0 0 0 1 = 17(base 10)
0 0 0 1 0 1 0 0 = 20(base 10)
0 0 1 1 0 10 1 1 = 51(base 10)
Digital Computer Organization
- 0 0 0 1 0 1 1 0 = 22(base 10)
0 0 0 1 1 1 0 1 = 29(base 10)
1s complement:-
1011----------------> 0100
110110-------------> 001001
1s complement Arithmetic:-
2) Proceed as in addition.
3) Disregard the carry and add 1 to the total (end around -carry)
Digital Computer Organization
Example:- Perform the subtractions using 1s complement addition of the given number.
Solution:-
+1
000101
2) Proceed as in addition.
3) Complement the result and place a negative sign in front of the result.
Excample:- Perform the subtractions using 1s complement addition of the given number
Digital Computer Organization
Solution:-
1101111
2s complement Subtraction:-
number
Solution:-
Digital Computer Organization
1100 1100
Example:- Perform the subtractions using 2s complement addition of the given number
Solution:-
1001 1001
2s complement Arithmetic
complement represented. There are two important ideas to notice in that arithmetic adding;
a) The MSB is the sign bit : 0 for a + sign and 1 for a sign.
b) The negative numbers shown in represents the 2s complement of the positive numbers.
17 1 0001 0001
Note:- Here -22 will be in its 2s complement form. Thus +22 (0001 0110) must be converted to
+ 29 +0001 1101
Note:- Here -47will be in its 2s complement form. Thus must be converted to -47 (1101
0001).
Logic Gates
Logic gates process signals which represent true or false. Normally the positive
supply voltage +Vs represents true and 0V represents false. Other terms which are used for the
true and false states are shown in the table on the right. It is best to be familiar with them all.
Gates are identified by their function: NOT, AND, NAND, OR, NOR, EX-OR and EX-NOR.
Digital Computer Organization
Capital letters are normally used to make it clear that the term refers to a logic gate.
Note that logic gates are not always required because simple logic functions can be performed
Logic states
1 0
HIGH LOW
OPERATIONS ON OFF
+Vs 0V
Inverter
The inverter (NOT circuit) performs a basic logic function called inversion or
complementation. The purpose of the inverter is to change one logic level (HIGH / LOW) to the
opposite logic level. In terms of bits, it changes a 1 to a 0 and vice versa. The standard logic
symbol for the inverter and a Venn diagram illustrating the relationship between the variables
and the logic gate operation, are shown in Figure 1-1 and Figure 1-2, respectively.
We generally express the logical operation of a gate with a truth table which lists all input
combinations and the corresponding outputs. The truth table for the NOT gate is shown in Table
Digital Computer Organization
1-1.
INPUT OUTPUT
0 1
1 0
Note: The total number of possible input combinations (N) is determined by the
mathematical formula:
(1-1)
The AND gate, which is composed of two or more inputs and a single
output, performs logical multiplication. The standard symbol for the AND gate is shown in
Figure 1-3 and its truth table listed in Table 1-2. The logical operation of the AND gate is such
that the output is HIGH (1) when all the inputs are HIGH, otherwise it is LOW (0). The Venn
diagram shown in Figure 1-4 provides an insight into the AND function. The highlighted area
A B
0 0 0
0 1 0
1 0 0
1 1 1
Digital Computer Organization
The OR gate
The OR gate, which is composed of two or more inputs and a single output,
performs logical addition. The standard symbol for the OR gate is shown in Figure 1-5 and its
truth table listed in Table 1-3. The logical operation of the OR gate is such that the output is
HIGH (1) when any of the inputs are HIGH, otherwise it is LOW (0). The Venn diagram shown
in Figure 1-6 provides an insight into the OR function. The highlighted area represents the
function X=A+B.
INPUT OUTPUT
A B
0 0 0
0 1 1
Digital Computer Organization
1 0 1
1 1 1
The NAND, which is composed of two or more inputs and a single output,
is a very popular logic element because it may be used as a universal function. That is, it may be
functions. The term NAND is formed by the concatenation NOT-AND and implies an AND
function with an inverted output. The standard symbol for the NAND gate is shown in Figure 1-7
and its truth table listed in Table 1-4. The logical operation of the NAND gate is such that the
output is LOW (0) only when all the inputs are HIGH (1).
INPUT OUTPUT
A B
0 0 1
0 1 1
1 0 1
1 1 0
The NOR gate, which is composed of two or more inputs and a single
output, also has a universal property. The term NOR is formed by the concatenation NOT-OR
and implies an OR function with an inverted output. The standard symbol for the NOR gate is
shown in Figure 1-7 and its truth table listed in Table 1-5. The logical operation of the NOR gate
is such that the output is HIGH (1) only when all the inputs are LOW.
INPUT OUTPUT
A B
0 0 1
0 1 0
1 0 0
1 1 0
These gates are usually formed from the combination of the other logic gates already
discussed.
However, because of their functional importance, these gates are treated as basic gates with their
own unique symbols. The truth tables for the XOR and XNOR gates, shown in Figure 1-8, are
listed in Table 1-6. The Exclusive-OR is an "inequality" function and the output is HIGH (1)
when the inputs are not equal to each other. Conversely, the Exclusive-NOR is an "equality"
Digital Computer Organization
function and the output is HIGH (0) when the inputs are equal to each other.
Figure 1-8 Standard logic symbols for: (a) XOR (b) XNOR
OUTPUT OUTPUT
A B
0 0 0 1
0 1 1 0
1 0 1 0
1 1 0 1
Table 1-6 Truth table for XOR and XNOR logic gates
Digital Computer Organization
contain several gates of the same type, for example four 2-input NAND gates or three 3-input
NAND gates. This can be wasteful if only a few gates are required unless they are all the same
type. To avoid using too many ICs you can reduce the number of gate inputs or substitute one
two (or more) inputs together. The diagram shows a 3-input AND gate operating as a 2-input
AND gate.
to just one input creates a NOT gate. The diagram shows this for a 2-input NAND gate.
Any gate can be built from NAND or NOR gates (Universal Gate)
gate, NAND or NOR gates can be combined to create any type of gate! This enables a circuit to
be built from just one type of gate, either NAND or NOR. For example an
Digital Computer Organization
AND gate is a NAND gate then a NOT gate (to undo the inverting function). Note that AND and
OR gates cannot be used to create other gates because they lack the inverting (NOT) function.
To change the type of gate, such as changing OR to AND, you must do three things:
For example an OR gate can be built from NOTed inputs fed into a NAND (AND + NOT) gate.
The table below shows the NAND gate equivalents of NOT, AND, OR and NOR gates:
NOT
AND
Digital Computer Organization
OR
NOR
we stated that the NAND and NOR were universal logic gates. Using DeMorgans theorem and
the Rules and laws of Boolean algebra proving this should be an easy task. Figure 1-11 shows
the equivalency between the basic logic gates and their NAND logic circuits counterpart.
Similarly, Figure 1-12 shows the equivalency between the basic logic gates and their NOR logic
circuits counterpart.
Boolean Algebra
Boolean Algebra: A mathematical system for formulating logical statements with symbols so
In short, Boolean algebra is the mathematics of digital systems. The basic rules for Boolean
0+0=0 0 .0 = 0
0+1=1 0 .1 = 0
1+0=1 1 .0 = 0
1+1=1 1 .1 = 1
Commutative Laws
expressed as
Digital Computer Organization
A+B=B+A
AB = BA
In summary, the order in which the variables are ORed or ANDed make no difference.
Associative Laws
A + (B + C) = (A + B) + C
A(BC) = (AB)C
In summary, ORing or ANDing a grouping of variables produces the same result regardless of
Distributive Law
A (B+C) = AB + AC
Digital Computer Organization
This law states that ORing several variables and ANDing the result is equivalent of ANDing the
single variable with each of the variables in the grouping, then ORing the result.
Boolean function
gates we form several useful rules that may be used in manipulating and simplifying Boolean
algebra expressions. Rules 1-9, as listed in Table 1-10, are the core precepts from which rules
10-12 are derived. Note that in each case, A, B, or C can either represent a single variable of a
combination of variables.
4
Digital Computer Organization
10
11
12
All these rules, in particular rules 1-9, are easily verified using truth tables.
Let us examine two methods by which we can prove the relationships of rules 10-12. First we
use the laws and rules of Boolean algebra. Second we employ the use of truth tables.
Digital Computer Organization
Method 1:
= A .1 rule 2
=A rule 4
Method 2:
A B AB A + AB
0 0 0 0
0 1 0 0
1 0 0 1
1 1 1 1
As the shaded columns are equal then the rule has be shown to be correct.
Similarly for Rule 12, we can apply the same two methods to prove the relationship.
Method 1:
= A + AC + BA + BC rule 7
= A (1 + C) + BA + BC distributive law
= A + BA + BC rule 4
= A (1 + B) + BC distributive law
= A.1 + BC rule 2
= A + BC rule 4
Method 2:
A B C A+B A+C (A + BC A + BC
B)(A+C)
0 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 1 1 1 1
1 0 0 1 1 1 0 1
1 0 1 1 1 1 0 1
1 1 0 1 1 1 0 1
Digital Computer Organization
1 1 1 1 1 1 1 1
Again, as the shaded columns are equal then the rule has be shown to be correct
Suppose A binary variable can have two possible states, namely 0 and 1. A Boolean
function is an expression formed with binary variables and logical operators, e.g.
X=AB+CD+AD. In essence a truth table is a list which defines a Boolean function. For example,
lets consider the truth table shown in Table 1-8. Note that the Function (X) is equal to 1 if A=0,
B=0, C=1; otherwise X=0. The algebraic expression representing this function is therefore
Input Output
A B C X
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
Digital Computer Organization
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 0
DE Morgans Theorems
following formulas:
Digital Computer Organization
Theorem1:- (1-2)
That is, the complement of the product is equivalent to the sum of the complements
Theorem2:- (1-3)
Similarly, the complement of the sum is equivalent to the product of the complements
providing alternative design to logic circuits. The objective of using these theorems in circuit
Canonical Form
true form (A) or its complement ( ). Second, recall that for n variables,
Then considering the AND gate, each of the N logic expressions formed is
digits 1 and 0 are taken to represent a given variable (e.g. A) and its
complemented (e.g. ), respectively. Also from Table 1-13 note that each
its true form (e.g. A), respectively. As shown in Table 1-13, a symbol (Sj)
number of the maxterm designated. Also observe that each maxterm is the
DeMorgans Theorem
Digital Computer Organization
0 0 0 P0 S0
0 0 1 P1 S1
0 1 0 P2 S2
0 1 1 P3 S3
1 0 0 P4 S4
1 0 1 P5 S5
1 1 0 P6 S6
1 1 1 P7 S7
In short,
minterms and maxterms may be used to define the two standard forms for
SUM OF PRODUCTS
function as read off the truth table to specify the input combinations when
that the output is high for the rows labelled 3, 5 and 6. The SOP expression
X = P3 + P5 + P6 or
Number A B C X
0 0 0 0 0
1 0 0 1 0
2 0 1 0 0
3 0 1 1 1
4 1 0 0 0
5 1 0 1 1
6 1 1 0 1
7 1 1 1 0
PRODUCT OF SUMS
logic function as read off the truth table to specify the input combinations
14. Observe that the output is low for the rows labelled 0, 1, 2, 4 and 7.
Digital Computer Organization
The POS expression for this circuit is thus given by any of the following:
2X = S0S1S2S4S7
Note:
Further examples:
Derive the SOP and POS expressions for the truth tables shown below:
Number
A B X
0 0 0 1
1 0 1 0
2 1 0 1
3 1 1 0
SOP:
X = P0 + P2 or
POS:
X = S1S3 or
Digital Computer Organization
Karnaugh Map
When used properly, the K map will produce the simplest SOP or POS
expression possible. Familiarity with the law and rules of Boolean algebra
mapping technique.
input variables. For a SOP expression each cell represents one particular
combination of the variables in product form. The table format is such that
there is a single variable change between any adjacent cells. This is the
variable are A and B then the K map illustrating the four (4) possible
assuming that our input variables are A, B and C the associated K Map is
computer.
expression using a K map, first identify all the input combinations that
map cell. Consequently, all other cells must contain zero (0). Second,
group the adjacent cells that contain 1 in a manner that maximises the size
of the groups but also minimises the total number of groups. All 1s in the
output must be included in a group even if the group is only one cell.
grouping is written with only the input variables that are common to the
Input Output
A B C X
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
is .
Let us now use the K map technique to simplify the SOP Boolean
table and K map are presented in Table 1-19 and Table 1-20, respectively.
Input Output
A B C X
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
Digital Computer Organization
1 0 1 1
1 1 0 0
1 1 1 1
is .
Suppressed Variables
complete set of variables in each of its terms. For example, the expression
suppressed variable.
Digital Computer Organization
must first expand out all of the shortened terms to include the missing
variables and its complement. To illustrate let us consider use our example
above:
and we may now use the truth table and the associated K map, as
Input Output
A B C X
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 0
Digital Computer Organization
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 1
From the three groupings shown in the K map we form the expression
to include all possible combinations of the input binary digits for the input
combinations will not occur due to the nature of the application. When the
input combinations are irrelevant or cannot occur, the output states are
in the Truth table and the K map are filled with an X and are referred to as
expression.
To illustrate let us consider the function specified by Table 1-23 and its
corresponding K map shown in Table 1-24. Note that the two groupings
Input Output
A B C X
0 0 0 1
Digital Computer Organization
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 X
1 1 0 X
1 1 1 X
Half Adder
Recall that the basic rules of binary addition are as indicated below in Table
2-9. A circuit known as the half-adder carries out these basic operations. The half-adder,
illustrated in Figure 2-1, accepts two binary digits and produces the sum and carry digits.
Digital Computer Organization
Addition Rules
0+0 0 0
0+1 0 1
1+0 0 1
1+1 1 0
Observe from Table 2-9 that we may derive logical expressions for the Sum (S) and carry output
(CO) bits. Namely, CO = AB, and . From these two expressions, the
Full Adder
circuit performs the arithmetic addition of three input bits. The noticeable difference between the
full- and the half-adder is the ability of the former to handle input carries (CI). The logical
symbol for the half-adder is shown in Figure 2-3 and the associated truth table in Table 2-10.
Input Output
A B CI CO S
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
Digital Computer Organization
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
By the very nature of the full adder we know that the two input bits must be added to the carry
input bit. Recall that for the half-adder the sum of A and B is the XOR of those two variables,
By examining Table 2-10 observe that the carry output (CO) is 1 when both the inputs to the
first and second XOR gates are 1. Consequently, . Note that the
complete logic circuit for the full adder is illustrated in Figure 2-5.
Digital Computer Organization
NB: An alternative design of this circuit may be found by forming the SOP expression for the
Figure 2-6 shows how two half-adders can be arranged to form a full adder.
Half subtractor
subtraction of two bits. It has two inputs, X (minuend) and Y (subtrahend) and two outputs D
Truth table
Digital Computer Organization
X Y D B
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
From the above table one can draw the Karnaugh map for "difference" and "borrow".
Full subtractor
As in the case of the addition using logic gates, a full subtractor is made by
combining two half-subtractors and an additional OR-gate. A full subtractor has the borrow in
capability (denoted as BORIN in the diagram below) and so allows cascading which results in
the possibility of multi-bit subtraction. The circuit diagram for a full subtractor is given below.
Digital Computer Organization
B = 1 If X<(Y+Z)
Truth table
X Y Z D B
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
Binary Adder
The use of one half-adder or one full-adder alone are great for adding up two
binary numbers with a length of one bit each, but what happens when the computer needs to add
up two binary numbers with a longer length? Well, there are several ways of doing this. The
fastest way by far is to use the Parallel Binary Adder. The parallel binary adder uses one half-
adder, along with one or more full adders. The number of total adders needed depends on the
length of the largest of the two binary numbers that are to be added. For example, if we were to
add up the binary numbers 1011 and 1, we would need four adders in total, because the length of
the larger number is four. Keeping this in mind, here is a demonstration of how a four-bit parallel
binary adder works, using 1101 and 1011 as the two numbers to add:
Just like when we add without the computer, in the parallel binary adder, the computer adds from
right to left. Here is a step by step list, showing you what happens in the parallel Binary Adder
In the first full-adder (going from right to left), the inputs of 1 and 0 plus the carry of 1 from
In the second full adder, the inputs of 0 and 1 plus the carry of 1 from the previous full-adder
3
Digital Computer Organization
In the third and final full adder, the inputs of 1 and 1 plus the carry of 1 from the previous
Since there are no more numbers to add up, and there is still a carry of 1, the carry becomes
MULTIPLEXER
input sources for transmission over a common shared line. To achieve this the MUX has several
data lines and a single output along with data-select inputs, which permit digital data on any one
of the inputs to be switched to the output line. The logic symbol for a 1-of-4 data
selector/multiplexer is shown in Figure 2-13, and its associated table listed in Table 2-14.
S1 S0
0 0 D0
0 1 D1
1 0 D2
1 1 D3
Note that if a binary zero appears on the data-select lines then data on input line D0 will appear
on the output. Thus, data output Y is equal to D0 if and only if S1=0 and S0=0
, respectively. Thus the total multiplexer logic expression, formed from ORing
terms is
Demultiplexer
operation to the MUX. That is, it functions as an electronic switch (/data distributor) to route an
incoming data signal to one of several outputs. Figure 2-15 shows the logic symbol for the 1-
line-to-4-line demultiplexer circuit and Table 2-15 list the associated Truth table. The
Address Outputs
Data S1 S0 Y0 Y1 Y2 Y3
D 0 0 D 0 0 0
Digital Computer Organization
D 0 1 0 D 0 0
D 1 0 0 0 D 0
D 1 1 0 0 0 D
Encoders
function of the decoder circuit. An encoder accepts an active level (i.e. 1) on one of its inputs
representing a digit (e.g. decimal or octal digit) and converts it to a coded output (e.g. binary of
BCD). The process of converting from familiar symbols or numbers to a coded format is called
encoding.
Recall that with BCD the ten decimal digits (0,1,,9) are
BCD encoder to have 10 inputs and 4 outputs. The logic symbol for this 10-line-to-4-line
decoder is presented in Figure 2-11 and the associated conversion table listed in Table 2-13 with
BCD Code
Decimal
Digit
A3 A2 A1 A0
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
Digital Computer Organization
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
A3 = 8 + 9
A2 = 4 + 5 + 6 + 7
A1 = 2 + 3 + 6 + 7
A0 = 1 + 3 + 5 + 7 + 9
Note that a connection for the decimal digit zero is not required as in this case the BCD outputs
Decoder
Decoders can detect a code and activate a single output to signal the presence of
that code. Decoders have many applications, from producing system alerts in alarm systems to
performing the task of driving multiple devices in microprocessor systems (e.g. memory).
combination has occurred. For example, if we wish to detect that 1011 occurs on the inputs of a
digital circuit we must design a decoder which only outputs 1 for this instance. Accordingly, a
4-input AND gate and an Inverter may be employed as illustrated in Figure 2-7.
Digital Computer Organization
(23=8) decoding logic gates are required. This type of decoder is called the 3-line-to-8-line
decoder because they are 3 inputs and 8 outputs. Let us consider the design of such a decoder
and assume that we require ACTIVE HIGH outputs. That is, for a given input combination the
decoder outputs 1. To illustrate lets consider Table 2-11 which list the decoding functions and
Outputs
D0 D1 D2 D3 D4 D5 D6 D7
0 0 0 0 1 0 0 0 0 0 0 0
1 0 0 1 0 1 0 0 0 0 0 0
2 0 1 0 0 0 1 0 0 0 0 0
3 0 1 1 0 0 0 1 0 0 0 0
Digital Computer Organization
4 1 0 0 0 0 0 0 1 0 0 0
5 1 0 1 0 0 0 0 0 1 0 0
6 1 1 0 0 0 0 0 0 0 1 0
7 1 1 1 0 0 0 0 0 0 0 1
Table 2-11 Decoding functions and truth tables for the 3-line-to-8-line decoder
Now, we can develop a decoder based on each logic function and implement the SOP logic
It is far more convenient to use the logic symbol for the3-line-to-8-line decoder as
illustrated in Figure 2-9 rather than repeating the complex internal circuitry each time.
Digital Computer Organization
decimal equivalent. The technique employed is very similar to the one used in developing the 3-
line-to-8-line decoder. Again assuming active high outputs are required, Table 2-12 lists the
Decimal
Digit
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
Digital Computer Organization
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
6 1 0 0 1
Now, we can develop a decoder based on each logic function and implement the SOP logic
Sequential Circuits
depends on the present inputs to the circuit. For sequential circuits, the output depends on the
sequence of inputs. In most sequential circuits, the inputs are sequenced by connecting one or
more of the outputs to the inputs of the circuit creating what is known as feedback. When
feedback is employed, the state of the circuit becomes time dependent. Figure 3-1 shows a block
Digital Computer Organization
diagram of a sequential circuit. Thus it becomes necessary to define previous, present and next
sates to completely describe and analyse sequential operation. We will explore these concepts
One important parameter to consider when analyzing sequential circuits is the time taken for the
output of the circuit to respond to a change in inputs, this is referred to as the propagation delay
(tp). In practice the output waveforms of a device a can be drawn to indicate the presence of tp,
however for many circuits this delay time is ignored to determine the basic logic operation of the
circuit.
FLIP-FLOP:
Flip flop is a BI stable device it can store single bit either 0 or 1. Flip flop has
two output, they are complement to each other. Today, the term flip-flop has come to mostly
denote non-transparent (clocked or edge-triggered) devices, while the simpler transparent ones
are often referred to as latches; however, as this distinction is quite new, the two words are
sometimes used interchangeably. A flip-flop is usually controlled by one or two control signals
and/or a gate or clock signal. The output often includes the complement as well as the normal
output. As flip-flops are implemented electronically, they require power and ground connections.
Digital Computer Organization
Clock Signal:
classified as raising (positive) edge clock signal and falling (negative) edge clock signal.
S-R and J-K Flip-Flop are raising edge triggered flip flop.
D, T and Master and Slave Flip-Flops are negative edge triggered flip flop
Set
Reset
No change
Toggle
Forbidden.
Flip flop has two output they are commonly named as and .
Set
Digital Computer Organization
Reset
No change
In which previous output does not change for the present input combination.
Toggle
In this condition flip flop produces the compliment output to the previous output.
Forbidden
Flip flop output must be complement to each other, if any condition does n't satisfy the above
Uses
A single flip-flop can be used to store one bit, or binary digit, of data.
Any one of the flip-flop type can be used to build any of the others.
Many logic synthesis tools will not use any other type than D flip-flop and D latch.
Level sensitive latches cause problems with Static Timing Analysis (STA) tools and
The data contained in several flip-flops may represent the state of a sequencer, the value
information.
One use is to build finite state machines from electronic logic. The flip-flops remember
the machine's previous state, and digital logic uses that state to calculate the next state.
Types of Flip-Flop:
S-R Flip-Flop
J-K Flip-Flop
J-K MS Flip-Flop
S-R Flip-Flop
The logic symbol for the S-R flip-flop is shown in Figure 3-5 and its operation
Figure 3-5 Logic Symbols for S-R flip-flop (rising edge triggered)
Digital Computer Organization
S R C Q Operation
0 1 Rising 0 1 Reset
edge
1 0 Rising 1 0 Set
edge
1 1 Rising ? ? Unstable
edge
Lets us now examine the output waveforms from the S-R flip-flop given the inputs shown in
The Set-Reset latch, commonly called S-R latch, has two inputs (S and R),
one true output (Q) and one complemented output ( ) as shown in Figure 3-2. The crossing of
the outputs is known as cross coupling and this circuit is said to employ cross-coupled feed back.
When the output at Q is HIGH (1) the latch is said to be in the set state, similarly when Q = 0 the
The logic symbol and the corresponding truth table for the S-R latch are presented in Figure 3-3
S R Q Operation
Digital Computer Organization
0 1 0 1 Reset
1 0 1 0 Set
1 1 ? ? Unstable
By introducing a time variable in the truth table, we may use the present input variable
combinations and the latch state, at time t (Qt), to determine and next state of the latch at time
t+1 (Qt+1). This type of table, referred to as the characteristic table, is illustrated in Table 3-2.
State
Comment
S R Qt Qt+1
0 0 0 0 Hold
0 0 1 1 Hold
0 1 0 0 Reset
Digital Computer Organization
0 1 1 0 Reset
1 0 0 1 Set
1 0 1 1 Set
1 1 0 Oscillating Invalid
1 1 1 Oscillating Invalid
Note that the circuit designer is responsible for ensuring that S=1 and R=1 do not occur at the
The S-R latch Circuit with active LOW inputs may be formed by replacing both of the NOR
The Gated S-R latch has some additional circuitry and an enable (EN) input. This type of
The D Flip-Flop
The logic symbol for the D flip-flop is shown in Figure 3-7 and its
operation outlined in Table 3-4. Notice that this flip-flop only has one input in addition to the
Digital Computer Organization
clock called the D-input. Note that whatever is on the D-input when the trigger occurs is output
at Q.
D C Q Operation
edge
edge
Notice that a D flip flop can be made from a S-R flip flop by ensuring that the S and R
J-K Flip-Flop
The J-K flip-flop is perhaps the most widely used type of flip-flop. Its
function is identical to that of the S-R flip flop in the SET, RESET and HOLD conditions of
operation. The difference is that the J-K flip-flop does not have any invalid states. The logic
symbol for the J-K flip-flop is presented in Figure 3-8 and its corresponding truth table is listed
in Table 3-5. Notice that for J=1 and K=1 the output toggles, that is to say that the output at time
Figure 3-8 Logic Symbols for J-K flip-flop (rising edge triggered)
J K C Q Operation
edge
0 1 Rising 0 1 Reset
edge
1 0 Rising 1 0 Set
edge
1 1 Rising Toggle
edge
Digital Computer Organization
Let us now consider the J-K flip-flop operation as illustrated by the waveform diagrams in
Recall that the flip-flops discussed so far are called synchronous because the transfer of the data
from the input to the output lines is synchronized with the triggering edge of the clock pulse.
Most integrated circuit flip-flops also have asynchronous inputs that affect state of the flip-flop
independent of the clock. These inputs are normally labeled preset (PRE) and clear (CLR) by
the manufacturers. An active level on the preset will SET (1) the flip-flop, similarly an active
level on the clear will RESET (0) the flip-flop. The logic symbol and the operation of a positive
edge triggered J-K flip-flop with active LOW preset ( ) and clear ( ) inputs are shown
in Figure 3-10 and Figure 3-11, respectively. Note that we assume that Q is HIGH initially
Pulse-Triggered Master-Slave
master-slave. These flip-flops are constructed from two separate flip-flops. The term pulse-
triggered means that data are entered into the flip-flop on the leading edge of the clock pulse, but
the output does not reflect the input state until the trailing edge of the clock pulse. This is due to
the master flip-flop being rising edge triggered and the slave flip-flop being falling edge
A major restriction of the pulse-triggered flip-flop is that the data inputs must not change
while the clock pulse is HIGH, because the flip-flop is sensitive to any changes of input
the initial inputs to the master and the outputs from the slave as indicated by the J-K master-slave
Recall the truth table for the J-K flip-flop, shown below in Table 3-4.
J K C Q Operation
0 1 Pulse 0 1 Reset
1 0 Pulse 1 0 Set
Digital Computer Organization
1 1 Pulse Toggle
Let us now examine the operation of the master-slave J-K flip-flop as shown in Figure 3-14.
T- Flip Flop
The T or "toggle" flip-flop changes its output on each clock edge, giving an
output which is half the frequency of the signal to the T input. It is useful for constructing binary
counters, frequency dividers, and general binary addition devices. It can be made from a J-K flip-
Symbol:
Digital Computer Organization
Connection Diagram:
When T is held high, the toggle flip-flop divides the clock frequency by two; that is, if clock
frequency is 4 MHz, the output frequency obtained from the flip-flop will be 2 MHz. This
"divide by" feature has application in various types of digital counters. A T flip-flop can also be
built using a JK flip-flop (J & K pins are connected together and act as T) or D flip-flop (T input
Excitation table
In electronics design, an excitation table shows the minimum inputs that are
necessary to generate a particular next state when the current state is known. They are similar to
truth tables and state tables, but rearrange the data so that the current state and next state are next
to each other on the left-hand side of the table, and the inputs needed to make that state change
Method to draw excitation table of flip-flop Draw the Q(t) and Q(t+1) for all possible cases
e.g., 00,01,10,11 Now, make the value of flip-flop such that on giving this value, we shall
receive the input as Q(t+1) as desired. e.g., in T flip flop, we want to change Q(t+1) to be
compliment of Q(t), make T=1, and if Q(t+1)=Q(t) , make T=0; thus we can get the T column as
below:
0 -> 0 0
Digital Computer Organization
0 -> 1 1
1 -> 0 1
1 -> 1 0
0 -> 0 0X
0 -> 1 10
1 -> 0 01
1 -> 1 X0
0 -> 0 0X
0 -> 1 1X
1 -> 0 X1
1 -> 1 X0
0 -> 0 0
0 -> 1 1
1 -> 0 0
1 -> 1 1
Race condition
A race condition or race hazard is a flaw in an electronic system or process whereby the output
or result of the process is unexpectedly and critically dependent on the sequence or timing of
other events. The term originates with the idea of two signals racing each other to influence the
output first.
Race conditions can occur in electronics systems, especially logic circuits, and in computer
Latch or flip-flop
In electronics, a flip-flop or latch is a circuit that has two stable states and can
be used to store state information. The circuit can be made to change state by signals applied to
one or more control inputs and will have one or two outputs. It is the basic storage element in
Digital Computer Organization
sequential logic. Flip-flops and latches are a fundamental building block of digital electronics
Flip-flops and latches are used as data storage elements. Such data storage can be used for
storage of state, and such a circuit is described as sequential logic. When used in a finite-state
machine, the output and next state depend not only on its current input, but also on its current
state (and hence, previous inputs). It can also be used for counting of pulses, and for
Introduction
digital counters. These devices generate binary numbers in a specified count sequence when
triggered by an incoming clock waveform. On each trigger, the counter advances to the next
number in the sequence. After reaching the final state in the sequence, the counter then recycles.
This section begins our study of designing an important class of clocked sequential logic circuits-
synchronous finite-state machines. Like all sequential circuits, a finite-state machine determines
its outputs and its next state from its current inputs and current state. A synchronous finite-state
Counter design is a good place for you to start understanding the design process for finite-state
machines. Counters are the simplest possible finite-state machines. They typically have only a
single input instructing them to count (often just the clock), and their outputs are nothing more
Three-Bit Up-Counter: State Transition Diagram Let's start with a simple counter, a 3-bit
binary up-counter. We begin the design process by understanding how the counter is to operate.
A convenient way to describe this is with a graphical specification called a state transition
diagram.
The state transition diagram is a graph with nodes and directed arcs. Each node represents a
unique state of the counter. A directed arc connects two nodes representing the present state and
the next state. If the counter is in the state at the tail of the arc, it will advance to the state at the
For the example design, we will dispense with a "count" input, and simply allow the counter to
Figure 7.14(a) shows a state transition diagram for the example. The nodes are labeled with the
counter state they represent, and the arcs connect the nodes in the sequence implemented by the
counter. We can describe the behavior of any finite-state machine with a state transition diagram,
although the diagrams are typically more complex than those for counters.
transition diagram is the state transition table, which shows the present state with the next state.
Each row corresponds to an arc in the state transition diagram. The state transition table for the
Each bit of the state is held by a single storage element. In this example, the counter proceeds
through eight states. To assign binary codes to these states, we need exactly three storage
elements. We have named the storage elements C, B, and A, from the highest- to the lowest-order
bit.
Three-Bit Up-Counter: Flip-Flop Choice The next step is to choose a kind of flip-flop to
implement the counter's storage elements. A close look at the state transition table suggests that
toggle flip-flops might be an attractive choice. In essence, A toggles on every clock pulse, B on
every second clock pulse, and C on every fourth clock pulse. This is a binary counter, after all.
The rightmost column of the state transition table of Figure 7.14(b) shows the inputs that must be
presented to toggle flip-flops to implement the desired state transitions. For example, consider
the state transition from 011 to 100. To get toggle flip-flops to implement these state changes, we
must set the toggle input of each flip-flop to one. The transition will take place on the appropriate
Three-Bit Up-Counter: Next-State Logic Our task now is to design combinational logic whose
input is the current state of the counter and whose output is the toggle inputs to the state flip-
flops. For this simple example, we can determine the logic just by examining the transition table.
Flip-flop A toggles on each state transition, B toggles whenever A is asserted, and C toggles
For more complex examples, we can view the transition table as a truth table that specifies the
flip-flops' inputs as a function of C, B, and A. We would use standard K-map methods to obtain
the reduced Boolean expressions. The K-maps for TC, TB, and TA are shown in Figure 7.15.
Step 1: From the written specification of the counter, we first draw a state transition
Step 2: We next derive the state transition table from the state -diagram, tabulating the
Digital Computer Organization
current state with the next state in the count sequence. Each state bit is implemented by
Step 3: We express each next-state bit as a combinational logic function of the current
state bits.
Step 4: We choose a flip-flop for implementation. Then we must "remap" the next-state
mapping derived in step 3 to obtain the desired behavior from the selected flip-flop.
Example Generalized Counter Design To see this four-step process in action, let's look at another
implementation of a counter. We will design a 3-bit counter that advances through the sequence
000, 010, 011, 101, 110, 000 and repeats. Not all of the possible combinations of the 3 bits
represent a valid state. The unused states, 001, 100, and 111, can be used as don't-care conditions
Step 1: Draw the state transition diagram. This is shown in Figure 7.18.
Step 2: Derive the state transition table. This is shown in Figure 7.19.
Step 3: Express each next-state bit as a combinational logic function of three current-state bits.
Step 4: Choose a flip-flop type for implementation. Since this is almost a straight binary
sequence, toggle flip-flops seem like a -reasonable choice. We use the toggle flip-flop excitation
table in Figure 7.22 to derive new next-state maps. Then we replace the desired state bits in the
K-map with the values needed to control the selected flip-flops to perform the necessary state
changes.
Figure 7.21 shows the toggle inputs needed to implement the state transitions of Figure 7.18.
For example, counter state 000 advances to 010, so the inputs to the toggle flip-flops should be 0
(don't toggle) for C, 1 (toggle) for B, and 0 (don't toggle) for A. Similarly, state 110 returns to
000. In this case, the control for C, B, A is toggle, toggle, don't toggle, respectively, or 110.
Reflecting this remapping of functions, the K-maps become those of Figure 7.23.
Figure 7.24 shows the component-level implementation, with its associated timing waveform in
Figure 7.25. To reduce wiring complexity, we simply label input and output nets rather than
draw them as wires. Two nets with the same label are understood to be connected. The proper
sequencing through the states 000, 010, 011, 101, 110, 000 should be clear from the waveform.
Digital Computer Organization
Counter Classification
comprehensive analysis it is important to specify the seven (7) characteristics listed below.
Asynchronous counters do
not have a common clock that controls all the flip-flop stages. The control clock is input to the
first stage, or the LSB stage of the counter. The clock for each stage subsequent is obtained from
Let us analyse the 2-bit counter shown in Figure 3-15 and its corresponding waveform diagram
in Figure 3-16. Note that we assume that Q0 and Q1 are LOW initially.
Digital Computer Organization
The counter has two flip-flops and two output bits, therefore it a two-stage counter.
The input clock does not trigger both flip-flops, therefore it is an asynchronous counter
The J and K inputs are tied together as kept HIGH, so they are considered to be toggle flip-
flips
The waveform analysis reveals that Q0 is the LSB and that its frequency is the input clock
frequency. Furthermore, Q1 is the MSB and that its frequency is the input clock frequency
The count sequence is 00,01,10,11 where the LSB is Q0. Thus it is a MOD-4 binary up
counter
The state transition diagram for this MOD-4 binary up counter is shown in figure 3-17.
Digital Computer Organization
Asynchronous counters are also know as ripple counters because the effect of the input clock
pulse which is first "felt" by the flip-flip at the first stage cannot immediately be "felt" by the
flip-flip at the second stage. This is due to the propagation delay. Thus, the effect of the input
clock "ripples" through the counter until it reaches the final stage.
Specify the operational requirements number of stages, modulus, trigger and characteristics.
Determine the necessary output to use as the clock input to the following stager. Either the
Synchronous digital counters have a common clock which results in all the flip-flops being
triggered simultaneously. Consequently, there are no cumulative delays that result because the
clock signal must ripple through the stages as in the asynchronous counters. Synchronous
Digital Computer Organization
counters can be designed to count up and down in numerical order. In addition, they may be used
synchronous counters is not dependent on the trigger characteristics of the flip-flops that
comprise the count stages. The count sequence is achieved by applying the required logic
we may employ a procedure similar to that used in the analysis of asynchronous counters. In
Verify that the counter is indeed synchronous (i.e. identify the common clock feature).
2. Determine the type of flip-flops and the input function for each stage. For reference,
recall the characteristic table which indicates the present state (Qt), the present inputs and
4. Analyse the counter using the characteristic table to determine the complete counter
sequence. This analysis concludes when the count sequence begins to repeat.
Binary Up Counters
number of bits/flip-flops in the counter. Each flip-flop is used to represent one bit. The flip-flop
in the lowest-order position is complemented/toggled with every clock pulse and a flip-flop in
any other position is complemented on the next clock pulse provided all the bits in the lower-
Take for example A4 A3 A2 A1 = 0011. On the next count, A4 A3 A2 A1 = 0100. A1, the lowest-
order bit, is always complemented. A2 is complemented because all the lower-order positions (A1
only in this case) are 1's. A3 is also complemented because all the lower-order positions, A2 and
A1 are 1's. But A4 is not complemented the lower-order positions, A3 A2 A1 = 011, do not give an
all 1 condition.
To implement a synchronous counter, we need a flip-flop for every bit and an AND gate for
every bit except the first and the last bit. The diagram below shows the implementation of a 4-bit
synchronous up-counter.
From the diagram above, we can see that although the counter is synchronous and is supposed to
change simultaneously, we have a propagation delay through the AND gates which add up to
give an overall propagation delay which is proportional to the number of bits of the counter. To
overcome this problem, we can feed the outputs from the flip-flops directly to a many-input
Digital Computer Organization
This method does overcome the problem of additive propagation delay but introduces some other
problem of its own. From the diagram above, we can see that the third flip-flop gets its J-K input
from the output of a 2-input AND gate and the fourth flip-flop gets its input from a 3-input AND
gate and so on. If we have a counter that counts to for example 16 bits, we will need to have:
...
...
...
This method obviously uses a lot more resources than the first method. Not only that, in the first
method, the output from each flip-flop is only used as an input to one AND gate. In the second
method, the output from each flip-flop is used as an input to all the higher-order bits. If we have
a 12-bit counter, the output of the first flip-flop will have to drive 10 gates (called fan-out. The
output from the flip-flop may not have the power to do this.
The "solution" to this is to use a compromise between the two methods. Say we have a 12-bit
Digital Computer Organization
counter, we can organize it into 3 groups of 4. Within each group of 4, we use the second method
and between the 3 groups, use the first method. This way, we only have an overall gate
propagation delay and a maximum fan-out of 3 instead of 10 using the first and second method
respectively.
There are many variations to the basic binary counter. The one described above is the binary up
counter (counts upwards). Besides the up counter, there is the binary down counter, the binary
up/down counter, binary-coded-decimal (BCD) counter etc. Any counter that counts in binary is
In a binary up counter, a particular bit, except for the first bit, toggles if all the lower-order bits
are 1's. The opposite is true for binary down counters. That is, a particular bit toggles if all the
lower-order bits are 0's and the first bit toggles on every pulse.
Taking an example, A4 A3 A2 A1 = 0100. On the next count, A4 A3 A2 A1 = 0011. A1, the lowest-
order bit, is always complemented. A2 is complemented because all the lower-order positions (A1
only in this case) are 0's. A3 is also complemented because all the lower-order positions, A2 and
A1 are 0's. But A4 is not complemented the lower-order positions, A3 A2 A1 = 011, do not give an
all 0 condition.
The implementation of a synchronous binary down counter is exactly the same as that of a
synchronous binary up counter except that the inverted output from each flip-flop is used. All the
The similarities between the implementation of a binary up counter and a binary down counter
leads to the possibility of a binary up/down counter, which is a binary up counter and a binary
down counter combined into one. Since the difference is only in which output of the flip-flop to
use, the normal output or the inverted one, we use two AND gates for each flip-flop to "choose"
From the diagram, we can see that COUNT-UP and COUNT-DOWN are used as control inputs
to determine whether the normal flip-flop outputs or the inverted ones are fed into the J-K inputs
of the following flip-flops. If neither is at logic level 1, the counter doesn't count and if both are
at logic level 1, all the bits of the counter toggle at every clock pulse. The OR gate allows either
of the two outputs which have been enabled to be fed into the next flip-flop. As with the binary
MOD-N/Divide-by-N Counters
Normal binary counter counts from 0 to 2N - 1, where N is the number od bits/flip-flops in the
counter. In some cases, we want it to count to numbers other than 2N - 1. This can be done by
allowing the counter to skip states that are normally part of the counting sequence. There are a
Digital Computer Organization
few methods of doing this. One of the most common methods is to use the CLEAR input on the
flip-flops.
In the example above, we have a MOD-6 counter. Without the NAND gate, it is a MOD-8
counter. Now, with the NAND gate, the output from the NAND gate is connected to the
asynchronous CLEAR inputs of each flip-flop. The inputs to the NAND gate are the outputs of
the B and C flip-flops. So, all the flip-flops will be cleared when B = C = 1 (1102 = 610 ) .When
the counter goes from state 101 to state 110, the NAND output will immediately clear the
counter to state 000. Once the flip-flops have been cleared, the B = C = 1 condition no longer
exists and the NAND output goes back to high. The counter will therefore count from 000 to
101, and for a very short period of time, be in state 110 before the counter is cleared. This state is
called the temporary state and the counter usually only remains in a temporary state for a few
nanoseconds. We can essentially say that the counter skips 110 and 111 so that it goes only six
different states; thus, it is a MOD-6 counter. We also have to note that the temporary state causes
a spike or glitch on the output waveform of B. This glitch is very narrow and will not normally
be a problem unless it is used to drive other circuitry outside the counter. The 111 state is the
unused state here. In a state machine with unused states, we need to make sure that the unused
states do not cause the system to hang, ie. no way to get out of the state. We don't have to worry
about this here because even if the system does go to the 111 state, it will go to state 000, a valid
Ring Counters
Ring counters are implemented using shift registers. It is essentially a circulating shift register
connected so that the last flip-flop shifts its value into the first flip-flop. There is usually only a
In the diagram above, assuming a starting state of Q3 = 1 and Q2 = Q1 = Q0 = 0. At the first pulse,
the 1 shifts from Q3 to Q2 and the counter is in the 0100 state. The next pulse produces the 0010
state and the third, 0001. At the fourth pulse, the 1 at Q0 is transferred back to Q3, resulting in the
1000 state, which is the initial state. Subsequent pulses will cause the sequence to repeat, hence
The ring counter above functions as a MOD-4 counter since it has four distinct states and each
flip-flop output waveform has a frequency equal to one-fourth of the clock frequency. A ring
counter can be constructed for any MOD number. A MOD-N ring counter will require N flip-
A ring counter requires more flip-flops than a binary counter for the same MOD number. For
example, a MOD-8 ring counter requires 8 flip-flops while a MOD-8 binary counter only
requires 3 (23 = 8). So if a ring counter is less efficient in the use of flip-flops than a binary
counter, why do we still need ring counters? One main reason is because ring counters are much
easier to decode. In fact, ring counters can be decoded without the use of logic gates. The
For the ring counter to operate properly, it must start with only one flip-flop in the 1 state and all
Digital Computer Organization
the others at 0. Since it is not possible to expect the counter to come up to this state when power
is first applied to the circuit, it is necessary to preset the counter to the required starting state
before the clock pulses are applied. One way to do this is to apply a pulse to the PRESET input
of one of the flip-flops and the CLEAR inputs of all the others. This will place a single 1 in the
ring counter.
Johnson/Twisted-Ring Counters
The Johnson counter, also known as the twisted-ring counter, is exactly the same as the ring
counter except that the inverted output of the last flip-flop is connected to the input of the first
flip-flop.
The Johnson counter works in the following way : Take the initial state of the counter to be 000.
On the first clock pulse, the inverse of the last flip-flop will be fed into the first flip-flop,
producing the state 100. On the second clock pulse, since the last flip-flop is still at level 0,
another 1 will be fed into the first flip-flop, giving the state 110. On the third clock pulse, the
state 111 is produced. On the fourth clock pulse, the inverse of the last flip-flop, now a 0, will be
shifted to the first flip-flop, giving the state 011. On the fifth and sixth clock pulse, using the
same reasoning, we will get the states 001 and 000, which is the initial state again. Hence, this
Johnson counter has six distinct states : 000, 100, 110, 111, 011 and 001, and the sequence is
repeated so long as there is input pulse. Thus this is a MOD-6 Johnson counter.
The MOD number of a Johnson counter is twice the number of flip-flops. In the example above,
Digital Computer Organization
three flip-flops were used to create the MOD-6 Johnson counter. So for a given MOD number, a
Johnson counter requires only half the number of flip-flops needed for a ring counter. However,
a Johnson counter requires decoding gates whereas a ring counter doesn't. As with the binary
counter, one logic gate (AND gate) is required to decode each state, but with the Johnson
counter, each gate requires only two inputs, regardless of the number of flip-flops in the counter.
Note that we are comparing with the binary counter using the speed up technique discussed
above. The reason for this is that for each state, two of the N flip-flops used will be in a unique
combination of states. In the example above, the combination Q2 = Q1 = 0 occurs only once in
the counting sequence, at the count of 0. The state 010 does not occur. Thus, an AND gate with
inputs (not Q2) and (not Q2) can be used to decode for this state. The same characteristic is
A Johnson counters represent a middle ground between ring counters and binary counters. A
Johnson counter requires fewer flip-flops than a ring counter but generally more than a binary
counter; it has more decoding circuitry than a ring counter but less than a binary counter. Thus, it
Registers
Each flip-flop is capable of storing one bit of information. An n-bit register has n flip-flop and is
The register is a type of sequential circuits and an important building black used in digital
A resister stores a sequence of 0s and 1s Register that are used to store information are known
as memory registers. If they are used to process information, they are called shift registers.
Shift Register
A register that is capable of shifting data one bit at a time is called a shift
register. The logical configuration of a serial shift register consists of a chain of flip-flops
connected in cascade, with the output of one flip-flop being connected to the input of its
neighbour. The operation of the shift register is synchronous; thus each flip-flop is connected to a
The basic data movements possible within a four-bit shift register is shown in Figure 3-22.
Figure 3-23 shows the circuit diagram for a four-bit serial in-serial out shift register implemented
using D flip-flops. Assuming that the register is initially clear, Figure 3-24 shown the waveform
Serial-in, serial-out shift registers delay data by one clock time for each stage. They will store a
bit of data for each register. A serial-in, serial-out shift register may be one to 64 bits in length,
Digital Computer Organization
Below is a single stage shift register receiving data which is not synchronized to the register
clock. The "data in" at the D pin of the type D FF (Flip-Flop) does not change levels when the
clock changes for low to high. We may want to synchronize the data to a system wide clock in a
The obvious point (as compared to the figure below) illustrated above is that whatever "data in"
is present at the D pin of a type D FF is transfered from D to output Q at clock time. Since our
example shift register uses positive edge sensitive storage elements, the output Q follows the D
input when the clock transitions from low to high as shown by the up arrows on the diagram
above. There is no doubt what logic level is present at clock time because the data is stable well
before and after the clock edge. This is seldom the case in multi-stage shift registers. But, this
was an easy example to start with. We are only concerned with the positive, low to high, clock
edge. The falling edge can be ignored. It is very easy to see Q follow D at clock time above.
Compare this to the diagram below where the "data in" appears to change with the positive clock
edge.
Since "data in" appears to changes at clock time t1 above, what does the type D FF see at clock
time? The short over simplified answer is that it sees the data that was present at D prior to the
clock. That is what is transfered to Q at clock time t1. The correct waveform is QC. At t1 Q goes
to a zero if it is not already zero. The D register does not see a one until time t2, at which time Q
goes high.
Digital Computer Organization
Since data, above, present at D is clocked to Q at clock time, and Q cannot change until the next
clock time, the D FF delays data by one clock period, provided that the data is already
synchronized to the clock. The QA waveform is the same as "data in" with a one clock period
delay.
A more detailed look at what the input of the type D Flip-Flop sees at clock time follows. Refer
to the figure below. Since "data in" appears to changes at clock time (above), we need further
information to determine what the D FF sees. If the "data in" is from another shift register stage,
another same type D FF, we can draw some conclusions based on data sheet information.
Manufacturers of digital logic make available information about their parts in data sheets,
formerly only available in a collection called a data book. Data books are still available; though,
The following data was extracted from the CD4006b data sheet for operation at 5VDC, which
[*]
tS=100ns
tH=60ns
Digital Computer Organization
tP=200-400ns typ/max
tS is the setup time, the time data must be present before clock time. In this case data must be
present at D 100ns prior to the clock. Furthermore, the data must be held for hold time tH=60ns
after clock time. These two conditions must be met to reliably clock data from D to Q of the
Flip-Flop.
There is no problem meeting the setup time of 60ns as the data at D has been there for the whole
previous clock period if it comes from another shift register stage. For example, at a clock
frequency of 1 Mhz, the clock period is 1000 s, plenty of time. Data will actually be present for
1000s prior to the clock, which is much greater than the minimum required tS of 60ns.
The hold time tH=60ns is met because D connected to Q of another stage cannot change any
faster than the propagation delay of the previous stage tP=200ns. Hold time is met as long as the
propagation delay of the previous D FF is greater than the hold time. Data at D driven by another
stage Q will not change any faster than 200ns for the CD4006b.
To summarize, output Q follows input D at nearly clock time if Flip-Flops are cascaded into a
Three type D Flip-Flops are cascaded Q to D and the clocks paralleled to form a three stage shift
register above.
Digital Computer Organization
Type JK FFs cascaded Q to J, Q' to K with clocks in parallel to yield an alternate form of the
A serial-in/serial-out shift register has a clock input, a data input, and a data output from the last
stage. In general, the other stage outputs are not available Otherwise, it would be a serial-in,
The waveforms below are applicable to either one of the preceding two versions of the serial-in,
serial-out shift register. The three pairs of arrows show that a three stage shift register
temporarily stores 3-bits of data and delays it by three clock periods from input to output.
At clock time t1 a "data in" of 0 is clocked from D to Q of all three stages. In particular, D of
stage A sees a logic 0, which is clocked to QA where it remains until time t2.
At clock time t2 a "data in" of 1 is clocked from D to QA. At stages B and C, a 0, fed from
At clock time t3 a "data in" of 0 is clocked from D to QA. QA goes low and stays low for the
remaining clocks due to "data in" being 0. QB goes high at t3 due to a 1 from the previous stage.
QC finally goes high at clock t4 due to the high fed to D from the previous stage QB. All earlier
Digital Computer Organization
stages have 0s shifted into them. And, after the next clock pulse at t5, all logic 1s will have been
The purpose of the parallel-in/ parallel-out shift register is to take in parallel data, shift it, then
output it as shown below. A universal shift register is a do-everything device in addition to the
Above we apply four bit of data to a parallel-in/ parallel-out shift register at DA DB DC DD. The
mode control, which may be multiple inputs, controls parallel loading vs shifting. The mode
control may also control the direction of shifting in some real devices. The data will be shifted
one bit position for each clock pulse. The shifted data is available at the outputs QA QB QC QD .
The "data in" and "data out" are provided for cascading of multiple stages. Though, above, we
can only cascade data for right shifting. We could accommodate cascading of left-shift data by
adding a pair of left pointing signals, "data in" and "data out", above.
The internal details of a right shifting parallel-in/ parallel-out shift register are shown below. The
tri-state buffers are not strictly necessary to the parallel-in/ parallel-out shift register, but are part
The 74LS395 so closely matches our concept of a hypothetical right shifting parallel-in/ parallel-
out shift register that we use an overly simplified version of the data sheet details above. See the
link to the full data sheet more more details, later in this chapter.
LD/SH' controls the AND-OR multiplexer at the data input to the FF's. If LD/SH'=1, the upper
four AND gates are enabled allowing application of parallel inputs DA DB DC DD to the four FF
data inputs. Note the inverter bubble at the clock input of the four FFs. This indicates that the
Digital Computer Organization
74LS395 clocks data on the negative going clock, which is the high to low transition. The four
going clock. In this "real part", OC' must be low if the data needs to be available at the actual
The previously loaded data may be shifted right by one bit position if LD/SH'=0 for the
succeeding negative going clock edges. Four clocks would shift the data entirely out of our 4-bit
shift register. The data would be lost unless our device was cascaded from QD' to SER of
another device.
. Then it is shifted one bit to the right. The incoming data is indicated by X, meaning the we do
no know what it is. If the input (SER) were grounded, for example, we would know what data
(0) was shifted in. Also shown, is right shifting by two positions, requiring two clocks.
The above figure serves as a reference for the hardware involved in right shifting of data. It is too
simple to even bother with this figure, except for comparison to more complex figures to follow.
Right shifting of data is provided above for reference to the previous right shifter.
Digital Computer Organization
If we need to shift left, the FFs need to be rewired. Compare to the previous right shifter. Also,
SI and SO have been reversed. SI shifts to QC. QC shifts to QB. QB shifts to QA. QA leaves on
the SO connection, where it could cascade to another shifter SI. This left shift sequence is
There is one problem with the "shift left" figure above. There is no market for it. Nobody
manufactures a shift-left part. A "real device" which shifts one direction can be wired externally
to shift the other direction. Or, should we say there is no left or right in the context of a device
which shifts in only one direction. However, there is a market for a device which will shift left or
right on command by a control line. Of course, left and right are valid in that context.
What we have above is a hypothetical shift register capable of shifting either direction under the
control of L'/R. It is setup with L'/R=1 to shift the normal direction, right. L'/R=1 enables the
multiplexer AND gates labeled R. This allows data to follow the path illustrated by the arrows,
when a clock is applied. The connection path is the same as the"too simple" "shift right" figure
above.
Data shifts in at SR, to QA, to QB, to QC, where it leaves at SR cascade. This pin could drive SR
With L'/R=0, the multiplexer AND gates labeled L are enabled, yielding a path, shown by the
arrows, the same as the above "shift left" figure. Data shifts in at SL, to QC, to QB, to QA, where
it leaves at SL cascade. This pin could drive SL of another device to the left.
The prime virtue of the above two figures illustrating the "shift left/ right register" is simplicity.
The operation of the left right control L'/R=0 is easy to follow. A commercial part needs the
parallel data loading implied by the section title. This appears in the figure below.
Now that we can shift both left and right via L'/R, let us add SH/LD', shift/ load, and the AND
gates labeled "load" to provide for parallel loading of data from inputs DA DB DC. When
SH/LD'=0, AND gates R and L are disabled, AND gates "load" are enabled to pass data DA DB
DC to the FF data inputs. the next clock CLK will clock the data to QA QB QC. As long as the
same data is present it will be re-loaded on succeeding clocks. However, data present for only
one clock will be lost from the outputs when it is no longer present on the data inputs. One
solution is to load the data on one clock, then proceed to shift on the next four clocks. This
problem is remedied in the 74ALS299 by the addition of another AND gate to the multiplexer.
If SH/LD' is changed to SH/LD'=1, the AND gates labeled "load" are disabled, allowing the
left/ right control L'/R to set the direction of shift on the L or R AND gates. Shifting is as in the
previous figures.
The only thing needed to produce a viable integrated device is to add the fourth AND gate to the
multiplexer as alluded for the 74ALS299. This is shown in the next section for that part.
Digital Computer Organization
A serial-in/parallel-out shift register is similar to the serial-in/ serial-out shift register in that it
shifts data into internal storage elements and shifts data out at the serial-out, data-out, pin. It is
different in that it makes all the internal stages available as outputs. Therefore, a serial-
in/parallel-out shift register converts data from serial format to parallel format. If four data bits
are shifted in by four clock pulses via a single wire at data-in, below, the data becomes available
The practical application of the serial-in/parallel-out shift register is to convert data from serial
format on a single wire to parallel format on multiple wires. Perhaps, we will illuminate four
The above details of the serial-in/parallel-out shift register are fairly simple. It looks like a serial-
in/ serial-out shift register with taps added to each stage output. Serial data shifts in at SI (Serial
Input). After a number of clocks equal to the number of stages, the first data bit in appears at SO
(QD) in the above figure. In general, there is no SO pin. The last stage (QD above) serves as SO
manufacturers bother to offer both types? Why not just offer the serial-in/parallel-out shift
register? They actually only offer the serial-in/parallel-out shift register, as long as it has no more
than 8-bits. Note that serial-in/ serial-out shift registers come in bigger than 8-bit lengths of 18 to
Digital Computer Organization
to 64-bits. It is not practical to offer a 64-bit serial-in/parallel-out shift register requiring that
many output pins. See waveforms below for above shift register.
The shift register has been cleared prior to any data by CLR', an active low signal, which clears
all type D Flip-Flops within the shift register. Note the serial data 1011 pattern presented at the
SI input. This data is synchronized with the clock CLK. This would be the case if it is being
shifted in from something like another shift register, for example, a parallel-in/ serial-out shift
register (not shown here). On the first clock at t1, the data 1 at SI is shifted from D to Q of the
first shift register stage. After t2 this first data bit is at QB. After t3 it is at QC. After t4 it is at QD.
Four clock pulses have shifted the first data bit all the way to the last stage QD. The second data
bit a 0 is at QC after the 4th clock. The third data bit a 1 is at QB. The fourth data bit another 1 is
at QA. Thus, the serial data input pattern 1011 is contained in (QD QC QB QA). It is now available
It will available on the four outputs from just after clock t4 to just before t5. This parallel data
must be used or stored between these two times, or it will be lost due to shifting out the QD stage
Ring counters
If the output of a shift register is fed back to the input. a ring counter results. The data pattern
contained within the shift register will recirculate as long as clock pulses are applied. For
example, the data pattern will repeat every four clock pulses in the figure below. However, we
must load a data pattern. All 0's or all 1's doesn't count. Is a continuous logic level from such a
Digital Computer Organization
condition useful?
We make provisions for loading data into the parallel-in/ serial-out shift register configured as a
ring counter below. Any random pattern may be loaded. The most generally useful pattern is a
single 1.
Loading binary 1000 into the ring counter, above, prior to shifting yields a viewable pattern. The
data pattern for a single stage repeats every four clock pulses in our 4-stage example. The
waveforms for all four stages look the same, except for the one clock time delay from one stage
The circuit above is a divide by 4 counter. Comparing the clock input to any one of the outputs,
shows a frequency ratio of 4:1. How may stages would we need for a divide by 10 ring counter?
An alternate method of initializing the ring counter to 1000 is shown above. The shift waveforms
are identical to those above, repeating every fourth clock pulse. The requirement for initialization
initialized at power-up since there is no way to predict what state flip-flops will power up in. In
theory, initialization should never be required again. In actual practice, the flip-flops could
eventually be corrupted by noise, destroying the data pattern. A "self correcting" counter, like a
The above binary synchronous counter needs only two stages, but requires decoder gates. The
ring counter had more stages, but was self decoding, saving the decode gates above. Another
disadvantage of the ring counter is that it is not "self starting". If we need the decoded outputs,
the ring counter looks attractive, in particular, if most of the logic is in a single shift register
package. If not, the conventional binary counter is less complex without the decoder.
The waveforms decoded from the synchronous binary counter are identical to the previous ring
Arithmetic Micro-operation
The arithmetic operations are used for modifying the data during the transfer by using basic
R3 <- R1 + R2
In the above example, the content of R1 is added to the content of R2 and the result is transferred
R1 <- R2 R3
In the above example, the content of R3 is subtracted from the content of R2 and the result will
The subtraction operation can also be accomplished by using compliment and addition operation.
R1 <- R2 + R3 + 1
In above example, the 1s compliment is represented by R3 and adding 1 to this content will
The increment and decrement operators are implemented by using plus-one and minus-one
Notation Meaning
R3.
to R3.
Add and shift micro-operations are used for implementing multiplication operator. Subtract and
shift micro-operators are used for implementing division operator. The CPU uses combination of
Transtutors.com is a one stop shop for all your need regarding the homework help and
assignment help. We are pioneer in providing homework help and assignment help for all
levels. Our team of experts thrive to provide only original and plagiarism free content for
The logic micro-operation is used for specifying binary operation for the strings of bits stored in
the register. Here, each bit of register is treated as a separate binary variable. In other words,
each individual bit of a register operates with corresponding register bit. Various logical
operation like OR, AND, NAND, and other logical operators. Special symbols are used for
Let us consider that there are two register R1 and R2, each with four bit. Let register R1 have
1010 and R2 have 1100. If OR micro-operation is performed on these registers and the result is
Digital Computer Organization
P <- R1 + R2
A 1 0 1 0
B 1 1 0 0
A AND B 1 0 0 0
The below table lists all micro-operation, that can be performed on any two registers. Here, we
OR F=A+B Bitwise OR
A.
B.
B)
A OR (Comp B) F=A+B
(Comp A) OR B F=A+B
Need help for your homework help and assignment help? Get all the resource need for
homework help and assignment help at Transtutors.com. With our team of experts we are
capable of providing homework help and assignment help for all levels.
Micro operations
1. Register transfer i.e. the transfer of binary information from one register to another.
Register transfer
Sometime it happens that we only need to transfer data from one register to another. The reason
could be the prolong storage or out of memory like situation. So in order to accomplish such
tasks we just transfer data from one register to another. Below given example will show you how
R1 R2
Arithmetic micro operations are the operations of manipulation, i.e. the data in such operations
are modified and then stored. The basic arithmetic micro operations are ADD, SUBTRACT,
MUTIPLY, and DIVISION. Examples are listed below to help you understand and also you may
contact our experts on Transtutors.com. Get your assignment help and homework help as per
R1 R1+R2
Here, the data in R1 and R2 is first added and then stored in R1.
R1 R1*R2
Here, the data in R1 and R2 is first multiplied and then stored in R1.
R1 R1-R2
R1 R1/R2
Digital Computer Organization
Shift micro operations are the operations in which the contents of the register can be shifted to
left or right. Shift micro operations are used for serial transfer of data. They can also be used in
lieu with arithmetic, logic and other data-processing operations. There are three types of shift
operations:
Logical shift
Circular shift
Arithmetic shift
Logical shift
Logical shift can be defined as the shift of the bits to the right or left serially. Let us suppose the
symbol for logical right shift as shr and for logical left shift as shl. The following example will
help you clear out in this. You may contact out experts for assignment
R1 shl R1
R2 shr R2
The bits are being transferred to 1-bit left in first one i.e. there is one bit shift in register R1, and
Circular shift
Circular shift also named as rotate shift circulates the bits among the ends of the register
without losing information. We can achieve this by connecting the output terminal to the input
terminal of the register. They also shifts only one bit at a single time. For example
R cir R
R cil R
The bits are being transferred to right and left in first and second case respectively in circular
fashion.
Digital Computer Organization
Instruction Code
We all know that without our instructions a computer can do nothing. Hence we need to instruct
1. The collection of bits that instruct the computer to perform a specific operation is called
an instruction code.
2. Operation part is the most basic part of an instruction code. The operation code of an
instruction is a group of bits that define such operations as add, subtract, multiply, shift
and complement.
3. The total number of operations available in the computer determines the number of bits
required for the operation code of an instruction. The operation code must consist of at
4. An 'operation' is a binary code, that instruct the computer to perform a specific operation.
The control unit gets the instruction from memory and interprets the operation code bits.
computer registers. For every operation code, the control issues a sequence of micro-
This operation should be performed on some data stored in processor registers or on the data
stored in the memory. Hence an instruction code must specify both the operation and the
registers or the memory words where the operands are to be found, as well as the registers or the
Memory words can be specified in instruction codes by their address. Processor registers can be
Digital Computer Organization
specified by assigning to the instruction another binary code of K bits that specifies one of 2K
registers. There are many variations for arranging the binary code of instructions. Each computer
has its own particular instruction code format called its Instruction Set.
Z: RD1 <- RA - RB
Hint: What does the Branch Control do when Z is 0 but the branch instruction requires Z be 1 in
One option would be to do the computation, but not write it to the destination register if Z is not
asserted. You'll probably need some logic that uses info from the instruction decoder to only
disable the register writeback when appropriate. (I haven't thought it through entirely, but...if for
some reason your architecture is such that you need to write something to the register file, you
might be able to do a "Write" that has no effect. e.g. If register R0 always returns 0, then it might
Digital Computer Organization
be the case that you could write anything to R0 and the result is just discarded. If so, your logic