First Name: Last Name: PID: CSE 140L Exam. Prof. Tajana Simunic Rosing. Winter 2010

Similar documents
CSE 140L Final Exam. Prof. Tajana Simunic Rosing. Spring 2008

CSE 140L Final Exam. Prof. Tajana Simunic Rosing. Spring 2008

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

EECS 151/251A: SRPING 2017 MIDTERM 1

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

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

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

EECS150 - Digital Design Lecture 20 - Finite State Machines Revisited

CSE140: Components and Design Techniques for Digital Systems

MLR Institute of Technology

VERILOG: FLIP-FLOPS AND REGISTERS

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

Finite-State Machine (FSM) Design

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

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

Note: Closed book no notes or other material allowed, no calculators or other electronic devices.

Memories. Design of Digital Circuits 2017 Srdjan Capkun Onur Mutlu.

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

Digital Design with SystemVerilog

ECE 341 Midterm Exam

Chapter 5 Registers & Counters

ECE 551: Digital System *

Modeling Sequential Circuits in Verilog

Digital Design with FPGAs. By Neeraj Kulkarni

EECS 373 Practice Midterm / Homework #3 Fall 2014

problem maximum score 1 10pts 2 8pts 3 10pts 4 12pts 5 7pts 6 7pts 7 7pts 8 17pts 9 22pts total 100pts

One and a half hours. Section A is COMPULSORY

ECE 341 Midterm Exam

Sense Amplifiers 6 T Cell. M PC is the precharge transistor whose purpose is to force the latch to operate at the unstable point.

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

CSE140L: Components and Design Techniques for Digital Systems Lab. Verilog HDL. Instructor: Mohsen Imani UC San Diego. Source: Eric Crabill, Xilinx

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

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences. Spring 2010 May 10, 2010

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Principles of Digital Techniques PDT (17320) Assignment No State advantages of digital system over analog system.

problem maximum score 1 8pts 2 6pts 3 10pts 4 15pts 5 12pts 6 10pts 7 24pts 8 16pts 9 19pts Total 120pts

6. Latches and Memories

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

CSE140L: Components and Design Techniques for Digital Systems Lab

Mealy and Moore examples

Music. Numbers correspond to course weeks EULA ESE150 Spring click OK Based on slides DeHon 1

CSE140L: Components and Design

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

Homework deadline extended to next friday

ELCT 501: Digital System Design

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

Verilog Tutorial. Introduction. T. A.: Hsueh-Yi Lin. 2008/3/12 VLSI Digital Signal Processing 2

ENEE245 Digital Circuits and Systems Lab Manual

(ii) Simplify and implement the following SOP function using NOR gates:

Finite State Machines

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

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

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS 151 Final. Q1 Q2 Q3 Q4 Q5 Total Credit Score. Instructions: Student ID. (Last Name) (First Name) Signature

Topics. Midterm Finish Chapter 7

This Lecture. Some components (useful for the homework) Verilog HDL (will continue next lecture)

Digital System Design with SystemVerilog

Digital Integrated Circuits

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Verilog for High Performance

Why Should I Learn This Language? VLSI HDL. Verilog-2

Hours / 100 Marks Seat No.

Digital Integrated Circuits

Problem Set 10 Solutions

One and a half hours. Section A is COMPULSORY UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE

Lecture #1: Introduction

COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING QUESTION BANK SUBJECT CODE & NAME: EC 1312 DIGITAL LOGIC CIRCUITS UNIT I

VALLIAMMAI ENGINEERING COLLEGE. SRM Nagar, Kattankulathur DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING EC6302 DIGITAL ELECTRONICS

Luleå University of Technology Kurskod SMD152 Datum Skrivtid

Two hours - online EXAM PAPER MUST NOT BE REMOVED FROM THE EXAM ROOM UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE

Summer 2003 Lecture 18 07/09/03

EECS Components and Design Techniques for Digital Systems. Lec 20 RTL Design Optimization 11/6/2007

L11: Major/Minor FSMs

Digital Design Using Digilent FPGA Boards -- Verilog / Active-HDL Edition

ECE 341 Midterm Exam

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

Sequential Logic Implementation. Mealy vs. Moore Machines. Specifying Outputs for a Mealy Machine. Specifying Outputs for a Moore Machine

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

Computer Architecture (TT 2012)

FPGA for Software Engineers

Topics. Midterm Finish Chapter 7

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Code No: R Set No. 1

Code No: R Set No. 1

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

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

Final Exam Review. b) Using only algebra, prove or disprove the following:

Control in Digital Systems

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

IT T35 Digital system desigm y - ii /s - iii

Memory and Programmable Logic

R a) Simplify the logic functions from binary to seven segment display code converter (8M) b) Simplify the following using Tabular method

EECS 270 Midterm Exam

Verilog Coding Guideline

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

Amrita Vishwa Vidyapeetham. EC429 VLSI System Design Answer Key

EECS150 - Digital Design Lecture 16 - Memory

Final Exam Solution Sunday, December 15, 10:05-12:05 PM

Transcription:

CSE 140L Exam Prof. Tajana Simunic Rosing Winter 2010 Do not start the exam until you are told to. Turn off any cell phones or pagers. Write your name and PID at the top of every page. Do not separate the pages. This is a closed-book, closed-notes, nocalculator exam. You many only refer to one 8 ½ x 11 page of your own handwritten notes. Do not look at anyone s exam. Do not talk to anyone but an exam proctor during the exam. If you have a question, raise your hand and an exam proctor will come to you. You have 50 minutes to finish the exam. When the time is finished, you must stop writing. Write your answers in the space provided. To get the most partial credit, clearly and neatly show all steps of your work. 1. 20 points 2. 15 points 3. 25 points 4. 20 points 5. 20 points Total (100 pts)

1. [5 pts total, 1pt each] Write T for True or F for False for your answer. a) F_ Carry lookahead adder provides the output faster but requires more gates than carry select adder. b) T_ Synthesis converts Verilog to an implementation using technologyspecific primitives c) F_ Adding synchronizing flip-flops after asynchronous input can eliminate metastability. d) F_ In the TicTacToe problem from lab3, if O goes first, the input should always have equal number of bits set in the two inputs, xin and oin. e) F_ Given CPU instructions with 3 bit opcode & 4 bit data, adding a couple of instructions to the existing 8 instructions would require no change in the number of bits of the opcode. [15pts, 3pts each] Multiple choices questions circle all that apply. 1. Given the Verilog code segment below, which statements are not true? (B) reg q; always @(posedge clock or posedge reset) if (reset) q <= 0; if (set) q <= 1; (A) When both reset and set are zero, q doesn t change. (B) The reset is synchronous. (C) The reset has the highest priority. (D) Both (A) and (B) (E) Both (B) and (C) 2. Which statements are correct? (A, C, D) (A) Register file is faster than SRAM (B) DRAM is faster than SRAM (C) DRAM is smaller than register file (D) Flash can erase large blocks of data at the same time (E) EEPROM can erase large blocks of data at the same time 3. Which modules should be changed to implement an instruction which adds R1 to the data in a specified memory location in minicpu design of Lab 4? (A, C) (A) Instruction set (B) Instruction ROM (C) Instruction decoder (D) Register file (E) Data path (F) Program counter

4. What are the common names for the x, y and z signals? (E) module mystery(v, w, x, y, z); input v, w, x, y; output reg z; always @(posedge v) if(w == 1 b1) z <= 1 b0; if(x == 1 b1) z <= y; module (A) x- Data input, y- enable, w synchronous reset (B) x-clock, y-data input, w synchronous reset (C) x-enable, y-clock, w asynchronous reset (D) x-enable, y- Data input, w asynchronous reset (E) x-enable, y-data input, w synchronous reset 5. Which statements are true for the clock counter in Lab 3 given implementation shown below? The counter should count from 00 to 59 and back to 00. (A,C) always@(reset) always@(posedge clk) (A) Asynchronous reset is asserted when the counter output is 59. (B) Synchronous reset is asserted when the counter output is 59. (C) We can use only one 6 bit variable to keep track of the count (D) None of the above

Problem 2 [15 points] For the following circuit, find the maximum operational frequency given the on resistance of NMOS transistor is Rn, of PMOS is 2Rn, and the gate capacitance of each transistor is Cg. Assume the input capacitance of the OR gate and D-Flip Flop is 2Cg. Use the following timing values: RnCg=1ns OR gate delay: 1.5ns D FF delay: 2.5ns D FF setup time: 2ns D FF hold time: 2.5ns Calculating the worst case delay in between the flip flops, (NOR) Path 1 =2.5ns+ (4Rn*2Cg) + 1.5ns+ 2ns =14ns (NAND) Path 2 = 2.5ns+ (2Rn*2Cg) + 1.5ns+ 2ns = 10ns (3 ORs) Path 3 = 2.5ns + ([2Rn*2Cg]+ [Rn*2Cg] +[2Rn*2Cg] ) +2ns =14.5ns Worst case delay --> cycle time = 14.5 Therefore, Max freq = 1 / cycle time =68.9MHz

Problem 3 [25 points] The instruction set of the CPU you have designed for LAB4 has been modified as follows: Command operands Description Move op3,op1,op2 Move the content of op2 to op1 and op3 Add1 op3,op1,op2 Add the content of op1 and op2 and put the result in op3 Add2 op1,#xx Add the content of op1 and immediate value xx and put the result in op1 Load op1,#xx Load the register with 8 bit data Shift op2,op1 Left shift the content of op1 by number of bits represented by op2. Mult op3,op1,op2 Multiply op1 and op2 and put the result in op3 RST Clears all the registers * Here op1, op2, op3 are 8 bit registers names. It can be any register among R1,R2,R3. * #xx refers to immediate data of size 8 bits. 1. What is the minimum instruction size? To encode 3 registers we need 2 bits. So need totally 6 bits for representing the register operands. But for Load and Add2 we need 10 bits to represent the operands. We need to choose highest among two values. Since there are totally 7 instructions we need 3 bits to represent the opcode. So totally we need 13 bits to encode these instructions.

2. Design and write the Verilog code for the instruction decoder. module instruction_decoder (instruction,r1_src_en,r2_src_en,r3_src_en, imm,r1_dest_en,r2_dest_en,r3_dest_en); input[0:in_width] instruction; //IN_WIDTH is the instruction width. output r1_src_en, r1_dest_en, r2_src_en,r2_dest_en,r3_src_en, r3_dest_en,imm; r1_src,r2_src,r3_src - represents the signals for source registers r1_dest,r2_dest,r3_dest - represents the signals for destination registers imm signal to represent immediate value in the instruction. Module instruction_decoder(instruction,r1_src_en,r2_src_en,r3_src_en,imm,r1_dest_en, r2_dest_en, r3_dest_en); input[0:13] instruction; //IN_WIDTH is the instruction width. Output reg r1_src_en, r1_dest_en, r2_src_en,r2_dest_en,r3_src_en, r3_dest_en,imm; Initial r1_src_en = 0; r2_src_en = 0; r3_src_en = 0; r1_dest_en = 0; r2_dest_en = 0; r3_dest_en = 0; imm = 0; always@( instruction[12] or instruction[11] or instruction[10]) case(instruction[12:10]) //Move op3,op1,op2 4'b000: Case(instruction[9:8]) // op3 2 b00: r1_dest_en = 1; 2 b01: r2_dest_en = 1; 2 b10: r3_dest_en = 1; Case(instruction[3:2]) // op1 Case(instruction[1:0]) // op2

//Add op3,op1,op2 3'b001: Case(instruction[9:8]) // op3 2 b00: r1_dest_en = 1; 2 b01: r2_dest_en = 1; 2 b10: r3_dest_en = 1; Case(instruction[3:2]) // op1 Case(instruction[1:0]) // op2 //Add2 op1,#xx 4'b010: Case(instruction[9:8]) // op3 2 b00: r1_dest_en = 1; 2 b01: r2_dest_en = 1; 2 b10: r3_dest_en = 1; Imm = 1; //Load op1,#xx 4'b011: Case(instruction[9:8]) // op3 2 b00: r1_dest_en = 1; 2 b01: r2_dest_en = 1; 2 b10: r3_dest_en = 1; Imm = 1; //Shift op2,op1 4'b100: Case(instruction[9:8]) // op2 2 b00: r1_dest_en = 1; 2 b01: r2_dest_en = 1;

2 b10: r3_dest_en = 1; Case(instruction[3:2]) // op1 //Mult op3,op1,op2 4'b101: Case(instruction[9:8]) // op3 2 b00: r1_dest_en = 1; 2 b01: r2_dest_en = 1; 2 b10: r3_dest_en = 1; Case(instruction[3:2]) // op1 Case(instruction[1:0]) // op2 case module Problem 4 [20 points] Given the Verilog module below and specified inputs, draw the output waveforms Module test (clk, a, b, f, g,h); Input clk, a, b; Output f,g,h; Reg f,g,h; always@(negedge clk) f <= #5 a b; always@(clk) g = #10 f ^ b; always@(f or g) h = #2 f & g; module

Problem 5[20 points] Sequence Detector: Write the complete Verilog description for a circuit with input x and two output z1 or z2. The circuit consists of two concurrent Mealy machines. The output z1 becomes 1 when 1011 sequence is found on the input, and the z2 output becomes 1 when a 110 sequence is found on x. 1011 detector 111 detector module seq3_detect_mealy(x,clk, z1,z2); // Mealy machine for a three-1s sequence detection input x, clk; output z1,z2;

reg z1,z2; reg [1:0] pstate, nstate; reg [1:0] pstate1, nstate1; parameter S0=2'b00, S1=2'b01, S2=2'b10, S3=2'b11; // Next state and output combinational logic // Use blocking assignments "=" always @(x or pstate) case (pstate) S0: if (x) Begin nstate = S1; z1 = 0; nstate = S0; z1 = 0; S1: if (x) nstate = S2; z1 = 0; nstate = S0; z1 = 0; S2: if (x) nstate = S3; z1 = 1; nstate = S0; z1 = 0; S3: if (x) nstate = S3; z1 = 1;

nstate = S0; z1 = 0; case // Sequential logic, use nonblocking assignments "<=" always @(posedge clk) pstate <= nstate; module always @(x or pstate1) case (pstate1) S0: if (x) Begin nstate1 = S1; nstate1 = S0; S1: if (x) nstate1 = S1; nstate1 = S2; S2: if (x) nstate1 = S3; nstate1 = S0;

S3: if (x) nstate1 = S1; z2 = 1; nstate1 = S2; case // Sequential logic, use nonblocking assignments "<=" always @(posedge clk) pstate1 <= nstate1; module