Assignment On State Machine Positive Edge Triggered
Added on - 25 Sep 2019
1 Introduction1.1 SpecificationThe system you design cycles through and displays the first five digits of a number—any number you want. For example, you could use five digits from your own oryour lab partner’s student number or phone number. Your submitted code may bestored on computers outside of Canada. If you are concerned about privacy, use arandom five digit number. The goal is that each cycle, the LCD on your DE1-SoC willdisplay one digit of this five digit number.The clock input to your state machine should come from pushbutton switch KEY0 onyour DE1-SoC. Every time you press switch KEY0, another number should appear. Ifthe first five digits of your number is “60412”, the LED should display a “6” one thefirst cycle, then “0” in the second cycle, then a “4” in the third cycle, etc. On thesixth cycle, it should cycle back to “6” and start again. The seven segments of theseven segment display are each controlled by each bit of HEX0[6:0]. A segmentturns on if the corresponding bit is 0 and off when that bit is 1 (this might beopposite to what you would expect). The mapping from bits of HEX0 to segmentscan be seen on the right side of Figure 1.To add a bit of a challenge (and make the lab more fun), the user (i.e., your TA)should be able to change the “direction” of cycling through the digits using sliderswitch SW0 on your DE1-SoC. If this switch is “up” (corresponding to logic value“1”), the system operates as described above. If this switch is “down”(corresponding to a logic value of “0”), the system should cycle “backwards” (butstill starts with the first character). So, in the above example the order would be“621406”.To make things even more interesting (and fun), the user should be able to changethe slider switch during any cycle. So, for example, you might go “forwards” for 4cycles, “backwards” for 2 cycles, and “forwards” for 4 cycles, outputting a display of“6041404126”.Your design should include a reset input controlled by pushbutton switch KEY1. Yourstate machine should reset on the rising edge ofclkif KEY1 is pressed.Note KEY0and KEY1 output a 1 when NOT pressed and a 0 when pressed (this is probably theopposite of what you would expect).Figure 1 shows the overall system you will build.2 Lab ProcedureDesign a state machine in Verilog to implement the circuit as described above. Asample state diagram might be something like the one shown in Figure 2 andassuming you used the first five digits of your phone number and your phonenumber happens to be “604-827-4116”.The reset should be synchronous. This means that when the reset signal is asserted(set to logic 1), the state machine is reset on the next rising edge of the clock.