Random Number Generation Section 3.10 Section 4.12.

Slides:



Advertisements
Similar presentations
ECE 3130 – Digital Electronics and Design
Advertisements

Chapter 15:Introduction to Verilog Testbenches Objectives In this section,you will learn about designing a testbench: Creating clocks Including files Strategic.
Verilog Section 3.10 Section 4.5. Keywords Keywords are predefined lowercase identifiers that define the language constructs – Key example of keywords:
Simulation executable (simv)
Decoder Mano Section 4.9 &4.12.
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
CPEN Digital System Design
Review for Exam 2 Using MUXs to implement logic
Verilog Intro: Part 1.
VERILOG EXAMPLES. //example 1.1 module ffNand; wireq, qBar; regpreset, clear; nand #1 g1 (q, qBar, preset), g2 (qBar, q, clear); endmodule.
Figure 4.1. The function f (x1, x2, x3) =  m(0, 2, 4, 5, 6).
Half Adder Sec Sec. 4.5, Schedule 11/13MondayCourse intro, diagnostic test 21/15Wednesday Fundamentals of digital logic design (1) (signed.
Full Adder Section 4.5 Spring, 2014 J.Ou. Schedule 62/3MondayBinary addition: full adder 72/5WednesdayBinary addition: full adder/four-bit adder L2/6ThursdayLab.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
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.
1 Verilog Digital Computer Logic Kashif Bashir WWW: http//:
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
7-Segment LED Display DD: Section Mano: Section 3.10.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
1 COMP541 Combinational Logic and Design Montek Singh Jan 30, 2007.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
ECE 353 Computer Systems Lab I Verilog Hardware Description Language.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
Verilog Lab This presentation includes some material that is selected from BUCKNELL VERILOG HANDBOOK. Instructor: Dr. Charles Liu Prepared by John Ren.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
Hardware Description Language HDL. 2 Hardware Description Language HDL  Describes circuits and systems in text. −As a software program.  Can be processed.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Introduction to Basys 2. Switches Slide switchesPush button switches.
Decoder Mano Section 4.9. Outline Decoder Applications Verilog.
Shift Register Section Register A register is a group of flip-flops, each one of which is capable of storing one bit of information. Issues of.
Lecture Note on Verilog, Course # , EE, NTU, C.H Tsai Basic Logic Design with Verilog TA: Chen-han Tsai.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 2 - Welcome Application: Introduction to C++
ECE 2372 Modern Digital System Design
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Module 1.2 Introduction to Verilog
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
Digital Electronics Chapter 3 Gate-Level Minimization.
1 Arithmetic, ALUs Lecture 9 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 4: Testing, Dataflow Modeling Spring 2009.
 A test bench is an HDL program used for applying stimulus to an HDL design in order to test it and observe its response during simulation.  In addition.
Introduction to Verilog Section Outline Set Up the Environment Your First Verilog File Set Up the Test Bench Running the Simulation.
Multiplexers Section Topics Multiplexers – Definition – Examples – Verilog Modeling.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
LECTURE V TEST BENCHES. As your projects become more complex and multiple modules are employed, it will no longer be possible to simulate them as we did.
1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
Full Adder Verilog(HO: wires/regs, always) Section 4.5 (Full adder)
Lecture 5. Verilog HDL #3 Prof. Taeweon Suh Computer Science & Engineering Korea University COSE221, COMP211 Logic Design.
Introduction to Verilog COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals.
University of Maryland Baltimore County Department of Computer Science and Electrical Engineering   CMPE 212 Laboratory (Discussion 2) Hasibul Hasan
Discussion 2: More to discuss
Verilog Introduction Fall
Verilog-HDL-1 by Dr. Amin Danial Asham.
Introduction to Verilog
102-1 Under-Graduate Project Verilog
Introduction to Verilog sonoma
COE 202 Introduction to Verilog
Presentation transcript:

Random Number Generation Section 3.10 Section 4.12

Outline Observations from the last week’s lab Anatomy of a Verilog Program More about Verilog – Including a file – Test a Module with a Random Sequence Example: NAND Implementation of a NOT Gate The NAND Implementation of a NOR Gate – Implementation Using 74LS00

Observations from Last Thursday’s Lab (1) The verilog code should be saved in a *.v file, e.g. – fig3p37.v is the file name – to execute the simulation, you need to type verilog +gui fig3p37.v &

Observations from Last Thursday’s Lab (2) Correction: Remove semicolon from the end of timescale line.

Observations from Last Thursday’s Lab (3) Correction: Use a backward quote (`), not a single quote (‘)

Observations from Last Thursday’s Lab (4) Definition of the module fig3p37 is the module name. I1 is the instance of the module. Comment: You need both modules!

Observations from Last Thursday’s Lab (5) System! Source file "fig3p37.v" cannot be opened for reading [Verilog-SFCOR] Solution: verilogSandBox]$ chmod 755 fig3p37.v

Question // comments out a line

Question: How do I get the play button back? If you comment out $stop and stop the simulation by using Initial #200 $finish, you will not get the play button. What do you do then?

Solution: Simulation ->Reinvoke Simulator

Select Yes

You Get the Play Button Back! Play button

Review of What We have Learned A minimalist’s view of a verilog Module A minimalist’s view of a module test bench

Anatomy of a Verilog Module module fig3p37 (A,B,C,D,E); output D,E; input A,B,C; wire w1; and G1(w1,A,B); not G2(E,C); or G3(D,w1,E); endmodule

module....endmodule module fig3p37 (A,B,C,D,E); output D,E; input A,B,C; wire w1; and G1(w1,A,B); not G2(E,C); or G3(D,w1,E); endmodule Always start the verilog program with the keyword pair module…endmodule The keyword module must always be terminated by the keyword endmodule.

output/input module fig3p37 (A,B,C,D,E); output D,E; input A,B,C; wire w1; and G1(w1,A,B); not G2(E,C); or G3(D,w1,E); endmodule 1.output/input 2.wire

Program Body module fig3p37 (A,B,C,D,E); output D,E; input A,B,C; wire w1; and G1(w1,A,B); not G2(E,C); or G3(D,w1,E); endmodule Program body

Anatomy of a Test Bench Test Bench 1.`timescale 2.module module_tb (,,,)…endmodule 3.ouput,reg 4.Invoke the module 5.Define the input vector

Use `include to reference a file Troubleshooting Exercise: verilog +gui fig3p37.v &

Introduce a Random Test Vector flip_me function Q: What is the function of this module?

flip_me_tb.v Test Bench Definition: Feed a random sequence of binary numbers to flip_me.v A=random input B=flipped version of A

Test Bench for flip_me.v Reference: Mano page

`timescale Comment out time scale Each time interval is one second.

include flip_me.v

Define outputs,reg We will read random numbers from a file. The random numbers are stored in t_A. vectornum is the index of the t_A. At the falling edge of the t_clock, a random numbers stored in t_A is transferred to A.

flip_me.v is called.

1000 time intervals will be simulated.

Clock Generation t_clock is initially 0. t_clock is flipped every 5 time intervals. The period of t_clock is 10 time intervals.

Read numbers from an input file Random number is stored in t_A.

Update at NegEdge of t_clock At negative edge of t_clock, transfer the random number from t_A to A.

Monitor Numbers Monitor numbers

Waveforms

Run Verilog Using Command- line $monitor only displays the results when A changes. Actual sequence: …

Implement NOR with NANDs C D E F A, B as inputs C,D, E as wires F as output G1 G2 G3G4

nor_with_nand.v

nor_with_nand_tb.v Use flip_me_tb.v as a guide. Complete the code for nor_with_nand_tb.v