ELEC 6270 – Low Power Design of Electric Circuits
Total Page:16
File Type:pdf, Size:1020Kb
ELEC 6270 – Low Power Design of Electric Circuits Four-bit Binary Counters with Binary Code, Gray Code and One-Hot Code Xue Xia Spring 2015 Final Project both connected to the ground. Description 4 bit Binary Code Encoding Considering using binary code, gray code, and one-hot code in digital circuits, binary code Binary and gray code can represent n states with Q3 Q2 Q1 Q0 log(n) bits code, while one-hot code would 0 0 0 0 0 need n bits for the same function. However, 1 0 0 0 1 binary code and gray code need gates circuits 2 0 0 1 0 for decoding, while one-hot code machine just need to find the location of high value bit to 3 0 0 1 1 achieve the state function. 4 0 1 0 0 5 0 1 0 1 D flip flop 6 0 1 1 0 7 0 1 1 1 8 1 0 0 0 9 1 0 0 1 10 1 0 1 0 11 1 0 1 1 12 1 1 0 0 13 1 1 0 1 14 1 1 1 0 15 1 1 1 1 Assume that Q3, Q2, Q1, Q0 represent the Fig.1 D Flip Flop present state, and Q3#, Q2#, Q1#, Q0# are for the next state. True Table Using Karnaugh map, the function equations are showed as below. inputs outputs PR' CLR' CLK D Q Q' ------ ------ ------ 0 1 X X 1 0 Q3# = Q3 Q1 + Q3 Q2 Q1 + Q3 Q2Q1Q0 + 1 0 X X 0 1 ------ Q3Q2Q1Q0 0 0 X X X X ------ ------ ------ 1 1 ↑ 1 1 0 Q2# = Q2Q1 + Q2Q1Q0 + Q2Q1Q0 1 1 ↑ 0 0 1 ------ ------ 1 1 0 X Q0 Q0' Q1# = Q1Q0 +Q1Q0 ------ I choose to use d flip flops to complete Q0# = Q0 counter circuit design. For there is no reset function in both binary and gray code counter circuits, the PR (preset) and CLR(clear) are Fig.3 Binary Code Counter Transition Fig.2 Binary Code Counter Circuit Gray Code Number of Circuit Components Gray code, which is also called reflected Inverter 4 binary code, has been designed by Frank Gray AND 9 at Bell Labs in 1947. The original purpose of OR 3 designing gray code is to prevent errors during PCM signal transmission, for it has only one D Flip Flop 4 bit differ between 2 adjacent state. For now days, This feature leads to the reduction of voltage switching in digital circuit, which can be used in low-power circuit design. 4 bit Gray Code Encoding Decimal Gray Code Q3 Q2 Q1 Q0 0 0 0 0 0 1 0 0 0 1 2 0 0 1 1 3 0 0 1 0 4 0 1 1 0 5 0 1 1 1 6 0 1 0 1 7 0 1 0 0 8 1 1 0 0 9 1 1 0 1 10 1 1 1 1 11 1 1 1 0 12 1 0 1 0 13 1 0 1 1 14 1 0 0 1 15 1 0 0 0 Fig.4 Gray Code Counter Circuit Assume that Q3, Q2, Q1, Q0 represent the present state, and Q3#, Q2#, Q1#, Q0# are for Number of Circuit Components the next state. Using Karnaugh map, the function equations Inverter 4 are showed as below. AND 13 OR 4 ------ ---------------- D Flip Flop 4 Q3# = Q3Q1Q0Q0 + Q3Q0 + Q2Q1Q0 ------ ------ ------ Q2# = Q2Q1 + Q2Q1Q0 +Q3Q1Q0 ------ ---------------- Q1# = Q1Q0 + Q3Q2Q0 + Q3Q2Q0 ---------------- ------ ------ Q0# = Q3Q2 Q1’ + Q3 Q2Q1 + Q3Q2 Q1 + ------ Q3Q2Q1 Fig.5 Gray Code Counter Transition One-Hot Code One-hot code is the code that only one bit is high value while other bits are all low. When the nth bit is high value, it represents that it is at the nth state. For the one-hot code machine only has one d flip-flop with high value at each state during operation, while the circuit scale is large, the total power consumption is rather low. Fig.5 One-Hot Code Counter Transition As for the one-hot code counter, which is also Results called a ring counter, it has 16 d flip flops, and Binary Gray One-Hot no gates. At each state, there is one d flip flop Counter Counte Code from 0 to 1, and one d flip flop from 1 to 0. r Counter The average transition is 2, keeping the same Inverter 4 4 0 value at all states. So even if the d flip flop Number transition is higher than binary code counter, AND 9 13 0 for it has no decode circuit transition, the total Number power consumption of one-hot code still OR Number 3 4 0 remains low. DFF 4 4 16 Number Reference Average 1.875 1 0 th Inverter [1]Flip-flop (electronics) Retrieved April 26 , Transition 2015, from Wikipedia Website: Average 2.375 2 0 http://en.wikipedia.org/wiki/Flip-flop_(electro AND nics) th Transition [2]One-hot code Retrieved April 26 , 2015, Average 0.875 1 0 from Wikipedia Website: OR http://en.wikipedia.org/wiki/One-hot th Transition [3]Gray doe Retrieved April 26 , 2015, from Average 1.875 1 2 Wikipedia Website: dff http://en.wikipedia.org/wiki/Gray_code Transition [4]Introduction to Low Power Design, (2015). Dr. Vishwani Agrawal [PowerPoint Slides] Retrieved April 26th, 2015, from Website: I choose to use C++ on VC to calculate the http://www.eng.auburn.edu/users/agrawvd/CO gate transition of binary code counter and gray URSE/E6270_Spr15/course.html code counter for 16 states. [5]Power Analysis,(2015). Dr. Vishwani For the transition number of circuit Agrawal [PowerPoint Slides] Retrieved April components decide the dynamic power 26th, 2015, from Website: consumption in digital circuit, the lower http://www.eng.auburn.edu/users/agrawvd/CO number of transition, the smaller amount of URSE/E6270_Spr15/course.html power consumption exists. Compared the transition number of gates and D flip flops from binary code and gray code counter circuits, OR gate transition in binary code counter is lower than gray code counter, for the gray code counter has more complicated decoding circuit. While looking at other components, such as AND gates, Invert gates, and D flip flops, the transition of gray code counter is much lower than binary code counter..