Chapter 8: Combinational Logic Modules

Slides:



Advertisements
Similar presentations
UNIT 8: Synthesis Basics
Advertisements

VERILOG: Synthesis - Combinational Logic Combination logic function can be expressed as: logic_output(t) = f(logic_inputs(t)) Rules Avoid technology dependent.
CPSC 321 Computer Architecture Andreas Klappenecker
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Verilog.
Supplement on Verilog adder examples
Combinational Logic.
Register Transfer Level
Chap. 6 Dataflow Modeling
Verilog Modules for Common Digital Functions
CPEN Digital System Design
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
CS 140 Lecture 12 Professor CK Cheng 11/07/02. Part III - Standard Modules Decoder, Encoder, Mux, DeMux, Shifter, Adder, Multiplexer Interconnect: Decoder,
Combinational Logic1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
Learning Outcome By the end of this chapter, students are expected to understand a few elementary components in digital system Decoder Multiplexer Demultiplexer.
Outline Analysis of Combinational Circuits Signed Number Arithmetic
Decoders.
Figure 6.1. A 2-to-1 multiplexer.
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
Combinational Logic. Digital Circuits Introduction Logic circuits for digital systems may be combinational or sequential. A combinational circuit.
Chapter 4: Behavioral Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 4-1 Ders – 4: Davranışsal Modelleme.
ECE/CS 352 Digital System Fundamentals© 2001 C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Spring 2001 Chapters 3 and 4: Verilog – Part 2 Charles R.
CO UNIT-I. 2 Multiplexers: A multiplexer selects information from an input line and directs the information to an output line A typical multiplexer has.
Chapter 2: Structural Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 2-1 Chapter 2a: Structural Modeling.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 6: Procedural Modeling Spring 2009 W. Rhett.
Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-1 Chapter 8: Combinational.
Digital Design Lecture 8 Combinatorial Logic (Continued)
Chapter 3: Dataflow Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 3-1 Chapter 3: Dataflow Modeling.
Chapter 5: Tasks, Functions, and UDPs Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 5-1 Chapter 5: Tasks, Functions,
Chapter 6: Hierarchical Structural Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 6-1 Chapter 6: Hierarchical.
Chapter1: Introduction Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 1-1 Chapter 1: Introduction Prof. Ming-Bo.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Examples of Basic Combinational
Overview Logistics Last lecture Today HW5 due today
Hardware Description Languages: Verilog
Mantıksal Tasarım – BBM231 M. Önder Efe
Adapted from Krste Asanovic
Figure 8.1. The general form of a sequential circuit.
TODAY’S OUTLINE Verilog Codings Concurrent and Sequential If-else
Reg and Wire:.
Verilog Introduction Fall
Supplement on Verilog Sequential circuit examples: FSM
Part 4 Combinational Logic.
Combinational Circuit Design
Verilog-HDL-3 by Dr. Amin Danial Asham.
Hardware Description Languages: Verilog
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
Chapter 4 Combinational Logic
Chapter 5: Tasks, Functions, and UDPs
Behavioral Modeling in Verilog
Chapter 2a: Structural Modeling
Chapter 3: Dataflow Modeling
Combinatorial Logic Design Practices
Introduction To Verilog-HDL
Chapter 7: Advanced Modeling Techniques
Chapter 9: Sequential Logic Modules
FIGURE 4.1 Block diagram of combinational circuit
Chapter 4: Behavioral Modeling
Supplement on Verilog Sequential circuit examples: FSM
Verilog Synthesis Synthesis vs. Compilation
The Verilog Hardware Description Language
Supplement on Verilog combinational circuit examples
Adder, Subtructer, Encoder, Decoder, Multiplexer, Demultiplexer
ECB2212-Digital Electronics Numbering Systems
Dr. Tassadaq Hussain Introduction to Verilog – Part-4 Expressing FSM in Verilog (contd) and FSM State Encoding Dr. Tassadaq Hussain.
Introduction to Digital IC Design
Presentation transcript:

Chapter 8: Combinational Logic Modules Prof. Ming-Bo Lin Department of Electronic Engineering National Taiwan University of Science and Technology

Syllabus Objectives Fundamentals of combinational logic modules Decoders Encoders Multiplexers Demultiplexers Comparators

Objectives After completing this chapter, you will be able to: Understand the features of decoders Understand the features of encoders Understand the features of priority encoders Understand the features of multiplexers Understand the features of demultiplexers Describe how to design comparators and magnitude comparators Describe how to design a parameterized module

Syllabus Objectives Fundamentals of combinational logic modules Decoders Encoders Multiplexers Demultiplexers Comparators

Basic Combinational Logic Modules Decoder Encoder Multiplexer Demultiplexer Comparator Adder (CLA) Subtracter (subtractor) Multiplier PLA Parity Generator -

Options for Modeling Combinational Logic Verilog HDL primitives Continuous assignment Behavioral statement Functions Task without delay or event control Combinational UDP Interconnected combinational logic modules

Syllabus Objectives Fundamentals of combinational logic modules Decoders Encoders Multiplexers Demultiplexers Comparators

Decoder Block Diagrams n-to-m decoders

A 2-to-4 Decoder Example

A 2-to-4 Decoder Example // a 2-to-4 decoder with active low output always @(x or enable_n) if (enable_n) y = 4'b1111; else case (x) 2'b00 : y = 4'b1110; 2'b01 : y = 4'b1101; 2'b10 : y = 4'b1011; 2'b11 : y = 4'b0111; endcase

A 2-to-4 Decoder with Enable Control // a 2-to-4 decoder with active-high output always @(x or enable) if (!enable) y = 4'b0000; else case (x) 2'b00 : y = 4'b0001; 2'b01 : y = 4'b0010; 2'b10 : y = 4'b0100; 2'b11 : y = 4'b1000; endcase

Syllabus Objectives Fundamentals of combinational logic modules Decoders Encoders Multiplexers Demultiplexers Comparators

Encoder Block Diagrams m-to-n encoders

A 4-to-2 Encoder Example Q: What is the problem of this encoder?

A 4-to-2 Encoder Example // a 4-to-2 encoder using if ... else structure always @(in) begin if (in == 4'b0001) y = 0; else if (in == 4'b0010) y = 1; else if (in == 4'b0100) y = 2; else if (in == 4'b1000) y = 3; else y = 2'bx; end

Another 4-to-2 Encoder Example // a 4-to-2 encoder using case structure always @(in) case (in) 4'b0001 : y = 0; 4'b0010 : y = 1; 4'b0100 : y = 2; 4'b1000 : y = 3; default : y = 2'bx; endcase

A 4-to-2 Priority Encoder

A 4-to-2 Priority Encoder Example // using if ... else structure assign valid_in = |in; always @(in) begin if (in[3]) y = 3; else if (in[2]) y = 2; else if (in[1]) y = 1; else if (in[0]) y = 0; else y = 2'bx; end

Another 4-to-2 Priority Encoder Example // using casex structure assign valid_in = |in; always @(in) casex (in) 4'b1xxx: y = 3; 4'b01xx: y = 2; 4'b001x: y = 1; 4'b0001: y = 0; default: y = 2'bx; endcase

Syllabus Objectives Fundamentals of combinational logic modules Decoders Encoders Multiplexers Demultiplexers Comparators

Multiplexer Block Diagrams m-to-1 ( m = 2n ) multiplexers

A 4-to-1 Multiplexer Example Gate-based 4-to-1 multiplexers

An n-bit 4-to-1 Multiplexer Example // an N-bit 4-to-1 multiplexer using conditional operator parameter N = 4; // input [1:0] select; input [N-1:0] in3, in2, in1, in0; output [N-1:0] y; assign y = select[1] ? (select[0] ? in3 : in2) : (select[0] ? in1 : in0) ;

The Second n-bit 4-to- 1 Multiplexer Example // an N-bit 4-to-1 multiplexer with enable control parameter N = 4; input [1:0] select; input enable; input [N-1:0] in3, in2, in1, in0; output reg [N-1:0] y; always @(select or enable or in0 or in1 or in2 or in3) if (!enable) y = {N{1’b0}}; else y = select[1] ? (select[0] ? in3 : in2) : (select[0] ? in1 : in0) ;

The Third n-bit 4-to- 1 Multiplexer Example // an N-bit 4-to-1 multiplexer using case structure parameter N = 8; input [1:0] select; input [N-1:0] in3, in2, in1, in0; output reg [N-1:0] y; always @(*) case (select) 2’b11: y = in3 ; 2’b10: y = in2 ; 2’b01: y = in1 ; 2’b00: y = in0 ; endcase

Syllabus Objectives Fundamentals of combinational logic modules Decoders Encoders Multiplexers Demultiplexers Comparators

DeMultiplexer Block Diagrams 1-to-m ( m = 2n ) demultiplexers

A 1-to-4 DeMultiplexer Example Gate-based 1-to-4 demultiplexers

An n-bit 1-to-4 DeMultiplexer Example // an N-bit 1-to-4 demultiplexer using if ... else structure parameter N = 4; // default width input [1:0] select; input [N-1:0] in; output reg [N-1:0] y3, y2, y1, y0; always @(select or in) begin if (select == 3) y3 = in; else y3 = {N{1'b0}}; if (select == 2) y2 = in; else y2 = {N{1'b0}}; if (select == 1) y1 = in; else y1 = {N{1'b0}}; if (select == 0) y0 = in; else y0 = {N{1'b0}}; end

The Second n-bit 1-to-4 DeMultiplexer Example // an N-bit 1-to-4 demultiplexer with enable control parameter N = 4; // Default width … output reg [N-1:0] y3, y2, y1, y0; always @(select or in or enable) begin if (enable)begin if (select == 3) y3 = in; else y3 = {N{1'b0}}; if (select == 2) y2 = in; else y2 = {N{1'b0}}; if (select == 1) y1 = in; else y1 = {N{1'b0}}; if (select == 0) y0 = in; else y0 = {N{1'b0}}; end else begin y3 = {N{1'b0}}; y2 = {N{1'b0}}; y1 = {N{1'b0}}; y0 = {N{1'b0}}; end end

Syllabus Objectives Fundamentals of combinational logic modules Decoders Encoders Multiplexers Demultiplexers Comparators

A 4-bit cascadable comparator block diagram Comparators A 4-bit comparator A 4-bit cascadable comparator block diagram

Types of Comparators Comparator Cascadable comparator

Comparators An 8-bit comparator Q: What will happen if you set the input value (010) at the rightmost end to other values?

A Simple Comparator Example // an N-bit comparator module example parameter N = 4; // default size input [N-1:0] a, b; output cgt, clt, ceq; assign cgt = (a > b); assign clt = (a < b); assign ceq = (a == b);

A Cascadable Comparator Example parameter N = 4; // I/O port declarations input Iagtb, Iaeqb, Ialtb; input [N-1:0] a, b; output Oagtb, Oaeqb, Oaltb; // dataflow modeling using relation operators assign Oaeqb = (a == b) && (Iaeqb == 1); // = assign Oagtb = (a > b) || ((a == b)&& (Iagtb == 1)); // > assign Oaltb = (a < b) || ((a == b)&& (Ialtb == 1)); // <