ECE 274 Digital Logic Verilog

Size: px
Start display at page:

Download "ECE 274 Digital Logic Verilog"

Transcription

1 ECE 274 igital Logic Verilog egister ehavior equential circuits have storage egister: most common storage component N-bit register stores N bits tructure may consist of connected flip-flops I3 I2 I I 3 2 (Vahid, Lysecky): Ch. 3 I3 I2 I I 4-bit register Typically just describe register behaviorally eclare output as reg variable to achieve storage Uses vector types Collection of bits More convenient than declaring separate bits like I3, I2, I, I Vector's bits are numbered Options: [:3], [:4], etc. [3:] Most-significant bit is on left Assign with binary constant (more on net slide) module eg4(i3,i2,i,i,3,); input I3, I2, I, I; I3 I2 I I module eg4(i,, ); input [3:] I; I: I[3]I[2]I[]I[] egister ehavior Vectors I3 I2 I I 3 2 `timescale ns/ ns module eg4(i,,, ); input [3:] I; output [3:] ; reg [3:] ; input, ; ) begin if ( == ) <= 4'b; <= I; module egister ehavior Constants inary constant 4'b 4: size, in number of bits 'b: binary base : binary value Other constant bases possible d: decimal base, o: octal base, h: headecimal base 2'hFA2 'h: headecimal base 2: 3 he digits require 2 bits FA2: he value ize is always in bits, and optional 'hfa2 is OK For decimal constant, size and 'd optional 8'd255 or just 255 In previous uses like A <= ; and are actually decimal numbers. b and b would eplicitly represent bits Underscores may be inserted into value for readability 2'b 8 I3 I2 I I 3 2 `timescale ns/ ns module eg4(i,,, ); input [3:] I; output [3:] ; reg [3:] ; input, ; ) begin if ( == ) <= 4'b; <= I; module 3 4 Procedure's event control involves input Not the I input. Thus, synchronous "posedge " Event is not just any change on, but specifically change from to (positive edge) negedge also possible Process has synchronous reset esets output only on rising edge of Process writes output declared as reg variable, thus stores value too egister ehavior I3 I2 I I 3 2 `timescale ns/ ns module eg4(i,,, ); input [3:] I; output [3:] ; reg [3:] ; input, ; ) begin if ( == ) <= 4'b; <= I; module 5 egister ehavior Testbench reg/wire declarations and module instantiation similar to previous testbenches Module uses two procedures One generates 2 ns clock for ns, for ns Note: always procedure repeats Other provides values for and I (i.e., vectors) initial procedure eecutes just once, does not repeat (more on net slide) `timescale ns/ ns module Testbench(); reg [3:] I_s; reg _s, _s; wire [3:] _s; eg4 CompToTest(I_s, _s, _s, _s); // Clock Procedure _s <= ; #; _s <= ; #; // Note: Procedure repeats _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; module 6 vldd_ch3_eg4t.v

2 egister ehavior Testbench /nets can be shared between procedures Only one procedure should write to variable Variable can be read by many procedures Clock procedure writes to _s Vector procedures reads _s Event control _s)" May be preped to statement to synchronize eecution with event occurrence tatement may be just ";" as in eample In previous eamples, the statement was a sequential block (begin-) Test vectors thus don't include the clock's period hard coded Care taken to change input values away from clock edges `timescale ns/ ns module Testbench(); reg [3:] I_s; reg _s, _s; wire [3:] _s; eg4 CompToTest(I_s, _s, _s, _s); // Clock Procedure _s <= ; #; _s <= ; #; // Note: Procedure repeats _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; module 7 vldd_ch3_eg4t.v egister ehavior Testbench imulation results Note that _s updated only on rising clock edges Note _s thus unknown until first clock edge _s is reset to on first clock edge _s _s I_s _s _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; vldd_ch3_eg4t.v ) begin if ( == ) <= 4'b; emember that _s is connected to, and I_s to I, in the testbench <= I; Initial value of a bit is the 8 unknown value Common Pitfalls Using "always" instead of "initial" procedure Causes repeated procedure eecution Not including any delay control or event control in an always procedure May cause infinite loop in the simulator imulator eecutes those statements over and over, never eecuting statements of another procedure imulation time can never advance _s ymptom imulator appears to just _s hang, generating no waveforms _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; _s <= ; I_s <= 4'b; Common Pitfalls Not initializing all module May cause undefined Or simulator may initialize to default value. witching simulators may cause design to fail. Tip: Immediately initialize all module when first writing procedure _s <= ; I_s <= 4'b; #5 _s <= ; I_s <= 4'b; I_s _s Common Pitfalls Finite-tate Machines (s) equential ehavior Forgetting to eplicitly declare as a wire an identifier used in a port connection e.g., _s Verilog implicitly declares identifier as a net of the default net type, typically a one-bit wire Inted as shortcut to save typing for large circuits May not give warning message during compilation Works fine if a one-bit wire was desired ut may be mismatch in this eample, the wire should have been four bits, not one bit Unepected simulation results Always eplicitly declare wires est to avoid use of Verilog's implicit declaration shortcut `timescale ns/ ns module Testbench(); reg [3:] I_s; reg _s, _s; wire [3:] _s; eg4 CompToTest(I_s, _s, _s, _s); Finite-state machine () is a common model of sequential behavior Eample: If =, hold = for 3 clock cycles Note: Transitions implicitly ANed with rising clock edge Implementation model has two parts: tate register HL model will reflect those two parts Inputs: ; Outputs: = = On ' = On2 tate tate register tatenet = On3 2 2

3 Finite-tate Machines (s) equential ehavior Modules with Multiple and hared Finite-tate Machines (s) equential ehavior Inputs: ; Outputs: = = On ' = On2 tate tate register tatenet = On3 `timescale ns/ ns _On: begin module LaserTimer(,,, ); <= ; tatenet <= _On2; input ; output reg ; _On2: begin input, ; <= ; tatenet <= _On3; parameter _ =, _On =, _On2 = 2, _On3 = 3; _On3: begin <= ; reg [:] tate, tatenet; tatenet <= _; case ) begin case (tate) _: begin <= ; ) begin if ( == ) if ( == ) tatenet <= _; tate <= _; tatenet <= _On; tate <= tatenet; module Modules has two procedures One procedure for combinational One procedure for state register ut it's still a behavioral description tate tate register tatenet `timescale ns/ ns module LaserTimer(,,, ); input ; output reg ; input, ; parameter _ =, _On =, _On2 = 2, _On3 = 3; reg [:] tate, tatenet; ) begin ) begin module Code will be eplained on following slides vldd_ch3_lasertimereh.v 3 vldd_ch3_lasertimereh.v 4 Finite-tate Machines (s) equential ehavior Parameters parameter declaration Not a variable or net, but rather a constant A constant is a value that must be initialized, and that cannot be changed within the module s definition Four parameters defined _, _On, _On2, _On3 Correspond to s states hould be initialized to unique values `timescale ns/ ns module LaserTimer(,,, ); input ; output reg ; input, ; parameter _ =, _On =, _On2 = 2, _On3 = 3; reg [:] tate, tatenet; ) begin ) begin module Finite-tate Machines (s) equential ehavior Module declares two reg variables tate, tatenet Each is 2-bit vector (need two bits to represent four unique state values to 3) are shared between CombLogic and tateeg procedures CombLogic procedure Event control sensitive to tate and input Will output tatenet and tateeg procedure ensitive to input Will output tate, which it stores tate tate register tatenet `timescale ns/ ns module LaserTimer(,,, ); input ; output reg ; input, ; parameter _ =, _On =, _On2 = 2, _On3 = 3; reg [:] tate, tatenet; ) begin ) begin module vldd_ch3_lasertimereh.v 5 vldd_ch3_lasertimereh.v 6 Finite-tate Machines (s) equential ehavior with Case tatements Procedure may use case statement Preferred over if--if when just one epression determines which statement to eecute case (epression) Eecute statement whose case item epression value matches case epression case item epression : statement statement is commonly a begin- block, as in eample First case item epression that matches eecutes; remaining case items ignored If no item matches, nothing eecutes Last item may be "default : statement" tatement eecutes if none of the previous items matched Finite-tate Machines (s) equential ehavior with Case tatements s CombLogic procedure reg [:] tate, tatenet; Case statement describes states ) begin case (tate) case (tate) ) begin _: begin Eecutes corresponding statement case (tate) <= ; (often a begin- block) based on uppose tate is _: begin if ( == ) tate's current value _On <= ; tatenet <= _; A state's statements consist of if ( == ) tatenet <= _; Actions of the state tatenet <= _On; etting of net state (transitions) tatenet <= _On; _On: begin E: tate is _On _On: <= ; begin tatenet <= _On2; Eecutes statements for state On, <= ; jumps to case tatenet <= _On2; _On2: begin <= ; Inputs: ; Outputs: _On2: begin tatenet <= _On3; = <= ; tatenet <= _On3; _On3: begin ' <= ; _On3: begin tatenet <= _; <= ; tatenet <= _; case = = = case On On2 On3 7 vldd_ch3_lasertimereh.v 8 vldd_ch3_lasertimereh.v 3

4 Finite-tate Machines (s) equential ehavior Finite-tate Machines (s) equential ehavior Modules with Multiple and hared tateeg Procedure imilar to 4-bit register egister for tate is 2-bit vector reg variable Procedure has synchronous reset esets tate to s initial state, _ parameter _ =, _On =, _On2 = 2, _On3 = 3; reg [:] tate, tatenet; ) begin if ( == ) tate <= _; tate <= tatenet; Inputs: ; Outputs: = = On ' = On2 tate tate register tatenet `timescale ns/ ns _On: begin module LaserTimer(,,, ); <= ; tatenet <= _On2; input ; output reg ; _On2: begin input, ; <= ; tatenet <= _On3; parameter _ =, _On =, _On2 = 2, _On3 = 3; _On3: begin <= ; reg [:] tate, tatenet; tatenet <= _; case ) begin case (tate) _: begin <= ; ) begin if ( == ) if ( == ) tatenet <= _; tate <= _; tatenet <= _On; tate <= tatenet; module Code should 9 now be clear vldd_ch3_lasertimereh.v vldd_ch3_lasertimereh.v 2 = On3 Finite-tate Machines (s) equential ehavior elf-checking Testbenches testbench First part of file (variable/net declarations, module instantiations) similar to before Vector Procedure esets ets 's input values ( test vectors ) Waits for specific clock cycles We observe the resulting waveforms to determine if behaves correctly _s _s _s _s // Clock Procedure _s <= ; #; _s <= ; #; // Note: Procedure repeats _s <= ; _s <= ; #5 _s <= ; #5 _s <= ; #5 _s <= ; module vldd_ch3_lasertimert.v 2 _s _s _s _s Finite-tate Machines (s) equential ehavior elf-checking Testbenches eading waveforms is error-prone Create self-checking testbench Use if statements to check for epected values If a check fails, print error message E: if _s fell to one cycle too early, simulation might output: 95: Third = failed _s <= ; _s <= ; #5 if (_s!= ) $display("%t: eset failed", $time); _s <= ; #5 _s <= ; #5 _s <= ; if (_s!= ) $display("%t: First = failed", $time); #5 if (_s!= ) $display("%t: econd = failed", $time); #5 if (_s!= ) $display("%t: Third = failed", $time); #5 if (_s!= ) $display("%t: Final = failed", $time); vldd_ch3_lasertimertisplay.v 22 Finite-tate Machines (s) equential ehavior $display ystem Procedure $display built-in Verilog system procedure for printing information to _s <= ; display during simulation _s <= ; A system procedure interacts with the simulator and/or host computer system #5 if (_s!= ) $display("%t: eset failed", $time); To write to a display, read a file, get the _s <= ; current simulation time, etc. tarts with $ to distinguish from regular #5 _s <= ; procedures tring argument is printed literally #5 _s <= ; if (_s!= ) $display("hello") will print "Hello" $display("%t: First = failed", $time); Automatically adds newline character ecept when special sequences appear #5 if (_s!= ) %t: isplay a time epression Time epression must be net argument $time uilt-in system procedure that returns the current simulation time 95: Third = failed $display("%t: econd = failed", $time); #5 if (_s!= ) $display("%t: Third = failed", $time); #5 if (_s!= ) $display("%t: Final = failed", $time); vldd_ch3_lasertimertisplay.v 23 Top-own esign s to Controller tructure ecall from Chapter 2 Top-down design Capture behavior, and simulate Capture structure (circuit), simulate again Gets behavior right first, unfettered by compleity of creating structure Capture behavior: Capture structure: Controller Create architecture (state register and combinational ) Encode states Create stable table (describes combinational ) Implement combinational Capture behavior Capture structure imulate imulate N N tate register K_s P_s _s W_s K_s P_s _s W_s hould be the same Inputs: ; Outputs: LaserTimer eample = ' = = = On On2 On3 24 4

5 Top-own esign s to Controller tructure ecall from Chapter 2 Top-down design Capture behavior, and simulate Capture structure (circuit), simulate again Gets behavior right first, unfettered by compleity of creating structure Capture behavior: Capture structure: Controller Create architecture (state register and combinational ) Encode states Create stable table (describes combinational ) Implement combinational Inputs: ; Outputs: = clk ' = = = On On2 On3 b s s tate register n n 25 Common Pitfall: Not Assigning Every Output in Every tate should be combinational function of current state (for Moore ) Not assigning output in given state means previous value is remembered Output has memory ehavior is not an olution e sure to assign every output in every state olution 2 Assign default values before case statement Later assignment in state overwrites default ) begin <= ; case (tate) _: begin <= ; if ( == ) Could delete this tatenet <= _; without changing behavior (but tatenet <= _On; probably clearer to keep it) _On: begin <= ; tatenet <= _On2; _On2: begin <= ; tatenet <= _On3; _On3: begin <= ; tatenet <= _; case 26 Common Pitfall: Not Assigning Every Output in Every tate olution 2 Assign default values before case statement Later assignment in state overwrites default Helps clarify which actions are important in which state Corresponds directly to the common simplifying diagram notation of implicitly setting unassigned to case tate : begin A <= ; <= ; C <= ; T: begin A <= ; <= ; C <= ; case A <= ; <= ; C <= ; case tate : begin <= ; T: begin C <= ; case A= = C= T A= = C= T = C= The imulation Cycle Instructive to consider how an HL simulator works HL simulation is comple; we'll introduce simplified form Consider eample ime Three reg variables,, Three procedures P,, imulator's job: etermine values for nets and variables over time epeatedly eecutes and susps procedures Note: Actually considers more objects, known collectively as processes, but we'll keep matters simple here to get just the basic idea of simulation Maintains a simulation time Time `timescale ns/ ns module ime(); output reg ; reg, ; // P <= ; #; <= ; #; begin <= (posedge ); <= (posedge ); <= ; module 27 vldd_ch3_ime.v 28 The imulation Cycle `timescale ns/ ns The imulation Cycle `timescale ns/ ns tart of simulation imulation time Time is it variables/nets initialized to the unknown value Eecute each procedure In any order, until stops at a delay or event control We'll use arrow to show where a Time (ns): tart P <=, then stop. Activate when Time is += ns. No actions, then stop. Activate when changes. No actions, then stop. Activate when changes to procedure stops module ime(); output reg ; reg, ; // P <= ; #; <= ; #; begin <= (posedge ); <= (posedge ); <= ; imulation cycle et time to net time at which a procedure activates (note: could be same as current time) In this case, time = ns (P activates) Eecute active procedures (in any order) until stops P Time (ns): tart Activate when Time is ns. <=, stop, activate when Time=+=2 ns. Activate when changes. Activate when changes to. module ime(); output reg ; reg, ; // P <= ; #; <= ; #; begin <= (posedge ); <= (posedge ); <= ; module vldd_ch3_ime.v 29 module vldd_ch3_ime.v 3 5

6 The imulation Cycle `timescale ns/ ns The imulation Cycle `timescale ns/ ns imulation cycle et time to net time at which a procedure activates till ns; just changed to ( activates) Eecute active procedures (in any order) until stops P Time (ns): tart Activate when Time is 2 ns. Activate when changes. Activate when changes to <=, stop, activate when changes to again module ime(); output reg ; reg, ; // P <= ; #; <= ; #; begin <= (posedge ); <= (posedge ); <= ; imulation cycle et time to net time at which a procedure activates till ns; just changed ( activates) Eecute active procedures until stops P Time (ns): tart Activate when Time is 2 ns. Activate when changes. <= (~), stop, activate when changes. Activate when change on to. module ime(); output reg ; reg, ; // P <= ; #; <= ; #; begin <= (posedge ); <= (posedge ); <= ; module vldd_ch3_ime.v 3 module vldd_ch3_ime.v 32 The imulation Cycle `timescale ns/ ns The imulation Cycle `timescale ns/ ns imulation cycle et time to net time at which a procedure activates In this case, set Time = 2 ns (P activates) Eecute active procedures until stops P Time (ns): Init Activate when Time is 2 ns. <=, stop, activate when T=2+=3ns. Activate when changes. Activate when change on to. 2 module ime(); output reg ; reg, ; // P <= ; #; <= ; #; begin <= (posedge ); <= (posedge ); <= ; imulation s when user-specified time is reached Variable/net values translate to waveforms Time (ns): Init Time (ns) module ime(); output reg ; reg, ; // P <= ; #; <= ; #; begin <= (posedge ); <= (posedge ); <= ; module vldd_ch3_ime.v 33 module vldd_ch3_ime.v 34 Variable Updates Assignment using "<=" ("non blocking assignment") imulation cycle (revised) doesn't change variable's value immediately et time to net time at which a procedure resumes Instead, schedules a change of value by placing an event on an event queue Eecute active procedures cheduled changes occur at of simulation cycle Update variables with schedule values Important implications Procedure eecution order in a simulation cycle doesn't Assume is. matter Proc: Assume procedures and 2 are both active <= ~; Proc schedules to be, but does not change the present value of. is still. Proc2: Proc2 schedules A to be A <= (the present value of ). ; At of simulation cycle, is updated to and A to A will be, not. Order of assignments to different variables in a procedure doesn't matter Proc3a: ame Proc3b: Assume C was. cheduled values will be C= and =, C <= ~C; <= C; for either Proc3a or Proc3b. <= C; C <= ~C; Later assignment in procedure effectively overwrites earlier assignment E will be updated with, but then by ; so E is at the Proc4: E <= ; of the simulation cycle. E <= ; ecall output assignment eample, 35 in which default assignments were added before the case statement. eset ehavior of a register when a reset input is asserted Good practice dictates having defined reset behavior for every register eset behavior should always have priority over normal register behavior eset behavior Usually clears register to s May initialize to other value e.g., state register of a controller may be initialized to encoding of initial state of eset usually asserted eternally at start of sequential circuit operation, but also to restart due to failure, user request, or other reason esets I3 I2 I I 3 2 `timescale ns/ ns module eg4(i,,, ); input [3:] I; output [3:] ; reg [3:] ; input, ; ) begin if ( == ) <= 4'b; <= I; module 36 6

7 Previous eamples used synchronous resets input only considered during rising clock I = has no effect until rising clock ynchronous eset I3 I2 I I 3 2 `timescale ns/ ns module eg4(i,,, ); input [3:] I; output [3:] ; reg [3:] ; input, ; ) begin if ( == ) <= 4'b; <= I; module Can also use asynchronous reset input considered indepently from clock Add "posedge " to sensitivity list I Asynchronous reset = has almost immediate effect I ynchronous reset = has no effect until net rising clock Asynchronous eset I3 I2 I I 3 2 `timescale ns/ ns module eg4(i,,, ); input [3:] I; output [3:] ; reg [3:] ; input, ; posedge ) begin if ( == ) <= 4'b; <= I; module 37 vldd_ch3_eg4asy.v 38 Asynchronous eset Could have used asynchronous reset for state register too ) begin if ( == ) tate <= _; ynchronous tate <= tatenet; posedge ) begin if ( == ) tate <= _; Asynchronous tate <= tatenet; vldd_ch3_lasertimerehasy.v ynchronous versus Asynchronous esets Which is better synchronous or asynchronous reset? Hotly debated in design community Each has pros and cons e.g., asynchronous can still reset even if clock is not functioning, synchronous avoids timing analysis problems sometimes accompanying asynchronous designs We won t try to settle the debate here What s important is to be consistent throughout a design All registers should have defined reset behavior that takes priority over normal register behavior That behavior should all be synchronous reset or all be asynchronous reset We will use synchronous resets in all of our remaining eamples

ECE 274 Digital Logic Verilog

ECE 274 Digital Logic Verilog ECE 274 igital Logic Verilog egister ehavior equential circuits have storage egister: most common storage component N-bit register stores N bits tructure may consist of connected flip-flops I3 I2 I I 3

More information

ECE 274 Digital Logic Fall 2008

ECE 274 Digital Logic Fall 2008 Register ehavior ECE 274 Digital Logic Fall 28 equential Logic Design using Verilog Verilog for Digital Design Ch. 3 equential circuits have storage Register: most common storage component N-bit register

More information

ECE 274 Digital Logic

ECE 274 Digital Logic ECE 274 igital Logic Combinational Logic esign using Verilog Verilog for igital esign Ch. & 2 igital ystems and HLs Typical digital components per IC 96s/97s: -, 98s:,-, 99s: Millions 2s: Billions 97s

More information

ECE 551: Digital System *

ECE 551: Digital System * ECE 551: Digital System * Design & Synthesis Lecture Set 5 5.1: Verilog Behavioral Model for Finite State Machines (FSMs) 5.2: Verilog Simulation I/O and 2001 Standard (In Separate File) 3/4/2003 1 Explicit

More information

Control in Digital Systems

Control in Digital Systems CONTROL CIRCUITS Control in Digital Systems Three primary components of digital systems Datapath (does the work) Control (manager, controller) Memory (storage) B. Baas 256 Control in Digital Systems Control

More information

Lab 7 (All Sections) Prelab: Introduction to Verilog

Lab 7 (All Sections) Prelab: Introduction to Verilog Lab 7 (All Sections) Prelab: Introduction to Verilog Name: Sign the following statement: On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work 1 Objective The

More information

VERILOG: FLIP-FLOPS AND REGISTERS

VERILOG: FLIP-FLOPS AND REGISTERS VERILOG: FLIP-FLOPS AND REGISTERS Semiconductor Memories Single-bit or Memory (Foreground) Individual memory circuits that store a single bit of information and have at least a 1) data input, 2) data output,

More information

EECS150 - Digital Design Lecture 20 - Finite State Machines Revisited

EECS150 - Digital Design Lecture 20 - Finite State Machines Revisited EECS150 - Digital Design Lecture 20 - Finite State Machines Revisited April 2, 2009 John Wawrzynek Spring 2009 EECS150 - Lec20-fsm Page 1 Finite State Machines (FSMs) FSM circuits are a type of sequential

More information

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes) Last (family) name: Answer Key First (given) name: Student I.D. #: Department of Electrical and Computer Engineering University of Wisconsin - Madison ECE 551 Digital System Design and Synthesis Midterm

More information

Lecture 24: Sequential Logic Design. Let s refresh our memory.

Lecture 24: Sequential Logic Design. Let s refresh our memory. 18 100 Lecture 24: equential Logic esign 15 L24 1 James C. Hoe ept of ECE, CMU April 21, 2015 Today s Goal: tart thinking about stateful stuff Announcements: Read Rizzoni 12.6 HW 9 due Exam 3 on April

More information

Verilog 1 - Fundamentals

Verilog 1 - Fundamentals Verilog 1 - Fundamentals FA FA FA FA module adder( input [3:0] A, B, output cout, output [3:0] S ); wire c0, c1, c2; FA fa0( A[0], B[0], 1 b0, c0, S[0] ); FA fa1( A[1], B[1], c0, c1, S[1] ); FA fa2( A[2],

More information

Synthesizable Verilog

Synthesizable Verilog Synthesizable Verilog Courtesy of Dr. Edwards@Columbia, and Dr. Franzon@NCSU http://csce.uark.edu +1 (479) 575-6043 yrpeng@uark.edu Design Methodology Structure and Function (Behavior) of a Design HDL

More information

EE178 Lecture Verilog FSM Examples. Eric Crabill SJSU / Xilinx Fall 2007

EE178 Lecture Verilog FSM Examples. Eric Crabill SJSU / Xilinx Fall 2007 EE178 Lecture Verilog FSM Examples Eric Crabill SJSU / Xilinx Fall 2007 In Real-time Object-oriented Modeling, Bran Selic and Garth Gullekson view a state machine as: A set of input events A set of output

More information

ECE 2300 Digital Logic & Computer Organization. More Verilog Finite State Machines

ECE 2300 Digital Logic & Computer Organization. More Verilog Finite State Machines ECE 2300 Digital Logic & Computer Organization Spring 2018 More Verilog Finite Machines Lecture 8: 1 Prelim 1, Thursday 3/1, 1:25pm, 75 mins Arrive early by 1:20pm Review sessions Announcements Monday

More information

Sequential Logic Design

Sequential Logic Design Sequential Logic Design Design of Digital Circuits 2017 Srdjan Capkun Onur Mutlu (Guest starring: Frank K. Gürkaynak and Aanjhan Ranganathan) http://www.syssec.ethz.ch/education/digitaltechnik_17 Adapted

More information

ECE 4514 Digital Design II. Spring Lecture 13: Logic Synthesis

ECE 4514 Digital Design II. Spring Lecture 13: Logic Synthesis ECE 4514 Digital Design II A Tools/Methods Lecture Second half of Digital Design II 9 10-Mar-08 L13 (T) Logic Synthesis PJ2 13-Mar-08 L14 (D) FPGA Technology 10 18-Mar-08 No Class (Instructor on Conference)

More information

The Verilog Hardware Description Language Testing the Design Overview

The Verilog Hardware Description Language Testing the Design Overview The Verilog Hardware Description Language Testing the Design Overview In this lesson we will Move from design to test Introduce the test bench Examine several of the system tools that support testing Learn

More information

ECE 2300 Digital Logic & Computer Organization. More Finite State Machines

ECE 2300 Digital Logic & Computer Organization. More Finite State Machines ECE 2300 Digital Logic & Computer Organization Spring 2018 More Finite State Machines Lecture 9: 1 Announcements Prelab 3(B) due tomorrow Lab 4 to be released tonight You re not required to change partner(s)

More information

Modeling Sequential Circuits in Verilog

Modeling Sequential Circuits in Verilog Modeling Sequential Circuits in Verilog COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals Presentation Outline Modeling Latches and Flip-Flops Blocking versus

More information

Mealy and Moore examples

Mealy and Moore examples CSE 37 Spring 26 Introduction to igital esign ecture 2: uential ogic Technologies ast ecture Moore and Mealy Machines Today uential logic technologies Ving machine: Moore to synch. Mealy OPEN = creates

More information

ECE 2300 Digital Logic & Computer Organization. More Verilog Finite State Machines

ECE 2300 Digital Logic & Computer Organization. More Verilog Finite State Machines ECE 2300 Digital Logic & Computer Organization Spring 2017 More Verilog Finite State Machines Lecture 8: 1 Announcements 1 st batch of (raw) quiz scores released on CMS Solutions to HW 1-3 released on

More information

EECS 270 Verilog Reference: Sequential Logic

EECS 270 Verilog Reference: Sequential Logic 1 Introduction EECS 270 Verilog Reference: Sequential Logic In the first few EECS 270 labs, your designs were based solely on combinational logic, which is logic that deps only on its current inputs. However,

More information

Verilog 1 - Fundamentals

Verilog 1 - Fundamentals Verilog 1 - Fundamentals FA FA FA FA module adder( input [3:0] A, B, output cout, output [3:0] S ); wire c0, c1, c2; FA fa0( A[0], B[0], 1 b0, c0, S[0] ); FA fa1( A[1], B[1], c0, c1, S[1] ); FA fa2( A[2],

More information

271/471 Verilog Tutorial

271/471 Verilog Tutorial 271/471 Verilog Tutorial Prof. Scott Hauck, last revised 9/15/14 Introduction The following tutorial is inted to get you going quickly in circuit design in Verilog. It isn t a comprehensive guide to System

More information

DIGITAL SYSTEM DESIGN

DIGITAL SYSTEM DESIGN DIGITAL SYSTEM DESIGN Prepared By: Engr. Yousaf Hameed Lab Engineer BASIC ELECTRICAL & DIGITAL SYSTEMS LAB DEPARTMENT OF ELECTRICAL ENGINEERING Digital System Design 1 Name: Registration No: Roll No: Semester:

More information

ECE 4514 Digital Design II. Spring Lecture 9: Review of Key Ideas, System Commands and Testbenches

ECE 4514 Digital Design II. Spring Lecture 9: Review of Key Ideas, System Commands and Testbenches ECE 4514 Digital Design II Lecture 9: Review of Key Ideas, System Commands and Testbenches A Language Lecture Iterating the Key Ideas Verilog is a modeling language. It cannot express hardware directly.

More information

Lecture 32: SystemVerilog

Lecture 32: SystemVerilog Lecture 32: SystemVerilog Outline SystemVerilog module adder(input logic [31:0] a, input logic [31:0] b, output logic [31:0] y); assign y = a + b; Note that the inputs and outputs are 32-bit busses. 17:

More information

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog ECE 2300 Digital Logic & Computer Organization Spring 2018 More Sequential Logic Verilog Lecture 7: 1 Announcements HW3 will be posted tonight Prelim 1 Thursday March 1, in class Coverage: Lectures 1~7

More information

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 11. Introduction to Verilog II Sequential Circuits

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 11. Introduction to Verilog II Sequential Circuits Name: Instructor: Engr. Date Performed: Marks Obtained: /10 Group Members (ID):. Checked By: Date: Experiment # 11 Introduction to Verilog II Sequential Circuits OBJECTIVES: To understand the concepts

More information

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Comp 541 Digital Logic and Computer Design Fall 2014 Lab #4: Sequential Design: Counters Issued Wed 9/10/14; Due Wed 9/17/14 (11:59pm) This lab assignment

More information

VERILOG 2: LANGUAGE BASICS

VERILOG 2: LANGUAGE BASICS VERILOG 2: LANGUAGE BASICS Verilog module Modules are basic building blocks. These are two example module definitions which you should use: // Safer traditional method module abc (in1, in2, out); input

More information

Department of Computer Science and Electrical Engineering. CMPE 415 Verilog Events Timing and Testbenches Prof. Ryan Robucci

Department of Computer Science and Electrical Engineering. CMPE 415 Verilog Events Timing and Testbenches Prof. Ryan Robucci Department of Computer Science and Electrical Engineering CMPE 415 Verilog Events Timing and Testbenches Prof. Ryan Robucci An Event Driven Language also used for Synthesis We emphasize use of Verilog

More information

Digital design laboratory 5

Digital design laboratory 5 Digital design laboratory 5 Preparations Launch the ISE Design Suite Create new project: File -> New Project Preparations Name: DigLab5 Location: D drive! D:\DigLab5 Working directory: The same as Location

More information

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design 1 In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design a fininte state machine in order to produce the desired

More information

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design a fininte state machine in order to produce the desired

More information

Logic Circuits II ECE 2411 Thursday 4:45pm-7:20pm. Lecture 3

Logic Circuits II ECE 2411 Thursday 4:45pm-7:20pm. Lecture 3 Logic Circuits II ECE 2411 Thursday 4:45pm-7:20pm Lecture 3 Lecture 3 Topics Covered: Chapter 4 Discuss Sequential logic Verilog Coding Introduce Sequential coding Further review of Combinational Verilog

More information

FSM Components. FSM Description. HDL Coding Methods. Chapter 7: HDL Coding Techniques

FSM Components. FSM Description. HDL Coding Methods. Chapter 7: HDL Coding Techniques FSM Components XST features: Specific inference capabilities for synchronous Finite State Machine (FSM) components. Built-in FSM encoding strategies to accommodate your optimization goals. You may also

More information

Abstraction of State Elements. Sequential Logic Implementation. Forms of Sequential Logic. Finite State Machine Representations

Abstraction of State Elements. Sequential Logic Implementation. Forms of Sequential Logic. Finite State Machine Representations Sequential ogic Implementation! Models for representing sequential circuits " Finite-state machines (Moore and Mealy) " epresentation of memory (states) " hanges in state (transitions)! Design procedure

More information

CS232 VHDL Lecture. Types

CS232 VHDL Lecture. Types CS232 VHDL Lecture VHSIC Hardware Description Language [VHDL] is a language used to define and describe the behavior of digital circuits. Unlike most other programming languages, VHDL is explicitly parallel.

More information

ECE331: Hardware Organization and Design

ECE331: Hardware Organization and Design ECE331: Hardware Organization and Design Lecture 19: Verilog and Processor Performance Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Verilog Basics Hardware description language

More information

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University Digital Circuit Design and Language Datapath Design Chang, Ik Joon Kyunghee University Typical Synchronous Design + Control Section : Finite State Machine + Data Section: Adder, Multiplier, Shift Register

More information

A Brief Introduction to Verilog Hardware Definition Language (HDL)

A Brief Introduction to Verilog Hardware Definition Language (HDL) www.realdigital.org A Brief Introduction to Verilog Hardware Definition Language (HDL) Forward Verilog is a Hardware Description language (HDL) that is used to define the structure and/or behavior of digital

More information

EECS150 - Digital Design Lecture 7 - Computer Aided Design (CAD) - Part II (Logic Simulation) Finite State Machine Review

EECS150 - Digital Design Lecture 7 - Computer Aided Design (CAD) - Part II (Logic Simulation) Finite State Machine Review EECS150 - Digital Design Lecture 7 - Computer Aided Design (CAD) - Part II (Logic Simulation) Feb 9, 2010 John Wawrzynek Spring 2010 EECS150 - Lec7-CAD2 Page 1 Finite State Machine Review State Transition

More information

CSE140L: Components and Design Techniques for Digital Systems Lab. FSMs. Instructor: Mohsen Imani. Slides from Tajana Simunic Rosing

CSE140L: Components and Design Techniques for Digital Systems Lab. FSMs. Instructor: Mohsen Imani. Slides from Tajana Simunic Rosing CSE4L: Components and Design Techniques for Digital Systems La FSMs Instructor: Mohsen Imani Slides from Tajana Simunic Rosing Source: Vahid, Katz Flip-flops Hardware Description Languages and Sequential

More information

Lab 7 (Sections 300, 301 and 302) Prelab: Introduction to Verilog

Lab 7 (Sections 300, 301 and 302) Prelab: Introduction to Verilog Lab 7 (Sections 300, 301 and 302) Prelab: Introduction to Verilog Name: Sign the following statement: On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work

More information

Verilog Introduc/on Part 2. B39VS Systems project

Verilog Introduc/on Part 2. B39VS Systems project Verilog Introduc/on Part 2 B39VS Systems project COMBINATIONAL LOGIC VERILOG: Synthesis - Combina/onal Logic Combina/on logic func/on can be expressed as: logic_output(t) = f(logic_inputs(t)) logic_inputs(t)

More information

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Comp 541 Digital Logic and Computer Design Prof. Montek Singh Fall 2017 Lab #3A: Sequential Design: Counters Issued Wed 9/6/17; Due Wed 9/13/17 (11:59pm)

More information

Lecture 3. Behavioral Modeling Sequential Circuits. Registers Counters Finite State Machines

Lecture 3. Behavioral Modeling Sequential Circuits. Registers Counters Finite State Machines Lecture 3 Behavioral Modeling Sequential Circuits Registers Counters Finite State Machines Behavioral Modeling Behavioral Modeling Behavioral descriptions use the keyword always, followed by optional event

More information

271/469 Verilog Tutorial

271/469 Verilog Tutorial 271/469 Verilog Tutorial Prof. Scott Hauck, last revised 8/14/17 Introduction The following tutorial is inted to get you going quickly in circuit design in Verilog. It isn t a comprehensive guide to System

More information

ENSC E-123: HW D3: Counter Applications; Counter in Verilog

ENSC E-123: HW D3: Counter Applications; Counter in Verilog HW D3; Counter Applications 1 ENSC E-123: HW D3: Counter Applications; Counter in Verilog REV 0 1 ; February 12, 2015 Contents 1 Counter Applications: Sync vs Async Function (5 points) 2 1.1 Crummy: asyncclear(2points).................

More information

EE 231 Fall EE 231 Homework 8 Due October 20, 2010

EE 231 Fall EE 231 Homework 8 Due October 20, 2010 EE 231 Homework 8 Due October 20, 20 1. Consider the circuit below. It has three inputs (x and clock), and one output (z). At reset, the circuit starts with the outputs of all flip-flops at 0. x z J Q

More information

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013 EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013 Print Here Student ID Signature This is a closed book exam. The exam is to be completed in one-hundred ten (110) minutes. Don t use scratch

More information

VLSI II E. Özgür ATES

VLSI II E. Özgür ATES VERILOG TUTORIAL VLSI II E. Özgür ATES Outline Introduction Language elements Gate-level modeling Data-flow modeling Behavioral modeling Modeling examples Simulation and test bench Hardware Description

More information

Verilog for Synthesis Ing. Pullini Antonio

Verilog for Synthesis Ing. Pullini Antonio Verilog for Synthesis Ing. Pullini Antonio antonio.pullini@epfl.ch Outline Introduction to Verilog HDL Describing combinational logic Inference of basic combinational blocks Describing sequential circuits

More information

Quick Introduction to SystemVerilog: Sequental Logic

Quick Introduction to SystemVerilog: Sequental Logic ! Quick Introduction to SystemVerilog: Sequental Logic Lecture L3 8-545 Advanced Digital Design ECE Department Many elements Don Thomas, 24, used with permission with credit to G. Larson Today Quick synopsis

More information

The Verilog Language COMS W Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science

The Verilog Language COMS W Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science The Verilog Language COMS W4995-02 Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science The Verilog Language Originally a modeling language for a very efficient event-driven

More information

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1 FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1 Anurag Dwivedi Digital Design : Bottom Up Approach Basic Block - Gates Digital Design : Bottom Up Approach Gates -> Flip Flops Digital

More information

CSE 591: Advanced Hardware Design and Verification (2012 Spring) LAB #0

CSE 591: Advanced Hardware Design and Verification (2012 Spring) LAB #0 Lab 0: Tutorial on Xilinx Project Navigator & ALDEC s Active-HDL Simulator CSE 591: Advanced Hardware Design and Verification Assigned: 01/05/2011 Due: 01/19/2011 Table of Contents 1 Overview... 2 1.1

More information

ECEN : Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University. Homework #1 Solutions

ECEN : Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University. Homework #1 Solutions ECEN 449 749: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University Homework #1 Solutions Upload your homework solution to ecampus as a single pdf file. Your

More information

Digital Integrated Circuits

Digital Integrated Circuits Digital Integrated Circuits Lecture 3 Jaeyong Chung System-on-Chips (SoC) Laboratory Incheon National University GENERAL MODEL OF MEALY MACHINE Chung EPC6055 2 GENERAL MODEL OF MOORE MACHINE Chung EPC6055

More information

Finite-State Machine (FSM) Design

Finite-State Machine (FSM) Design 1 Finite-State Machine (FSM) Design FSMs, an important category of sequential circuits, are used frequently in designing digital systems. From the daily used electronic machines to the complex digital

More information

Laboratory Exercise 7

Laboratory Exercise 7 Laboratory Exercise 7 Finite State Machines This is an exercise in using finite state machines. Part I We wish to implement a finite state machine (FSM) that recognizes two specific sequences of applied

More information

ECE 353 Lab 4. Verilog Review. Professor Daniel Holcomb UMass Amherst Fall 2017

ECE 353 Lab 4. Verilog Review. Professor Daniel Holcomb UMass Amherst Fall 2017 ECE 353 Lab 4 Verilog Review Professor Daniel Holcomb UMass Amherst Fall 2017 What You Will Do In Lab 4 Design and implement a serial MIDI receiver Hardware in an Altera Complex Programmable Logic Device

More information

Finite State Machines

Finite State Machines Finite State Machines Design methodology for sequential logic -- identify distinct states -- create state transition diagram -- choose state encoding -- write combinational Verilog for next-state logic

More information

Administrivia. CSE 370 Spring 2006 Introduction to Digital Design Lecture 9: Multilevel Logic

Administrivia. CSE 370 Spring 2006 Introduction to Digital Design Lecture 9: Multilevel Logic SE 370 Spring 2006 Introduction to igital esign Lecture 9: Multilevel Logic Last Lecture Introduction to Verilog Today Multilevel Logic Hazards dministrivia Hand in Homework #3 Homework #3 posted this

More information

Lab 7 (All Sections) Prelab: Verilog Review and ALU Datapath and Control

Lab 7 (All Sections) Prelab: Verilog Review and ALU Datapath and Control Lab 7 (All Sections) Prelab: Verilog Review and ALU Datapath and Control Name: Sign the following statement: On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic

More information

N-input EX-NOR gate. N-output inverter. N-input NOR gate

N-input EX-NOR gate. N-output inverter. N-input NOR gate Hardware Description Language HDL Introduction HDL is a hardware description language used to design and document electronic systems. HDL allows designers to design at various levels of abstraction. It

More information

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis Jan 31, 2012 John Wawrzynek Spring 2012 EECS150 - Lec05-verilog_synth Page 1 Outline Quick review of essentials of state elements Finite State

More information

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1] FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language Reference: [] FIELD PROGRAMMABLE GATE ARRAY FPGA is a hardware logic device that is programmable Logic functions may be programmed

More information

Graduate Institute of Electronics Engineering, NTU. Lecturer: Chihhao Chao Date:

Graduate Institute of Electronics Engineering, NTU. Lecturer: Chihhao Chao Date: Design of Datapath Controllers and Sequential Logic Lecturer: Date: 2009.03.18 ACCESS IC LAB Sequential Circuit Model & Timing Parameters ACCESS IC LAB Combinational Logic Review Combinational logic circuits

More information

Introduction to Verilog

Introduction to Verilog Introduction to Verilog Synthesis and HDLs Verilog: The Module Continuous (Dataflow) Assignment Gate Level Description Procedural Assignment with always Verilog Registers Mix-and-Match Assignments The

More information

Behavioral Modeling and Timing Constraints

Behavioral Modeling and Timing Constraints Lab Workbook Introduction Behavioral modeling was introduced in Lab 1 as one of three widely used modeling styles. Additional capabilities with respect to testbenches were further introduced in Lab 4.

More information

Spring 2017 EE 3613: Computer Organization Chapter 5: Processor: Datapath & Control - 2 Verilog Tutorial

Spring 2017 EE 3613: Computer Organization Chapter 5: Processor: Datapath & Control - 2 Verilog Tutorial Spring 2017 EE 3613: Computer Organization Chapter 5: Processor: Datapath & Control - 2 Verilog Tutorial Avinash Kodi Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio

More information

Introduction to Verilog and XILINX

Introduction to Verilog and XILINX DEPARTAMENTO DE TECNOLOGÍA ELECTRÓNICA ESCUELA TÉCNICA SUPERIOR DE INGENIERÍA INFORMÁTICA Introduction to Verilog and XILINX Lab Session Computer Structure WARNING: A written solution of the preliminary

More information

Last Lecture: Divide by 3 FSM

Last Lecture: Divide by 3 FSM Last Lecture: Divide by 3 FSM Output should be 1 every 3 clock cycles S2 S0 S1 The double circle indicates the reset state Slide derived from slides by Harris & Harris from their book 1 Finite State Machines

More information

Verilog Coding Guideline

Verilog Coding Guideline Verilog Coding Guideline Digital Circuit Lab TA: Po-Chen Wu Outline Introduction to Verilog HDL Verilog Syntax Combinational and Sequential Logics Module Hierarchy Write Your Design Finite State Machine

More information

Laboratory Exercise 3 Davide Rossi DEI University of Bologna AA

Laboratory Exercise 3 Davide Rossi DEI University of Bologna AA Laboratory Exercise 3 Davide Rossi DEI University of Bologna AA 2017-2018 Objectives Summary of finite state machines (Mealy, Moore) Description of FSMs in System Verilog Design of control blocks based

More information

HDL Compiler Directives 7

HDL Compiler Directives 7 7 HDL Compiler Directives 7 Directives are a special case of regular comments and are ignored by the Verilog HDL simulator HDL Compiler directives begin, like all other Verilog comments, with the characters

More information

FSM and Efficient Synthesizable FSM Design using Verilog

FSM and Efficient Synthesizable FSM Design using Verilog FSM and Efficient Synthesizable FSM Design using Verilog Introduction There are many ways to code FSMs including many very poor ways to code FSMs. This lecture offers guidelines for doing efficient coding,

More information

Parallel versus serial execution

Parallel versus serial execution Parallel versus serial execution F assign statements are implicitly parallel Ì = means continuous assignment Ì Example assign E = A & D; assign A = B & C; Ì A and E change if B changes F always blocks

More information

Tutorial 3. Appendix D. D.1 Design Using Verilog Code. The Ripple-Carry Adder Code. Functional Simulation

Tutorial 3. Appendix D. D.1 Design Using Verilog Code. The Ripple-Carry Adder Code. Functional Simulation Appendix D Tutorial 3 This tutorial introduces more advanced capabilities of the Quartus II system. We show how Verilog code is organized and compiled and illustrate how multibit signals are represented

More information

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS Note: Closed book no notes or other material allowed apart from the one

More information

Introduction To Verilog Design. Chun-Hung Chou

Introduction To Verilog Design. Chun-Hung Chou Introduction To Verilog Design Chun-Hung Chou 1 Outline Typical Design Flow Design Method Lexical Convention Data Type Data Assignment Event Control Conditional Description Register Description Synthesizable

More information

Chap 4 Connecting the Testbench and. Design. Interfaces Clocking blocks Program blocks The end of simulation Top level scope Assertions

Chap 4 Connecting the Testbench and. Design. Interfaces Clocking blocks Program blocks The end of simulation Top level scope Assertions Chap 4 Connecting the Testbench and Interfaces Clocking blocks Program blocks The end of simulation Top level scope Assertions Design 1 4 Connecting the Testbench and Design Testbench wraps around the

More information

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8 CSCB58 - Lab 3 Latches, Flip-flops, and Registers Learning Objectives The purpose of this exercise is to investigate the fundamental synchronous logic elements: latches, flip-flops, and registers. Prelab

More information

Nonblocking Assignments in Verilog Synthesis; Coding Styles That Kill!

Nonblocking Assignments in Verilog Synthesis; Coding Styles That Kill! Nonblocking Assignments in Verilog Synthesis; Coding Styles That Kill! by Cliff Cummings Sunburst Design, Inc. Abstract -------- One of the most misunderstood constructs in the Verilog language is the

More information

OUTLINE SYSTEM-ON-CHIP DESIGN. GETTING STARTED WITH VHDL September 3, 2018 GAJSKI S Y-CHART (1983) TOP-DOWN DESIGN (1)

OUTLINE SYSTEM-ON-CHIP DESIGN. GETTING STARTED WITH VHDL September 3, 2018 GAJSKI S Y-CHART (1983) TOP-DOWN DESIGN (1) September 3, 2018 GETTING STARTED WITH VHDL 2 Top-down design VHDL history Main elements of VHDL Entities and architectures Signals and processes Data types Configurations Simulator basics The testbench

More information

Designing Safe Verilog State Machines with Synplify

Designing Safe Verilog State Machines with Synplify Designing Safe Verilog State Machines with Synplify Introduction One of the strengths of Synplify is the Finite State Machine compiler. This is a powerful feature that not only has the ability to automatically

More information

Verilog Module 1 Introduction and Combinational Logic

Verilog Module 1 Introduction and Combinational Logic Verilog Module 1 Introduction and Combinational Logic Jim Duckworth ECE Department, WPI 1 Module 1 Verilog background 1983: Gateway Design Automation released Verilog HDL Verilog and simulator 1985: Verilog

More information

Nikhil Gupta. FPGA Challenge Takneek 2012

Nikhil Gupta. FPGA Challenge Takneek 2012 Nikhil Gupta FPGA Challenge Takneek 2012 RECAP FPGA Field Programmable Gate Array Matrix of logic gates Can be configured in any way by the user Codes for FPGA are executed in parallel Configured using

More information

A Verilog Primer. An Overview of Verilog for Digital Design and Simulation

A Verilog Primer. An Overview of Verilog for Digital Design and Simulation A Verilog Primer An Overview of Verilog for Digital Design and Simulation John Wright Vighnesh Iyer Department of Electrical Engineering and Computer Sciences College of Engineering, University of California,

More information

ECE 274 Digital Logic Verilog

ECE 274 Digital Logic Verilog ECE 74 Digital Logic Verilog (Vahid, Lysecky): Ch. 4 Multifunction Register Behavior Previously-considered register loaded on every clock cycle Now consider register with control inputs, such as load or

More information

Techniques for Digital Systems Lab. Verilog HDL. Tajana Simunic Rosing. Source: Eric Crabill, Xilinx

Techniques for Digital Systems Lab. Verilog HDL. Tajana Simunic Rosing. Source: Eric Crabill, Xilinx CSE140L: Components and Design Techniques for Digital Systems Lab Verilog HDL Tajana Simunic Rosing Source: Eric Crabill, Xilinx 1 More complex behavioral model module life (n0, n1, n2, n3, n4, n5, n6,

More information

Last Lecture. Talked about combinational logic always statements. e.g., module ex2(input logic a, b, c, output logic f); logic t; // internal signal

Last Lecture. Talked about combinational logic always statements. e.g., module ex2(input logic a, b, c, output logic f); logic t; // internal signal Last Lecture Talked about combinational logic always statements. e.g., module ex2(input logic a, b, c, output logic f); logic t; // internal signal always_comb t = a & b; f = t c; should use = (called

More information

Introduction to Verilog and ModelSim. (Part 6 State Machines)

Introduction to Verilog and ModelSim. (Part 6 State Machines) Introduction to Verilog and ModelSim (Part 6 State Machines) State Machine Actually, a Finite State Machine (FSM) mathematical model of computation abstract machine with finite states can only be in ONE

More information

HDL. Hardware Description Languages extensively used for:

HDL. Hardware Description Languages extensively used for: HDL Hardware Description Languages extensively used for: Describing (digital) hardware (formal documentation) Simulating it Verifying it Synthesizing it (first step of modern design flow) 2 main options:

More information

VHDL: RTL Synthesis Basics. 1 of 59

VHDL: RTL Synthesis Basics. 1 of 59 VHDL: RTL Synthesis Basics 1 of 59 Goals To learn the basics of RTL synthesis. To be able to synthesize a digital system, given its VHDL model. To be able to relate VHDL code to its synthesized output.

More information

EECS 3201: Digital Logic Design Lecture 4. Ihab Amer, PhD, SMIEEE, P.Eng.

EECS 3201: Digital Logic Design Lecture 4. Ihab Amer, PhD, SMIEEE, P.Eng. EECS 32: Digital Logic Design Lecture 4 Ihab Amer, PhD, SMIEEE, P.Eng. What is a HDL? A high-level computer language that can describe digital systems in tetual form Two applications of HDL processing:

More information

ECE 4514 Digital Design II. Spring Lecture 3: Verilog Bread and Butter

ECE 4514 Digital Design II. Spring Lecture 3: Verilog Bread and Butter ECE 4514 Digital Design II Spring 2007 Verilog Difference between synthesis and simulation Modules, module declarations and instantiation Constants Numbers Data types Value Levels Regs Vectors Arrays Synthesis

More information