HDL Model Combinational circuits. module halfadder(s, cout, a, b); input a, b; output s, cout; xor g1(s, a, b); and g2(cout, a, b); endmodule.

Slides:



Advertisements
Similar presentations
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Advertisements

Verilog.
The Verilog Hardware Description Language
Verilog Modules for Common Digital Functions
CPEN Digital System Design
Verilog Intro: Part 1.
16/04/20151 Hardware Descriptive Languages these notes are taken from Mano’s book It can represent: Truth Table Boolean Expression Diagrams of gates and.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
//HDL Example 6-1 // //Behavioral description of //Universal shift register // Fig. 6-7 and Table 6-3 module shftreg.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
Half Adder ( / ) Structural description: Data flow description:

Texas A&M University Computer Science Department CPSC 321 Computer Organization Introduction to Verilog and ALU Design Hank Walker Adopted from notes.
DON’T CARE CONDITIONS Functions that have unspecified output for some input combinations are called incompletely specified functions. Unspecified minterms.
Combinational Logic Chapter 4. Digital Circuits Introduction Logic circuits for digital systems may be combinational or sequential. A combinational.
Verilog Module Module declaration Module instantiation module Add_full (sum, c_out, a, b, c_in); // parent module input a, b, c_in; output c_out, sum;
ECE 353 Computer Systems Lab I Verilog Hardware Description Language.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
//HDL Example 3-3 // //Stimulus for simple circuit module stimcrct; reg A,B,C; wire x,y; circuit_with_delay swd(A,B,C,x,y);
Hardware Description Language HDL. 2 Hardware Description Language HDL  Describes circuits and systems in text. −As a software program.  Can be processed.
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.
Hardware Description Language - Introduction
Digital System Design EEE344 Lecture 2 Introduction to Verilog HDL Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock1.
CS 105 Digital Logic Design
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
Digital Electronics.
Outline Analysis of Combinational Circuits Signed Number Arithmetic
Binary Addition CSC 103 September 17, 2007.
XOR and XNOR Logic Gates. XOR Function Output Y is TRUE if input A OR input B are TRUE Exclusively, else it is FALSE. Logic Symbol  Description  Truth.
CORRECTION Last session, I have made a mistake about two digital coding methods. I explained Hamming code as Grey code mistakenly. Here is correct explanation.
Combinational Circuits
EN3542 – Digital System Design
ECE/CS 352 Digital Systems Fundamentals
ADDERS Half Adders Recall that the basic rules of binary addition are as indicated below in Table 2-9. A circuit known as the half-adder carries out these.
F = ∑m(1,4,5,6,7) F = A’B’C+ (AB’C’+AB’C) + (ABC’+ABC) Use X’ + X = 1.
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.
CENG 241 Digital Design 1 Lecture 5 Amirali Baniasadi
Digital System Ch4-1 Chapter 4 Combinational Logic Ping-Liang Lai ( 賴秉樑 ) Digital System 數位系統.
Lecture 9 Topics: –Combinational circuits Basic concepts Examples of typical combinational circuits –Half-adder –Full-adder –Ripple-Carry adder –Decoder.
C ONTINUOUS A SSIGNMENTS. C OMBINATIONAL L OGIC C IRCUITS each output of a Combinational Logic Circuit  A function of the inputs - Mapping functions.
Chapter 4 Combinational Logic 授課教師: 張傳育 博士 (Chuan-Yu Chang Ph.D.)
CPEN Digital System Design
3.Gate-Level Minimization
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.
Introduction to ASIC flow and Verilog HDL
M.Mohajjel. Objectives Learn How to write synthesizable Verilog code Common mistakes and how to avoid them What is synthesized for what we code Digital.
Multiplexers Section Topics Multiplexers – Definition – Examples – Verilog Modeling.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Chapter 3 Digital Logic Structures
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.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
LECTURE VI USER DEFINED PRIMITIVES GATE-LEVEL MODELING.
Introduction to Verilog COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals.
Verilog-HDL-3 by Dr. Amin Danial Asham.
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Chapter 4 Combinational Logic
Hardware Descriptive Languages these notes are taken from Mano’s book
Introduction to Verilog
Lecture 1.3 Hardware Description Languages (HDLs)
Hardware Descriptive Languages these notes are taken from Mano’s book
فصل چهارم مدارهای ترکیبی.
مدار منطقی به نام یگانه مهندس هستی مهدی قدیری
Lecture 4 Minterm and Maxterm
Chapters 4 – Part3: Verilog – Part 1
The Verilog Hardware Description Language
ECB2212-Digital Electronics Numbering Systems
Presentation transcript:

HDL Model Combinational circuits

module halfadder(s, cout, a, b); input a, b; output s, cout; xor g1(s, a, b); and g2(cout, a, b); endmodule

module fulladder(s, c, x, y, z); input x, y, z; output s, c; halfadder HA1(s1, c1, x, y); halfadder HA2(s, c2, s1, z); or g1(c, c1, c2); endmodule

module ripplecarryadder4bit(S, c4, A, B, c0); output [3:0] S; output c4; input [3:0] A, B; input c0; wire c1, c2, c3; fulladder FA0(S[0], c1, A[0], B[0], c0); fulladder FA1(S[1], c2, A[1], B[1], c1); fulladder FA2(S[2], c3, A[2], B[2], c2); fulladder FA3(S[3], c4, A[3], B[3], c3); endmodule

//HDL Example 3-1 // //Description of the simple circuit of Fig module smpl_circuit(A,B,C,x,y); input A,B,C; output x,y; wire e; and g1(e,A,B); not g2(y, C); or g3(x,e,y); endmodule

//HDL Example 3-2 // //Description of circuit with delay module circuit_with_delay (A,B,C,x,y); input A,B,C; output x,y; wire e; and #(30) g1(e,A,B); or #(20) g3(x,e,y); not #(10) g2(y,C); endmodule

//Stimulus for simple circuit module stimcrct; reg A,B,C; wire x,y; circuit_with_delay cwd(A,B,C,x,y); initial begin A = 1'b0; B = 1'b0; C = 1'b0; #100 A = 1'b1; B = 1'b1; C = 1'b1; #100 $finish; end endmodule //Description of circuit with delay module circuit_with_delay (A,B,C,x,y); input A,B,C; output x,y; wire e; and #(30) g1(e,A,B); or #(20) g3(x,e,y); not #(10) g2(y,C); endmodule

//HDL Example 3-4 // //Circuit specified with Boolean equations module circuit_bln (x,y,A,B,C,D); input A,B,C,D; output x,y; assign x = A | (B & C) | (~B & C); assign y = (~B & C) | (B & ~C & ~D); Endmodule //assign statement describes Boolen equations. AND & OR | ~ negate

//HDL Example 3-5 // //User defined primitive(UDP) primitive crctp (x,A,B,C); output x; input A,B,C; //Truth table for x(A,B,C) = Minterms (0,2,4,6,7) table // A B C : x (Note that this is only a comment) : 1; : 0; : 1; : 0; : 1; : 0; : 1; : 1; endtable endprimitive

//HDL Example 4-2 // //Gate-level hierarchical description of 4-bit adder // Description of half adder (see Fig 4-5b) module halfadder (S,C,x,y); input x,y; output S,C; //Instantiate primitive gates xor (S,x,y); and (C,x,y); endmodule

//Description of full adder (see Fig 4-8) module fulladder (S,C,x,y,z); input x,y,z; output S,C; wire S1,D1,D2; //Outputs of first XOR and two AND gates //Instantiate the halfadder halfadder HA1 (S1,D1,x,y), HA2 (S,D2,S1,z); or g1(C,D2,D1); endmodule

//Description of 4-bit adder (see Fig 4-9) module _4bit_adder (S,C4,A,B,C0); input [3:0] A,B; input C0; output [3:0] S; output C4; wire C1,C2,C3; //Intermediate carries //Instantiate the fulladder fulladder FA0 (S[0],C1,A[0],B[0],C0), FA1 (S[1],C2,A[1],B[1],C1), FA2 (S[2],C3,A[2],B[2],C2), FA3 (S[3],C4,A[3],B[3],C3); endmodule

//HDL Example 4-5 // //Dataflow description of a 4-bit comparator. module magcomp (A,B,ALTB,AGTB,AEQB); input [3:0] A,B; output ALTB,AGTB,AEQB; assign ALTB = (A < B), AGTB = (A > B), AEQB = (A == B); endmodule

//HDL Example 4-6 // //Dataflow description of 2-to-1-line multiplexer module mux2x1_df (A,B,select,OUT); input A,B,select; output OUT; assign OUT = select ? A : B; Endmodule // if select =1 then OUT = A, else OUT =B

//HDL Example 4-3 // //Dataflow description of a 2-to-4-line decoder //See Fig.4-19 module decoder_df (A,B,E,D); input A,B,E; output [0:3] D; assign D[0] = ~(~A & ~B & ~E), D[1] = ~(~A & B & ~E), D[2] = ~(A & ~B & ~E), D[3] = ~(A & B & ~E); endmodule

//HDL Example 4-4 // //Dataflow description of 4-bit adder module binary_adder (A,B,Cin,SUM,Cout); input [3:0] A,B; input Cin; output [3:0] SUM; output Cout; assign {Cout,SUM} = A + B + Cin; endmodule

//HDL Example 4-7 // //Behavioral description of 2-to-1-line multiplexer module mux2x1_bh(A,B,select,OUT); input A,B,select; output OUT; reg OUT; (select or A or B) if (select == 1) OUT = A; else OUT = B; endmodule

//HDL Example 4-8 // //Behavioral description of 4-to-1- line multiplexer //Describes the function table of Fig (b). module mux4x1_bh (i0,i1,i2,i3,select,y); input i0,i1,i2,i3; input [1:0] select; output y; reg y; (i0 or i1 or i2 or i3 or select) case (select) 2'b00: y = i0; 2'b01: y = i1; 2'b10: y = i2; 2'b11: y = i3; endcase endmodule