Figure 5.1 Conversion from decimal to binary. Table 5.1 Numbers in different systems.

Slides:



Advertisements
Similar presentations
Adder Discussion D6.2 Example 17. s i = c i ^ (a i ^ b i ) c i+1 = a i * b i + c i * (a i ^ b i ) Full Adder (Appendix I)
Advertisements

VHDL ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
Arithmetic Operations and Circuits
ECE 331 – Digital System Design
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448.
ECE 331 – Digital System Design Single-bit Adder Circuits and Adder Circuits in VHDL (Lecture #12) The slides included herein were taken from the materials.
ECE 331 – Digital System Design
CSET 4650 Field Programmable Logic Devices Dan Solarek VHDL Behavioral & Structural.
Chapter 7 Arithmetic Operations and Circuits Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits.
Arithmetic Operations and Circuits
L23 – Arithmetic Logic Units. Arithmetic Logic Units (ALU)  Modern ALU design  ALU is heart of datapath  Ref: text Unit 15 9/2/2012 – ECE 3561 Lect.
AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’.
CS 105 Digital Logic Design
George Mason University Modeling of Arithmetic Circuits ECE 545 Lecture 7.
 Seattle Pacific University EE Logic System DesignCADNumbers-1 Arithmetic and CAD Tools CAD tools work great with arithmetic functions Adding,subtracting,multiplying,
Digital Arithmetic and Arithmetic Circuits
A.7 Concurrent Assignment Statements Used to assign a value to a signal in an architecture body. Four types of concurrent assignment statements –Simple.
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
VHDL TUTORIAL Preetha Thulasiraman ECE 223 Winter 2007.
Figure 5.1. Conversion from decimal to binary.. Table 5.1. Numbers in different systems.
Figure 5.1. Conversion from decimal to binary.. Table 5.1. Numbers in different systems.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
CWRU EECS 317 EECS 317 Computer Design LECTURE 1: The VHDL Adder Instructor: Francis G. Wolff Case Western Reserve University.
ECE 331 – Digital System Design Single-bit Adder Circuits and Adder Circuits in VHDL (Lecture #11) The slides included herein were taken from the materials.
1 CS 151: Digital Design Chapter 4: Arithmetic Functions and Circuits 4-1,2: Iterative Combinational Circuits and Binary Adders.
2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2.
CEC 220 Digital Circuit Design More VHDL Fri, February 27 CEC 220 Digital Circuit Design Slide 1 of 15.
2/10/07DSD,USIT,GGSIPU1 BCD adder KB3B2B1B0CD3D2D1D
Digital System Projects
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 5: Arithmetic Circuits Chapter 5 (minus 5.3.4)
CS/EE 3700 : Fundamentals of Digital System Design
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
VHDL ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
Number Representation and Arithmetic Circuits
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
CS151 Introduction to Digital Design Chapter 4: Arithmetic Functions and HDLs 4-1: Iterative Combinational Circuits 4-2: Binary Adders 1Created by: Ms.Amany.
Explain Half Adder and Full Adder with Truth Table.
Logic Design (CE1111 ) Lecture 4 (Chapter 4) Combinational Logic Prepared by Dr. Lamiaa Elshenawy 1.
1 Digital Logic Design (41-135) Chapter 5 Number Representation & Arithmetic Circuits Younglok Kim Dept. of Electrical Engineering Sogang University Spring.
Gunjeet Kaur Dronacharya Group of Institutions. Binary Adder-Subtractor A combinational circuit that performs the addition of two bits is called a half.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
1 Computer Architecture & Assembly Language Spring 2009 Dr. Richard Spillman Lecture 11 – ALU Design.
LAB #5 Modular Design and Hierarchy using VHDL
Combinational logic circuit
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Instructor: Tor Aamodt
ENG6530 Reconfigurable Computing Systems
ECE 331 – Digital System Design
HDL Programming Fundamentals
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
VHDL VHSIC Hardware Description Language VHSIC
FIGURE 4.1 Block diagram of combinational circuit
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
VHDL (VHSIC Hardware Description Language)
Instructor: Alexander Stoytchev
Chapter 5 – Number Representation and Arithmetic Circuits
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
ECE 331 – Digital System Design
Data Flow Description of Combinational-Circuit Building Blocks
Instructor: Alexander Stoytchev
Instructor: Alexander Stoytchev
Data Flow Description of Combinational-Circuit Building Blocks
Instructor: Alexander Stoytchev
Digital Logic with VHDL
Presentation transcript:

Figure 5.1 Conversion from decimal to binary

Table 5.1 Numbers in different systems

Figure 5.2 Half-adder Please see “portrait orientation” PowerPoint file for Chapter 5

Figure 5.3 An example of addition

Figure 5.4 Full-adder Please see “portrait orientation” PowerPoint file for Chapter 5

Figure 5.5 A decomposed implementation of the full-adder circuit HA s c s c c i x i y i c i1+ s i c i x i y i c i1+ s i (a) Block diagram (b) Detailed diagram

Figure 5.6 An n-bit ripple-carry adder FA x n –1 c n c n1” y n1– s n1– FA x 1 c 2 y 1 s 1 c 1 x 0 y 0 s 0 c 0 MSB positionLSB position

Figure 5.8 Formats for representation of integers b n1– b 1 b 0 Magnitude MSB (a) Unsigned number b n1– b 1 b 0 Magnitude Sign (b) Signed number b n2– 0 denotes 1 denotes + –MSB

Table 5.2 Interpretation of four-bit signed integers

Figure 5.9 Examples of 1’s complement addition () 5–  3-  + 5–  7–  + 2–  5+ () 2+ () 7+ () + 5+ () 3+ () + 2– 

Figure 5.10 Examples of 2’s complement addition ignore 5+ () 2+ () 7+ () + 5+ () 3+ () + 2– () 2+ () 5– () 3– () + 5– () 7– () + 2– ()

Figure 5.11 Examples of 2’s complement subtraction – () 2+ () 3+ () – 1 ignore – – 1 ignore – () 7+ () – – () 7– () 2+ () 2– () – – – () 5– () 3– ()

Figure 5.12 Graphical interpretation of four-bit 2’s complement numbers – – 3– 4– 5– 6– 7– 8– 0

Figure 5.13 Adder/subtractor unit s 0 s 1 s n1– x 0 x 1 x n1– c n n-bit adder y 0 y 1 y n1– c 0 Add ¤ Sub control

Figure 5.14 Examples of determination of overflow () 2+ () 9+ () () 5+ () + 2– () 11 c 4 0= c 3 1= c 4 0= c 3 0= c 4 1= c 3 1= c 4 1= c 3 0= 2+ () 7– () 5– () + 7– () 9– () +2– ()

x 1 y 1 g 1 p 1 s 1 Stage 1 x 0 y 0 g 0 p 0 s 0 Stage 0 c 0 c 1 c 2 Figure 5.15 A ripple-carry adder with generate/propagate signals

Figure 5.16 The first two stages of a carry-lookahead adder x 1 y 1 g 1 p 1 s 1 x 0 y 0 s 0 c 2 x 0 y 0 c 0 c 1 g 0 p 0

Figure 5.17 A hierarchical carry-lookahead adder with ripple-carry between blocks Block x 3124– c 32 c 24 y 3124– s 3124– x 158– c 16 y 158– s 8– c 8 x 70– y 70– s 70– c 0 3 Block 1 0

Figure 5.18 A hierarchical carry-lookahead adder Block x 158– y 8– x 70– y 70– 3 Block 1 0 Second-level lookahead c 0 s 70– P 0 G 0 P 1 G 1 P 3 G 3 s 158– s 3124– c 8 c 16 c 32 x 3124– y 3124– c

Figure 5.19 An alternative design for a carry-lookahead adder x 1 y 1 g 1 p 1 s 1 s 0 c 2 x 0 y 0 c 0 c 1 g 0 p 0

Figure 5.20 Schematic using an LPM adder/subtractor module

Figure 5.21 Simulation results for the LPM adder Optimized for cost Optimized for speed

Figure 5.23 VHDL code for the full-adder LIBRARY ieee ; USE ieee.std_logic_1164.all ; ENTITY fulladd IS PORT (Cin, x, y: IN STD_LOGIC ; s, Cout: OUT STD_LOGIC ) ; END fulladd ; ARCHITECTURE LogicFunc OF fulladd IS BEGIN s <= x XOR y XOR Cin ; Cout <= (x AND y) OR (Cin AND x) OR (Cin AND y) ; END LogicFunc ;

Figure 5.24 VHDL code for a four-bit adder LIBRARY ieee ; USE ieee.std_logic_1164.all ; ENTITY adder4 IS PORT (Cin: IN STD_LOGIC ; x3, x2, x1, x0 : IN STD_LOGIC ; y3, y2, y1, y0 : IN STD_LOGIC ; s3, s2, s1, s0 : OUT STD_LOGIC ; Cout : OUT STD_LOGIC ) ; END adder4 ; ARCHITECTURE Structure OF adder4 IS SIGNAL c1, c2, c3 : STD_LOGIC ; COMPONENT fulladd PORT ( Cin, x, y : IN STD_LOGIC ; s, Cout : OUT STD_LOGIC ) ; END COMPONENT ; BEGIN stage0: fulladd PORT MAP ( Cin, x0, y0, s0, c1 ) ; stage1: fulladd PORT MAP ( c1, x1, y1, s1, c2 ) ; stage2: fulladd PORT MAP ( c2, x2, y2, s2, c3 ) ; stage3: fulladd PORT MAP ( Cin => c3, Cout => Cout, x => x3, y => y3, s => s3 ) ; END Structure ;

Figure 5.25 Declaration of a package LIBRARY ieee ; USE ieee.std_logic_1164.all ; PACKAGE fulladd_package IS COMPONENT fulladd PORT ( Cin, x, y : IN STD_LOGIC ; s, Cout : OUT STD_LOGIC ) ; END COMPONENT ; END fulladd_package ;

Figure 5.26 Using a package for the four-bit adder LIBRARY ieee ; USE ieee.std_logic_1164.all ; USE work.fulladd_package.all ; ENTITY adder4 IS PORT ( Cin : IN STD_LOGIC ; x3, x2, x1, x0 : IN STD_LOGIC ; y3, y2, y1, y0 : IN STD_LOGIC ; s3, s2, s1, s0 : OUT STD_LOGIC ; Cout : OUT STD_LOGIC ) ; END adder4 ; ARCHITECTURE Structure OF adder4 IS SIGNAL c1, c2, c3 : STD_LOGIC ; BEGIN stage0: fulladd PORT MAP ( Cin, x0, y0, s0, c1 ) ; stage1: fulladd PORT MAP ( c1, x1, y1, s1, c2 ) ; stage2: fulladd PORT MAP ( c2, x2, y2, s2, c3 ) ; stage3: fulladd PORT MAP ( Cin => c3, Cout => Cout, x => x3, y => y3, s => s3 ) ; END Structure ;

Figure 5.27 A four-bit adder defined using multibit signals LIBRARY ieee ; USE ieee.std_logic_1164.all ; USE work.fulladd_package.all ; ENTITY adder4 IS PORT ( Cin : IN STD_LOGIC ; X, Y : IN STD_LOGIC_VECTOR(3 DOWNTO 0) ; S : OUT STD_LOGIC_VECTOR(3 DOWNTO 0) ; Cout : OUT STD_LOGIC ) ; END adder4 ; ARCHITECTURE Structure OF adder4 IS SIGNAL C : STD_LOGIC_VECTOR(1 TO 3) ; BEGIN stage0: fulladd PORT MAP ( Cin, X(0), Y(0), S(0), C(1) ) ; stage1: fulladd PORT MAP ( C(1), X(1), Y(1), S(1), C(2) ) ; stage2: fulladd PORT MAP ( C(2), X(2), Y(2), S(2), C(3) ) ; stage3: fulladd PORT MAP ( C(3), X(3), Y(3), S(3), Cout ) ; END Structure ;

Figure 5.28 VHDL code for a 16-bit adder LIBRARY ieee ; USE ieee.std_logic_1164.all ; USE ieee.std_logic_signed.all ; ENTITY adder16 IS PORT ( X, Y: IN STD_LOGIC_VECTOR(15 DOWNTO 0) ; S : OUT STD_LOGIC_VECTOR(15 DOWNTO 0) ) ; END adder16 ; ARCHITECTURE Behavior OF adder16 IS BEGIN S <= X + Y ; END Behavior ;

Figure 5.29 A 16-bit adder with carry and overflow LIBRARY ieee ; USE ieee.std_logic_1164.all ; USE ieee.std_logic_signed.all ; ENTITY adder16 IS PORT ( Cin : IN STD_LOGIC ; X, Y : IN STD_LOGIC_VECTOR(15 DOWNTO 0) ; S : OUT STD_LOGIC_VECTOR(15 DOWNTO 0) ; Cout, Overflow: OUT STD_LOGIC ) ; END adder16 ; ARCHITECTURE Behavior OF adder16 IS SIGNAL Sum : STD_LOGIC_VECTOR(16 DOWNTO 0) ; BEGIN Sum <= ('0' & X) + Y + Cin ; S <= Sum(15 DOWNTO 0) ; Cout <= Sum(16) ; Overflow <= Sum(16) XOR X(15) XOR Y(15) XOR Sum(15) ; END Behavior ;

Figure 5.30 Use of the arithmetic package LIBRARY ieee ; USE ieee.std_logic_1164.all ; USE ieee.std_logic_arith.all ; ENTITY adder16 IS PORT (Cin : IN STD_LOGIC ; X, Y : IN SIGNED(15 DOWNTO 0) ; S : OUT SIGNED(15 DOWNTO 0) ; Cout, Overflow : OUT STD_LOGIC ) ; END adder16 ; ARCHITECTURE Behavior OF adder16 IS SIGNAL Sum : SIGNED(16 DOWNTO 0) ; BEGIN Sum <= ('0' & X) + Y + Cin ; S <= Sum(15 DOWNTO 0) ; Cout <= Sum(16) ; Overflow <= Sum(16) XOR X(15) XOR Y(15) XOR Sum(15) ; END Behavior ;

Figure 5.31 A 16-bit adder using INTEGER signals ENTITY adder16 IS PORT (X, Y: ININTEGER RANGE TO ; S : OUT INTEGER RANGE TO ) ; END adder16 ; ARCHITECTURE Behavior OF adder16 IS BEGIN S <= X + Y ; END Behavior ;

Figure 5.32 Multiplication of unsigned numbers Please see “portrait orientation” PowerPoint file for Chapter 5

Figure 5.33 A 4 x 4 multiplier circuit Please see “portrait orientation” PowerPoint file for Chapter 5

Figure 5.34 Multiplication of signed numbers Please see “portrait orientation” PowerPoint file for Chapter 5

Figure 5.35 IEEE standard floating-point formats Sign 32 bits 23 bits of mantissa excess-127 exponent 8-bit 52 bits of mantissa11-bit excess-1023 exponent 64 bits Sign SM SM (a) Single precision (c) Double precision E + E 0 denotes – 1 denotes

Table 5.3 Binary-coded decimal digits

Figure 5.36 Addition of BCD digits X Y Z carry X Y Z carry S = 2 S = 7

Figure 5.37 Block diagram for a one-digit BCD adder

Figure 5.38 VHDL code for a one-digit BCD adder LIBRARY ieee ; USE ieee.std_logic_1164.all ; USE ieee.std_logic_unsigned.all ; ENTITY BCD IS PORT (X, Y : IN STD_LOGIC_VECTOR(3 DOWNTO 0) ; S : OUT STD_LOGIC_VECTOR(4 DOWNTO 0) ) ; END BCD ; ARCHITECTURE Behavior OF BCD IS SIGNAL Z : STD_LOGIC_VECTOR(4 DOWNTO 0) ; SIGNAL Adjust : STD_LOGIC ; BEGIN Z <= ('0' & X) + Y ; Adjust 9 ELSE '0' ; S <= Z WHEN (Adjust = '0') ELSE Z + 6 ; END Behavior ;

Figure 5.39 Functional simulation of the one-digit BCD adder

Figure 5.40 Circuit for a one-digit BCD adder c out Four-bit adder Two-bit adder s 3 s 2 s 1 s 0 z 3 z 2 z 1 z 0 x 3 x 2 x 1 x 0 y 3 y 2 y 1 y 0 c in

Figure P5.1 C ircuit for problem 5.11

Figure P5.2 The VHDL code for problem 5.17 LIBRARY ieee ; USE ieee.std_logic_1164.all ; ENTITY problem IS PORT ( Input : IN STD_LOGIC_VECTOR(3 DOWNTO 0) ; Output : OUT STD_LOGIC_VECTOR(3 DOWNTO 0) ) ; END problem ; ARCHITECTURE LogicFunc OF problem IS BEGIN WITH Input SELECT Output <="0001" WHEN "0101", "0010" WHEN "0110", "0011" WHEN "0111", "0010" WHEN "1001", "0100" WHEN "1010", "0110" WHEN "1011", "0011" WHEN "1101", "0110" WHEN "1110", "1001" WHEN "1111", "0000" WHEN OTHERS ; END LogicFunc ;

Figure P5.3 Ternary half-adder