1 Modeling Combinational Logic Circuits Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.

Slides:



Advertisements
Similar presentations
VERILOG: Synthesis - Combinational Logic Combination logic function can be expressed as: logic_output(t) = f(logic_inputs(t)) Rules Avoid technology dependent.
Advertisements

Verilog in transistor level using Microwind
ECE 2110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices Encoders.
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Princess Sumaya University
Supplement on Verilog adder examples
Modular Combinational Logic
EE 361 Fall 2003University of Hawaii1 Hardware Design Tips EE 361 University of Hawaii.
Combinational Logic.
Verilog Modules for Common Digital Functions
Table 7.1 Verilog Operators.
Combinational Logic with Verilog Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Slide 1 7. Verilog: Combinational always statements. VHDL: Combinational Processes: To avoid (I.E. DO NOT What in your HDL code?) Cases that generate Synthesis.
ELEN 468 Lecture 151 ELEN 468 Advanced Logic Design Lecture 15 Synthesis of Language Construct I.
Digital System Design by Verilog University of Maryland ENEE408C.
Arbitrary Waveform Discussion 12.2 Example 34. Recall Divide-by-8 Counter Use q2, q1, q0 as inputs to a combinational circuit to produce an arbitrary.
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
Combinational Logic Building Blocks
Combinational Logic1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
Multiplexers Lecture L6.6v Section 6.2. Multiplexers A Digital Switch A 2-to-1 MUX A 4-to-1 MUX A Quad 2-to-1 MUX The Verilog if…else Statement TTL Multiplexer.
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.
Overview Logistics Last lecture Today HW5 due today
ECE 551 Digital System Design & Synthesis Lecture 11 Verilog Design for Synthesis.
Combinational Logic in Verilog
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.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
CS 151: Digital Design Chapter 3 3-8: Encoding. CS 151 Encoding Encoding - the opposite of decoding - the conversion of a maximum of 2 n input code to.
Outline Analysis of Combinational Circuits Signed Number Arithmetic
Figure 6.1. A 2-to-1 multiplexer.
ECE 2372 Modern Digital System Design
Chapter 4: Behavioral Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 4-1 Ders – 4: Davranışsal Modelleme.
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexer Circuits.
1 Combinational Logic Design Digital Computer Logic Kashif Bashir
ECE 551 Digital Design And Synthesis
Slide 1 6. VHDL/Verilog Behavioral Description. Slide 2 Verilog for Synthesis: Behavioral description Instead of instantiating components, describe them.
ELEN 468 Lecture 131 ELEN 468 Advanced Logic Design Lecture 13 Synthesis of Combinational Logic II.
Finite State Machine (FSM) Nattha Jindapetch December 2008.
EKT 124 / 3 DIGITAL ELEKTRONIC 1
ECE 320 Homework #3 1. Simplify the Boolean function F using the don’t care conditions d, in both S.O.P. and P.O.S. form: a) F=A’B’D’+A’CD+A’BC d=A’BC’D+ACD+AB’D’
1 CS 151: Digital Design Chapter 3: Combinational Logic Design 3-1Design Procedure CS 151: Digital Design.
ECOM 4311—Digital System Design with VHDL
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 6: Procedural Modeling Spring 2009 W. Rhett.
Multiplexers Section Topics Multiplexers – Definition – Examples – Verilog Modeling.
Chapter 8: Combinational Logic Modules Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 8-1 Chapter 8: Combinational.
SYEN 3330 Digital SystemsJung H. Kim 1 SYEN 3330 Digital Systems Chapter 7 – Part 2.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Decoder Chapter 12 Subject: Digital System Year: 2009.
Lecture No. 18 Combinational Functional Devices. Recap Decoder Decoder –3-to-8 Decoder –Cascading of Decoders 4-to-16 decoder –Implementing SOP & POS.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
1 Modeling Synchronous Logic Circuits Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
1 Modeling of Finite State Machines Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
Examples of Basic Combinational
Overview Logistics Last lecture Today HW5 due today
Hardware Description Languages: Verilog
TODAY’S OUTLINE Verilog Codings Concurrent and Sequential If-else
EKT 124 / 3 DIGITAL ELEKTRONIC 1
ELEN 468 Advanced Logic Design
Combinational Circuits
Combinational Logic Circuits
Behavioral Modeling in Verilog
Introduction To Verilog-HDL
COE 202 Introduction to Verilog
Multiplexers Anindya IE CSE.
Digital System Design Combinational Logic
Supplement on Verilog combinational circuit examples
Adder, Subtructer, Encoder, Decoder, Multiplexer, Demultiplexer
Introduction to Verilog – Part-2 Procedural Statements
Presentation transcript:

1 Modeling Combinational Logic Circuits Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur

Types 1.logical/ arithmetical equations 2.multiplexers 3.encoders 4.priority encoders 5.decoders 6.comparators 7.Arithmetic Logic Units (ALUs)

Useful Verilog Constructs if case –casex: handles don’t cares also. for: leads to compact coding. always assign

Use of parenthesis module logic_struct(A1,B1,C1,D1,A2,B2,C2,D2,Y1,Y2); input [7:0] A1,B1,C1,D1,A2,B2,C2,D2; output [7:0] Y1,Y2; reg [7:0] Y1,Y2; or B1 or C1 or D1 or A2 or B2 or C2 or D2) begin Y1=A1+B1+C1+D1; Y2=(A2+B2)+(C2+D2); end endmodule

Synthesized Circuit Structure Second circuit has a shorter critical delay (longest path delay)!

Modeling Multiplexers Five ways of modeling multiplexers: –one if statement with multiple else/else if clauses. –nested if statements –case statements

4-1 Mux: method 1 or A or B or C or D) begin if(sel==2’b0) Y=A; else if(sel==2’b01) Y=B; else if(sel==2’b10) Y=C; else Y=D; if else if else

4-1 Mux: method 2 or A or B or C or D) if(sel[1]==0) if(sel[0]==0) Y=A; //sel=00 else Y=B; //sel=01 else if(sel[0]==0) Y=C; //sel=10 else Y=D; //sel=11 nested if, else statements

4-1 Mux: method 3 or A or B or C or D) case(sel) 2’b00: Y=A; 2’b01: Y=B; 2’b10: Y=C; 2’b11: Y=D; default: Y=A; endcase More Compact and clear

A Comparison: Case is simulation efficient Sparc/32Mb RAM, Solaris 2.5, Verilog XL Data Structure (bytes of memory) Memory Usage Percentages Simulation Time (in seconds) CPU Simulation CaseMux % % Ifmux % %

Encoders Discrete quantities of digital data are often represented in a coded form. Encoders do that. A typical encoder takes in 2 n input lines and provides n encoded output lines. Assume that only one of the inputs is 1 at any given time, otherwise the output is undefined and have some meaningless value.

8-3 encoder A7A6A5A4A3A2A1A Y2Y1Y

Verilog code begin if(A==8’b ) Y=0; else if(A==8’b )Y=1; else if(A==8’b )Y=2; … else if(A==8’b )Y=7; else Y=3’bx; end Why is this line kept?

Verilog code begin if(A==8’b ) Y=0; else if(A==8’b )Y=1; else if(A==8’b )Y=2; … else if(A==8’b )Y=7; else Y=3’bx; end Minimizes the synthesize circuit. The synthesizer may take for the input cases specified, the output as 0 or 1 as per required, to generate a small circuit.

Using casex begin casex(A) 8’b : Y=0; 8’b : Y=1; 8’b : Y=2; … 8’b : Y=7; default: Y=3’bx; endcase end

Using for loop begin Test=8’b ; Y=3’bx; for(N=0;N<8;N=N+1) begin if(A==Test) Y=N; Test=Test<<1; end Compact and does not grow with dimensions!

Priority Encoders Operation of Priority encoder is such that if two or more single bit inputs are at logic 1, then the input with highest priority will take precedence. How to code in verilog?

Model 1 begin Valid=1; if(A[7]) Y=7; else if(A[6]) Y=6; else if(A[5]) Y=5; … else if(A[0]) Y=0; else begin Valid=0 Y=3’bx; end

Model 2 begin Valid=1; casex(A) 8’b1xxxxxxx: Y=7; 8’b01xxxxxx: Y=6; … 8’b : Y=0; default: begin Valid=0; Y=3’bx; end endcase end

Model 3 begin Valid=0; Y=3’bx; for(N=0;N<8;N=N+1) if(A[N]) begin Valid=1; Y=N; end

Decoders Decode data that has been previously encoded using possibly binary format. Automatic priority encoding with if and case, and “don’t care” output values are not needed. The codes are left as an exercise.

Assignment1 BCD 7 segment Decoder Write a Verilog code for a BCD 7 segment decoder. The decoder takes the numbers 0-9 and results in the 7-segment code for the same. First, use if-else, casex. C0 C1 C2 C3 C4 C5 C

Using K-Map Minimization Perform K-Map minimization for all the 7 output bits. Use the don’t cares suitably. Rewrite the Verilog code using the minimized equations and check (test) that the same outputs result.