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

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

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

Laboratory 4. Figure 1: Serdes Transceiver

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

1. Synopsis: 2. Description of the Circuit:

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

Synchronous Sequential Logic

Experiment # 12. Traffic Light Controller

EE178 Spring 2018 Lecture Module 5. Eric Crabill

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

LED Array Tutorial. This guide explains how to set up and operate the LED arrays that can be used for your. Internal Structure of LED Array

Design and implementation (in VHDL) of a VGA Display and Light Sensor to run on the Nexys4DDR board Report and Signoff due Week 6 (October 4)

Lab #10 Hexadecimal-to-Seven-Segment Decoder, 4-bit Adder-Subtractor and Shift Register. Fall 2017

Laboratory Exercise 7

Ryerson University Department of Electrical and Computer Engineering EES508 Digital Systems

EE178 Lecture Module 4. Eric Crabill SJSU / Xilinx Fall 2005

Modeling Latches and Flip-flops

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

Sequential Digital Design. Laboratory Manual. Experiment #3. Flip Flop Storage Elements

ECE 270 Lab Verification / Evaluation Form. Experiment 9

Lab #11: Register Files

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

Inside Digital Design Accompany Lab Manual

Sequential Circuits. Output depends only and immediately on the inputs Have no memory (dependence on past values of the inputs)

ECE 372 Microcontroller Design

Debugging of Verilog Hardware Designs on Altera s DE-Series Boards. 1 Introduction. For Quartus Prime 15.1

COMP2611: Computer Organization Building Sequential Logics with Logisim

Traffic Light Controller

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

Lab 17: Building a 4-Digit 7-Segment LED Decoder

ECE 263 Digital Systems, Fall 2015

Table of Contents Introduction

Review : 2 Release Date : 2019 Last Amendment : 2013 Course Code : SKEE 2742 Procedure Number : PK-UTM-FKE-(0)-10

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

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

Chapter 4: One-Shots, Counters, and Clocks

Step 1 - shaft decoder to generate clockwise/anticlockwise signals

Lab #11: Register Files

Physics 120 Lab 10 (2018): Flip-flops and Registers

VARIABLE FREQUENCY CLOCKING HARDWARE

Figure 1 shows a simple implementation of a clock switch, using an AND-OR type multiplexer logic.

Advanced Devices. Registers Counters Multiplexers Decoders Adders. CSC258 Lecture Slides Steve Engels, 2006 Slide 1 of 20

Lab 4: Hex Calculator

Experimental Study to Show the Effect of Bouncing On Digital Systems

Figure 1: segment of an unprogrammed and programmed PAL.

Digital Electronics II 2016 Imperial College London Page 1 of 8

Experiment: FPGA Design with Verilog (Part 4)

Sequential logic. Circuits with feedback. How to control feedback? Sequential circuits. Timing methodologies. Basic registers

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

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

Task 4_B. Decoder for DCF-77 Radio Clock Receiver

Experiment 8 Introduction to Latches and Flip-Flops and registers

Logic Design. Flip Flops, Registers and Counters

Digital Blocks Semiconductor IP

Figure 30.1a Timing diagram of the divide by 60 minutes/seconds counter

2.6 Reset Design Strategy

The word digital implies information in computers is represented by variables that take a limited number of discrete values.

Design and Implementation of Timer, GPIO, and 7-segment Peripherals

BUSES IN COMPUTER ARCHITECTURE

DEDICATED TO EMBEDDED SOLUTIONS

Modeling Digital Systems with Verilog

Universal Asynchronous Receiver- Transmitter (UART)

Programmable Logic Design I

Main Design Project. The Counter. Introduction. Macros. Procedure

Laboratory Exercise 6

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

Asynchronous (Ripple) Counters

Chapter 6. sequential logic design. This is the beginning of the second part of this course, sequential logic.

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

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).

Faculty of Electrical & Electronics Engineering BEE3233 Electronics System Design. Laboratory 3: Finite State Machine (FSM)

Tutorial 11 ChipscopePro, ISE 10.1 and Xilinx Simulator on the Digilent Spartan-3E board

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

EECS 270 Midterm 2 Exam Closed book portion Fall 2014

4 of 40. Multi-ASIC reset synchronization Good Multi-Flip-Flop. Synthesis issues with reset nets. 3 of 40. Synchronous Resets? Asynchronous Resets?

University of Pennsylvania Department of Electrical and Systems Engineering. Digital Design Laboratory. Lab8 Calculator

LAB 3 Verilog for Combinational Circuits

CSE140L: Components and Design Techniques for Digital Systems Lab. FSMs. Tajana Simunic Rosing. Source: Vahid, Katz

Administrative issues. Sequential logic

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

Main Design Project. The Counter. Introduction. Macros. Procedure

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

DEPARTMENT OF ELECTRICAL &ELECTRONICS ENGINEERING DIGITAL DESIGN

EE 209 Lab 7 A Walk-Off

Registers and Counters

Laboratory Exercise 4

Today 3/8/11 Lecture 8 Sequential Logic, Clocks, and Displays

FPGA Laboratory Assignment 4. Due Date: 06/11/2012

Read-only memory (ROM) Digital logic: ALUs Sequential logic circuits. Don't cares. Bus

Experiment # 4 Counters and Logic Analyzer

NEW MEXICO STATE UNIVERSITY Electrical and Computer Engineering Department. EE162 Digital Circuit Design Fall Lab 5: Latches & Flip-Flops

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

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

Laboratory 11. Required Components: Objectives. Introduction. Digital Displays and Logic (modified from lab text by Alciatore)

Lab #10: Building Output Ports with the 6811

Solutions to Embedded System Design Challenges Part II

FPGA-BASED EDUCATIONAL LAB PLATFORM

CprE 281: Digital Logic

CprE 281: Digital Logic

BISHOP ANSTEY HIGH SCHOOL & TRINITY COLLEGE EAST SIXTH FORM CXC CAPE PHYSICS, UNIT 2 Ms. S. S. CALBIO NOTES lesson #39

Transcription:

Nate Pihlstrom, npihlstr@uccs.edu Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts) Objective The objective of lab assignments 5 through 9 are to systematically design and implement an FPGA-based keypad scanner. The keypad scanner will utilize a FIFO for data storage and retrieval, a display mux, and the seven-segment displays, slide switches, and LEDs of the Digilent Spartan3 prototyping board. The top level block diagram of the system is shown in Figure 1 and the I/O in Table 1. When a button of the hex keypad is pressed the system must decode the button and store the data in an internal FIFO. The read button will be used to read data from the FIFO and display the data on the seven-segment displays. The mode_toggle input will be used to toggle between display states so that more than eight signals can be presented for view on the LED s. The LEDs will display the status of the FIFO and other information. The hardware prototype will be verified to operate with the Grayhill 072 hex Keypad. A system partition is shown in Figure 2. As input mode_toggle is depressed output DGrp will toggle between DGrp1, DGrp2, and DGrp3 as denoted in Table 2. Figure 1: Keypad scanner top level Name Direction Width Purpose clk input 50MHz clock reset input Asynchronous active high reset read input Read from the fifo. Page 1 of 8 Lab 5 Version 1.5

mode_toggle input Toggle between LED display states Row input [3:0] Keypad row Col output [3:0] Keypad column seven_seg output [6:0] 7-segment character - active low seven_seg_0_en output 7-segment character 0 enable active low seven_seg_1_en output 7-segment character 1 enable active low seven_seg_2_en output 7-segment character 2 enable active low seven_seg_3_en output 7-segment character 3 enable active low DGrp output [7:0] 8 LED s Table 1: Keypad scanner I/O Data Group DGrp1 DGrp2 DGrp3 Table 2: LED System Debug info Figure 2: Partition of keypad scanner System Debug Info {1 b0, read_ptr[2:0], 1 b0, write_ptr[2:0] {<your choice>, empty, full} {Row, Col} Page 2 of 8 Lab 5 Version 1.5

The objective of this lab is to design and test the keypad scanner/encoder. This lab will be completed individually. Keypad Scanner Keypad scanners are used to enter data manually in digital telephones, computer keyboards and other digital systems. Telephones have a decimal keypad, and computer keyboards usually have a hexadecimal keypad. A keypad scanner responds to a pressed key and forms a code that uniquely identifies the key that is pressed. It must take into account the asynchronous nature of the inputs and deal with switch debounce. Also, in some applications, it must not interpret a key to be pressed repeatedly if it is pressed once and held down. We will use a synchronizer to synchronize the asynchronous inputs and a debounce circuit to debounce the synchronized input. Let's consider a scheme for designing a scanner/decoder for the hexadecimal keypad circuit shown in Figure 3. A pressed button establishes a connection between a row and a column at the location of the button. Each row is connected to a pull-down resistor, and is connected to a column when a keypad button is pressed. If a column line is connected to the supply voltage, a row that is connected to that column by a pressed button will be pulled to the supply voltage too; otherwise the row line is pulled down to 0 V. The keypad code generator unit has control over the column lines, and will exercise that control to detect the location of a pressed button. Figure 3: Scanner/encoder for the Grayhill 072 hexadecimal keypad circuit A keypad code generator must implement a decoding scheme that (1) detects whether a button is pressed, (2) identifies the button that is pressed, and (3) generates an output consisting of the unique code of the button. The decoding scheme will be implemented as a synchronous sequential machine with the Page 3 of 8 Lab 5 Version 1.5

button codes shown in Table 3. The outputs of the machine are the column lines, the code lines, and a signal, Valid, that indicates a valid code. Note that for each key press Valid will only be asserted for 1 clock cycle to indicate a valid signal on Code. This is true even if a key is pressed and held down. Table 3: Keypad codes for a hexadecimal scanner/encoder The pin-out of the ribbon cable for the keypad is Figure 4. The column (Col) is scanned by driving a 1 across each column and observing the value of Row. From this information it can be determined what button was pressed. For example if Col[2] is driven to 1 and a 1 is observed on row[1] key 6 has been pressed. Figure 4: Pinout for keypad Synchronization Circuit The input from the keypad, Row, is asynchronous. Any flip-flop that uses input Row will have to meet that flip-flip s setup or hold time requirement as depicted in Figure 5. When a flip-flip s setup/hold time requirement is not met the flip-flop s output may be unknown for a period of time. Page 4 of 8 Lab 5 Version 1.5

Figure 5: Setup/hold time for a flip-flop To combat this problem a synchronization circuit will be used as depicted in Figure 6 with the behavior as depicted in Figure 7. The clk signal is connected to the high speed system clock. Figure 6: Synchronization Circuit Figure 7: Synchronization Circuit timing Debounce Circuit The Row input can bounce for many milliseconds. There are many possibilities for de-bounce circuits. One possibility is to create a very slow divided down clock (~100Hz) and if Row is the same value on two clock edges then Row is considered to have stabilized. Another possibility that does not require dividing down the clock is a counter that will count the number of times a potential transition has occurred. For example, if the current de-bounced value is a zero, the counter will count the number of sequential ones detected. If a zero is detected the counter is reset. When the counter reaches a set value the de-bounced value will be set to a 1. Then the counter begins to look for a zero. Sample code is below: module debounce ( input wire clk, input wire reset, // Active high input wire data_in, // Input to debounce output reg data_debounced // Data debounced ); Page 5 of 8 Lab 5 Version 1.5

reg [15:0] change_reg; always @(posedge clk or posedge reset) begin if (reset) change_reg <= 'b0; // If we are at a 1 and get a 1 reset the change reg else if (data_debounced && data_in) change_reg <= 'b0; // If we are at a 0 and get a 0 reset the change reg else if (!data_debounced &&!data_in) change_reg <= 'b0; // If we are at a 1 and get a 0 increment the change reg else if (data_debounced &&!data_in) change_reg <= change_reg + 1'b1; // If we are at a 0 and get a 1 increment the change reg else if (!data_debounced && data_in) change_reg <= change_reg + 1'b1; end // If change_reg is MAX, toggle data_debounced always @(posedge clk or posedge reset) begin if (reset) data_debounced <= 'b0; else if (change_reg == 16'hFFFF) data_debounced <=!data_debounced; end endmodule Testbench Using the testbench depicted in Figure 8, verify the functionality of Hex_Keypad_Grayhill_072. The scanner is to be tested within a Verilog environment, not on a physical prototyping board with a physical keypad. Therefore, the testbench shown in Figure 8 must include (1) a signal generator that will simulate the assertion of a key, and (2) a module, Row_Signal, that will assert a row line corresponding to the asserted key, and (3) Hex_Keypad_Grayhill_072, the DUT. After the model of the keypad scanner has been verified, it can serve as a user interface in simulating other systems, and can also be used in a physical environment with confidence that it should function correctly, which greatly reduces the scope of a search for the source of an error in the operation of a prototype. The code for module Row_Signal is in Figure 9 Page 6 of 8 Lab 5 Version 1.5

Figure 8: Sample Testbench Figure 9: Code for Row_Signal Deliverables 1. I/O table for the Scanner/Encoder 2. State transition/output diagram for the Scanner/Encoder 3. Source code of Scanner/Encoder 4. Test plan 5. Source code of final self checking testbench 6. Demonstration of the operation of the test-bench to the lab instructor. Grading 1. Demonstrations: Page 7 of 8 Lab 5 Version 1.5

a. Correct operation of self checking test-bench 30pts b. Correct operation of the Scanner/Encoder - 15 pts each 2. Report: a. Completeness of test plan. 30pts b. Final report including test plan. 30pts Page 8 of 8 Lab 5 Version 1.5