Special Assignment Subjects: - Digital VLSI Design Topic: “A four-bit comparator with a six-bit output Y(5:0). Bit 5 of Y is for "equals:' bit 4 is for "not equal to," bit 3 is for "greater than," bit 2 is for "less than," bit 1 for "greater than or equal to: ' and bit 0 for "less than or equal to." With minimum hardware requirements.” Department of Electrical Engineering Electronics & Communication Engineering Program Master of Technology - VLSI Institute of Technology, Nirma University Ahmedabad-382481 Prepared By, Axay Patel (14MECV14) Guided By, Dr. Usha S Mehta Prof. Vaishali Dhare
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Special Assignment
Subjects:
- Digital VLSI Design
Topic:
“A four-bit comparator with a six-bit output Y(5:0). Bit 5 of Y is for "equals:' bit 4 is for "not equal to," bit 3 is for "greater than," bit 2 is for "less than," bit 1 for "greater than or equal to: ' and bit 0 for "less than or equal to." With minimum hardware requirements.”
Department of Electrical Engineering
Electronics & Communication Engineering Program
Master of Technology - VLSI
Institute of Technology, Nirma University
Ahmedabad-382481
Prepared By,
Axay Patel (14MECV14)
Guided By,
Dr. Usha S Mehta
Prof. Vaishali Dhare
1. Specification and Architecture definition
1.1 4-bit Magnitude Comparator:
Our aim is to minimize hardware area as much as possible. So first we derive two outputs, equal and greater. Then others (lesser, greater or equal, not equal, less or equal) will be derived using simple gate structure followed by those two outputs. This is explained below
Two 4-bit data
𝐴 = 𝐴3𝐴2 𝐴1𝐴0, 𝐵 = 𝐵3𝐵2𝐵1𝐵0
𝑋3 = 𝐴3 𝑥𝑛𝑜𝑟 𝐵3
𝑋2 = 𝐴2 𝑥𝑛𝑜𝑟 𝐵2
𝑋1 = 𝐴1 𝑥𝑛𝑜𝑟 𝐵1
𝑋0 = 𝐴0 𝑥𝑛𝑜𝑟 𝐵0
𝐸𝑞𝑢𝑎𝑙 (𝐸) = 𝑋3𝑋2𝑋1𝑋0
𝐺𝑟𝑒𝑎𝑡𝑒𝑟 (𝐺) = 𝐴3 𝐵3′ + 𝑋3𝐴2𝐵2
′ + 𝑋3𝑋2𝐴1𝐵1′ + 𝑋3𝑋2𝑋1𝐴0𝐵0
′
𝐺𝑟𝑒𝑎𝑡𝑒𝑟 (𝐺) = 𝐴3 𝐵3′ + 𝑋3(𝐴2𝐵2
′ + 𝑋2(𝐴1𝐵1′ + 𝑋1𝐴0𝐵0
′ ))
𝑁𝑜𝑡 𝑒𝑞𝑢𝑎𝑙 (𝑁𝐸) = �̅�
𝐺𝑟𝑒𝑎𝑡𝑒𝑟 𝑜𝑟 𝑒𝑞𝑢𝑎𝑙 (𝐺𝐸) = 𝐺 + 𝐸
𝐿𝑒𝑠𝑠 (𝐿) = 𝐺𝐸̅̅ ̅̅
𝐿𝑒𝑠𝑠 𝑜𝑟 𝑒𝑞𝑢𝑎𝑙 (𝐿𝐸) = �̅�
For lesser area we reduce the equation
Output is in form of 6-bit,
Y(5:0)={E,NE,G,L,GE,LE}
For example, 1) A=0101 and B=0010 then 2) A=1010 and B=1010 then
Y=011010 Y=100011
2. RTL Schematic
3. Gate Level Schematic Tool Used: DSCH 2.7f Here we have tried to put all universal gates and NOT gate so we can easily implement all gate into transistor level schematic. So, area can be reduced. We have equations
′ + 𝐴𝑛 )′ + (𝐴𝑛′ + 𝐵𝑛)′]′ -- NOR and NOT structure
𝐺𝑟𝑒𝑎𝑡𝑒𝑟 (𝐺) = 𝐴3 𝐵3
′ + 𝑋3(𝐴2𝐵2′ + 𝑋2(𝐴1𝐵1
′ + 𝑋1𝐴0𝐵0′ ))
is manipulated as
G = [𝑚3
′ ∙ [𝑋3 ∙ [𝑚2′ ∙ [𝑋2 ∙ [𝑚1
′ ∙ (𝑋1 ∙ 𝑚0)′]′]′]′]′]′ -- NAND and NOT structure
𝑤ℎ𝑒𝑟𝑒 𝑚3 = 𝐴3 𝐵3′ , 𝑚2 = 𝐴2𝐵2
′ , 𝑚1 = 𝐴1𝐵1′ , 𝑚0 = 𝐴0𝐵0
′ ,
E = 𝑋3𝑋2𝑋1𝑋0 -> E = ((𝑋3𝑋2𝑋1)′ + 𝑋0′ )′ --NAND ,NOR and NOT structure
(maximum 3 input NAND or NOR gate is used)
𝐿 = (𝐺 + 𝐸)′ -> GE = L’ LE =G’
Verilog Code: module comparator_4_bit( A0,B0,B3,A3,A2,B2,B1,A1, E,NE,G,LE,L,GE); input A0,B0,B3,A3,A2,B2,B1,A1; output E,NE,G,LE,L,GE; nor or(w3,w1,A0); not inv(w4,A0); not inv(w1,B0); nor or(w6,B0,w4); nor or(w7,w3,w6); nor or(w11,w9,w10); nor or(w10,B3,w12); not inv(NE,E); not inv(w12,A3); nor or(w9,w16,A3); nor or(w19,w17,A2); not inv(w20,A2); not inv(w17,B2); nor or(w22,B2,w20); nor or(w23,w19,w22); nor or(w27,w25,w26);
nor or(w26,B1,w28); not inv(w29,B1); not inv(w28,A1); nor or(w25,w29,A1); nand and(w31,w11,w23,w27); nor or(E,w31,w32); not inv(w32,w7); not inv(w16,B3); nand and(w33,w6,w27); not inv(w34,w26); not inv(w35,w22); nand and(w36,w33,w34); nand and(w37,w36,w23); nand and(w38,w37,w35); not inv(w39,w10); nand and(w40,w38,w11); nand and(G,w40,w39); not inv(LE,G); nor or(L,E,G); not inv(GE,L); endmodule
TOTAL Transistor used: 116 transistors
4. Transistor level schematic for each gate
Total Transistor calculated = 112 transistors (including nmos and pmos)
As we can see that if we implement transistor level schematic using switch level coding in micro-wind, it increases wiring costs. Very less numbers of transistors are reduced. So we will prefer previous layout style.
Here we need to design fully combinational circuit and moreover hardware should be minimized. For combinational circuit we have 8 inputs and 6 non registered outputs. So we can use PROM or PLA or PAL.
1) PROM: Programmable read only memory In PROM, decoder is followed by programmable OR plane. So, unnecessary hardware consumed in decoder as well as in programmable OR plane. So, this is not suitable choice for design.
2) PLA: Programmable Logic Array
PLA consist two programmable arrays. One is OR plane and second is AND plane. Here we need three output (G, E, and GE) should be fed back to the input. This facility is not easily available with PLA structure. If we use PLA structure we need to implement all equation separately and it consumes more hardware. So PLA would not be suitable choice for our design.
3) PAL: Programmable Array Logic PAL is having one programmable AND plane and fixed OR plane. We know that PAL could be our suitable choice. Now we will find particular device in PAL.
We need three output fed back to input. 8 input 6 output
So we can use PLA 22CEV10 for our design. Now our aim is implement this design on FPGA kit. We will use SPARTAN 3E starter board for our design.
Xilinx XC3S500E Spartan-3E FPGA • Up to 232 user-I/O pins • 320-pin FBGA package • Over 10,000 logic cells
Top Level Output File Name : magnitude_comparator.ngc
Primitive and Black Box Usage:
------------------------------
# BELS : 9
# LUT4 : 3
# LUT5 : 4
# LUT6 : 2
# IO Buffers : 14
# IBUF : 8
# OBUF : 6
Device utilization summary:
---------------------------
Selected Device : 6slx45csg324-3
Slice Logic Utilization:
Number of Slice LUTs: 9 out of 27288 0%
Number used as Logic: 9 out of 27288 0%
Slice Logic Distribution:
Number of LUT Flip Flop pairs used: 9
Number with an unused Flip Flop: 9 out of 9 100%
Number with an unused LUT: 0 out of 9 0%
Number of fully used LUT-FF pairs: 0 out of 9 0%
Number of unique control sets: 0
IO Utilization:
Number of IOs: 14
Number of bonded IOBs: 14 out of 218 6%
6.1 Synthesis Report
7. Technology Schematic
8. RTL Schematic
7.1 Basic difference between two schematics
RTL View
Viewing an RTL schematic opens an NGR file that can be viewed as a gate-level schematic.
This schematic is generated after the HDL synthesis phase of the synthesis process. It shows a representation of the pre-optimized design in terms of generic symbols, such as adders, multipliers, counters, AND gates, and OR gates, that are independent of the targeted Xilinx device.
Technology View
Viewing a Technology schematic opens an NGC file that can be viewed as an architecture-specific schematic.
This schematic is generated after the optimization and technology targeting phase of the synthesis process. It shows a representation of the design in terms of logic elements optimized to the target Xilinx device or "technology"; for example, in terms of of LUTs, carry logic, I/O buffers, and other technology-specific components. Viewing this schematic allows you to see a technology-level representation of your HDL optimized for a specific Xilinx architecture, which might help you discover design issues early in the design process.
9. Test Bench
module comp_stm; // Inputs reg [3:0] A; reg [3:0] B; // Outputs wire [5:0] Y; // Instantiate the Unit Under Test (UUT)
magnitude_comparator uut ( .A(A), .B(B), .Y(Y) ); initial begin // Initialize Inputs A = 0; B = 0; // Wait 100 ns for global reset to finish #100 A=4'b0101; B=4'b0011; #10 A=4'b1111; B=4'b1111; #10 A=4'b0001; B=4'b0010; end endmodule