Unit - I 1.0) Introduction: Digital Logic and Computer Organization
Unit - I 1.0) Introduction: Digital Logic and Computer Organization
Unit - I 1.0) Introduction: Digital Logic and Computer Organization
0) Introduction
Inside a computer system, data is stored in a format that cannot be easily read by human beings. This is the reason why input and output (I/O) interfaces are required. Every computer stores numbers, letters and other special characters in a coded form. Before going into the details of these codes, it is essential to have a basic understanding of the number system. It also introduces some of the commonly used number systems by computer professionals and the relationship between them. This chapter deals with the basic fundamentals of number system, computer arithmetic and binary Codes. Data in a computer is stored in a series of bits which are often interpreted in blocks known as bytes [8 bits] or words. The ALU (Arithmetic and Logic Unit) performs arithmetic operations on data and the control unit needs to decode instructions. Both of these functions are performed by logic circuits. The second part of this chapter deals with the digital logic, the Boolean algebra and the logical gates.
1.1) Objectives
This chapter presents the various binary systems suitable for representing information in digital systems. The binary number system is explained and binary codes are illustrated. Examples are given for addition and subtraction of signed binary numbers and decimal numbers in BCD. In this Chapter you will learn about Introduction Number Systems Decimal Number System Binary Number System Octal Number System Hexadecimal Number System Number System Conversions Representation of Negative Numbers Binary Coded Decimal and Gray Code Boolean Algebra Logic Gates Half Adder Full Adder Subtractors Karnaugh Maps (K-Maps) The Flip Flop
Page1
1.2) Content
1.2.1 Number Systems Number systems are basically of two types: non-positional and positional. Non-Positional Number Systems In early days, human beings counted on fingers. When ten fingers were not adequate, stones, pebbles or sticks were used to indicate values. This method of counting uses an additive approach or the non-positional number system. In this system, symbols such as I for 1, II for 2, III for 3, IIII for 4, IIIII for 5, etc are used. Each symbol represents the same value regardless of its position in the number and the symbols are simply added to find out the value of a particular number. Since it is very difficult to perform arithmetic with such a number system, positional number systems were developed as the centuries passed. Positional Number Systems In a positional number system, there are only a few symbols called digits and these symbols represent different values depending on the position they occupy in the number. The value of each digit in such a number is determined by three considerations. 1. 2. 3. the digit itself; the position of the digit in the number; and the base of the number system (where base is defined as the total number of digits available in the number system).
The number system that is used in our day-to-day life is called the Decimal number system. In this system, the base is equal to 10 because there are altogether ten symbols or digits (0,1,2,3,4,5,6,7,8,9) used in this system. In the decimal system, the successive positions to the left of the decimal point represent units, tens, hundreds, thousands, etc. It may also be observed that the same digit signifies different values depending upon the position it occupies in the number. For example, In 258610 In 256810 In 265810 In 625810 the digit 6 signifies 6 the digit 6 signifies 6 the digit 6 signifies 6 the digit 6 signifies 6 100 = 6 101 = 60 102 = 600 103 = 6000
Page2
In order to be specific about which system is referred to, it is common practice to indicate the base as a subscript. Thus the numbers are represented as: 101012 = 2110 The common abbreviation bit often refers to Binary digit. Thus, a bit in computer technology means either a 0 or a 1. A binary number consisting of n bits is called an n-bit number. Table 1.1 lists all the 3-bit numbers along with their decimal equivalent. Remember that there are only two digits, 0 and 1, in the binary system and hence the binary equivalent of the decimal number 2 has to be stated as 10 (read as one,zero). Page3
000 0 001 1 Table 1.1: 3-bit010 Numbers With their Decimal Values 2 011 3 Octal Number System 100 4 In the octal number system the base is 8. So in this system, there are only eight 101 5 symbols or digits: 0,1,2,3,4,5,6 110 7 (8 and 9 do not exist in this system). Here, the and 6 largest single digit is 7 (one less than the base). 7Again, each position in an octal number 111 represents a power of the base (8). Thus, the decimal equivalent of the octal number 2057 (written as 20578) is : (2 83)+ (0 82) + (5 81)+ (7 80) or 1024 + 0 + 40 + 7 or 1071 Thus, 20578 = 107110. Observe that since there are only 8 digits in the octal number system, so 3 bits (23 =8) are sufficient to represent any octal number in binary. Hexadecimal Number System The hexadecimal number system is one with a base of 16. The base of 16 suggests choices of 16 single-character digits or symbols. The first 10 digits are the digits of a decimal system 0,1,2,3,4,5,6,7,8 and 9. The remaining six digits are denoted by A,B,C,D,E and F representing the decimal values of 10,11,12,13,14 and 15 respectively. In the hexadecimal number system, therefore, the letters A through F are number digits. The number A has a decimal equivalent value of 10, B has a value of 11 and so on. Thus, the largest single digit is F or 15 (one less than the base). Again, each position in a hexadecimal system represents a power of the base (16). Thus, the decimal equivalent of the hexadecimal number 1AF is 431. (1 162) + (A 161) + (F 160) or or (1 256)+(10 16)+(15 1) 256 + 160 + 15
Page4
Thus, 1AF16 = 43110 Observe that since there are only 16 digits in the hexadecimal number system, 4 bits (2 = 16) are sufficient to represent any hexadecimal number in binary.
4
1.2.2 Number System Conversions Numbers expressed in decimal are much more meaningful than are values expressed in any other number system. This is mainly because of the fact that decimal numbers are used in day-to-day life. Any number value in one number system can be represented in any other number system. Because the input and the final output values are to be in decimal, computer professionals are often required to convert numbers in other number systems to decimal and vice versa. There are many methods or techniques that can be used to convert numbers from one base to another. Converting to Decimal from another base The following three steps are used to convert to a base 10 value from any other number system: Step 1: Determine the column (Positional) value of each digit (this depends on the position of the digits and the base of the number system). Step 2: Multiply the obtained column values (In Step 1) with the digits in the corresponding columns. Step 3: Sum the products calculated in Step 2. The total is the equivalent value in decimal. Example 1.1 110012 = ?10 Solution: Step 1: Determine column values Column Number (from right) 1 2 3 4 5 Column Value 20 = 1 21 = 2 22 = 4 23 = 8 24 =16
Page5
Page6
As mentioned in Steps 2 & 4, the remainders have to be arranged in the reverse order so that the first remainder becomes the Least Significant Digit (LSD) and the last remainder becomes the Most Significant Digit (MSD). Hence 2510 = 110012 Example 1.5 4210 = ?2 Solution: 2 42 21 Remainders 0
Page7
Hence, 4610 = 568 So, 1011102 = 4610=568 Thus, 1011102 = 568 Shortcut methods for conversions There are shortcut methods of conversion from one base to another. The octal number can be converted to hexadecimal format without being converted to decimal and then being divided by 16. Each digit of the octal number are split and represented by equivalent binary numbers of 3 bits each. And the binary number can then be grouped into 4 bits each for representing a hexadecimal number. The shortcut methods of conversion are as follows: Binary to Octal The following steps are used in this method: Step 1: Divide the binary digits into groups of three (starting from the right). Step 2: Convert each group of three binary digits into one octal digit. Since decimal digits 0 to 7 are equal to octal digits 0 to 7 so binary to decimal
Page9
Step 2: Convert each group into one digit of octal (use binary-to-decimal conversion) 1012 = 1 22 + 0 21 + 1 20 = 4 + 0 + 1 = 58 = 1 22 + 1 21 + 0 20 = 4 + 2 +0 = 68
1102
Hence, 1011102 = 568 Octal to Binary The following steps are used in this method: Step 1 : Convert each octal digit to a 3 digit binary number (The octal digits may be treated as Decimal for this conversion). Step 2: Combine all the resulting binary groups (of 3 digits each) into a single binary number. Example 1.10 5628 = ?2
Solution: Step 1: Convert each octal digit to 3 binary digits. 58 = 1012 68 = 1102 28 = 0102 Page10
= 1101111010012 Hence, 67518 = 1101111010012 Binary to Hexadecimal The following steps are used in this method: Step 1: Divide the binary digits into groups of four (Starting from the right). Step 2: Convert each group of four binary digits to one hexadecimal digit. (The hexadecimal digits 0 to 9 are equal to decimal digits 0 to 9 and hexadecimal digits. A to F are equal to decimal digits 10 to 15. The decimal values 10 to 15 must be represented as hexadecimal A to F. Example 1.12 110100112 =? 16 Solution: Step 1: Divide the binary digits into groups of 4. 1101 0011 Step 2: Convert each group of 4 binary digits to 1 hexadecimal digit. 11012 = = = = 1 23 +1 22 +0 2 1+1 20 8 + 4 + 0 +1 1310 D16
0011 2 = 0 2 3 + 0 22 + 1 2 1 + 1 2 0 = 0 + 0 + 2 + 1 Page11
Page12
= 1010101111002 Hence, ABC16 = 1010101111002 Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Hexa Decimal 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 Binary 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111 10000 Octal 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 20
Table 1.2: Relationship between Decimal, Hexadecimal, Binary and Octal Number Systems. Finally, the above Table 1.2 summarizes the relationship between the decimal, binary, hexadecimal and octal number systems. Note that the maximum value for a single digit of octal (7) is equal to the maximum value of three digits of binary. The value range of one digit of octal duplicates the value range of three digits of binary. If octal digits are substituted for binary digits, the substitution is on a one-to-three basis. Similarly, note that the maximum value of one digit in hexadecimal is equal to the maximum value of four digits in binary. Thus, the value range of one digit of hexadecimal is equivalent to the value range of four digits of binary. Therefore, hexadecimal shortcut notation is a one-to-four reduction in the space and time required for memory dump.
Page13
In general, a number in a number system with base b would be written as: an an-1 a1 a0 .a-1 a-2 a-m and would be interpreted to mean an bn + an-1 bn-1 + + a0 b0 + a-1 b-1 + a-2 b-2 + a-m b-m The symbols an a n-1, ., a-m used in the above representation should be one of the symbols allowed in the number system. Thus, as per the above mentioned general rule,
Page14
Example 1.17 Find the decimal equivalent of the octal number 127.54 Solution: 127.548 = 1 82 + 2 81+7 80+5 8-1+4 8-2 = 64 + 16 + 7 + 5/8 + 4/64 = 87+0.625+0.0625 = 87.687510 Example 1.18 Find the decimal equivalent of the hexadecimal number 2B.C4 Solution: 2B.C416 = 2x16 1+ Bx160 + Cx16-1+4x16-2 = 32 + 11 + C/16 + 4/256 = 43 + 0.75 + 0.015625 = 43.765652 10 1.2.4 Representation of Negative Number The 2s complement is used to represent the negative of a binary number. Before proceeding to 2s complement in the binary number system, 9s and 10s complement in the decimal number system are dealt with for better understanding.
Page15
In this case the decimal number is of two digits. If the sum of the number and its 10s complement only up to two digits are considered, the sum becomes zero. Similarly, Example 2 5 2 3 (decimal number) + 4 7 7 (its 10s complement) ________________________________________ 0 0 0 Carry = 1 The decimal number 523 is of three digits. Considering the sum of the number and its 10s complement only up to three digits, the sum becomes zero. Thus it is concluded that the 10s complement gives the negative value of the number The 10s complement of a decimal number = - decimal number. 1s Complement. The 1s complement in the binary number system is similar to the 9s complement in the decimal system. The 1s complement of a binary number is obtained by subtracting each bit of the number from 1. The 1s complement of 01 is 10. The 1s complement of 111 is 000. Thus, the 1s complement of a binary number can be obtained by simply changing bit 1 to 0 and 0 to 1.
Page16
1 1 0
Page17
__________________ 00000000 carry =1 The last carry will be neglected, if the 8 bit sum is considered. Example 2 + 4 (decimal) = -4 = Its 2s complement +4 -4 Example 3 Add + 5 and 7 7 -7 = 00000111 = 11111000 + 1 = 11111001 +5 = 00000101 -7 = 11111001 ____________________________ -2 = 11111110 2 -2 00000100 (binary) = 11111011 + 1 = 11111100 = 00000100 = 11111100 ______________________ 00000000
Check:
= 00000010 = 11111101 + 1 = 11111110 Thus, the 2s complement of a binary number represents its negative. 1.2.5 Binary Subtraction Using 2s Complement. The addition of 2s complement of a number is equivalent to the subtraction of the number. Suppose, 0010 ( 2 decimal) has to be subtracted from 0101 ( 5 decimal ). If the 2s complement of 0010 (2 decimal) is added to 0101 (5 decimal) the sum will be 0011 (3 decimal). It is equal to 0101 (5 decimal) 0010 (2 decimal) = 0011 (3 decimal).
Page18
Figure 1.1: Binary Coded Decimal The following table gives the decimal number along with their BCD codes. __________________________________________________________________ Decimal Number Standard BCD Number
__________________________________________________________________ Table 1.3: Decimal to Standard BCD Conversion 1.2.7 Alphanumeric Coding For the inherently binary world of the computer, it is necessary to put all symbols, letters, numbers, etc. into binary form. The most commonly used alphanumeric code is the ASCII code, with others like the EBCDIC code being applied in some communication applications. Gray Code The reflected binary or Gray Code is shown in Table 1.4. In this code only one bit changes in the transition from one number to the next higher number. The Gray code is used in shaft encoder, which is to indicate the angular position of a shaft. The use of Gray code reduces errors. Suppose that the present position of the shaft is indicated by Gray code 0100, which is for 7. If the position changes to 8, the Gray code will be 1100. If the detector does not pick up the encoder the new change in binary bit will show the previous position, that is, 7. But in case of ordinary binary code 7 is represented by 0111 and 8 by 1000. Now suppose the detector picks up the least significant bits, that is, 000, but fails to pick up the most significant bit 1, the output will be 0000 instead of 1000. So there is a large error if a simple binary code is used for a shaft encoder. _________________________________________________________________ _ Decimal Binary Code Gray Code _________________________________________________________________ _ 0 0000 0000
Page20
0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Table 1.4. Gray Code
0001 0011 0010 0110 0111 0101 0100 1100 1101 1111 1110 1010 1011 1001 1000
often referred to as TRUE or FALSE. dealing with an electronic system has either a voltage present (e.g. 5 or 3.3V) a value of 1 or no voltage a value of 0.
1.2.8 Boolean Algebra Boolean Algebra is the algebra of binary variables. Binary variables are also known as Boolean variables. Boolean variables have only two values 0 and 1. The only logical operations in Boolean algebra are OR, AND and NOT operations. The mathematical symbol + and . stand for OR and AND operations respectively. The symbol or is used for NOT (INVERT or COMPLEMENT) operation.
Page21
OR Laws
AND Laws
Laws of complementation
Page22
19. A + AB = A 20. A . (A + B) = A 21. A + AB = A + B 22. A . (A + B) = AB 23. AB + AB = A 24. (A + B)(A + B) = A 25. AB + AC = (A + C) . (A + B) 26. (A + B) ( A + C) = AC + AB 27. AB + AC + BC = AB + AC 28. (A + B)(A + C)(B + C) = (A + B)(A + C) 29. (A + B +C + ) = A . B . C. 30. A.B.C = A + B + C Table 1.1. Boolean Algebraic Theorems In Table 1.1, laws 5 to 8 are for AND operation. The fifth law is A.0 = 0. This law is true for AND operation when A is put equal to either 0 to 1. Similarly, laws from 6 to 8 are true when the value of A is put either 0 or 1.Laws of complementation from 9 to 13 are obvious and very simple. Similarly all the laws can be justified by either assuming the value 1 or 0 for the variable used or using truth table or with the help of other Boolean laws. 1.2.9 Logic Gates The term Gate is used to describe the members of a set of basic electronic components which, when combined with each other, are able to perform complex logical and arithmetic operations. 'Gates' are the physical realization of the simple Boolean expressions. Logic gates can be designed with only a few electronic components. Types of Logic Gates
Page23
Figure 1.1: Basic Gates 'OR' Gate If any input is logic 1 then the output of an OR gate will be logic 1.
The output value is 1 when at least one input value is 1 'AND' Gate The AND gate requires both inputs to be logic 1 for an output of logic 1
Page24
The output is 1 only when both inputs are 1 XOR Gate If both the inputs are different the output is high.
'NOT' Gate (Inverter Gate) Any input is inverted. Logic 1 input yields logic 0 as output and vice versa.
Not Gate takes only one input and is written as X or ~X in Boolean expressions.
Page25
If both the inputs are high the output is low. NOR Gate It is a combination of OR gate and NOT gate.
XNOR Gate If both the inputs are same the output is high.
Page26
For two binary variables (taking values 0 and 1) there are 16 possible functions. The functions involve only three operations which make up Boolean algebra: AND, OR and COMPLEMENT. These operations are like ordinary algebraic operations in that they are commutative, associative and distributive.
Figure 1.9: Logical Functions Half Adder The logic circuits that perform addition within the Arithmetic and Logic Unit (ALU) of the CPU are called adders. A unit that adds two binary digits is called the half adder and the one that adds together three binary digits is called a full adder. A half adder sums two binary digits to give a sum term (S) and a carry term (C), both being Boolean variables. The truth table for the half adder would be as follows: Page27
X 0 0 1 1
Y 0 1 0 1
S 0 1 1 0
C 0 0 0 1
Figure 1.11: Logic Gate for Half Adder. Full Adder A half adder logic circuit is an important component of computing systems however as this circuit cannot accept a carry bit from a previous addition it is not enough to fully perform additions for binary number greater than 1. In order to achieve this, a full adder is required. A full adder gives the sum and carry obtained after adding 3 bits.
Page28
From the truth table, the carry bit output is given by the relationship COUT=ABCIN + ABCIN +ABCIN +ABCIN Since X +X =X, ABCIN can be added to the above expression giving, COUT=ABCIN + ABCIN +ABCIN +ABCIN+ ABCIN+ ABCIN Rearranging the terms gives, COUT=ABCIN + ABCIN + ABCIN +ABCIN +ABCIN+ ABCIN On taking out the common terms, COUT =BCIN(A+A)+ACIN(B+B)+AB(CIN+CIN) COUT =ACIN+ BCIN+AB The full adder logic relationship from the truth table is: S=ABCIN+ABCIN+ABCIN+ABCIN Factoring out A S=A(BCIN+BCIN)+A(BCIN+BCIN) which is, Assume, then this can be seen to be another XOR statement, which can be written as
Page29
Subtractors Binary Subtraction can be done by means of complements. For example, Subtraction of A B can be done by means of taking 2s complement of B and adding it to A. The 2s complement of B is obtained by taking 1s complement of B and adding 1 to the least significant bit. The 1s complement is implemented with inverters and one is added to the sum through the input carry. The addition and subtraction operations can be combined into one common circuit by including an Exclusive-OR gate with each full adder. A 4-bit adder-subtractor circuit is shown in figure 2.13. The mode input M controls the operation. When M = 0 the circuit is an adder and when M = 1 the circuit becomes a subtractor. Each Exclusive-OR gate receives input M and one of the inputs B. When M = 0, B 0 = B. The full-adders receive the value of B, the input carry is 0 and the circuit performs A plus B. When M = 1, B 1 = B and C0 = 1 results. The B inputs are all complemented and a 1 is added through the input carry. The circuit performs the operation A plus the 2s complement of B. For unsigned numbers, this gives A B if A >= B or the 2s complement of (B A) if A<= B.
B3 A3 B2 A2 B1 A1 B0 A0
M
FA
C4
C3
FA
S2
C2
FA
S1
C1
FA
S0
C0
S3
Figure 1.13: Logic Gate for Subtractor 1.2.10 Karnaugh Maps (K-Maps) Karnaugh or K- maps are useful tool fot boolean function minimization and for visualization of the boolean function. In brief, K-maps provide a graphical method for minimizing boolean functions via pattern recognition forup to about n=6 variables. For larger numbers of variables, there are computer algorithms which can yield near-minimal implementations. K-maps are a way of expressing truth tables to make minimization easier. They are constructed from minterm codes. Page30
The truth table is A B f 0 0 1 m0 0 1 1 m1 1 0 1 m2 1 1 0 m3 The K-map is shown in Figure 1.14. The essence of the K-map is the two dimensional representation of f, which is equivalent to the truth table but more visual. To minimize f, the logical adjacencies are looped out. (a)
Page31
Figure 1.14: K-map showing looped-out terms and also corresponding minterms. Therefore This is less complex than f in canonical SOP form. Note that looping out logical adjacencies is a graphical alternative to algebraic calculations. Unit distance code (Gray code.) For two bits, the Gray code is: 00 01 11 10 Only one bit changes as one goes from left to right. This code preserves logical adjacencies. The K-map method is to loop out groups of 2n logically adjacent minterms. Each looped out group corresponds to a product term in a minimal SOP expression. 1. Loop out single 1s (n=0) which have no logical adjacencies. 2. Loop out all pairs of 1s (n=1) which cannot be included in a larger group. 3. Loop out all quads of 1s (n=2) which cannot be included in a larger group etc. Example. The K-map is shown in Figure 1.15.
Page33
Don't cares. In some applications it doesn't matter what the output is for certain input values. These are called don't cares. For instance, in the Binary Coded Decimal code, not all input values occur: 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 0 1 2 3 4 5 6 7 8 9
1 0 1 0 10 1 0 1 1 11 1 1 0 0 12 1 1 0 1 13 1 1 1 0 14 1 1 1 1 15 The decimal numbers are those in the range needed to encode these. The remaining numbers which are not used in BCD. and a minimum of 4 bits is correspond to code values
The symbols or X are used to denote don't cares. Don't cares can be exploited to help minimize boolean functions. Example : Figure 1.17. The K-map is shown in
Page34
Figure 1.17: K-map for . The minimal SOP representation is 1.2.11 The Flip-Flop One of the basic operations in a computer is the storage and retrieval of data from memory. Part of the electronic component responsible for the storage of data is known as the 'flip-flop'. It can store binary bit either 0 or 1. It has two stable states: HIGH and LOW, that is, 1 and 0. It has the property to remain in one state indefinitely until it is directed by an input signal to switch over to the other state. It is also called bistable multivabrator. It is a basic memory element. The basic flip flops are S-R Flip flop, JK Flip flop, D Flip flop, T Flip flop. For Presetting and Clearing a clocked flip flop may be required before applying inputs. For this purpose Preset (PR) and Clear (CLR) terminals are provided. PR and CLR are not low at the same time. Preset and Clear are used to initialize a circuit before normal clocked operation of the circuit starts.
Page35
Figure 1.19: Astable Multivibrator Monostable Multivibrator In response to a positive trigger pulse the monostable multivibrator or "one-shot" will produce a single output pulse of length t determined by the value of the resistor and capacitor. The non-retriggerable one-shot will not respond to further trigger pulses which happen during its pulse length.
(a) (b) Figure 1.20: (a) Monostable Multivibrator (b) Timing diagram
Page36
Figure 1.21: Logic Circuit for the SR flip-flop Clocked Set-Reset Flip-flop When the signal line S goes high, the other line to the NAND gate from the pulse steering circuit must also be high for it to generate a low output. Likewise, a clock pulse must have the reset NAND gate high to receive a high RESET pulse. Therefore all transitions are synchronized to the clock.
Figure 1.22: Clocked Set-Reset Flip-flop Pulse-Steering Circuit In order to add clock synchronization to a flip-flop, a ciruit is used to apply the clock pulses to the flip-flop. To convert a NAND gate latch to a clocked S/R flip-flop, two NAND gates may be used as above left to enable an input pulse on either the S or R lines to trigger a transition.
Page37
(a) (b) Figure 1.24: (a) Resetting NAND Gate (b) Timing Diagram Clocked D Flip-Flop A D flip-flop constructed from a NAND-latch. The D flip-flop tries to follow the input D but cannot make the required transitions unless it is enabled by the clock. Note that if the clock is low when a transition in D occurs, the tracking transition in Q occurs at the next upward transition of the clock.
(a)
(b)
Page38
Figure 1.26: (a) D-Flip-Flop (b) Clocked D Flip-flop T Flip Flop The T Flip-Flop is obtained from a JK flip-flop when J and K are connected to provide a single input designated by T. The T flip-flop therefore has only to conditions. When T = 0 (J=K=0) a clock transition does not change the state of the flip-flop. When T = 1 (J=K=1) a clock transition complements the state of the flip-flop. These conditions can be expressed by a characteristic equation: Q (t 1) = Q(t) T J J >C
K
K 0 1 0 1
0 0 1 1
T Q >C
J 0 1
J-K Flip-Flop The J-K flip-flop is the most versatile of the basic flip-flops. It has the input- following character of the clocked D flip-flop but has two inputs,traditionally labeled J and K. If J and K are different then the output Q takes the value of J at the next clock edge. The outputs feed back to the enabling NAND gates. This is what gives the toggling action when J=K=1 If J and K are both low then no change occurs. If J and K are both high at the clock edge then the output will toggle from one state to the other. It can perform the functions of the set/reset flip-flop and has the advantage that there are no ambiguous
Page39
(a)
(b)
(c) Figure 1.27: (a) J-K Flip Flop circuit (b) Truth Table (c) J-K Flip-Flop with clock Switching Example - J-K Flip-Flop The positive going transition (PGT) of the clock enables the switching of the output Q. The "enable" condition does not persist through the entire positive phase of the clock. The J & K inputs alone cannot cause a transition, but their values at the time of the PGT determine the output according to the truth table. This is an application of the J-K flipflop.
(a)
Page40
(b) Figure 1.28: (a) Clock J-K Flip Flop (b) Timing Diagram
J-K Flip-Flop Data Transfer In synchronous data transfer between two J-K flip-flops, a transfer signal on the clock put causes transfer from cell A to cell B. The transfer signal could be applied to several such cells in series to create a shift register.
(a)
Figure 1.29: Truth Table for J-K Flip Flop
(b)
In asynchronous data transfer, a transfer pulse may be applied at any time to force the data onto the asynchronous set and clear inputs, storing the data regardless of what is happening on the other inputs. NAND-gate Latch The concept of a "latch" circuit is important to creating memory devices. The function of such a circuit is to "latch" the value created by the input signal to the device and hold that value until some other signal changes it.
Page41
Figure 1.30: NAND Gate Latch Setting and Resetting the NAND Latch After being set to Q=1 by the low pulse at S (NAND gate function), the restored normal value S=1 is consistent witht the Q=1 state, so it is stable. Another negative pulse on S gives which does not switch the flip-flop, so it ignores further input.
(a)
(b) Figure 1.31: (a) Setting NAND Gate Latch (b) Resetting NAND Gate Latch
Page42
1.5) Summary
Number systems are basically of two types: non-positional and positional. In all the number systems, the value of the base determines the total number of different symbols or digits available in the number system. The decimal number system has the digits from 0 to 9 and the numbers have a base ten. The binary number system has only two symbols or digits (0 and 1) that can be used with the base 2.
Page43
1.8) Assignments
Conversions from one representation to another can be given
1.11) Keywords
Bit Byte Signed magnitude form 1s Complement form 2s Complement Form
Page45
Page46