ECE / COMP SCI 352 DIGITAL SYSTEMS FUNDAMENTALS. Design Project 2. Spring 2003 Due: Beginning of class on Friday 5/02/2003

Similar documents
ECE / COMP SCI 352 DIGITAL SYSTEMS FUNDAMENTALS. Design Project 2. Spring 2003 Due: Beginning of class on Friday 5/02/2003

Chapter 11 State Machine Design

Long and Fast Up/Down Counters Pushpinder Kaur CHOUHAN 6 th Jan, 2003

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING. EXPERIMENT VIII: FLIP-FLOPS, COUNTERS 2014 Fall

Section 6.8 Synthesis of Sequential Logic Page 1 of 8

Asynchronous (Ripple) Counters

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District UNIT-III SEQUENTIAL CIRCUITS

CSE Latches and Flip-flops Dr. Izadi. NOR gate property: A B Z Cross coupled NOR gates: S M S R Q M

1. Convert the decimal number to binary, octal, and hexadecimal.

MC9211 Computer Organization

Logic Design. Flip Flops, Registers and Counters

Chapter 6. Flip-Flops and Simple Flip-Flop Applications

ECE 555 DESIGN PROJECT Introduction and Phase 1

WINTER 15 EXAMINATION Model Answer

Chapter 3 Unit Combinational

Synchronous Sequential Logic

CSE115: Digital Design Lecture 23: Latches & Flip-Flops

EE 209 Lab 7 A Walk-Off

MODULE 3. Combinational & Sequential logic

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

Unit 11. Latches and Flip-Flops

Chapter 4. Logic Design

CprE 281: Digital Logic

Contents Circuits... 1

CHAPTER 4: Logic Circuits

Vignana Bharathi Institute of Technology UNIT 4 DLD

The basic logic gates are the inverter (or NOT gate), the AND gate, the OR gate and the exclusive-or gate (XOR). If you put an inverter in front of

MODEL QUESTIONS WITH ANSWERS THIRD SEMESTER B.TECH DEGREE EXAMINATION DECEMBER CS 203: Switching Theory and Logic Design. Time: 3 Hrs Marks: 100

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY CS 2202 DIGITAL PRINCIPLES AND SYSTEM DESIGN

CPE 200L LABORATORY 3: SEQUENTIAL LOGIC CIRCUITS UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND: SR FLIP-FLOP/LATCH

problem maximum score 1 28pts 2 10pts 3 10pts 4 15pts 5 14pts 6 12pts 7 11pts total 100pts

0 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 1 1 Stop bits. 11-bit Serial Data format

DIGITAL SYSTEM FUNDAMENTALS (ECE421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE422) COUNTERS

Lecture 8: Sequential Logic

Counter dan Register

Experiment # 4 Counters and Logic Analyzer

CS 110 Computer Architecture. Finite State Machines, Functional Units. Instructor: Sören Schwertfeger.

DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 220. Experiment 4 - Latches and Flip-Flops

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

Chapter 5 Flip-Flops and Related Devices

Digital Systems Laboratory 3 Counters & Registers Time 4 hours

RS flip-flop using NOR gate

IS1500 (not part of IS1200) Logic Design Lab (LD-Lab)

Experiment # 12. Traffic Light Controller

1. Synopsis: 2. Description of the Circuit:

Design of a Binary Number Lock (using schematic entry method) 1. Synopsis: 2. Description of the Circuit:

Combinational vs Sequential

EXPERIMENT: 1. Graphic Symbol: OR: The output of OR gate is true when one of the inputs A and B or both the inputs are true.

HDL & High Level Synthesize (EEET 2035) Laboratory II Sequential Circuits with VHDL: DFF, Counter, TFF and Timer

Experiment # 9. Clock generator circuits & Counters. Digital Design LAB

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Introductory Digital Systems Laboratory

Experiment 8 Introduction to Latches and Flip-Flops and registers

CS8803: Advanced Digital Design for Embedded Hardware

Sequential Logic and Clocked Circuits

COE328 Course Outline. Fall 2007

Logic Design Viva Question Bank Compiled By Channveer Patil

Digital Logic. ECE 206, Fall 2001: Lab 1. Learning Objectives. The Logic Simulator

Sequential Logic. E&CE 223 Digital Circuits and Systems (A. Kennings) Page 1

Laboratory 1 - Introduction to Digital Electronics and Lab Equipment (Logic Analyzers, Digital Oscilloscope, and FPGA-based Labkit)

University of Victoria. Department of Electrical and Computer Engineering. CENG 290 Digital Design I Lab Manual

RS flip-flop using NOR gate

CHAPTER 4: Logic Circuits

Sequential Digital Design. Laboratory Manual. Experiment #7. Counters

Chapter 5 Sequential Circuits

Altera s Max+plus II Tutorial

LAB 3 Verilog for Combinational Circuits

DIGITAL ELECTRONICS MCQs

Rensselaer Polytechnic Institute Computer Hardware Design ECSE Report. Lab Three Xilinx Richards Controller and Logic Analyzer Laboratory

Counters

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Introductory Digital Systems Laboratory

EMT 125 Digital Electronic Principles I CHAPTER 6 : FLIP-FLOP

SEQUENTIAL LOGIC. Satish Chandra Assistant Professor Department of Physics P P N College, Kanpur

UNIVERSITI TEKNOLOGI MALAYSIA

Registers and Counters

MODU LE DAY. Class-A, B, AB and C amplifiers - basic concepts, power, efficiency Basic concepts of Feedback and Oscillation. Day 1

Chapter 7 Counters and Registers

ASYNCHRONOUS COUNTER CIRCUITS

EKT 121/4 ELEKTRONIK DIGIT 1

Final Exam review: chapter 4 and 5. Supplement 3 and 4

Sequential Circuits: Latches & Flip-Flops

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE

Chapter 7 Registers and Register Transfers

CARLETON UNIVERSITY. Facts without theory is trivia. Theory without facts is bull 2607-LRB

Switching Theory And Logic Design UNIT-IV SEQUENTIAL LOGIC CIRCUITS

ECB DIGITAL ELECTRONICS PROJECT BASED LEARNING PROJECT REPORT ON 7 SEGMENT DIGITAL STOP WATCH USING DECODER

Flip-Flops and Sequential Circuit Design

The outputs are formed by a combinational logic function of the inputs to the circuit or the values stored in the flip-flops (or both).

First Name Last Name November 10, 2009 CS-343 Exam 2

Scanned by CamScanner

Introduction to Microprocessor & Digital Logic

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

Combinational / Sequential Logic

Modeling Digital Systems with Verilog

CPS311 Lecture: Sequential Circuits

Chapter. Synchronous Sequential Circuits

Tribhuvan University Institute of Science and Technology Bachelor of Science in Computer Science and Information Technology

CSE 352 Laboratory Assignment 3

Chapter 2. Digital Circuits

Transcription:

ECE / COMP SCI 352 DIGITAL SYSTEMS FUNDAMENTALS Design Project 2 Spring 2003 Due: Beginning of class on Friday 5/02/2003 Projects 1 and 2 together will be the design of a simple digital stopwatch. In Project 1, you have designed five combinational circuits that are used for counting up (for stop-watch mode) and counting down (for timer mode) the digits of the watch. These circuits will be combined with storage elements and additional data and control logic in Project 2 to form the logic core of the stopwatch. The goals of this project are to: 1. Increase your familiarity with Mentor Graphics design and simulation tools, and familiarize you with CAFE (a logic simplification tool), 2. Improve your understanding of material covered in class, and Objective: This project is to be performed by teams of two students only (teams with more than two members are not allowed). Interactions between teams are to be limited to discussions of understanding of the specifications or to understanding of how to use the tools. All design and simulation work and files used are to be yours, not those of others, unless specified otherwise. I. Project Overview This semester, you will be designing and implementing the datapath and control logic for a digital stopwatch shown in Figure 1. The stopwatch is to have a five digit 7-segment LCD display and four buttons to control its operation. It can measure the elapsed time in seconds starting with 0:00:00 up to 9:59:59 (9 hours, 59 minutes and 59 seconds). It can also be set to a specified time and can count down to 0:00:00. Notice that there are labels for digits and buttons that we will be using for the references through out this description. The stopwatch has two modes, namely 1) stopwatch mode and 2) timer mode. In a stopwatch mode (a default mode), the stopwatch can be reset to 0:00:00 by pressing and releasing the RESET button. When you push START_STOP button once, it will count up and display the elapsed time in a resolution of seconds. Second push of START_STOP button will stop or pause the current clock (time count). The stopwatch counts up or pauses with each push of START_STOP button. When the mode button is pressed, the stopwatch will go to a timer mode where it counts the time in backward. In a timer mode, hour, high minute and low minute digit can be selected by pressing SET button repeatedly. The MODE_INC button will increase the selected field, which allows to be set to any desired time in a resolution of minutes. Count down starts with the push of START_STOP button. ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 1

Similar to the stopwatch mode, count down can be paused or restarted with each push of START_STOP button. Table 1 describes functions of digits and push buttons. Figure 1. Stop-watch Display TABLE 1. Function(s) of digits and push buttons Name Function(s) Digits Push buttons H HM LM HS LS SET RESET MODE_INC START_STOP Hour digit Higher minute digit Lower minute digit Higher second digit Lower second digit In a timer mode, select a digit to set Reset all digits to 0, then go to stopwatch mode Switch between a stopwatch mode and timer mode Increase selected digit in a timer mode Start, stop, and resume counting The stopwatch will be designed using the hierarchical structure shown in Figure 2. The top level design will contain five logic blocks (modules) and some of theses blocks will consist of smaller sub-blocks. A brief description of each block is given below: STOPWATCH : Top level component of the stop watch PBI (Push Button Interface) : Synchronize push button signal with 10Hz clock. You will place three PBI modules for each of MODE_INC, Set, and START_STOP push buttons. CSL(Control State Logic) : Sequential State machine for control. COL(Control Output Logic) : Decodes CSL output to generate control signal for COUNT_BLK CLK_DIV(Clock divider) : Generates 1 second clock signal using 10Hz system clock. COUNT_BLK(Counter block) : 5 digit (H, HM, LM, HS, and LS) up/down counter * In this project, you will design two different COUNT_BLK modules MSCNT (Mode selectable up/down counter) : Up/Down Counter with mode select (Modulo 6 or Modulo 10) ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 2

MSINC (Mode selectable incrementer/decrementer) : In/decrement 4bit input by 1 with mode select (Modulo 6 or Modulo 10) Adder_4 : 4-bit full adder m6avg and m10avg (modulo 6 add value generator and modulo 10 add value generator) : Takes on a 4-bit BCD input and up_down signal, it generates a 4-bit offset value to be added the 4-bit BCD input. mux21_4 (4-bit 2-to-1 multiplexer): Select between a pair of 4-bit inputs using a control signal. Figure 2. Hierarchical structure of stop-watch design In project 1, you already designed following five modules: Adder_4, m10avg, m6avg, mux21_4 and MSINC. The additional modules will be completed in Project 2 using those five modules. II. Design and Project Report Guidelines You and your partner are to submit only one copy of joint project report for your group. Any project reports that do not conform following design and project report guidelines are subject to a penalty (point deduction). A late project submission carries a hefty 10% late penalty for each 24- hour period, up to 72-hours. For example, a project submitted between after lecture on Friday and same time on following Saturday will be deducted by 10 points. No project report will be accepted 72 hours after the due date. Here are some design and project report guidelines. Your are NOT to use a gated-clock design for this project. Wires must be drawn either horizontally or vertically. Never overlap symbols or gates; wires/buses should not cross symbols or gates. ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 3

Always label symbols. You are to minimize the logic (gate count) whenever possible. Use the provided coversheet and your report must be in the EXACT same order as appears on the checklist. Your report must be page numbered. All schematics, symbols, trace windows, and list output files should be clearly labeled and scaled (zoomed in/out) to show all the contents. Your comments on test case should clearly demonstrate your understanding of each module s function and expected behavior. You are also required to indicate if the module is functioning properly or not. Hand-written page numbers, test cases, validations and comments are acceptable, but they should be readable. Fancy cover or binding are not required, but use a proper stable or clip to secure all pages. Finally, you are not to delete, modify or remove any of your files after the project has been submitted until you are instructed to do so. In a rare occasion, we may ask you to demonstrate your project to verify or to clarify your submitted work. III. Design of Modules 1. reg4 : 4-bit register with write enable The reg4 is a 4-bit register that stores the current value of one BCD digit. A 1-bit register is comprised of a D-FF and 1-bit 2-to-1 multiplexer to add a write enable control as shown in Figure 3. Design a 1-bit register first, then design 4-bit register by making four copies of 1-bit register. Input/output ports and functions are defined as follows: PORT NAME Function D(3:0) Input value which will be captured in 4 D FF s. If EN=1 (high), four D-FFs will capture the value on D(3:0) during IN EN the rising edge of CLK. If EN=0 (low), then 4 D FF s will not capture the value on D(3:0) and keep previous value on Q(3:0) CLK System clock RST Resets all D-FFs to 0 asynchronously. OUT Q(3:0) Outputs of four D-FFs. Figure 3. One bit slice of 4bit register with write enable ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 4

Note that you are to use BUS, D(3:0 and Q(3:0) as input and output. Since this module is simple to design and test, you are to submit only your schematic for this module. However, you should verify that your register works correctly by writing your own force file and simulating with Quicksim. The following is to be submitted in: The schematic from Design Architect 2. MSCNT : Mode Selectable Counter The module MSINC block designed in Project 1 was a purely combinational circuit, and it did not include any state or memory elements. To implement a counter, a set of flip-flops are to be added to MSINC to store the current state information. You are to use dff (D-FF) in gen_lib. Note that this flip-flop has active low reset (CLR) and set (PRE) input ports. If any of these signals are not used, connect them to logic 1 (VCC in gen_lib). The names for input/and output ports are given below. You have to use the same labels to make use of the provided force file. Input : CLK for clock signal, RST for reset, up and dn for up/down control Output: D(3:0) for current value of counter, co and bo for carry out and borrow out. Note that you have to use a BUS D(3:0) as output port instead of separate D3, D2, D1 and D0. Four flip-flops will capture current output value of MSINC at the rising edge of CLK. In order to implement this function, the CLK port should be connected to all flip-flops. The RST input should be connected to CLR port of each flip-flop through an inverter so that you can initialize the counter value to 0 if RST is high. The set (PRE) port of flip flops should be connected to VCC since you are not going to use this function. The up, dn and mod control input should connect directly to the same signals in the MSINC block. Also, co and bo output ports need to be connected to those from MSINC. The following diagram gives the basic idea for the design of this block. Figure 3. MSCNT block diagram ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 5

Use the provided force file MSINC.force to test your module. Verify and show that your design works correctly with appropriate comments on your trace window printout. Non-annotated traces will be penalized. The followings are to be submitted in: The schematic from Design Architect The annotated test (trace window from Quicksim) of MSINC.force Once you verified your circuit with the force file, generate a symbol for this module and save it for later use. 3. COUNT_BLK : Counter Block Once you have the mode selectable up/down counter (MSCNT), you can build a 5-digit counter block. As shown in figure 1 and 2, five copies of MSCNT will be used as hour(h) digit, higher minute digit(hm), lower minute digit(lm), higher second digit(hs), and Lower second digit(ls). The port names and functions are described in following table. You have to use the same names to make use of force file we provide. Table 2. COUNTER_BLK in/out port and function PORT NAME Function incsec When incsec is high, the current time value increase by 1 sec at rising edge of clock. decsec When decsec is high, the the current time value decrease by 1 sec at rising edge of clock. These two signal will be used while the stop watch is counting time, up or down. inch When inch is high, Hour digit increase by 1 at rising edge of clock. IN When inchm is high, Higher Minute digit increase by 1 at rising edge inchm of clock. inclm When inclm is high, Lower Minute digit increase by 1 at rising edge of clock. These three control signal will be used to preset the time for timer mode. CLK System clock that operates 10Hz RST Resets all digit to 0. H(3:0) Hour digit. HM(3:0) Higher minute digit. LM(3:0) Lower minute digit OUT HS(3:0) Higher second digit LS(3:0) Lower second digit all0 During timer mode, if the count down reach all 0, this signal goes high and indicate the controller to ring. This block is shown in Figure 4. MSCNT instances with shaded color should be set to modulo 6 counter. For this block, you have to figure out how to connect each block and what additional logic gates are necessary to implement the functions described in table 2. Designs with excessive number of gates will be penalized. ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 6

In order to test your circuit, use the force file COUNT_BLK.force is provided for this block. This can be downloaded by following the instructions in Section 2. Verify that your circuit works right by looking at the trace window that you get when you run this force file using Quicksim. Please annotate your trace window before you turn it in to facilitate easy grading. Non-annotated traces will be penalized. (One way of annotating could be to mark the actual input and output values for each time interval on the trace. Also, you could put a tick under each correct output and a cross under each incorrect output.) The following should be turned in: The schematic from Design Architect The annotated test (trace window from Quicksim) of COUNT_BLK.force Figure 4. The design of COUNT_BLK Once you verified your circuit with the force file, generate a symbol for this module and save it for later use. 4. CSL : Control State Logic The CSL is the state machine that controls the operation of the stop-watch. The state machine stores current state of stop-watch and depending on push button inputs and feedback signal from the counter block, CSL changes its current state. Port names and a brief description of each are given below in table 3. You have to use the same names to make use of the force file we provide. Table 3. CSL ports and functions PORT NAME Function all0 Input from COUNT_BLK, indicating the timer hits all 0. SET In timer mode, select a digit to set MD_INC Switch between stop-watch mode and timer mode. IN ST_SP Start, stop, or resume counting SET, MD_INC, ST_SP signals are from push button interface (PBI) of each push button. RST Resets state to stop-watch stop state. CLK 10Hz system Clock input OUT CNT_en Count enable signal. When this signal is high, the clock divider block(clk_div) will generate one second signal. ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 7

Ring The timer rings when this signal is high. Current state signal. These signals will be connected to control output S(2:0) logic (COL) to generate control signals to the counter block. The state transition diagram of this block is shown in the Figure 5. As there are eight states and three D-FFs are requires to build this machine. State assignment and state transition table is also provided blow. State description Stop-watch stop state Figure 5. State transition diagram for CSL Table 3. CSL state assignment and transition table. Current State state assignment Input Next state Output ST_SP SW_count(1) - SW_stop 0(000b) MD_INC T_stop(2) - Stop-watch counting state SW_count 1(001b) ST_SP SW_stop(0) CNT_en ST_SP T_count(3) - Timer stop state T_stop 2(010b) SET H_set(5) - MD_INC SW_STOP(0) - Timer counting all0 Ring(4) - T_count 3(011b) state ST_SP T_stop(2) CNT_en Ringing state Ring 4(100b) - - Ring Hour setting state H_set 5(101b) SET HM_set(6) - Higher minute setting state HM_set 6(110b) SET LM_set(7) - Lower minute setting state LM_set 7(111b) SET H_set(5) - Based on given state transition table and diagram you have to fill up the following excitation table in order to generate a Café input file. The partially filled excitation table for this block is given ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 8

below. You will have to fill in the values for the outputs. Please make sure that you use don t cares (x) wherever possible so that your circuit cost is reduced. Current state Input Next state Output S2 S1 S0 MD_INC ST_SP SET TimeOut NS2 NS1 NS0 Ring CNT_en SW_STOP 0 0 0 0 0 X X 0 0 0 0 0 0 0 0 0 1 X X 0 0 0 1 0 X X 0 0 0 1 1 X X SW_count 0 0 1 X 0 X X 0 0 1 X 1 X X T_stop 0 1 0 0 0 0 X 0 1 0 0 0 1 X 0 1 0 0 1 0 X 0 1 0 0 1 1 X 0 1 0 1 0 0 X 0 1 0 1 0 1 X 0 1 0 1 1 0 X 0 1 0 1 1 1 X T_count 0 1 1 X 0 X 0 0 1 1 X 0 X 1 0 1 1 X 1 X 0 0 1 1 X 1 X 1 Ring 1 0 0 X X X X H_set 1 0 1 X X 0 X 1 0 1 X X 1 X HM_set 1 1 0 X X 0 X 1 1 0 X X 1 X LM_set 1 1 1 X X 0 X 1 1 1 X X 1 X This partially filled table (CSL.cafe) will be available. Fill in the blanks and use café as you did in project 1. Once you get the equations, use design architect to build circuits for the same. Make sure that you group the terms in the equations that you get (wherever possible) so that the total number of gates that you use is minimal. Designs with excessive number of gates will be penalized. In order to test your circuit, use the force file CSL.force provided for this block. Verify that your circuit works right by looking at the trace window that you get when you run this force file using ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 9

Quicksim. Annotate your trace window before you turn it in. Non-annotated traces will be penalized. The followings are to be submitted: The completed café input file CSL.cafe The schematic from Design Architect The annotated trace windows from Quicksim of CSL.force Once you verified your circuit with the force file, generate a symbol for this module and save it for later use. 5. CLK_DIV : Clock Divider As described in overview section, we will assume that we will be using a 10Hz system clock. In order to count up or down every 1 second, you need to build clock divider which generates 1SEC signal once every second. This block can be built using the MSCNT block. If you set MSCNT as modulo-10 counter, the co signal of MSCNT will go high whenever it counts 10 system clocks. However, it would be very memory intensive and impractical to simulate thousands of seconds in Quicksim. Thus for a practical reason, we will simulate and test our circuit using the clock period of 10 nanosecond. In other words, for test and simulation, use the clock period of 10 ns and 1SEC signal is to be high for every 10 clock periods (100 ns). The required input and output signals for this block are shown below. Input : CLK : 10Hz system clock RST : Resets current counting to 0 state en : enable counting, if en=low, the MSCNT will hold current value. Output : 1SEC : 1 second signal. This signal will be connected to COL to generate in/decrease control for COUNT_BLK. To test this block, you have to provide your own force file. However, you have to verify following features. The clock divider can be reset by high RST signal. If en=1, the clock divider count up from current value and generates high 1SEC signal for one period of system clock cycle (rising edge to next rising edge). If en=0, the clock counter should not count system clock (hold current value). An example simulation trace is given below in Figure 6. ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 10

Figure 6. Example simulation for CLK_DIV Annotate and comment your tests before you turn it in. Non-annotated traces will be penalized. The following should be turned in: The schematic from Design Architect The trace window from Quicksim running your own forefile Once you verified your circuit with the force file, generate a symbol for this module and save it for later use. 6. PBI: Push Button Interface. Although all the blocks you have built are synchronized with system clock, the push button input from user is not synchronized with system clock. Also, if user holds a button more than 100mSec, all other blocks will take that as more than 1 click of button. Hence, the interface between push button and rest of circuits should be interfaced using PBI. The PBI should generates one clock period of logic 1 whenever a button is pushed no matter how long it is. The following wave form describes the function of the PBI block. Figure 7. Function of PBI Input/output port names and descriptions are as follows: Input RST : Reset PBI to its initial state. IN : Push button input CLK : 10Hz system clock input Output OUT : synchronized push button signal. ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 11

Design your own state diagram and state transition table. There should be no more than 4 states to achieve this functionality and hence 2 flip-flops should be sufficient. Since there is only one input (except CLK and RST which will be directly connected to the flip-flops) and 2 flip-flops, you may not need to use Café to minimize the Boolean functions. To test this block, you have to provide your own force file. However, your simulation result should be similar to Figure7. Please annotate your trace window before you turn it in. You are to submit followings: A state transition diagram and table The schematic from Design Architect The annotated test (trace window from Quicksim of your own forefile) Once you verified your circuit with the force file, generate a symbol for this module and save it for later use. 7. COL: Control Output Generator. The COL is the only combinational block in project part2. This block will be placed between COUNT_BLK and CSL to generate appropriate control signals for COUNT_BLK together with synchronized button inputs, 1SEC signal and current state of state machine. In/output port names, functions and conditions are shown in table blow. PORT NAME Function S(3:0) Current state input from CSL IN MD_INC Synchronized(through PBI) push button signal of MD_INC button. 1SEC 1-Second signal from CLK_DIV block incsec Increase Second signal into COUNT_BLK decsec Decrease Second signal into COUNT_BLK OUT inch Increase Hour signal into COUNT_BLK inchm Increase Higher minute signal into COUNT_BLK inclm Increase Lower minute signal into COUNT_BLK rstall Reset COUNT_BLK to 0 The COL block can be viewed as specialized decoder with two different enable signal (MD_INC and 1SEC). This block will decode current state to generate control outputs for COUNT_BLK as follows. incsec : This signal goes high when CSL state is SW_count and 1SEC signal is high. decsec : This signal goes high when CSL state is T_count and 1SEC signal is high. inch : This signal goes high when CSL state is H_set and MD_INC signal is high. inchm : This signal goes high when CSL state is HM_set and MD_INC signal is high. inclm : This signal goes high when CSL state is LM_set and MD_INC signal is high. rstall : This dignal goes high when CSL state is T_stop and MD_INC signal is high. To construct this circuit, you can use any method of your choice. Designs with excessive number of gates will be penalized. To this circuit, you have to provide your own force file. One way to test this circuit is for all possible value of S(3:0), give a pulse of 1SEC signal and MD_INC signal. ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 12

Any incomplete test will be penalized. Annotate your trace window before you turn it in. Nonannotated traces will be penalized. The following should be turned in: The schematic from Design Architect The annotated test (trace window from Quicksim of your own forefile) Once you verified your circuit with a force file, generate a symbol for this module and save it for later use. 8. STOP_WATCH: Top Design Module Now you will build the top module of project STOP_WATCH using symbols that you have generated. The function of STOP_WATCH is already described in the overview section. Refer to the project overview section for the functional description. If you have designed each module correctly and understood functionalities of each module, the top level design will not be complex. However, thorough test is more important for top module design to verify that the modules are communicating with each other correctly. As specified in overview section the stopwatch will have 4 push button input and 10Hz external clock signal as well as 5 BCD output for time information. The Input/output ports are described below. Input Set_PB : SET push button input. MD_INC_PB : MD_INC push button input ST_SP_PB : START_STOP push button input These three push buttons will be synchronized by the PBI module RST : RESET push button input Note that RST do not have to be synchronized since the flip-flops we are using provide an asynchronous reset. CLK : 10Hz system clock input* Output H(3:0) : BCD output of hour Digit HM(3:0) : BCD output of higher minute digit LM(3:0) : BCD output of lower minute digit HS(3:0) : BCD output higher second digit LS(3:0) : BCD output lower second digit The STOP_WATCH module is built using following modules: PBI, CSL, CLK_DIV, COUNT_BLK, and COL. Use Figure 8 as reference. Test your top design with the provided force file STOP_WATCH.force. Carefully read comments in this force file and verify your circuit to see if it functions correctly. Once you have verified your trace, you need to submit five different portion of your annotated trace as follows. Schematic of your design. Print out of entire trace from 0ns to 1,200,000ns Print out of zoomed trace from 0ns to 2,000ns (should be annotated) Print out of zoomed trace from 477,000ns to 495,000ns (should be annotated) Print out of zoomed trace from 549,800ns to 551,500ns (should be annotated) Print out of zoomed trace from 1,094,000ns to ns 1,096,400ns (should be annotated) * Figure 8. Design reference for STOP_WATCH ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 13

9. COUNT_BLK2 : Sequential COUNT_BLK. In this section, you will design new COUNT_BLK which sequentially updates each digit. The COUNT_BLK you have designed in previous section used 5 instances of MSCNT. As you may notice, each MSCNT was fixed to be either modulo-6 or modulo-10 mode and one of m6avg or m10avg in MSINC instances will never be used for specific digit. Also, MSINC instances in MSCNT modules are doing similar job for each MSCNT instances. To reduce cost, it is possible to share only one MSINC to update each digit by adding an additional sequential controller. The diagram in Figure 9 illustrates how we can redesign COUNT_BLK. In the following sections, you will design the Sequential Update Logic (SUL) and a new counter block (COUNT_BLK2). 9.1 SUL: Sequential Update Control Logic. Figure 9. Redesigned COUNT_BLK The COUNT_BLK2 will use only one copy of MSINC to update all 5 digits in the counter block. In other words the MSINC should be shared in a sequential manner by control signals to update each digit. According to the control signals (inch, inchm, inclm, incsec and decsec) and the previous digit s co and bo, the SUL will change its state as well as generating up, dn and mod signal for shared MSINC block. The following table specifies input/output port names and their purposes. PORT NAME Function ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 14

IN OUT inch inchm inclm incsec decsec prev_up prev_dn CLK RST updateh updatehm updatelm updatehs updatels These four signals are output of COL block and invokes the state machine to update specific digit. Will be connected to co of MSCNT to indicate update of previous(lower) digit had carry out. Will be connected to bo of MSCNT to indicate update of previous(lower) digit had borrow out. System clock Resets state machine If this signal is high, the hour digit will be updated according to up/dn signal. If this signal is high, the higher minute digit will be updated according to up/dn signal. If this signal is high, the lower minute digit will be updated according to up/dn signal. If this signal is high, the higher second digit will be updated according to up/dn signal. If this signal is high, the lower second digit will be updated according to up/dn signal. Indicates whether the MSINC should count up. Indicates whether the MSINC should count down. Indicates the MSINC whether current digit is modulo-6 or modulo-10. up dn mod The SUL will operate as specified in the Figure 10. There are six states. Figure 10.State transition diagram of SUL. ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 15

To implement this state machine you will use One hot state encoding A.K.A one flip-flop per state design scheme to minimize complexity of combinational logic design. If you are not familiar with this design scheme you should review the textbook (Mano and Kime, page 406-410). The basic premise of the one flip-flop per state design method is that only a single state flip-flop will be high at any given time and the flip-flop with the 1 identifies the current state. So, the input logic for each state flip-flop simply reflects that there are only two conditions to place 1 in that flip-flop: 1. The flip-flop currently has a 1 and the conditions for moving to next state have not been met. 2. The previous state flip-flop has a 1, and the conditions for moving to the current state have been met. Since we have 6 different states, we will need 6 flip-flops to implement this state machine. Refer to following table for state assignment. State State flip-flops D5 D4 D3 D2 D1 D0 IDLE 0 0 0 0 0 1 UpdateLS 0 0 0 0 1 0 UpdateHS 0 0 0 1 0 0 UpdateLM 0 0 1 0 0 0 UpdateHM 0 1 0 0 0 0 UpdateH 1 0 0 0 0 0 Now you can develop the expressions for each state that correspond to the two conditions mentioned above by using the state transition diagram in Figure 11. The following table is provided to develop expressions for each state flip-flop. State IDLE (D0) Conditions required to remain the current state All control signals = 0 Conditions required to become current state UpdateLS (D1) None State = IDLE and State = UpdateH or all other state with co+bo = 0 either incsec or decsec is 1 UpdateHS (D2) None State = UpdateLS and either co or bo is 1 UpdateLM (D3) None 1. State = UpdateHS and either co or bo is 1 2. State = IDLE and inclm is 1 UpdateHM (D5) None 1. State = UpdateLM and Input logic expression for each state flipflop D0= D1= D0*(incSec+decSEC) D2=D1*(co+bo) D3=D2*(co+bo) + D0*(incLM) D4= D3*(co+bo) + D0*(incHM) ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 16

either co or bo is 1 2. State = IDLE and inchm is 1 UpdateH (D6) None 1. State = UpdateHM and either co or bo is 1 2. State = IDLE and inch is 1 D5= D2*(co+bo) + D0*(incH) Now you also have to define the expressions for outputs. updateh = D5 updatehm = D4 updatelm updatehs = D3 = D2 updatels = D1 mod = D2+D4 up = previous value of ( co + incsec + inch + inchm + inclm ) dn = previous value of ( bo + decsec ) Note that previous value can be obtained by delaying them for one clock cycle. In order to delay signals by one clock cycle, you may want to insert a DFF s between outputs (up, dn) and logics generating those outputs. Once you are done with your design, you have to test this block. Write your own force file and verify your state machine and output reflects given state transition diagram and your expression table. However, you don t have to submit your force file nor trace. Instead followings are to be submitted Completed expression table Schematic sheet of your design 9.2 COUNT_BLK2 Now you have to combine CUL, MSINC, and reg4 to build up new COUNT_BLK. Use figure 9 as a reference to combine all modules. Each update signal from CUL will be connected to EN port of corresponding registers and also connected to tri-state buffers( buf.n.so3 in genlib ). Note that you have to specify the width of bus connected to each tristate buffer by changing N into 4 as in figure 12. This can be done by Shift-F7 as you do when changing the port names. N 4 Figure 12. Specifying width of buf.n.so3 The p(3:0) bus will be shared among 5 register s output. Since only one of update signal will be 1 at a given time, there will be no contention on p(3:0) bus. Also, n(3:0) will be captured on only one register which is currently enabled. The input/output ports are exactly the same as COUNT_BLK in section 2. ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 17

Once you are done with the schematic, you can reuse COUNT_BLK.force to test this block since all the port names and function of COUNT_BLK2 are the same as COUNT_BLK. However, you will notice that each digit is updated sequentially (one at one clock cycle). Once you have verified the correct functionality of your new counter block, generate a symbol which has exactly the same shape as your COUNT_BLK. In the next section you will replace the COUNT_BLK symbol with COUNT_BLK2 symbol. The following should be turned in Completed schematic of COUNT_BLK2 Annotated trace of COUNT_BLK.force. 10. STOP_WATCH2: Replacement of COUNT_BLK Now, you will replace the COUNT_BLK in your top level schematic with newly designed COUNT_BLK2. Note that at this point you have generated the symbol for COUNT_BLK2 in the same shape of COUNT_BLK. Make a copy of your top level design(stop_watch) that is named STOP_WATCH2 and then replace COUNT_BLK with COUNT_BLK2. Verify the ports are connected correctly. Again, to test your STOP_WATCH2, you can reuse STOP_WATCH.force to test your new top level design. Compare the simulation trace with your original simulation trace you obtained in Section 7. Once you have verified and compared your new trace, you need to submit the same five different portions of your annotated trace: Print out of entire trace from 0ns to 1200000ns Print out of zoomed trace from 0ns to 2000ns Print out of zoomed trace from 477000ns to 495000ns Print out of zoomed trace from 549800ns to 551500ns Print out of zoomed trace from 1094000ns to ns 1096400ns Schematic of your design. Each trace should contain meaningful annotation. Poor annotation will be penalized. 11. Extra credit options You can earn up to 30% additional points for your project by pursuing one of the following additional options. Make sure you have completed the required portion of the project before attempting any of these extra credit steps. You will not receive ANY extra credit if your base required design does not work correctly. You should not attempt more than one of the options below, as each requires significant time and effort. Additional points will be distributed relative to other groups that attempt the same extra credit choice. Here is a brief description of each option. We are also willing to entertain other extra credit options; however, you *must* discuss your idea with an instructor before attempting it. No extra credit will be granted for additional work that was not discussed with an instructor ahead of time. 1) (up to 15 points) Add a lap timer function to the stopwatch by using the SET input button as the lap timer button. Pressing the lap timer button holds the current stopwatch time on the display, while the stopwatch itself keeps running. Pressing the lap timer button again will revert the display to the current time. Also, if the user presses STOP while in the lap timer display mode, the stopwatch should stop, but continue to display the lap time until the user presses the lap timer button. You must modify the control ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 18

logic state diagram appropriately, add additional flip-flops to store the frozen lap time, and modify the output function for the display. This option will be worth at most 15 points. 2) (up to 30 points) Design a code converter block that converts the BCD digits supplied by the stop watch to a Roman numeral number display. The digits must be displayed as specified in the following table. Since Roman numerals require a variable number of characters, assume that the maximum number deeded for each position is available on a display device. Hence, the display device will have the ability to display a total of fourteen characters: HHHH:MMMMMMM:SSSSSSS. The display device will display one of five characters at each character according to the following 3-bit encoding: a blank space is represented with 000, I is represented with 001, V is represented with 010, X is represented with 011, and L is represented with 100. Hence, the display device has 18x3 = 54 bits controlling it, so your output function will have to generate these 54 bits as a function of the current BCD digits. All numbers should be aligned to the rightmost position (blanks, if any, should be on the left). Your code converter can be a purely combinational output function that uses the BCD digit values as inputs, or you can build it as a sequential state machine, similar in spirit to the sequential COUNT_BLK2. However, any sequential design must have few enough states that it can keep up with digit updates occurring once per second as a result of the timer or stop watch running or the user changing digits in timer mode. Digit Max letters Representation Hours 4 I, II, III, IV, V, VI, VII, VIII, IX Minutes 7 I-X,XI-XX,XXI-XXX,XXXI-XL,XLI-L,LI-LIX Seconds 7 I-X,XI-XX,XXI-XXX,XXXI-XL,XLI-L,LI-LIX 3) (up to 30 points) Redesign COUNT_BLK to minimize the number of gates by using dedicated next state and output functions instead of the existing functional blocks (adder, m6avg, etc.). The cost of your implementation (gate count) will be compared against all other such designs submitted by other groups, and the extra credit points you earn will be proportional to your cost relative to the other groups. 4) (up to 30 points) Build your design by purchasing discrete parts, assembling them on a proto board, and demonstrating your board to the instructors. If you choose this option, you are on your own, and the instructors will not be able to support or assist your efforts. Extra credit points will be distributed on a competitive basis, and will not exceed 30 points. All extra credit work must be documented in your report with a schematic, a textual description, state diagram (if relevant), a commented force file, and an annotated trace for each new or modified module. Also, if you pursue option (4) you must schedule a time with an instructor or TA to demo your implementation. Make sure you have completed the required portions of the project before attempting any extra credit work. The instructors will provide minimal, if any, support for extra credit work. ECE/CS 352 Spring 2003 Project 2 Document Version 1.0 19