VERILOG EXAMPLES. //example 1.1 module ffNand; wireq, qBar; regpreset, clear; nand #1 g1 (q, qBar, preset), g2 (qBar, q, clear); endmodule.

Slides:



Advertisements
Similar presentations
Counters Discussion D8.3.
Advertisements

Verilog in transistor level using Microwind
CPSC 321 Computer Architecture Andreas Klappenecker
CDA 3100 Recitation Week 11.
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Verilog.
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
EE 361 Fall 2003University of Hawaii1 Hardware Design Tips EE 361 University of Hawaii.
Verilog Modules for Common Digital Functions
Review for Exam 2 Using MUXs to implement logic
Table 7.1 Verilog Operators.
Verilog Intro: Part 1.
Anurag Dwivedi.  Verilog- Hardware Description Language  Modules  Combinational circuits  assign statement  Control statements  Sequential circuits.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
//HDL Example 5-1 // //Description of D latch (See Fig.5-6) module D_latch (Q,D,control); output Q; input.
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
1 Brief Introduction to Verilog Weiping Shi. 2 What is Verilog? It is a hardware description language Originally designed to model and verify a design.
//HDL Example 6-1 // //Behavioral description of //Universal shift register // Fig. 6-7 and Table 6-3 module shftreg.
Latches and Flip-Flops Discussion D8.1 Section 13-9.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
1 Lecture 1: Verilog HDL Introduction. 2 What is Verilog HDL? Verilog Hardware Description Language(HDL)? –A high-level computer language can model, represent.
Pulse-Width Modulated DAC
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
Ring Counter Discussion 11.3 Example 32.
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.
Counters Discussion 12.1 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Registers and Shift Registers Discussion D8.2. D Flip-Flop X 0 Q 0 ~Q 0 D CLK Q ~Q D gets latched to Q on the rising edge of the clock. Positive.
Generic Multiplexers: Parameters Discussion D7.5 Example 8.
D Flip-Flops in Verilog Discussion 10.3 Example 27.
Quad 2-to-1 Multiplexer Discussion D7.4 Example 7.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
ECE 2372 Modern Digital System Design
Week Four Design & Simulation Example slides. Agenda Review the tiny example (Minako “logic”)from last week – look at the detailed static timing report.
Introduction Verilog is a HARDWARE DESCRIPTION LANGUAGE (HDL) A hardware description language is a language or means used to describe or model a digital.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
CH71 Chapter 7 Hardware Description Language (HDL) By Taweesak Reungpeerakul.
Module 1.2 Introduction to Verilog
Traffic Lights Discussion D8.3a. Recall Divide-by-8 Counter Use Q2, Q1, Q0 as inputs to a combinational circuit to produce an arbitrary waveform. s0 0.
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Chap. 4 Modules and Ports. 2 Modules and Ports Modules Ports Hierarchical Names Summary.
Use of HDLs in Teaching of Computer Hardware Courses Zvonko Vranesic and Stephen Brown University of Toronto.
Switch Level Modeling Part II 26 September Contents 1.Clarifications: a)nMOS and pMOS instantiations b)Testbenches for NOR gate example c)Use of.
Brief Verilog.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
Random Number Generation Section 3.10 Section 4.12.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Chapter 6: Hierarchical Structural Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 6-1 Chapter 6: Hierarchical.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
1 Lecture 1: Verilog HDL Introduction. 2 What is Verilog HDL? Verilog Hardware Description Language(HDL)? –A high-level computer language can model, represent.
Figure Implementation of an FSM in a CPLD..
An Introduction to Verilog: Transitioning from VHDL
Supplement on Verilog for Algorithm State Machine Chart
Verilog Introduction Fall
‘if-else’ & ‘case’ Statements
Behavioral Modeling Structural modeling Behavioral modeling
OUTLINE Introduction Basics of the Verilog Language
Pulse-Width Modulation (PWM)
Verilog.
Register-Transfer Level Components in Verilog
The Verilog Hardware Description Language
The Verilog Hardware Description Language
Presentation transcript:

VERILOG EXAMPLES

//example 1.1 module ffNand; wireq, qBar; regpreset, clear; nand #1 g1 (q, qBar, preset), g2 (qBar, q, clear); endmodule

//example 1.2 module ffNandSim; wireq, qBar; regpreset, clear; nand #1 g1 (q, qBar, preset), g2 (qBar, q, clear); initial begin // two slashes introduce a single line comment $monitor ($time,, "Preset = %b clear = %b q = %b qBar = %b", preset, clear, q, qBar); //waveform for simulating the nand flip flop # 10 preset = 0; clear = 1; # 10 preset = 1; # 10 clear = 0; # 10 clear = 1; # 10 $finish; end endmodule

//example 1.3 module m16 (value, clock, fifteen, altFifteen); output[3:0]value; outputfifteen, altFifteen; inputclock; dEdgeFFa (value[0], clock, ~value[0]), b (value[1], clock, value[1] ^ value[0]), c (value[2], clock, value[2] ^ &value[1:0]), d (value[3], clock, value[3] ^ &value[2:0]); assign fifteen = value[0] & value[1] & value[2] & value[3]; assign altFifteen = &value; endmodule

//examples 3.2 and 1.4 module dEdgeFF (q, clock, data); outputq; regq; inputclock, data; initial #10 q = 0; always clock) #10 q = data; endmodule

//example 1.6 module board; wire[3:0]count; wireclock, f, af; m16counter (count, clock, f, af); m555clockGen (clock); (posedge clock) $display ($time,,,"count=%d, f=%d, af=%d", count, f, af); endmodule

// example 1.8 module m16Behav (value, clock, fifteen, altFifteen); output[3:0]value; reg [3:0] value; outputfifteen, altFifteen; regfifteen, altFifteen; inputclock; initial value = 0; always begin clock) #10 value = value + 1; if (value == 15) begin altFifteen = 1; fifteen = 1; end else begin altFifteen = 0; fifteen = 0; end endmodule

//example 4.1 module fullAdder(cOut, sum, aIn, bIn, cIn); outputcOut, sum; inputaIn, bIn, cIn; wirex2; nand(x2, aIn, bIn), (cOut, x2, x8); xnor(x9, x5, x6); nor(x5, x1, x3), (x1, aIn, bIn); or(x8, x1, x7); not(sum, x9), (x3, x2), (x6, x4), (x4, cIn), (x7, x6); endmodule