ECEN 651: Microprogrammed Control of Digital Systems Department of Electrical and Computer Engineering Texas A&M University

Similar documents
ECEN 651: Microprogrammed Control of Digital Systems Department of Electrical and Computer Engineering Texas A&M University

Laboratory Exercise #8 Introduction to Sequential Logic

Laboratory Exercise #10 An Introduction to High-Speed Addition

Laboratory Exercise #11 A Simple Digital Combination Lock

Digital Circuits and Systems

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

CHW 261: Logic Design

ELE2120 Digital Circuits and Systems. Tutorial Note 9

UNIVERSITY OF WISCONSIN MADISON

Digital Fundamentals

Tate Bilinear Pairing Core Specification. Author: Homer Hsing

Boolean Logic Continued Prof. James L. Frankel Harvard University

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING EXAMINATION SEMESTER /2017

Q: Examine the relationship between X and the Next state. How would you describe this circuit? A: An inverter which is synched with a clock signal.

Simulation of Logic Primitives and Dynamic D-latch with Verilog-XL

Chapter 5 Synchronous Sequential Logic

Simplify the following Boolean expressions and minimize the number of literals:

University of Florida EEL 3701 Fall 2014 Dr. Eric. M. Schwartz Department of Electrical & Computer Engineering Wednesday, 15 October 2014

Lecture 17: Designing Sequential Systems Using Flip Flops

Synchronous Sequential Circuit Design. Digital Computer Design

Chapter 14 Sequential logic, Latches and Flip-Flops

Different encodings generate different circuits

University of Guelph School of Engineering ENG 2410 Digital Design Fall There are 7 questions, answer all questions.

Digital Circuits. 1. Inputs & Outputs are quantized at two levels. 2. Binary arithmetic, only digits are 0 & 1. Position indicates power of 2.

Introduction to the Xilinx Spartan-3E

CprE 281: Digital Logic

Chapter 3 Combinational Logic Design

State and Finite State Machines

Elliptic Curve Group Core Specification. Author: Homer Hsing

Synchronous Sequential Logic

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 7 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

University of Florida EEL 3701 Summer 2015 Dr. Eric. M. Schwartz Department of Electrical & Computer Engineering Tuesday, 30 June 2015

Lab #10: Design of Finite State Machines

Digital Circuits ECS 371

6 Synchronous State Machine Design

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Parity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process

State & Finite State Machines

CPE100: Digital Logic Design I

Philadelphia University Student Name: Student Number:

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences

Clocked Synchronous State-machine Analysis

Chapter 7 Sequential Logic

ENGG 1203 Tutorial _03 Laboratory 3 Build a ball counter. Lab 3. Lab 3 Gate Timing. Lab 3 Steps in designing a State Machine. Timing diagram of a DFF

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

DESIGN AND IMPLEMENTATION OF ENCODERS AND DECODERS. To design and implement encoders and decoders using logic gates.

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

Lecture 14 Finite state machines

COMBINATIONAL LOGIC FUNCTIONS

Experiment 7: Magnitude comparators

Finite State Machine (FSM)

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C.

EGC221: Digital Logic Lab

Digital Logic Design. Midterm #2

Problem Set 9 Solutions

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

Module half adder module half_adder(output S,C,input x,y); xor(s,x,y); and(c,x,y); endmodule

11.1 As mentioned in Experiment 10, sequential logic circuits are a type of logic circuit where the output of

ECE 341. Lecture # 3

Sequential Circuit Analysis

State & Finite State Machines

Written reexam with solutions for IE1204/5 Digital Design Monday 14/

EECS150 - Digital Design Lecture 17 - Sequential Circuits 3 (Counters)

EECS150 - Digital Design Lecture 23 - FSMs & Counters

ECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals

EECS150 - Digital Design Lecture 25 Shifters and Counters. Recap

EXPERIMENT Traffic Light Controller

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 18 - Counters

Module 2. Basic Digital Building Blocks. Binary Arithmetic & Arithmetic Circuits Comparators, Decoders, Encoders, Multiplexors Flip-Flops

Faculty of Engineering. FINAL EXAMINATION FALL 2008 (December2008) ANSWER KEY

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

EECS150 - Digital Design Lecture 11 - Shifters & Counters. Register Summary

Combinational Logic. By : Ali Mustafa

Roger L. Tokheim. Chapter 8 Counters Glencoe/McGraw-Hill

Sample Test Paper - I

Chapter 4 (Lect 4) Encoders Multiplexers Three-State Gates More Verilog

Save from: cs. Logic design 1 st Class أستاذ المادة: د. عماد

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

EET 310 Flip-Flops 11/17/2011 1

Philadelphia University Student Name: Student Number:

Combinational Logic Design Combinational Functions and Circuits

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

Written exam with solutions IE Digital Design Friday 21/

ALU A functional unit

Binary addition example worked out

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University

EECS 312: Digital Integrated Circuits Midterm Exam 2 December 2010

ELCT201: DIGITAL LOGIC DESIGN

Example: vending machine

ELEVATOR CONTROL CIRCUIT. Project No: PRJ045 Presented by; Masila Jane Mwelu. Supervisor: Prof. Mwangi Examiner: Dr. Mang oli

Shift Register Counters

Boolean Logic Prof. James L. Frankel Harvard University. Version of 3:20 PM 29-Aug-2017 Copyright 2017, 2016 James L. Frankel. All rights reserved.

Logic Design II (17.342) Spring Lecture Outline

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

Gates and Flip-Flops

Quiz 2 Room 10 Evans Hall, 2:10pm Tuesday April 2 (Open Katz only, Calculators OK, 1hr 20mins)

Transcription:

ECEN 651: Microprogrammed Control of Digital Systems Department of Electrical and Computer Engineering Texas A&M University Prof. Mi Lu TA: Ehsan Rohani Laboratory Exercise #2 Behavioral, Dataflow, and Structural Verilog Objective The objective of lab this week is to explain the various levels of abstraction used to model digital logic in Verilog, while reviewing a few architectural level digital components. In Verilog, digital logic can be described in three distinct ways. At one of the spectrum is structural modeling such that digital logic is conveyed using primitive logic gates. At the other of the spectrum is behavioral in which a particular circuit behavior is simply described. Somewhere between these two is a method which allows the designer to express how data should flow through the digital circuitry using logic and arithmetic expressions. Typically, a design will consist of a mixture of the aforementioned design description levels. Experience developing hardware in Verilog will reveal which level is more appropriate for a given circumstance. Procedure 1. Design and simulate a JK Flip-flop using structural Verilog. (a) Using Figure 1 as a reference, describe a JK Flip-flop in structural Verilog. 1

2 Laboratory Exercise #2 J Q Clk ~Q K ~R Figure 1: A JK Flip-Flop constructed with gates (b) Use the code provide below to test your structural model of the JK flip-flop. Demonstrate your progress to the TA. Note the use of blocking assignment statements in the code below. d e f i n e STRLEN 15 module JKTest v ; t a s k p a s s T e s t ; i n p u t a c t u a l O u t, e x p e c t e d O u t ; i n p u t [ STRLEN 8 : 0 ] t e s t T y p e ; i n o u t [ 7 : 0 ] p a s s e d ; i f ( a c t u a l O u t == e x p e c t e d O u t ) $ d i s p l a y ( % s p a s s e d, t e s t T y p e ) ; p a s s e d = p a s s e d + 1 ; $ d i s p l a y ( % s f a i l e d : %d s h o u l d be %d, t e s t T y p e, a c t u a l O u t, e x p e c t e d O u t ) ; t a s k a l l P a s s e d ; 2 ECEN 651

Laboratory Exercise #2 3 i n p u t [ 7 : 0 ] p a s s e d ; i n p u t [ 7 : 0 ] numtests ; i f ( p a s s e d == numtests ) $ d i s p l a y ( A l l t e s t s p a s s e d ) ; $ d i s p l a y ( Some t e s t s f a i l e d ) ; / / I n p u t s r e g j ; r e g k ; r e g c l k ; r e g r e s e t ; r e g [ 7 : 0 ] p a s s e d ; / / O u t p u t s w ire o u t ; / / I n s t a n t i a t e t h e Unit Under T e s t (UUT) JK u u t (. o u t ( o u t ),. j ( j ),. k ( k ),. c l k ( c l k ),. r e s e t ( r e s e t ) ) ; i n i t i a l / / I n i t i a l i z e I n p u t s j = 0 ; k = 0 ; c l k = 0 ; r e s e t = 1 ; p a s s e d = 0 ; / / Wait 100 ns f o r g l o b a l r e s e t t o f i n i s h #100; ECEN 651 3

4 Laboratory Exercise #2 / / Add s t i m u l u s h e r e r e s e t = 0 ; #90; j =1; k =0; # 7 ; c l k = 1 ; p a s s T e s t ( out, 1, S e t, p a s s e d ) ; #90; j =1; k =1; # 7 ; c l k = 1 ; p a s s T e s t ( out, 0, Toggle 1, p a s s e d ) ; #90; j =0; k =0; # 7 ; c l k = 1 ; p a s s T e s t ( out, 0, Hold 1, p a s s e d ) ; #90; j =1; k =1; # 7 ; c l k = 1 ; p a s s T e s t ( out, 1, Toggle 2, p a s s e d ) ; #90; j =0; k =0; # 7 ; c l k = 1 ; p a s s T e s t ( out, 1, Hold 2, p a s s e d ) ; #90; j =0; k =1; # 7 ; c l k = 1 ; p a s s T e s t ( out, 0, R e s e t, p a s s e d ) ; #90; a l l P a s s e d ( passed, 6 ) ; module (c) Provide a truth table to describe the operation of a JK Flip-flop. 2. Design and simulate a JK and D Flip-flop using behavioral Verilog. (a) In behavioral Verilog, create a JK Flip-flop module. Be sure to use non-blocking assignment statements. 4 ECEN 651

Laboratory Exercise #2 5 (b) Test your module against the test bench provided above. The operation should be identical to that of your structural version. (c) Now create a D Flip-flop using behavioral Verilog and provide the truth table for a D flip-flop. (d) Using the above testbench as a starting point, create a testbench to test the operation of your D Flip-flop. Demonstrate your progress to the TA. 3. Design and simulate a 2-to-4 decoder using dataflow Verilog. (a) Construct the truth table for a 2:4 decoder with an enable signal. (b) Draw the gate level schematic for a 2:4 decoder. (c) Describe the decoder in Verilog using dataflow level modeling. Hint: You can do so succinctly using the ternary operator and the << operator. (d) Use the code provided below to test the operation of your decoder. Demonstrate your progress to the TA when complete. d e f i n e STRLEN 15 module Decode24Test v ; t a s k p a s s T e s t ; i n p u t a c t u a l O u t, e x p e c t e d O u t ; i n p u t [ STRLEN 8 : 0 ] t e s t T y p e ; i n o u t [ 7 : 0 ] p a s s e d ; i f ( a c t u a l O u t == e x p e c t e d O u t ) $ d i s p l a y ( % s p a s s e d, t e s t T y p e ) ; p a s s e d = p a s s e d + 1 ; $ d i s p l a y ( % s f a i l e d : %d s h o u l d be %d, t e s t T y p e, a c t u a l O u t, e x p e c t e d O u t ) ; ECEN 651 5

6 Laboratory Exercise #2 t a s k a l l P a s s e d ; i n p u t [ 7 : 0 ] p a s s e d ; i n p u t [ 7 : 0 ] numtests ; i f ( p a s s e d == numtests ) $ d i s p l a y ( A l l t e s t s p a s s e d ) ; $ d i s p l a y ( Some t e s t s f a i l e d ) ; / / I n p u t s r e g [ 1 : 0 ] i n ; r e g [ 7 : 0 ] p a s s e d ; / / O u t p u t s w ire [ 3 : 0 ] o u t ; / / I n s t a n t i a t e t h e Unit Under T e s t (UUT) Decode24 u u t (. i n ( i n ),. o u t ( o u t ) ) ; i n i t i a l / / I n i t i a l i z e I n p u t s i n = 0 ; p a s s e d = 0 ; / / Add s t i m u l u s h e r e #90; i n = 0 ; #10; p a s s T e s t ( out, 1, I n p u t 0, p a s s e d ) ; #90; i n = 1 ; #10; p a s s T e s t ( out, 2, I n p u t 1, p a s s e d ) ; #90; i n = 2 ; #10; p a s s T e s t ( out, 4, I n p u t 2, p a s s e d ) ; #90; i n = 3 ; #10; p a s s T e s t ( out, 8, I n p u t 3, p a s s e d ) ; a l l P a s s e d ( passed, 4 ) ; 6 ECEN 651

Laboratory Exercise #2 7 module 1 Deliverables 1. Submit a lab report that captures your efforts in lab. 2. Include all Verilog source files with appropriate comments. Note: Code submitted without adequate comments will not be graded! 3. Be sure to include all material requested in lab. 4. Answer the following review questions: (a) In behavioral Verilog, two types of assignment statements exists. What are they, and when would you use one over the other? (b) Compare and contrast the structural verses behavioral implementation of the JK flip-flop. Which level of abstraction might you use for a processor design and why? (c) Based on the gate level diagram you created for the 2:4 decoder, how would the structural implementation compare to the dataflow implementation? Could you use behavioral Verilog to create the 2:4 decoder? If so, provide a snippet of code to do so. ECEN 651 7