Design of Binary Arithmetic Circuits Experiment 7.

Slides:



Advertisements
Similar presentations
Modular Combinational Logic
Advertisements

Documentation Standards
Combinational Logic with Verilog Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer.
EELE 367 – Logic Design Module 4 – Combinational Logic Design with VHDL Agenda 1.Decoders/Encoders 2.Multiplexers/Demultiplexers 3.Tri-State Buffers 4.Comparators.
Tutorial: Wednesday Week 3 Hand in on Monday, Do the questions for tutorials 1 & 2 at the back of the course notes (answers to tutorial 3 will be published.
Arithmetic Operations and Circuits
ECE 331 – Digital System Design
CSE-221 Digital Logic Design (DLD)
Chapter # 5: Arithmetic Circuits Contemporary Logic Design Randy H
ECE 301 – Digital Electronics
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
Chapter 7 Arithmetic Operations and Circuits Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits.
Counting with Sequential Logic Experiment 8. Experiment 7 Questions 1. Determine the propagation delay (in number of gates) from each input to each output.
Logic Gates Combinational Circuits
Combinational Logic in Verilog
Introduction to Digital Logic Design Appendix A of CO&A Dr. Farag
Top-down modular design
Adders and Multipliers Review. ARITHMETIC CIRCUITS Is a combinational circuit that performs arithmetic operations, e.g. –Addition –Subtraction –Multiplication.
Combinational and Sequential Logic Circuits.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
ECE 3130 – Digital Electronics and Design
Digital Arithmetic and Arithmetic Circuits
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
IKI a-Combinatorial Components Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture Notes.
Power Point Presentation Donald Bearden CS 147 September 13, 2001.
Chapter # 5: Arithmetic Circuits
Chapter 6-1 ALU, Adder and Subtractor
HCL and ALU תרגול 10. Overview of Logic Design Fundamental Hardware Requirements – Communication: How to get values from one place to another – Computation.
1 Combinational Logic Design Digital Computer Logic Kashif Bashir
Lecture 9 Topics: –Combinational circuits Basic concepts Examples of typical combinational circuits –Half-adder –Full-adder –Ripple-Carry adder –Decoder.
Combinational Building Blocks: Encoders and Decoders Experiment 6.
1 Arithmetic Logic Unit ALU. 2 The Bus Concept 3 CPU Building Blocks  Registers (IR, PC, ACC)  Control Unit (CU)  Arithmetic Logic Unit (ALU)
Computing Systems Designing a basic ALU.
Design of Binary Arithmetic Circuits Experiment 7.
CHAPTER 4 Combinational Logic Design- Arithmetic Operation (Section 4.6&4.9)
Arithmetic Logic Unit (ALU) Anna Kurek CS 147 Spring 2008.
Digital Logic. 2 Abstractions in CS (gates) Basic Gate: Inverter IO IO GNDI O Vcc Resister (limits conductivity) Truth Table.
Logic Design CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
Lab 4 Report Comments: Procedure Ordering in lab reportProcedure Ordering in lab report report should follow logical flow of what you did in experiment:
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexer Circuits.
1 CS 151: Digital Design Chapter 4: Arithmetic Functions and Circuits 4-1,2: Iterative Combinational Circuits and Binary Adders.
Logic and computers 2/6/12. Binary Arithmetic /6/ Only two digits: the bits 0 and 1 (Think: 0 = F, 1.
Logic Gates Informatics INFO I101 February 3, 2003 John C. Paolillo, Instructor.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 7 Dr. Shi Dept. of Electrical and Computer Engineering.
1  2004 Morgan Kaufmann Publishers Lets Build a Processor Almost ready to move into chapter 5 and start building a processor First, let’s review Boolean.
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
1 ECE 545—Digital System Design with VHDL Lecture 1 Digital Logic Refresher Part A – Combinational Logic Building Blocks.
Lecture #23: Arithmetic Circuits-1 Arithmetic Circuits (Part I) Randy H. Katz University of California, Berkeley Fall 2005.
CS151 Introduction to Digital Design Chapter 4: Arithmetic Functions and HDLs 4-1: Iterative Combinational Circuits 4-2: Binary Adders 1Created by: Ms.Amany.
C OMBINATIONAL L OGIC D ESIGN 1 Eng.Maha AlGubali.
Explain Half Adder and Full Adder with Truth Table.
Mu.com.lec 11.  Used not only to perform addition but also to perform subtraction, multiplication and division  The most basic of the adders is the.
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
Chapter 36 Combinational Logic Circuits. Objectives After completing this chapter, you will be able to: –Describe the functions of encoders, decoders,
Combinational Design, Part 2: Procedure. 2 Topics Positive vs. negative logic Design procedure.
ECE 3130 Digital Electronics and Design
Structural style Modular design and hierarchy Part 1
ECE 3130 Digital Electronics and Design
Swamynathan.S.M AP/ECE/SNSCT
Summary Half-Adder Basic rules of binary addition are performed by a half adder, which has two binary inputs (A and B) and two binary outputs (Carry out.
EEL 3705 / 3705L Digital Logic Design
Chapter 6 Functions of Combinational Logic
Combinatorial Logic Design Practices
Lecture 8 Logistics Last lecture Last last lecture Today
Digital Logic.
Digital System Design Combinational Logic
XOR Function Logic Symbol  Description  Truth Table 
Adder Circuits By: Asst Lec. Basma Nazar
Arithmetic Circuits.
Presentation transcript:

Design of Binary Arithmetic Circuits Experiment 7

Lab Report Comments: VHDL code should be easily readableVHDL code should be easily readable –Proper indentation –Commented –Title banner (names, description, etc) –No line wrap! –Self commented names Include block diagramsInclude block diagrams –Especially if multiple devices interconnected

Lab Report Comments: Circuit Diagrams: ALWAYS INCLUDE ! –Titled with a descriptive name for the circuit –Brief verbal description of the circuit's function / purpose (what does it do?) –Circuit schematic and/or block diagram Include all input/output signalsInclude all input/output signals –When circuits are implemented in VHDL, signal names on schematics should match signal names used in your VHDL code Include all input/output signals sources / destinations on the Development Board (switches, LEDs, etc.)Include all input/output signals sources / destinations on the Development Board (switches, LEDs, etc.) If combining multiple modules, show each module and the interconnectionsIf combining multiple modules, show each module and the interconnections –Not just 1 big “black box” for the whole thing.

Modular Design & Design Reuse Best to “reuse” a previously-designed, tested, verified VHDL module with as little change as possible –…or NONE, if possible! –Changes negate the benefits of having a “proven, working” design Ex: Rewriting the BCD-7seg in Exp 6 to use only 3-bit inputs (to match Priority Enc output) was not the “best” solution This week, we will use a more powerful implementation of “Modular Design”…….. VHDL Structural Modeling

VHDL Structural Modeling Reflects modern digital circuit design practice Supports preferred digital design approach Hierarchical (Top-Down) Design

VHDL Structural Modeling Hierarchical (Top-Down) Design Digital Alarm System BCD-7 Seg Decoder Priority Encoder 4-bit Digital Comparator Alarm Controller FSM AND_2 (AND gate) NOR_2 (NOR gate) 1-bit Digital Comparator D Flip-Flop (This is an Example of Multi-level Hierarchical Design. It is NOT necessarily how YOU should complete Exp 9.)

VHDL Structural Modeling Reflects modern digital circuit design practice Supports preferred digital design approach: Hierarchical (Top-Down) Design Leverages software design techniques Supports readability, understandability, and reuse of code Allows for easy scalability of design Allows for the use of library-based modules

Instructional Objectives: To use concurrent VHDL statements in the design of arithmetic circuitsTo use concurrent VHDL statements in the design of arithmetic circuits –Half Adder –Full Adder Use “Structural Modeling” in VHDLUse “Structural Modeling” in VHDL –4-bit Ripple Carry Adder –Using Half Adder & Full Adder as “Components” –“Top Module” in same “Project” as Half Adder & Full Adder To design a 4-bit Comparator (need for Alarm System)To design a 4-bit Comparator (need for Alarm System) –Any VHDL Model style (architecture) you like (Hint: Probably NOT structural!)(Hint: Probably NOT structural!)

1-Bit Binary Addition To Add Two Single-Bit Binary Numbers: A0A0B0B0 Sum S0 Carry CO ut A0B0A0B0 A0B0A0B0 1-Bit Binary Adder Half Adder Half Adder A i B i CO i S i A 0 B 0 S0S0 CO 0

Multiple-Bit Binary Addition Alternative Approach: Modular Design Use same approach as manual computation Apply the same basic binary addition rules at each bit position Need to handle “Carry In” for higher bit position additions Modular Approach Design a 1-bit “Full Adder” for 2 numbers + Carry In Reuse the design for each upper bit position A 3 A 2 A 1 A 0 + B 3 B 2 B 1 B 0 CO S 3 CO 2 S 2 CO 1 S 1 CO 0 S 0 A B 3-0 _______________________ CO S 3-0 CI 1 CI 2 CI 3

Input VariablesOutputs ABCI n Carry CO ut S um Bit Binary Full Adder To Add Two 1-Bit Binary Numbers w/Carry In : Input VariablesOutputs ABCI n Carry CO ut S um ?? 101?? 110?? 111?? Full Adder A i B i C I i CO i S i A B CI S CO

4- Bit Ripple-Carry Adder A 3 A 2 A 1 A 0 + B 3 B 2 B 1 B 0 S 3 S 2 S 1 S 0 Full Adder A i B i CI i CO i S i A 3 B 3 CI 3 S3S3 CO 3 Full Adder A i B i CI i CO i S i A 2 B 2 CI 2 S2S2 CO 2 Full Adder A i B i CI i CO i S i A 1 B 1 CI 1 S1S1 CO 1 Half Adder A i B i CO i S i A 0 B 0 S0S0 CO 0 CI 1 CI 2 CI 3 CO 0 CO 1 CO 2 COut

VHDL Concurrent Statement Refresher ARCHITECTURE mad_hatter OF myhalfadder IS BEGIN concurrent statement1; -- half adder sum equation concurrent statement2; -- half adder carry equation END myarch;

VHDL Structural Modeling Similar to higher level language programming Example circuit

VHDL Code for “Modules”

Structural VHDL Code A F B A F B A F B

Code3 Code2 Code1 Code0 EQ I3 I2 I1 I0 Key Comparator 4 switches (access code) I7 I6 I5 Y2 I4 Y1 I3 Y0 I2 I1 STROBE I0 Priority Encoder 4 switches (sensors) Connect to ground Break-in Armed OFF/ON_L Alarm B3 B2 AA-AG B1 CATH B0 7-Seg Decoder Alarm Control Digital Alarm System Experiment 7 P3 Preset Secret Code 4-Bit Comparator

Given two 4-bit binary numbers, A and B, determine if they are equal. Multiple solutions: –Subtract B from A and test for zero result –Use VHDL operators require special libraries –Use XNOR gates to do a bitwise comparison

Experiment 7 Overview P1:Design, test, and implement a Half Adder P2: Design, test, and implement a Full Adder P3:Design and implement a 4-bit Ripple Carry Adder Using Structural Modeling - Behavioral Simulation P4:Design and implement a 4-bit Comparator Save for use in Experiment 9

4-bit sum Of A+B Nexys Development Board Carry out EQUAL AB

Place & Route Post-Route Simulation Behavioral Simulation Design Verification Steps Is the basic logic correct? Does the design still work with the actual devices used ( with prop. delays, etc.) ? An important step for “real world” designs!!

Testing Strategies We want to create input signal “test vectors” that will: Verify all important functions of our designs are working properly Be THOROUGH….. –Cover as many functions / cases as possible …..AND be EFFICIENT –Use as few test cases (vectors) as possible

Testing Strategies Possible Approaches: 1.Test ALL POSSIBLE input combinations (Truth Table) –Thorough!! –Good approach if the number of inputs is small. If not reasonable, then consider: 2.Targeted Functional Testing –What are the important functions to verify? –What is already proven? (reuse)...what is not? –What could have gone wrong in the design that I should check for? –How can we test each issue as efficiently as possible? If it ain’t too bad,…Why not???

Then,… BRAINSTORM

Testing the Half & Full Adders Full Adder A i B i CI i CO i S i A 1 B 1 CI 1 S1S1 CO 1 Half Adder A i B i CO i S i A 0 B 0 S0S0 CO 0 How would you suggest testing these two devices? What method / test vectors would you choose?

Testing the Ripple-Carry Adder Full Adder A i B i CI i CO i S i CI 3 S3S3 CO 3 Full Adder A i B i CI i CO i S i A 2 B 2 CI 2 S2S2 CO 2 Full Adder A i B i CI i CO i S i A 1 B 1 CI 1 S1S1 CO 1 Half Adder A i B i CO i S i A 0 B 0 S0S0 CO 0 COut A 3 B 3 How many input signals? How many Test Vectors to test ALL CASES? 4 (A) + 4 (B) = = 256 Good Luck!!

Testing the Ripple-Carry Adder Full Adder A i B i CI i CO i S i CI 3 S3S3 CO 3 Full Adder A i B i CI i CO i S i A 2 B 2 CI 2 S2S2 CO 2 Full Adder A i B i CI i CO i S i A 1 B 1 CI 1 S1S1 CO 1 Half Adder A i B i CO i S i A 0 B 0 S0S0 CO 0 COut A 3 B 3 If you’ve already proven that the Half Adder & Full Adder designs are OK,… What other “features” of the RCA do you need to verify? What “mistakes” could you have made in the structural design that you should check for?

4- Bit Comparator ABAB 4-bit Digital Comparator = 1 : if A = B = 0 : if A \= B 4 4 EQUAL Verification Testing of the How might we approach “efficiently” testing this device?

Ideas for testing HA & FA: Test all RCA: –Inputs connected right? A3->InA3, B3->InB3, etc Test each bit position (i): A i =1, A rest =0, B=0000; generates SUMi=1, no carries –Example: Bit 1: A = 0010, B = 0000, Sum = 0010? CarryOut=0? Test each bit position (i): B i =1, B rest =0, A=0000; generates SUMi=1, no carries –Example: Bit 2: A = 0000, B = 0100, Sum = 0100? CarryOut=0? –Carry ripple connected right? Generate carry from LSB all way to carryout A=1111, B=0001 Generate sum with no carries Comparator EQUAL= 1 For All bits equal with 1’s A=1111, B=1111 EQUAL= 1 For All bits equal with 0’s A=0000, B=0000 EQUAL= 1 For All bits equal alternating bits EQUAL= 0 For All Equal except 1 bit: