Digital Design Using Verilog EE Final Examination

Similar documents
Digital Design Using Verilog EE Midterm Examination

Digital Design using HDLs EE 4755 Midterm Examination

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

Computer Organization EE 3755 Midterm Examination

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

Writing Circuit Descriptions 8

TOPIC : Verilog Synthesis examples. Module 4.3 : Verilog synthesis

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

EE 4755 Digital Design Using Hardware Description Languages

Verilog for High Performance

CAD for VLSI Design - I. Lecture 21 V. Kamakoti and Shankar Balachandran

Digital Design using HDLs EE 4755 Midterm Examination

Computer Organization EE 3755 Midterm Examination

Digital Design using HDLs EE 4755 Final Examination

Computer Organization EE 3755 Midterm Examination

Digital Design using HDLs EE 4755 Midterm Examination

Modeling Sequential Circuits in Verilog

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

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

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

Amrita Vishwa Vidyapeetham. EC429 VLSI System Design Answer Key

Blocking(=) vs Nonblocking (<=) Assignment. Lecture 3: Modeling Sequential Logic in Verilog HDL. Procedural assignments

Digital Design using HDLs EE 4755 Midterm Examination

Synthesizable Verilog

Verilog Lecture Gandhi Puvvada, USC always statements, Coding a Flip-Flop. blocking and non-blocking assignments. Copyright 2008 Gandhi Puvvada 1

Verilog for Synthesis Ing. Pullini Antonio

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

Digital Design with FPGAs. By Neeraj Kulkarni

EN164: Design of Computing Systems Lecture 06: Lab Foundations / Verilog 2

271/471 Verilog Tutorial

VHDL for Synthesis. Course Description. Course Duration. Goals

Verilog For Synthesis

Quick Introduction to SystemVerilog: Sequental Logic

VHDL: RTL Synthesis Basics. 1 of 59

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

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

Last Lecture: Divide by 3 FSM

CSE140L: Components and Design Techniques for Digital Systems Lab

Digital Design using HDLs EE 4755 Final Examination

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

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

CSE140L: Components and Design

ECE Digital Engineering Laboratory. Designing for Synthesis

EEL 4783: HDL in Digital System Design

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Nonblocking Assignments in Verilog Synthesis; Coding Styles That Kill!

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

Digital Integrated Circuits

Lecture 15: System Modeling and Verilog

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

Lecture 7: Structural RTL Design. Housekeeping

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

ECEN 468 Advanced Logic Design

VLSI Design 13. Introduction to Verilog

Programming with HDLs

Verilog Execution Semantics

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

Simple Behavioral Model: the always block

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

EECS150 - Digital Design Lecture 10 Logic Synthesis

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

EECS150 - Digital Design Lecture 10 Logic Synthesis

Verilog Nonblocking Assignments with Delays - Myths & Mysteries

Digital System Design Verilog-Part III. Amir Masoud Gharehbaghi

EN164: Design of Computing Systems Lecture 07: Lab Foundations / Verilog 3

Course Details: Webpage

CME341 Assignment 4. module if\_else\_combinational\_logic( input [3:0] a, b, output reg [3:0] y ); * begin

Introduction to Verilog/System Verilog

Lecture 12 VHDL Synthesis

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

EN2911X: Reconfigurable Computing Lecture 05: Verilog (2)

ECE 551 Digital System Design and Synthesis. Instructor: Kewal K. Saluja. Midterm Exam

EE178 Spring 2018 Lecture Module 4. Eric Crabill

Introduction. Why Use HDL? Simulation output. Explanation

Synthesis of Combinational and Sequential Circuits with Verilog

L5: Simple Sequential Circuits and Verilog

LSU EE 4755 Homework 1 Solution Due: 9 September 2015

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

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

Module 4. Design of Embedded Processors. Version 2 EE IIT, Kharagpur 1

Register Transfer Level in Verilog: Part I

Online Verilog Resources

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

MCMASTER UNIVERSITY EMBEDDED SYSTEMS

Lab 7 (All Sections) Prelab: Introduction to Verilog

REGISTER TRANSFER AND MICROOPERATIONS

Verilog introduction. Embedded and Ambient Systems Lab

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

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

Homework deadline extended to next friday

Algorithmic C synthesis (High-level synthesis)

Introduction to Verilog HDL. Verilog 1

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

Register Transfer Level

271/469 Verilog Tutorial

C A R L E T O N U N I V E R S I T Y. FINAL EXAMINATION April Duration: 3 Hours No. of Students: 108

Digital Design with SystemVerilog

Politecnico di Milano FACOLTÀ DI INGEGNERIA DELL INFORMAZIONE. Sistemi Embedded 1 A.A Exam date: September 5 th, 2017

The University of Alabama in Huntsville ECE Department CPE Midterm Exam February 26, 2003

Transcription:

Name Digital Design Using Verilog EE 4702-1 Final Examination 8 May 2000, 7:30 9:30 CDT Alias Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Exam Total (100 pts) Good Luck!

Problem 1: The modules below are supposed to describe combinational logic that rearranges bits. The output of module rearrange, below, is a rearranged version of its input a; input op determines how the bits are rearranged. Module rerearrange uses two instances of rearrange to reverse and then left shift its inputs. Unfortunately, the modules are not quite ready for tape out because both contain errors. Find and fix the following kinds of errors. (Points may be deducted if correct Verilog is identified as having errors.) A: One compile error. (Modelsim will not compile it.) B: One load error or warning. (Modelsim will compile it but will issue a warning or error message when loading it.) C: Three errors that result in incorrect output. The code will simulate but the output, if any, will be incorrect. Lines with the comment // Okay do not have errors. None of the errors are typographical or are due to syntactic minutiæ such as missing semicolons. module rerearrange(y,a); input a; output y; wire [7:0] a; reg [7:0] y; wire [0:7] temp; wire operation; assign operation = e1.op_reverse; rearrange e1(temp,a,operation); assign operation = e1.op_left_shift; rearrange e2(y,temp,operation); module rearrange(x,a,op); input a, op; output x; wire [7:0] a; wire [1:0] op; reg [7:0] x; reg [2:0] ptr, ptr_plus_one; parameter op_reverse = 0; // Reverse order of bits. // Okay parameter op_identity = 1; // No change. // Okay parameter op_left_shift = 2; // Circular (-around) left shift. // Okay parameter op_right_shift = 3; // Circular (-around) right shift.// Okay always @( a ) for(ptr=0; ptr<8; ptr=ptr+1) begin ptr_plus_one = ptr + 1; // Okay case( op ) op_reverse: x[ptr] = a[7-ptr]; // Okay op_identity: x[ptr] = a[ptr]; // Okay op_right_shift: x[ptr] = a[ptr_plus_one]; // Okay op_left_shift: x[ptr_plus_one] = a[ptr]; // Okay case 2

Problem 2: Using the grid show the register values for the first 40 time units of execution of the module below. module clocks(); reg clk, clk2, clk3, clk4, clk5, clk6, clk7, clk8; initial begin clk = 0; clk2 = 0; clk3 = 0; clk4 = 0; clk5 = 0; clk6 = 0; clk7 = 0; clk8 = 0; always #8 clk = ~clk; always @( clk ) #4 clk2 = ~clk2; always @( clk ) clk3 <= #10 clk; always @( posedge clk ) clk4 = ~clk4; always #2 forever #8 clk5 = ~clk5; always wait( clk ) #3 clk6 = ~clk6; always @( clk clk4 ) clk7 = ~clk7; always @( clk or clk4 ) clk8 = ~clk8; Time 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 clk clk2 clk3 clk4 clk5 clk6 clk7 clk8 3

Problem 3: Draw a schematic of the hardware Leonardo will synthesize for the following Verilog code examples. These should approximate the RTL schematic, showing the hardware before optimization and technology mapping. If flip flops are used, indicate if they are level triggered or edge triggered. Otherwise, don t worry about using the precisely correct gate or symbol, as long as it s functionally correct. (a) Show an approximate RTL schematic for the module below. What form is the description in? Hint: think about what form the code is in. (6 pts) module mod_a(x,y,a,b,c); input a,b,c; output x,y; wire [7:0] b, c; reg [8:0] x, y; always @( a or b or c ) begin if( a ) begin x = b + c; y = b - c; else begin x = b - c; 4

Problem 3, continued: (b) Show an approximate RTL schematic for the module below. What form is the description in? Hint: think about what form the code is in. (6 pts) module mod_b(x,y,d,e,f,g,h); input d,e,f,g,h; output x,y; reg x,y; always @( posedge d or negedge e or posedge f ) if( d ) begin x = 0; y = 1; else if ( f ) begin x = 1; else begin if( g ) x = h; y = h; 5

Problem 3, continued: (c) Show an approximate RTL schematic for the module below. Assume that the synthesis program will not infer that this module performs magnitude comparison. Use symbols < and > for bit comparison. (8 pts) module compare(gt, lt, a, b); input a, b; output gt, lt; wire [2:0] a, b; reg gt, lt; integer i; always @( a or b ) begin gt = 0; lt = 0; for(i=2; i>=0; i=i-1) if(!gt &&!lt ) begin if( a[i] < b[i] ) lt = 1; if( a[i] > b[i] ) gt = 1; 6

Problem 4: The incomplete code below, compare_ism, is for a magnitude comparison module (similar to the one in the previous problem, except it s sequential). When input start is set to 1, output valid goes to zero and the module computes lt and gt. When lt and gt are set to their proper values valid is set to one. The module is to compare one bit position per cycle of input clk. Output valid should go to one as soon as possible. Complete the module so that it is in the form of an implicit state machine, synthesizable by Leonardo. The solution can be based on the combinational module compare, below. Don t forget signals start and valid. Hint: The solution is very similar to the combinational module. For partial credit ignore synthesizability but follow other specifications. module compare(gt, lt, a, b); // Synthesizable combinational implementation. input a, b; output gt, lt; wire [31:0] a, b; reg gt, lt; integer i; always @( a or b ) begin gt = 0; lt = 0; for(i=31; i>=0; i=i-1) if(!gt &&!lt ) begin if( a[i] < b[i] ) lt = 1; if( a[i] > b[i] ) gt = 1; // Implicit state machine implementation. module compare_ism(gt, lt, valid, a, b, start, clk); input a, b, start, clk; output gt, lt, valid; wire [31:0] a, b; reg gt, lt, valid; wire start, clk; integer i; if( a[i] < b[i] ) lt = 1; if( a[i] > b[i] ) gt = 1; // Part of solution. 7

Problem 5: Answer each question below. (a) Complete the module below so that it will stop simulation (using the system task $stop) if there is no change in signal heartbeat for 1000 simulator time units. There might be many changes in heartbeat, but the first time heartbeat remains unchanged for 1000 simulator time units simulation should be stopped. Hint: use a fork. Also, the answer is short. (5 pts) module watchdog(heartbeat); input heartbeat; wire heartbeat; // watchdog (b) What is a critical path? At what point in the design flow can one first find out about critical paths? (5 pts) 8

(c) Provide an example case statement in which the directive exemplar case_parallel is needed. What is its effect? (5 pts) (d) The module below is supposed to zero the middle 3 bits of its input. It s rejected by the compiler (the b= line), identify and fix the problem. (5 pts) module whatswrong(a,b); input a; output b; wire [8:0] a; wire [8:0] b; assign b = {a[8:6],0,a[2:0]}; 9