Design a three-input, two-output sequential digital circuit which functions as a digital locking mechanism. LOCK ALARM

Similar documents
Step 1: Downloading the source files

Boise State University Digital Systems Laboratory

Xilinx Tutorial Basic Walk-through

and 32 bit for 32 bit. If you don t pay attention to this, there will be unexpected behavior in the ISE software and thing may not work properly!

Xilinx ISE/WebPack: Introduction to Schematic Capture and Simulation

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

UNIVERSITI MALAYSIA PERLIS

ELEC 204 Digital System Design LABORATORY MANUAL

Revision: February 27, E Main Suite D Pullman, WA (509) Voice and Fax

EE 1315 DIGITAL LOGIC LAB EE Dept, UMD

Laboratory of Digital Circuits Design: Design, Implementation and Simulation of Digital Circuits Using Programmable Devices

Xilinx Schematic Entry Tutorial

Digital Circuit Design Using Xilinx ISE Tools

After opening the Programs> Xilinx ISE 8.2i > Project Navigator, you will come to this screen as start-up.

Introduction. About this tutorial. How to use this tutorial

Programmable Logic Design I

EE 367 Logic Design Lab #1 Introduction to Xilinx ISE and the ML40X Eval Board Date: 1/21/09 Due: 1/28/09

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science. EECS 150 Spring 2000

Tutorial: Working with the Xilinx tools 14.4

CPLD Experiment 4. XOR and XNOR Gates with Applications

CECS LAB 1 Introduction to Xilinx EDA Tools

Lab 3 Sequential Logic for Synthesis. FPGA Design Flow.

Verilog Design Entry, Synthesis, and Behavioral Simulation

Circuit Design and Simulation with VHDL 2nd edition Volnei A. Pedroni MIT Press, 2010 Book web:

Lab 6 : Introduction to Verilog

ECSE-323 Digital System Design. Lab #1 Using the Altera Quartus II Software Fall 2008

1. Downloading. 2. Installation and License Acquiring. Xilinx ISE Webpack + Project Setup Instructions

Tutorial on FPGA Design Flow based on Xilinx ISE Webpack and ModelSim. ver. 1.3

Written exam for IE1204/5 Digital Design Thursday 29/

Tutorial on FPGA Design Flow based on Xilinx ISE WebPack and ModelSim. ver. 2.0

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

Using Synplify Pro, ISE and ModelSim

Tutorial on FPGA Design Flow based on Xilinx ISE Webpack and ModelSim. ver. 1.5

ENGN 1630: CPLD Simulation Fall ENGN 1630 Fall Simulating XC9572XLs on the ENGN1630 CPLD-II Board Using Xilinx ISim

Lecture 1: Introduction Course arrangements Recap of basic digital design concepts EDA tool demonstration

EET2141 Project 2: Binary Adder Using Xilinx 7.1i Due Friday April 25

TUTORIAL On USING XILINX ISE FOUNDATION DESIGN TOOLS: Mixing VHDL and Schematics

Introduction to LogicWorks (Version 5) by: Kevin Su

University of California, Davis Department of Electrical and Computer Engineering. Lab 1: Implementing Combinational Logic in the MAX10 FPGA

Programmable Logic Design I

Actel Libero TM Integrated Design Environment v2.3 Structural Schematic Flow Design Tutorial

TLL5000 Electronic System Design Base Module

Tutorial on FPGA Design Flow based on Aldec Active HDL. Ver 1.5

Tutorial: ISE 12.2 and the Spartan3e Board v August 2010

ECT 224: Digital Computer Fundamentals Using Xilinx StateCAD

Timing Analysis in Xilinx ISE

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

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

Xilinx ChipScope ICON/VIO/ILA Tutorial

10-MINUTE TUTORIAL DIGITAL LOGIC CIRCUIT MODELING AND SIMULATION WITH MULTISIM

Steps to run compxlib to compile Xilinx libraries in Modelsim SE 10.1 for EE101/EE201L/EE560 students as well as USC ITS

TLL5000 Electronic System Design Base Module. Getting Started Guide, Ver 3.4

Programmable Logic Design Techniques I

Tutorial: Working with Verilog and the Xilinx FPGA in ISE 9.2i

eproduct Designer A Simple Design and Simulation Tutorial

ECE337 Lab 1 Introduction to VHDL Simulation via Modelsim and Digital Logic Design Refresher

The board is powered by the USB connection, so to turn it on or off you plug it in or unplug it, respectively.

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

ANADOLU UNIVERSITY DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EEM Digital Systems II

FPGA Design Tutorial

Programming Xilinx SPARTAN 3 Board (Simulation through Implementation)

Copyright 2011 R.S.R. Electronics, Inc. All rights reserved. 04/11. Ver. 1.0web

Digital Design LU. Lab Exercise 1

EE261 Computer Project 1: Using Mentor Graphics for Digital Simulation

ENGR 5865 DIGITAL SYSTEMS

Xilinx Project Navigator Reference Guide

Introduction to Verilog and XILINX

Guidelines for Laboratory Sessions:

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180A DIGITAL SYSTEMS I Winter 2015

DIGITAL SYSTEM DESIGN

Implementing a Verilog design into the UWEE CPLD Development Board Using Xilinx s ISE 7.1i Software: A Tutorial

ECE 4305 Computer Architecture Lab #1

Digital Design and Computer Architecture

Project 1a: Hello World!

University of Florida EEL 3701 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering Revision 0 12-Jun-16

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Lecture 32: SystemVerilog

Introduction to Computer Engineering (E114)

Laboratory Exercise 3

Engineering 1630 Fall Simulating XC9572XL s on the ENGN1630 CPLD-II Board

ECE 331: N0. Professor Andrew Mason Michigan State University. Opening Remarks

Tutorial on FPGA Design Flow based on Xilinx ISE Webpack andisim. ver. 1.0

QUARTUS II Altera Corporation

ELEC 4200 Lab#0 Tutorial

Advanced module: Video en/decoder on Virtex 5

EE 101 Lab 5 Fast Adders

2 nd Year Laboratory. Experiment: FPGA Design with Verilog. Department of Electrical & Electronic Engineering. Imperial College London.

Written Re-exam with solutions for IE1204/5 Digital Design Friday 10/

Digital Design and Computer Architecture J. Spjut & M. Spencer

DesignDirect-CPLD Tutorial Manual

CCE 3202 Advanced Digital System Design

Tutorial on FPGA Design Flow based on Aldec Active HDL. Ver 1.5

Introduction to Electronics Workbench

LAB 2: INTRODUCTION TO LOGIC GATE AND ITS BEHAVIOUR

2IN35 VLSI Programming Lab Work Assignment 1: Hardware design using Verilog

ISim In-Depth Tutorial. UG682 (v13.4) January 18, 2012

ISE Simulator (ISim) In-Depth Tutorial. UG682 (v 13.1) March 1, 2011

Getting Started with Xilinx WebPack 13.1

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

Transcription:

Department of Computing Course 112 Hardware First Year Laboratory Assignment Dates for the session 2005-2006: Hand out Date: 10 th January 2006 Hand in deadline (electronic and written report): 17.00 Monday 23 rd January 2006 Laboratory Lecture 10 th January 11.00 room 308 Laboratory Sessions Thursday 12 Jan 16.00-18.00 Friday 13 th Jan 10.00-12.00 Tuesday 17 th Jan 15.00-17.00 Thursday 19 th Jan 09.00-11.00 Friday 20 th Jan 15.00-17.00 The hardware laboratory is designed to introduce you to a modern computer aided design (CAD) tool for hardware called Xilinx ISE Foundation. The Xilinx software is available on some of the Windows machines in the laboratory. In addition, the equivalent Xilinx ISE Webpack is available for free download from http://www.xilinx.com/ise/logic_design_prod/webpack.htm. You can set it up on your own machine if you wish. There will be a limited amount of tutorial help during the later laboratory sessions so try to start the exercise as soon as possible. The Xilinx interface can take a little getting used to so make sure you check it out during the first week. On the last Friday the tutors may be too busy to see everybody. 1. The Design Problem Design a three-input, two-output sequential digital circuit which functions as a digital locking mechanism. DATA CLOCK RESET Digital Lock LOCK ALARM A safe full of used banknotes The Police If a logic level 0 appears on the LOCK output then the safe is unlocked. If a logic level 1 appears on the ALARM line then the police are summoned. When a logic 1 appears on the RESET line, the mechanism is put into the known "reset" state in which the LOCK output is set to logic level 1 (locked). In this state the lock mechanism is waiting for a specific five binary digit sequence of 1s and 0s to appear, one binary digit for each CLOCK pulse. If the correct sequence of digits is sent then the LOCK output becomes logic 0 and the safe opens. The safe remains open as long as the DATA input line is at logic 1. When logic 0 appears on the DATA input the system returns to the reset state. If a wrong sequence of digits is input then the ALARM output signal becomes a logic 1 and it remains so for any sequence of values appearing at the DATA input. The only way to remove the Alarm signal is to set the RESET input line to 1. DOC112: Computer Hardware Laboratory Page 1

Your design should use a personalised sequence number. On the web there is a list of students with a unique number allocated to each. This same number was used for the coursework in term 1. Your individual binary sequence number can be generated using the formula: Binary Sequence = Binary Equivalent of ( 1 + (MyNumber mod 30) ) For example, if my unique number is 87, I get ( 1 + (87 mod 30) ) = 1+27 = 28 = 11100 If my unique number is 8, I get ( 1 + (8 mod 30) ) = 1+8 = 9 = 01001. The sequence is to be input with the most significant bit coming first. 2. Digital Design The design procedure will be demonstrated for a three-digit sequence, say 110 (remember that your design problem has five digits!). 2.1 The State Diagram The operation of the digital lock mechanism can be described by the following Moore state diagram. Note that a 1 on the RESET input takes the finite state machine to the reset state from any state. We will handle this input separately from the DATA input by using either a preset or clear function on the D-Q flip flops. 2.2 The State Transition Table From the State Diagram a State Transition Table can be generated. There are five states; therefore, we need a minimum of three flip-flops whose outputs are Q2, Q1, Q0. We have a free choice to assign the five required states to the eight possible ones. The complexity of the final circuit will depend on these assignments but not in an obvious way. We choose the following ones: This State Next State DATA State Q2 Q1 Q0 State D2 D1 D0 0 Reset 0 0 0 Alarm 1 1 1 0 S1 0 0 1 Alarm 1 1 1 0 * 0 1 0 * * * * 0 S2 0 1 1 Open 1 1 0 0 * 1 0 0 * * * * 0 * 1 0 1 * * * * 0 Open 1 1 0 Reset 0 0 0 0 Alarm 1 1 1 Alarm 1 1 1 1 Reset 0 0 0 S1 0 0 1 1 S1 0 0 1 S2 0 1 1 1 * 0 1 0 * * * * 1 S2 0 1 1 Alarm 1 1 1 1 * 1 0 0 * * * * 1 * 1 0 1 * * * * 1 Open 1 1 0 Open 1 1 0 1 Alarm 1 1 1 Alarm 1 1 1 1 Reset Input (from any state) Open 0 0 0,1 Reset Alarm S2 0 1 0 1 S1 1 DOC112: Computer Hardware Laboratory Page 2

2.3 The Karnaugh Maps From the flip-flop output table the three design Karnaugh maps can be generated: D2 Q1 Q0 00 01 11 10 00 1 1 1 X DataQ2 01 X X 1 0 11 X X 1 1 10 0 0 1 X D1 Q1 Q0 00 01 11 10 00 1 1 1 X DataQ2 01 X X 1 0 11 X X 1 1 10 0 1 1 X D0 Q1 Q0 00 01 11 10 00 1 1 0 X DataQ2 01 X X 1 0 11 X X 1 0 10 1 1 1 X D2 = DATA' Q1'+DATA Q2 +Q1 Q0 D1 = Q0 + DATA' Q1'+DATA Q2 D0 = Q1' + Q2 Q0 + DATA Q0 Further factorisations and simplifications may be possible at this stage. 2.4. Output Logic Design You must ensure that the LOCK output signal becomes 0 only when the system is in the Open state, and the safe is to be unlocked. Similarly, the ALARM output should only be 1 when the system is in the Alarm state. 3. Circuit Design You are allowed to use the following gate types which are a small subset of those supported by Xilinx. Name Function Area Name Function Area INV Inverter 15 OR2 28 AND2 Two input AND 27 OR3 34 AND3 Three input AND 34 XNOR2 44 AND4 40 XOR2 44 NAND2 etc. 20 FDP D Flip Flop with 100 asynchronous preset NAND3 28 FDC D Flip Flop with 110 NAND4 32 NOR2 19 NOR3 43 asynchronous clear The RESET input to the lock mechanism can be achieved by using the CLEAR or PRESET input for the D-type flip-flops FDC or FDP. Depending on the state (flip-flop outputs) assigned to the RESET state, you may choose to use flip-flops with CLEAR, or PRESET functions only. The flip- DOC112: Computer Hardware Laboratory Page 3

flops are positive edge triggered; i.e they latch their inputs on the positive rising edge of the clock pulse. Minimisation here is for silicon area; therefore you are given the approximate area for each gate in the table above. Try to minimise this area as much as possible within your design constraints. 4. Schematic Construction and Testing We suggest that you implement the simple circuit shown below at first. This is just for practice using the Xilinx tools. It doesn t solve the problem, but you can easily tell whether you have a correct implementation. Go through the schematic construction, simulation and hard copy generation for this sample circuit, so you get the mechanics out of the way. Decide whether the results make sense. Data Lock Clock Reset Alarm You can test the above circuit and your final design by using a test vector file. A test vector file is one that can be read by Xilinx, and contains a specification of the inputs over a period of time. There is a vector file named vec00_31.zip, which includes data sequences for numbers 0, 1, 2, 3 until 31. Each input is separated by a reset signal. You should check that your circuit places a 0 on the lock output only on the correct sequence only. Once you are satisfied that your circuit does work, you should make a hard copy of your circuit as well as your simulation results (waveforms). 5. Getting Started With Xilinx In the following description, Click means click the left mouse button, and Click right means click the right mouse button. You can use any Windows XP machine to run Xilinx. Setting up your Machine 1. Ensure that your fileserver space is mounted as the H: drive. Although the work is done under the Windows you will need to use Linux for the final submission. 2. Create a directory in your home space for your designs (eg use H:\hwlabs\d_lock). The test vector file set up for this exercise is named vec00_31.zip. It is available on the course web page. Follow the link to Laboratory Test Vector Files, download the zip file to your directory and extract the seven files to your directory (H:\hwlabs\d_lock). Starting the Tools From the Windows Start menu select Programs, Lab, Xilinx ISE 7.1 and Click on Project Navigator. The project navigator window will appear. To create a new project: 1. Select File New Project from the pull down menu DOC112: Computer Hardware Laboratory Page 4

2. A new dialog box will appear, please enter the following information as shown in the figure: a. Project Name: d_lock b. Project Location: H:\hwlabs\d_lock c. Top-Level Module Type: Schematic 3. Click next, another dialog will appear, please enter the following information as shown in the figure: a. Device Family: Spartan2 b. Device: xc2s15 c. Package: cs144 d. Speed Grade: -6 e. Synthesis Tools: XST (VHDL/Verilog) f. Simulator: ModelSim g. Generated Simulation Language: VHDL 4. Click next, you will be asked to create source files. Click new source, then choose schematic from the dialog box. In the file name field, type d_lock, and make sure to check add to project, then click next 2 times, and finish. DOC112: Computer Hardware Laboratory Page 5

5. You will be asked to add existing source files. You may simply skip this step and click next to continue. 6. You will be prompted for the summary of your project, click finish to confirm. If you experience problems starting the Xilinx tools try another PC and email (help@doc.ic.ac.uk) with the name of the suspect PC. Entering your design. 1. There are three major areas in the design environment. The upper left area displays your project information and the lower left area shows a list of tasks available, while the main screen shows a summary of you design. DOC112: Computer Hardware Laboratory Page 6

2. Click the tab named d_lock.sch under the main area. You will switch to schematic capture design environment. More options are available on the left hand side. In particular, the upper left area contains one more tab named Symbol, which is marked with an AND symbol. You can click it to obtain the symbol toolbox which contains a set of categories and symbols. The categories with which we concerned are Flip_Flop and Logic. The Flip_Flop category contains flip flop, namely, FDC and FDP, while the Logic category provides combinational logic gates such as AND2, OR2 etc. For this exercise you are limited to the 13 types of components listed above. 3. Select each component required and move the cursor to a suitable spot on the sheet, click to place it. Select the arrow tool from the left hand menu to move it about. Place other components as required. 4. Input and output markers should be placed for the 5 external connections to your circuit. You can place the markers by using the Add I/O Marker tool. It can be found at the toolbar. Please make sure you name the I/O marker exactly the same as the homework specification in order to make the simulation work. 5. The interconnections can be made using the Add Wires tool. It can be found on the toolbar. When adding wire, please make sure you are using the manual method. You can select the manual method by accessing options in lower left hand area. Alternatively, wires (and terminals) with the same names are assumed to be connected together. Using this feature can reduce clutter in your schematic. To name a wire, I/O marker 1. Using the standard crosshair (selected with the arrow button on the top of the left hand button bar) point to the wire or the marker and right click. A menu will appear giving you an option to rename the net or the port. Alternatively, you can use Add net names button to name a wire. DOC112: Computer Hardware Laboratory Page 7

2. For Component pins remember to add a small stub of wire if there is no other wire connected. First connect a wire to the pin, add a small stub, right click, then click the Add net names button type in the name and enter. 3. Terminal pins will automatically be connected to any wires with the same name. Note that you must use the names DATA, RESET and CLOCK for the input wires and LOCK and ALARM for the output wires in order to make the simulation work. For all other wires adopt a sensible naming convention to help you when debugging your circuit. For example if as part of your state sequencing logic you have a wire corresponding to a tern Q1 Q2 choose a name line NQ1NQ2 To Edit Components, wires or terminals 1. First select the component then click right, a menu will appear. Click properties. To import the testbench waveform file 1. First select project add source from pull down menu 2. select file vec00_31.tbw, which is the file you unzipped and copied previously 3. double click the testbench wave from module view and the testbench waveform will be shown on the main area Once you have entered your design and imported the waveform, you can use ModelSim to simulate it 1. If you did not open the testbench waveform, double click it from module view. Otherwise, click the testbench waveform from the main area. 2. Select process view tab from lower left area, then double click Simulate Behaviour Model DOC112: Computer Hardware Laboratory Page 8

3. ModelSim will launch and the corresponding design will be compiled and simulated automatically. Wait for the simulation to complete. The waveforms can be obtained by clicking wave tab from ModelSim window. You probably need to zoom in, zoom out or scroll the waveform in order to observe the specific part of the simulation. After observing the simulation, simply quit it by choosing File Quit from pull down menu. Debugging your design 1. Initially only signals with I/O marker can be observed. However, you can include more intermediate signals in ModelSim 2. You first need to add a net name to the intermediate signal you want to observe in the schematic. Restart the simulation as described above. 3. After the first simulation completes, you can now access the instance tab, choose the instance just under vec00_31 (which probably uut ). The object tab will contain the intermediate signal you want. Drag and drop it to the waveform. 4. On the ModelSim command line interface, type restart and press enter. A dialog will appear to confirm. Click restart and the simulation will be reset 5. In the ModelSim command line interface, type run -continue and press enter. The simulation will start again and will stop automatically. You can simply switch to waveform to debug the intermediate signals. DOC112: Computer Hardware Laboratory Page 9

6. Correct simulation results can be detected by checking the lock signal. For example, if the required input is (01101), the lock signal will be high for 1 clock cycle after the last input. 6. Required Submission Paper report You are required to submit a written report in which you describe your solution to this design problem, showing your finite state machine, state transition table, Karnaugh maps, final circuit printout, waveform printout and your calculation of the total silicon area. Electronic submission of your design Submission must be done in the Linux environment. First change to your design directory /hwlabs/ and type:- tar zcf d_lock.tar.gz d_lock Upload your gzip file d_lock.tar.gz using the CATE system. DOC112: Computer Hardware Laboratory Page 10