# ECEN3100 - Digital Logic

## Lab 9: Combination Lock Design Project

### 2 lab period(s)

The goal of this lab assignment is to continue working with state machines to explore their more advanced functionality. Your design should behave as follows:

Required functionality:

• You will construct a realistic digital combination lock whose combination is an arbitrary set of three four-digit decimal numbers. Like a traditional rotary lock, the user should not know if the code entered was correct or not until after having input all three numbers.
• It should start in a locked state, waiting to accept the first number.
• You may initially "hard code" the combination in the schematic, code or state diagram, but a bonus of 15% will be given for devising a mechanism to allow the user, when the lock is open, to change the combination.
• As input, the user will have a reset button and an enter button connected to KEY[0] and KEY[1], respectively. Also, the user will input 4 BCD digits via SW[15:0]. If any digits are out of the range of [0-9], ignore the enter button and display an error message.
• As output, you will use the first four HEX digits to display either the numbers currently being input or a message. When there is an error, display "Errr". When the lock is successfully opened, display "OPEn" and when unsuccessful, display "LOCD".
• The fifth HEX digit should display the current number entry position. So if the code is 1234-5678-1337, when inputting the first entry it should display '1', '2' for the second and '3' for the third. When open, display '0' or a blank.
• You may wish to use LEDG[8:0] and LEDR[17:0] for debugging purposes, however they may not be used as indicators for the end user.

Demonstrate that your lock works to your TA using this pin assignments file. Include in your report all of your files and a hand-drawn state diagram representing your design. Answer this question: why might a Mealy machine be a bad choice for this application?

Get signed off with this sign-off sheet.