Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-1 Chapter 8: Combinational.

Slides:



Advertisements
Similar presentations
UNIT 8: Synthesis Basics
Advertisements

Verilog Fundamentals Shubham Singh Junior Undergrad. Electrical Engineering.
//HDL Example 8-2 // //RTL description of design example (Fig.8-9) module Example_RTL (S,CLK,Clr,E,F,A);
Traffic light contoller using FSM
Verilog in transistor level using Microwind
CPSC 321 Computer Architecture Andreas Klappenecker
ECE 2110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices Encoders.
Verilog Modules for Common Digital Functions
CPEN Digital System Design
Table 7.1 Verilog Operators.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
FSM Revisit Synchronous sequential circuit can be drawn like below  These are called FSMs  Super-important in digital circuit design FSM is composed.
ECE 2372 Modern Digital System Design Section 4.4 Mutiplexers - Demultiplexers 1.
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 4 - Verilog 2 (Sequential.
Combinational Logic and Verilog
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 2 FPGAs & Verilog.
Digital System Design Verilog ® HDL Behavioral Modeling (1) Maziar Goudarzi.
Introduction to Verilog Multiplexers. Introduction to Verilog Verilog Hardware Description Language (Verilog HDL) released by Gateway Design Automation.
Quad 2-to-1 Multiplexer Discussion D7.4 Example 7.
Verilog Descriptions of Digital Systems. Electronic Lock // // Electronic combinational lock // module lock(seg7,key, valid_key, col, row, mclk, resetL)
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexers.
Spring 2007W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 7: Design Example,
Learning Outcome By the end of this chapter, students are expected to understand a few elementary components in digital system Decoder Multiplexer Demultiplexer.
Decoders.
Figure 6.1. A 2-to-1 multiplexer.
Chapter 4: Behavioral Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 4-1 Ders – 4: Davranışsal Modelleme.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Ders 8: FSM Gerçekleme ve.
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexer Circuits.
EEE2243 Digital System Design Chapter 5: Simple Design Case Studies by Muhazam Mustapha, February 2011.
Lab7-1 Lab 6: FSM Description Separate combinational and memory circuits –State memory uses FFs –Others are combinational circuits.
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.
Chapter 2: Structural Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 2-1 Chapter 2a: Structural Modeling.
M.Mohajjel. Structured Procedures Two basic structured procedure statements always initial All behavioral statements appear only inside these blocks Each.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 6: Procedural Modeling Spring 2009 W. Rhett.
Multiplexors Decoders  Decoders are used for forming separate signals for different combination of input signals.  The multiplexer circuit is a digital.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Chapter 11: System Design.
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.
1 Modeling Combinational Logic Circuits Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
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.
ACOE161 (Spring2007)MSI Devices1 Revision on MSI Devices M. Mano & C. Kime: Logic and Computer Design Fundamentals (Chapter 5)
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Figure Implementation of an FSM in a CPLD..
Examples of Basic Combinational
Hardware Description Languages: Verilog
Figure 8.1. The general form of a sequential circuit.
TODAY’S OUTLINE Verilog Codings Concurrent and Sequential If-else
Reg and Wire:.
Supplement on Verilog Sequential circuit examples: FSM
Verilog-HDL-3 by Dr. Amin Danial Asham.
Hardware Description Languages: Verilog
ECE 2110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices Encoders.
Chapter 3: Dataflow Modeling
Combinatorial Logic Design Practices
Chapter 9: Sequential Logic Modules
FIGURE 4.1 Block diagram of combinational circuit
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
Chapter 4: Behavioral Modeling
Chapter 8: Combinational Logic Modules
Supplement on Verilog Sequential circuit examples: FSM
Supplement on Verilog combinational circuit examples
Adder, Subtructer, Encoder, Decoder, Multiplexer, Demultiplexer
ECE2030 HW-6.
Introduction to Digital IC Design
Presentation transcript:

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-1 Chapter 8: Combinational Logic Modules Prof. Ming-Bo Lin Department of Electronic Engineering National Taiwan University of Science and Technology

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-2 Decoder Block Diagrams  n-to-m decoders

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-3 A 2-to-4 Decoder Example

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-4 A 2-to-4 Decoder Example // a 2-to-4 decoder with active low output 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

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-5 A 2-to-4 Decoder with Enable Control // a 2-to-4 decoder with active-high output 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

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-6 Encoder Block Diagrams  m-to-n encoders

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-7 A 4-to-2 Encoder Example Q: What is the problem of this encoder?

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-8 A 4-to-2 Encoder Example // a 4-to-2 encoder using if... else structure 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

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-9 Another 4-to-2 Encoder Example // a 4-to-2 encoder using case structure case (in) 4'b0001 : y = 0; 4'b0010 : y = 1; 4'b0100 : y = 2; 4'b1000 : y = 3; default : y = 2'bx; endcase

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-10 A 4-to-2 Priority Encoder

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-11 A 4-to-2 Priority Encoder Example // using if... else structure assign valid_in = |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

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-12 Another 4-to-2 Priority Encoder Example // using casex structure assign valid_in = |in; casex (in) 4'b1xxx: y = 3; 4'b01xx: y = 2; 4'b001x: y = 1; 4'b0001: y = 0; default: y = 2'bx; endcase

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-13 Multiplexer Block Diagrams  m-to-1 ( m = 2 n ) multiplexers

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-14 A 4-to-1 Multiplexer Example  Gate-based 4-to-1 multiplexers

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-15 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) ;

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-16 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; 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) ;

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-17 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; case (select) 2’b11: y = in3 ; 2’b10: y = in2 ; 2’b01: y = in1 ; 2’b00: y = in0 ; endcase

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-18 DeMultiplexer Block Diagrams  1-to-m ( m = 2 n ) demultiplexers

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-19 A 1-to-4 DeMultiplexer Example  Gate-based 1-to-4 demultiplexers

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-20 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; 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

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-21 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; 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

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-22 Comparators  A 4-bit comparator A 4-bit cascadable comparator block diagram

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-23 Comparators  An 8-bit comparator

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-24 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);

Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-25 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)); // <