COE 405 Structural Specification of Hardware Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Dr. Aiman.

Slides:



Advertisements
Similar presentations
UNIT 2: Data Flow description
Advertisements

HDL Programming Fundamentals
You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
A Polynomial-Time Algorithm for Global Value Numbering SAS 2004 Sumit Gulwani George C. Necula.
ECE555 Lecture 8/9 Nam Sung Kim University of Wisconsin – Madison
Digital System Design Subject Name : Digital System Design Course Code : IT-314.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
0 - 0.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
ABC Technology Project
Automatic Test Generation and Logic Optimization.
Chapter 3 Gate-Level Minimization
Other Gate Types COE 202 Digital Logic Design Dr. Aiman El-Maleh
Discrete Mathematics Dr.-Ing. Erwin Sitompul
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Test B, 100 Subtraction Facts
Week 1.
We will resume in: 25 Minutes.
A SMALL TRUTH TO MAKE LIFE 100%
Chapter 30 Induction and Inductance In this chapter we will study the following topics: -Faraday’s law of induction -Lenz’s rule -Electric field induced.
Structural Specification of Hardware Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Verilog Part 1 – Chapter.
1/8/ VerilogCopyright Joanne DeGroat, ECE, OSU1 Verilog Overview An overview of the Verilog HDL.
COE 405 VHDL Basics Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Dr. Aiman H. El-Maleh Computer Engineering.
1 Introduction to VHDL (Continued) EE19D. 2 Basic elements of a VHDL Model Package Declaration ENTITY (interface description) ARCHITECTURE (functionality)
VHDL Programming in CprE 381 Zhao Zhang CprE 381, Fall 2013 Iowa State University Last update: 9/15/2013.
INTRO TO VHDL Appendix A: page page VHDL is an IEEE and ANSI standard. VHDL stands for Very High Speed IC hardware description language.
EELE 367 – Logic Design Module 4 – Combinational Logic Design with VHDL Agenda 1.Decoders/Encoders 2.Multiplexers/Demultiplexers 3.Tri-State Buffers 4.Comparators.
LECTURE 4: The VHDL N-bit Adder
Digital Design with VHDL Presented by: Amir Masoud Gharehbaghi
VHDL Structural Architecture ENG241 Week #5 1. Fall 2012ENG241/Digital Design2 VHDL Design Styles Components and interconnects structural VHDL Design.
1 Lecture 13 VHDL 3/16/09. 2 VHDL VHDL is a hardware description language. The behavior of a digital system can be described (specified) by writing a.
© Dr. Alaaeldin Amin 1 Hardware Modeling & Synthesis Using VHDL Very High Speed Integrated Circuits Start Of VHDL Development First Publication.
N Structural Modeling: n Entities n Ports n Architectures n Packages.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
Fall 08, Oct 29ELEC Lecture 7 (updated) 1 Lecture 7: VHDL - Introduction ELEC 2200: Digital Logic Circuits Nitin Yogi
Design Organization and Parameterization Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Introduction to VHDL Arab Academy for Science, Technology & Maritime Transport Computer Engineering Department Magdy Saeb, Ph.D.
VHDL IE- CSE. What do you understand by VHDL??  VHDL stands for VHSIC (Very High Speed Integrated Circuits) Hardware Description Language.
1/8/ L7 Project Step 3Copyright Joanne DeGroat, ECE, OSU1 Project Step 4 Step 1 in transitioning to behavioral modeling. We will wire behavioral.
Language Concepts Ver 1.1, Copyright 1997 TS, Inc. VHDL L a n g u a g e C o n c e p t s Page 1.
EE3A1 Computer Hardware and Digital Design Lecture 5 Testbenches and Memories in VHDL.
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
Introduction to VLSI Design – Lec01. Chapter 1 Introduction to VLSI Design Lecture # 11 High Desecration Language- Based Design.
M. Balakrishnan Dept of Computer Science & Engg. I.I.T. Delhi
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
Lecture #18 Page 1 ECE 4110– Sequential Logic Design Lecture #18 Agenda 1.MSI Demultiplexers 2.MSI Tri-State Buffers 3.MSI Comparators Announcements 1.HW.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Introduction to Verilog
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Show who is the BOSS Issues with VHDL Synthesis. VHDL Simulator versus Synthetiser VHDL Simulator follows the strict VHDL rules. It does not produce a.
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE 6: State machines Instructor: Francis G. Wolff Case Western Reserve University.
Behavioral Modeling in Verilog
VHDL Discussion Subprograms
VHDL Structural Architecture
VHDL Discussion Subprograms
Hardware Modeling & Synthesis Using VHDL
Copyright Joanne DeGroat, ECE, OSU
COE 202 Introduction to Verilog
Presentation transcript:

COE 405 Structural Specification of Hardware Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals

2-2 OutlineOutline n Parts Library n Wiring of Primitives Single-bit comparator n Wiring Iterative Networks 4-bit comparator For…Generate Statement IF…Generate Statement n Modeling a Test Bench n Binding Alternative n Top Down Wiring Sequential Comparator Byte Latch Byte Comparator n Parts Library n Wiring of Primitives Single-bit comparator n Wiring Iterative Networks 4-bit comparator For…Generate Statement IF…Generate Statement n Modeling a Test Bench n Binding Alternative n Top Down Wiring Sequential Comparator Byte Latch Byte Comparator

2-3 Basic Components & Graphical Notation n Three basic components are used n Will use as the basic components of several designs n A graphical notation helps clarify wiring n Three basic components are used n Will use as the basic components of several designs n A graphical notation helps clarify wiring

2-4 Entity Syntax INV Entity NAND2 Entity

2-5 A Cascadable Single-Bit Comparator n When a > b the a_gt_b becomes 1 n When a < b the a_lt_b becomes 1 n If a = b outputs become the same as corresponding inputs n When a > b the a_gt_b becomes 1 n When a < b the a_lt_b becomes 1 n If a = b outputs become the same as corresponding inputs

2-6 Structural Single-Bit Comparator n Design uses basic components n The less-than and greater-than outputs use the same logic n Design uses basic components n The less-than and greater-than outputs use the same logic

2-7 Structural Single-Bit Comparator: Aspect Notation

2-8 Structural Model of Single-Bit Comparator … ENTITY bit_comparator IS PORT (a, b, gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END bit_comparator; ARCHITECTURE gate_level OF bit_comparator IS -- COMPONENT n1 PORT (i1: IN BIT; o1: OUT BIT); END COMPONENT ; COMPONENT n2 PORT (i1,i2: IN BIT; o1:OUT BIT); END COMPONENT; COMPONENT n3 PORT (i1, i2, i3: IN BIT; o1: OUT BIT); END COMPONENT; -- Component Configuration FOR ALL : n1 USE ENTITY WORK.inv (single_delay); FOR ALL : n2 USE ENTITY WORK.nand2 (single_delay); FOR ALL : n3 USE ENTITY WORK.nand3 (single_delay); --Intermediate signals SIGNAL im1,im2, im3, im4, im5, im6, im7, im8, im9, im10 : BIT; ENTITY bit_comparator IS PORT (a, b, gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END bit_comparator; ARCHITECTURE gate_level OF bit_comparator IS -- COMPONENT n1 PORT (i1: IN BIT; o1: OUT BIT); END COMPONENT ; COMPONENT n2 PORT (i1,i2: IN BIT; o1:OUT BIT); END COMPONENT; COMPONENT n3 PORT (i1, i2, i3: IN BIT; o1: OUT BIT); END COMPONENT; -- Component Configuration FOR ALL : n1 USE ENTITY WORK.inv (single_delay); FOR ALL : n2 USE ENTITY WORK.nand2 (single_delay); FOR ALL : n3 USE ENTITY WORK.nand3 (single_delay); --Intermediate signals SIGNAL im1,im2, im3, im4, im5, im6, im7, im8, im9, im10 : BIT;

2-9 … Structural Model of Single-Bit Comparator BEGIN -- a_gt_b output g0 : n1 PORT MAP (a, im1); g1 : n1 PORT MAP (b, im2); g2 : n2 PORT MAP (a, im2, im3); g3 : n2 PORT MAP (a, gt, im4); g4 : n2 PORT MAP (im2, gt, im5); g5 : n3 PORT MAP (im3, im4, im5, a_gt_b); -- a_eq_b output g6 : n3 PORT MAP (im1, im2, eq, im6); g7 : n3 PORT MAP (a, b, eq, im7); g8 : n2 PORT MAP (im6, im7, a_eq_b); -- a_lt_b output g9 : n2 PORT MAP (im1, b, im8); g10 : n2 PORT MAP (im1, lt, im9); g11 : n2 PORT MAP (b, lt, im10); g12 : n3 PORT MAP (im8, im9, im10, a_lt_b); END gate_level; BEGIN -- a_gt_b output g0 : n1 PORT MAP (a, im1); g1 : n1 PORT MAP (b, im2); g2 : n2 PORT MAP (a, im2, im3); g3 : n2 PORT MAP (a, gt, im4); g4 : n2 PORT MAP (im2, gt, im5); g5 : n3 PORT MAP (im3, im4, im5, a_gt_b); -- a_eq_b output g6 : n3 PORT MAP (im1, im2, eq, im6); g7 : n3 PORT MAP (a, b, eq, im7); g8 : n2 PORT MAP (im6, im7, a_eq_b); -- a_lt_b output g9 : n2 PORT MAP (im1, b, im8); g10 : n2 PORT MAP (im1, lt, im9); g11 : n2 PORT MAP (b, lt, im10); g12 : n3 PORT MAP (im8, im9, im10, a_lt_b); END gate_level;

2-10 Netlist Description of Single-Bit Comparator ARCHITECTURE netlist OF bit_comparator IS SIGNAL im1,im2, im3, im4, im5, im6, im7, im8, im9, im10 : BIT; BEGIN -- a_gt_b output g0 : ENTITY Work.inv(single_delay) PORT MAP (a, im1); g1 : ENTITY Work.inv(single_delay) PORT MAP (b, im2); g2 : ENTITY Work.nand2(single_delay) PORT MAP (a, im2, im3); g3 : ENTITY Work.nand2(single_delay) PORT MAP (a, gt, im4); g4 : ENTITY Work.nand2(single_delay) PORT MAP (im2, gt, im5); g5 : ENTITY Work.nand3(single_delay) PORT MAP (im3, im4, im5, a_gt_b); -- a_eq_b output g6 : ENTITY Work.nand3(single_delay) PORT MAP (im1, im2, eq, im6); g7 : ENTITY Work.nand3(single_delay) PORT MAP (a, b, eq, im7); g8 : ENTITY Work.nand2(single_delay) PORT MAP (im6, im7, a_eq_b); -- a_lt_b output g9 : ENTITY Work.nand2(single_delay) PORT MAP (im1, b, im8); g10 : ENTITY Work.nand2(single_delay) PORT MAP (im1, lt, im9); g11 : ENTITY Work.nand2(single_delay) PORT MAP (b, lt, im10); g12 : ENTITY Work.nand3(single_delay) PORT MAP (im8, im9, im10, a_lt_b); END netlist; ARCHITECTURE netlist OF bit_comparator IS SIGNAL im1,im2, im3, im4, im5, im6, im7, im8, im9, im10 : BIT; BEGIN -- a_gt_b output g0 : ENTITY Work.inv(single_delay) PORT MAP (a, im1); g1 : ENTITY Work.inv(single_delay) PORT MAP (b, im2); g2 : ENTITY Work.nand2(single_delay) PORT MAP (a, im2, im3); g3 : ENTITY Work.nand2(single_delay) PORT MAP (a, gt, im4); g4 : ENTITY Work.nand2(single_delay) PORT MAP (im2, gt, im5); g5 : ENTITY Work.nand3(single_delay) PORT MAP (im3, im4, im5, a_gt_b); -- a_eq_b output g6 : ENTITY Work.nand3(single_delay) PORT MAP (im1, im2, eq, im6); g7 : ENTITY Work.nand3(single_delay) PORT MAP (a, b, eq, im7); g8 : ENTITY Work.nand2(single_delay) PORT MAP (im6, im7, a_eq_b); -- a_lt_b output g9 : ENTITY Work.nand2(single_delay) PORT MAP (im1, b, im8); g10 : ENTITY Work.nand2(single_delay) PORT MAP (im1, lt, im9); g11 : ENTITY Work.nand2(single_delay) PORT MAP (b, lt, im10); g12 : ENTITY Work.nand3(single_delay) PORT MAP (im8, im9, im10, a_lt_b); END netlist;

2-11 Syntax Details

Bit Comparator Structural Iterative Wiring

Bit Comparator Aspect Notation n Aspect notation shows VHDL wiring n VHDL description will use same intermediate signal names n Aspect notation shows VHDL wiring n VHDL description will use same intermediate signal names

Bit Comparator: “For ……. Generate” Statement … ENTITY nibble_comparator IS PORT (a, b : IN BIT_VECTOR (3 DOWNTO 0); -- a and b data inputs gt, eq, lt : IN BIT; -- previous greater, equal & less than a_gt_b, a_eq_b, a_lt_b : OUT BIT); -- a > b, a = b, a < b END nibble_comparator; -- ARCHITECTURE iterative OF nibble_comparator IS COMPONENT comp1 PORT (a, b, gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END COMPONENT; FOR ALL : comp1 USE ENTITY WORK.bit_comparator (gate_level); SIGNAL im : BIT_VECTOR ( 0 TO 8); BEGIN c0: comp1 PORT MAP (a(0), b(0), gt, eq, lt, im(0), im(1), im(2)); ENTITY nibble_comparator IS PORT (a, b : IN BIT_VECTOR (3 DOWNTO 0); -- a and b data inputs gt, eq, lt : IN BIT; -- previous greater, equal & less than a_gt_b, a_eq_b, a_lt_b : OUT BIT); -- a > b, a = b, a < b END nibble_comparator; -- ARCHITECTURE iterative OF nibble_comparator IS COMPONENT comp1 PORT (a, b, gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END COMPONENT; FOR ALL : comp1 USE ENTITY WORK.bit_comparator (gate_level); SIGNAL im : BIT_VECTOR ( 0 TO 8); BEGIN c0: comp1 PORT MAP (a(0), b(0), gt, eq, lt, im(0), im(1), im(2));

2-15 … 4-Bit Comparator: “For ……. Generate” Statement c1to2: FOR i IN 1 TO 2 GENERATE c: comp1 PORT MAP ( a(i), b(i), im(i*3-3), im(i*3-2), im(i*3-1), im(i*3+0), im(i*3+1), im(i*3+2) ); END GENERATE; c3: comp1 PORT MAP (a(3), b(3), im(6), im(7), im(8), a_gt_b, a_eq_b, a_lt_b); END iterative; c1to2: FOR i IN 1 TO 2 GENERATE c: comp1 PORT MAP ( a(i), b(i), im(i*3-3), im(i*3-2), im(i*3-1), im(i*3+0), im(i*3+1), im(i*3+2) ); END GENERATE; c3: comp1 PORT MAP (a(3), b(3), im(6), im(7), im(8), a_gt_b, a_eq_b, a_lt_b); END iterative; n USE BIT_VECTOR for Ports a & b n Separate first and last bit-slices from others n Arrays FOR intermediate signals facilitate iterative wiring n Can easily expand to an n-bit comparator

2-16 Syntax of Generate Statement n Generate statement is a concurrent statement n Generate statement brackets concurrent statements

Bit Comparator: “IF …… Generate” Statement … ARCHITECTURE iterative OF nibble_comparator IS -- COMPONENT comp1 PORT (a, b, gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END COMPONENT; -- FOR ALL : comp1 USE ENTITY WORK.bit_comparator (gate_level); CONSTANT n : INTEGER := 4; SIGNAL im : BIT_VECTOR ( 0 TO (n-1)*3-1); -- BEGIN c_all: FOR i IN 0 TO n-1 GENERATE l: IF i = 0 GENERATE least: comp1 PORT MAP (a(i), b(i), gt, eq, lt, im(0), im(1), im(2) ); END GENERATE; ARCHITECTURE iterative OF nibble_comparator IS -- COMPONENT comp1 PORT (a, b, gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END COMPONENT; -- FOR ALL : comp1 USE ENTITY WORK.bit_comparator (gate_level); CONSTANT n : INTEGER := 4; SIGNAL im : BIT_VECTOR ( 0 TO (n-1)*3-1); -- BEGIN c_all: FOR i IN 0 TO n-1 GENERATE l: IF i = 0 GENERATE least: comp1 PORT MAP (a(i), b(i), gt, eq, lt, im(0), im(1), im(2) ); END GENERATE;

2-18 … 4-Bit Comparator: “IF …… Generate” Statement -- m: IF i = n-1 GENERATE most: comp1 PORT MAP (a(i), b(i), im(i*3-3), im(i*3-2), im(i*3-1), a_gt_b, a_eq_b, a_lt_b); END GENERATE; -- r: IF i > 0 AND i < n-1 GENERATE rest: comp1 PORT MAP (a(i), b(i), im(i*3-3), im(i*3-2), im(i*3-1), im(i*3+0), im(i*3+1), im(i*3+2) ); END GENERATE; -- END GENERATE; -- Outer Generate END iterative; -- m: IF i = n-1 GENERATE most: comp1 PORT MAP (a(i), b(i), im(i*3-3), im(i*3-2), im(i*3-1), a_gt_b, a_eq_b, a_lt_b); END GENERATE; -- r: IF i > 0 AND i < n-1 GENERATE rest: comp1 PORT MAP (a(i), b(i), im(i*3-3), im(i*3-2), im(i*3-1), im(i*3+0), im(i*3+1), im(i*3+2) ); END GENERATE; -- END GENERATE; -- Outer Generate END iterative;

Bit Comparator: Alternative Architecture (Single Generate) ARCHITECTURE Alt_iterative OF nibble_comparator IS constant n: Positive :=4; COMPONENT comp1 PORT (a, b, gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END COMPONENT; FOR ALL : comp1 USE ENTITY WORK.bit_comparator (gate_level); SIGNAL im : BIT_VECTOR ( 0 TO 3*n+2); BEGIN im(0 To 2) <= gt&eq< cALL: FOR i IN 0 TO n-1 GENERATE c: comp1 PORT MAP (a(i), b(i), im(i*3), im(i*3+1), im(i*3+2), im(i*3+3), im(i*3+4), im(i*3+5) ); END GENERATE; a_gt_b <= im(3*n); a_eq_b <= im(3*n+1); a_lt_b <= im(3*n+2); END Alt_iterative ; ARCHITECTURE Alt_iterative OF nibble_comparator IS constant n: Positive :=4; COMPONENT comp1 PORT (a, b, gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END COMPONENT; FOR ALL : comp1 USE ENTITY WORK.bit_comparator (gate_level); SIGNAL im : BIT_VECTOR ( 0 TO 3*n+2); BEGIN im(0 To 2) <= gt&eq< cALL: FOR i IN 0 TO n-1 GENERATE c: comp1 PORT MAP (a(i), b(i), im(i*3), im(i*3+1), im(i*3+2), im(i*3+3), im(i*3+4), im(i*3+5) ); END GENERATE; a_gt_b <= im(3*n); a_eq_b <= im(3*n+1); a_lt_b <= im(3*n+2); END Alt_iterative ;

2-20 Structural Test Bench n A Testbench is an Entity without Ports that has a Structural Architecture n The Testbench Architecture, in general, has 3 major components: Instance of the Entity Under Test (EUT) Test Pattern Generator ( Generates Test Inputs for the Input Ports of the EUT) Response Evaluator (Compares the EUT Output Signals to the Expected Correct Output) n A Testbench is an Entity without Ports that has a Structural Architecture n The Testbench Architecture, in general, has 3 major components: Instance of the Entity Under Test (EUT) Test Pattern Generator ( Generates Test Inputs for the Input Ports of the EUT) Response Evaluator (Compares the EUT Output Signals to the Expected Correct Output)

2-21 Testbench Example … Entity nibble_comparator_test_bench IS End nibble_comparator_test_bench ; -- ARCHITECTURE input_output OF nibble_comparator_test_bench IS -- COMPONENT comp4 PORT (a, b : IN bit_vector (3 DOWNTO 0); gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END COMPONENT; -- FOR a1 : comp4 USE ENTITY WORK.nibble_comparator(iterative); -- SIGNAL a, b : BIT_VECTOR (3 DOWNTO 0); SIGNAL eql, lss, gtr, gnd : BIT; SIGNAL vdd : BIT := '1'; -- BEGIN a1: comp4 PORT MAP (a, b, gnd, vdd, gnd, gtr, eql, lss); -- Entity nibble_comparator_test_bench IS End nibble_comparator_test_bench ; -- ARCHITECTURE input_output OF nibble_comparator_test_bench IS -- COMPONENT comp4 PORT (a, b : IN bit_vector (3 DOWNTO 0); gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END COMPONENT; -- FOR a1 : comp4 USE ENTITY WORK.nibble_comparator(iterative); -- SIGNAL a, b : BIT_VECTOR (3 DOWNTO 0); SIGNAL eql, lss, gtr, gnd : BIT; SIGNAL vdd : BIT := '1'; -- BEGIN a1: comp4 PORT MAP (a, b, gnd, vdd, gnd, gtr, eql, lss); --

2-22 …Testbench Example a2: a <= "0000", -- a = b (steady state) "1111" AFTER 0500 NS, -- a > b (worst case) "1110" AFTER 1500 NS, -- a < b (worst case) "1110" AFTER 2500 NS, -- a > b (need bit 1 info) "1010" AFTER 3500 NS, -- a < b (need bit 2 info) "0000" AFTER 4000 NS, -- a < b (steady state, prepare FOR next) "1111" AFTER 4500 NS, -- a = b (worst case) "0000" AFTER 5000 NS, -- a < b (need bit 3 only, best case) "0000" AFTER 5500 NS, -- a = b (worst case) "1111" AFTER 6000 NS; -- a > b (need bit 3 only, best case) -- a3 : b <= "0000", -- a = b (steady state) "1110" AFTER 0500 NS, -- a > b (worst case) "1111" AFTER 1500 NS, -- a < b (worst case) "1100" AFTER 2500 NS, -- a > b (need bit 1 info) "1100" AFTER 3500 NS, -- a < b (need bit 2 info) "1101" AFTER 4000 NS, -- a < b (steady state, prepare FOR next) "1111" AFTER 4500 NS, -- a = b (worst case) "1110" AFTER 5000 NS, -- a < b (need bit 3 only, best case) "0000" AFTER 5500 NS, -- a = b (worst case) "1110" AFTER 6000 NS; -- a > b (need bit 3 only, best case) END input_output; a2: a <= "0000", -- a = b (steady state) "1111" AFTER 0500 NS, -- a > b (worst case) "1110" AFTER 1500 NS, -- a < b (worst case) "1110" AFTER 2500 NS, -- a > b (need bit 1 info) "1010" AFTER 3500 NS, -- a < b (need bit 2 info) "0000" AFTER 4000 NS, -- a < b (steady state, prepare FOR next) "1111" AFTER 4500 NS, -- a = b (worst case) "0000" AFTER 5000 NS, -- a < b (need bit 3 only, best case) "0000" AFTER 5500 NS, -- a = b (worst case) "1111" AFTER 6000 NS; -- a > b (need bit 3 only, best case) -- a3 : b <= "0000", -- a = b (steady state) "1110" AFTER 0500 NS, -- a > b (worst case) "1111" AFTER 1500 NS, -- a < b (worst case) "1100" AFTER 2500 NS, -- a > b (need bit 1 info) "1100" AFTER 3500 NS, -- a < b (need bit 2 info) "1101" AFTER 4000 NS, -- a < b (steady state, prepare FOR next) "1111" AFTER 4500 NS, -- a = b (worst case) "1110" AFTER 5000 NS, -- a < b (need bit 3 only, best case) "0000" AFTER 5500 NS, -- a = b (worst case) "1110" AFTER 6000 NS; -- a > b (need bit 3 only, best case) END input_output;

2-23 Different Binding Schemes Entity sr_latch IS Port (S, R, C : IN Bit; q : Out Bit); END sr_latch; ARCHITECTURE Wrong OF sr_latch IS COMPONENT n2 PORT (i1, i2: IN BIT; o1: OUT BIT); END COMPONENT; FOR ALL : n2 USE ENTITY WORK.nand2 (single_delay); SIGNAL im1, im2, im4 : BIT; BEGIN g1 : n2 PORT MAP (s, c, im1); g2 : n2 PORT MAP (r, c, im2); g3 : n2 PORT MAP (im1, im4, q); g4 : n2 PORT MAP (q, im2, im4); -- Error … q declared as Output END Wrong; Entity sr_latch IS Port (S, R, C : IN Bit; q : Out Bit); END sr_latch; ARCHITECTURE Wrong OF sr_latch IS COMPONENT n2 PORT (i1, i2: IN BIT; o1: OUT BIT); END COMPONENT; FOR ALL : n2 USE ENTITY WORK.nand2 (single_delay); SIGNAL im1, im2, im4 : BIT; BEGIN g1 : n2 PORT MAP (s, c, im1); g2 : n2 PORT MAP (r, c, im2); g3 : n2 PORT MAP (im1, im4, q); g4 : n2 PORT MAP (q, im2, im4); -- Error … q declared as Output END Wrong; USE 4 2-Input NAND gates to design an SR latch

2-24 SR Latch Modeling … Fix #1 (Same Architecture -- Change mode of q to Inout) Entity sr_latch IS Port (S, R, C : IN Bit; q : InOut Bit); END sr_latch; Fix #2 (Same Architecture -- Change mode of q to Buffer) Entity sr_latch IS Port (S, R, C : IN Bit; q : Buffer Bit); END sr_latch;

2-25 … SR Latch Modeling … Fix #3 (Use Local Signal—Mode of q is maintained as Out) ARCHITECTURE Problem OF sr_latch IS COMPONENT n2 PORT (i1, i2: IN BIT; o1: OUT BIT); PORT (i1, i2: IN BIT; o1: OUT BIT); END COMPONENT; FOR ALL : n2 USE ENTITY WORK.nand2 (single_delay); SIGNAL im1, im2, im3, im4 : BIT; BEGIN g1 : n2 PORT MAP (s, c, im1); g2 : n2 PORT MAP (r, c, im2); g3 : n2 PORT MAP (im1, im4, im3); g4 : n2 PORT MAP (im3, im2, im4); q <= im3; END Problem; Correct Syntax  Problem Oscillating If all delays are equal then (0,0) on (q, qbar) will oscillate Remedy by using gates of different delay values

2-26 … SR Latch Modeling ARCHITECTURE fast_single_delay OF nand2 IS BEGIN o1 <= i1 NAND i2 AFTER 1 NS; END fast_single_delay; ARCHITECTURE gate_Level OF sr_latch IS COMPONENT n2 PORT (i1, i2: IN BIT; o1: OUT BIT); END COMPONENT; FOR g1, g3 : n2 USE ENTITY WORK.nand2 (fast_single_delay); FOR g2, g4 : n2 USE ENTITY WORK.nand2 (single_delay); SIGNAL im1, im2, im3, im4 : BIT; BEGIN g1 : n2 PORT MAP (s, c, im1); g2 : n2 PORT MAP (r, c, im2); g3 : n2 PORT MAP (im1, im4, im3); g4 : n2 PORT MAP (im3, im2, im4); q <= im3; END gate_Level;

2-27 Binding 3-Input NAND Entity (Different Delay) to 2-Input “NAND” Component ARCHITECTURE gate_level OF sr_latch IS COMPONENT n2 PORT (x, y: in BIT; z: out BIT); END COMPONENT; FOR g1, g3 : n2 USE ENTITY WORK.nand2 (single_delay) PORT MAP (x, y, z); FOR g2, g4 : n2 USE ENTITY WORK.nand3 (single_delay) PORT MAP (x, x, y, z); SIGNAL im1, im2, im3, im4 : BIT; BEGIN g1 : n2 PORT MAP (s, c, im1); g2 : n2 PORT MAP (r, c, im2); g3 : n2 PORT MAP (im1, im4, im3); g4 : n2 PORT MAP (im3, im2, im4); q <= im3; END gate_level;

2-28 Port Map Association … Instance Actual Signals Component. Local Ports Entity Formal Ports Config. Spec.

2-29 … Port Map Association n Association is done in two steps: n Instance-To-Component (Actuals  Component Local Ports) n Componenet-To-Entity (Configuration Port Map) (Component Local Ports  Entity Formal Ports) Specifying PORT MAP in Configuration Statements is Optional PORT MAP of COMPONENT declaration is the default To Override Component Local Port Names, USE PORT MAP in configuration declaration IF No Port Map is Specified in Configuration Statement, Local Port Names of COMPONENT declaration are the Default and they must be the Same as the Formals of the Design Entity. n Association is done in two steps: n Instance-To-Component (Actuals  Component Local Ports) n Componenet-To-Entity (Configuration Port Map) (Component Local Ports  Entity Formal Ports) Specifying PORT MAP in Configuration Statements is Optional PORT MAP of COMPONENT declaration is the default To Override Component Local Port Names, USE PORT MAP in configuration declaration IF No Port Map is Specified in Configuration Statement, Local Port Names of COMPONENT declaration are the Default and they must be the Same as the Formals of the Design Entity.

2-30 Default Binding n Default Binding: Component instance is Bound to an Entity which: Has the same NAME as the Component Has the same number of Ports as the Component Ports must have the Same Name, Type and be of Compatible modes The most Recently analyzed Architecture will Be used A declared Signal can be associated with A Formal Port of Any Mode as long as it has the Same Type n Port Compatibility: Formal => Actual n Default Binding: Component instance is Bound to an Entity which: Has the same NAME as the Component Has the same number of Ports as the Component Ports must have the Same Name, Type and be of Compatible modes The most Recently analyzed Architecture will Be used A declared Signal can be associated with A Formal Port of Any Mode as long as it has the Same Type n Port Compatibility: Formal => Actual INOUTINOUTBUFFER INXX OUTXX INOUTX BUFFER X Actual`s Mode (Instance Ports) Formal`s Mode Entity Formal Ports

2-31 Use of Configuration Specifications

2-32 Sequential Comparator … n Compare consecutive sets of data on an 8-bit input bus. n Data on the input bus are synchronized with a clock signal (new value on falling edge of clock) n Compare consecutive sets of data on an 8-bit input bus. n Data on the input bus are synchronized with a clock signal (new value on falling edge of clock)

2-33 D-LatchD-Latch ENTITY d_latch IS PORT (d, c : IN BIT; q: OUT BIT); END d_latch; -- ARCHITECTURE sr_based OF d_latch IS COMPONENT sr_latch PORT (s, r, C : IN BIT; q : OUT BIT); END COMPONENT; COMPONENT inv PORT (i1 : IN BIT; o1 : OUT BIT); END COMPONENT; SIGNAL dbar: BIT; BEGIN c1 : sr_latch PORT MAP (d, dbar, c, q); c2 : inv PORT MAP (d, dbar); END sr_based; ENTITY d_latch IS PORT (d, c : IN BIT; q: OUT BIT); END d_latch; -- ARCHITECTURE sr_based OF d_latch IS COMPONENT sr_latch PORT (s, r, C : IN BIT; q : OUT BIT); END COMPONENT; COMPONENT inv PORT (i1 : IN BIT; o1 : OUT BIT); END COMPONENT; SIGNAL dbar: BIT; BEGIN c1 : sr_latch PORT MAP (d, dbar, c, q); c2 : inv PORT MAP (d, dbar); END sr_based;

2-34 Byte Latch ENTITY byte_latch IS PORT ( di : IN BIT_VECTOR (7 DOWNTO 0); clk : IN BIT; qo : OUT BIT_VECTOR( 7 DOWNTO 0)); END byte_latch; -- ARCHITECTURE iterative OF byte_latch IS COMPONENT d_latch PORT (d, c : IN BIT; q : OUT BIT); END COMPONENT; BEGIN g : FOR i IN di'RANGE GENERATE L7DT0 : d_latch PORT MAP (di(i), clk, qo(i)); END GENERATE; END iterative; ENTITY byte_latch IS PORT ( di : IN BIT_VECTOR (7 DOWNTO 0); clk : IN BIT; qo : OUT BIT_VECTOR( 7 DOWNTO 0)); END byte_latch; -- ARCHITECTURE iterative OF byte_latch IS COMPONENT d_latch PORT (d, c : IN BIT; q : OUT BIT); END COMPONENT; BEGIN g : FOR i IN di'RANGE GENERATE L7DT0 : d_latch PORT MAP (di(i), clk, qo(i)); END GENERATE; END iterative;

2-35 … Sequential Comparator … ENTITY old_new_comparator IS PORT (i : IN BIT_VECTOR (7 DOWNTO 0); clk : IN BIT; compare : OUT BIT); END old_new_comparator; -- ARCHITECTURE wiring Of old_new_comparator IS COMPONENT byte_latch PORT (di : IN BIT_VECTOR (7 DOWNTO 0); clk : IN BIT; qo : OUT BIT_VECTOR (7 DOWNTO 0)); END COMPONENT; COMPONENT byte_comparator PORT (a, b : BIT_VECTOR (7 DOWNTO 0); gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END COMPONENT; SIGNAL con1 : BIT_VECTOR (7 DOWNTO 0); SIGNAL vdd : BIT := '1'; SIGNAL gnd : BIT := '0'; ENTITY old_new_comparator IS PORT (i : IN BIT_VECTOR (7 DOWNTO 0); clk : IN BIT; compare : OUT BIT); END old_new_comparator; -- ARCHITECTURE wiring Of old_new_comparator IS COMPONENT byte_latch PORT (di : IN BIT_VECTOR (7 DOWNTO 0); clk : IN BIT; qo : OUT BIT_VECTOR (7 DOWNTO 0)); END COMPONENT; COMPONENT byte_comparator PORT (a, b : BIT_VECTOR (7 DOWNTO 0); gt, eq, lt : IN BIT; a_gt_b, a_eq_b, a_lt_b : OUT BIT); END COMPONENT; SIGNAL con1 : BIT_VECTOR (7 DOWNTO 0); SIGNAL vdd : BIT := '1'; SIGNAL gnd : BIT := '0';

2-36 … Sequential Comparator BEGIN l : byte_latch PORT MAP (i, clk, con1); c : byte_comparator PORT MAP (con1, i, gnd, vdd, gnd, OPEN, compare, OPEN); END wiring; BEGIN l : byte_latch PORT MAP (i, clk, con1); c : byte_comparator PORT MAP (con1, i, gnd, vdd, gnd, OPEN, compare, OPEN); END wiring;  Unconnected Outputs  OPEN  Unconnected Inputs (Only with Default Specified)  OPEN