CSE 140L Lab 2 - Sequential Circuit Design

Fall 2010, Professor Cheng, TAs Gopi Krishna Tummala, Shams Pirani, Vikram Murali

Due time: Demonstrate by 11/03/2010 TA-lab hours, Report by 11/03/2010 11:59pm.

Important! Please regularily check http://webct.ucsd.edu for the latest updates and news regarding this lab. FAQs and announcements will be on the webboard, so check it often!


- Learn how to use flip-flops.
- Learn how to design basic sequential circuits like shifters, counters, etc.
- Learn how to use the FPGA board to demonstrate your sequential circuits.
- Learn how to implement a fibonacci number series using flip-flops.

We will give you guys a tutorial on a very basic sequential circuit. Here you will learn how to use the on-board clock. Also, we will provide a step-by-step instructions for using the VHDL editor and creating modules with it. We will also provide the VHDL code to use.

IMPORTANT: thoughout all the parts of this lab, the clock frequency will be 1 Hz. Pressing the left button will start the cycle, while pressing the right button will reset/clear the cycle.

The rest of the lab will not contain as detailed instructions. However, we will give hints as needed. Important - For the timing and functional outputs, we want the actual output, NOT the segment display output. So similar to lab 1, please use output ports before the segment display modules like you did for the adder and mux.

Part 0. Sequential Circuit Tutorial

For this part, you will simply follow the tutorial to learn some of the basics that you will need for this lab.

Lab 2 Tutorial

Part 1. 8-bit Shift Register

For part 1, you will be designing an 8-bit shift register using D flip-flops. To demonstrate this on the board, you will be designing your shifter so that you shift the red line on your LED outputs. Normally your board will display nothing, but when you press the left button (you will have to hold it down for a second or so), you send an input of 1 into the first flip flop, which causes a red line to be shifted every second around the segment display. The output pattern will look like:

Use the tutorial as a starting point for this circuit. Configure your D flip-flops in such a way that you capture this shifting. The left button will be used to start the cycle, and the right button will be used to clear all the segment displays. Note: You can ignore the leftmost two LED displays (just use HEX0 and HEX1).

- Include schematic diagrams of your circuit
- Include functional and timing diagrams of your simulation.
- Explain what happens in your functional simuation when you press the reset button. What happens to all the outputs? - Explain why this shifter is "sequential" as opposed to the combinational circuits you did in lab 1. What does sequential even mean? - Draw out what the outputs would look like if you tied a "1" into the first flip flop (draw out 10 cycles).

Part 2. Asynchronous Counter

In this part, you will build an 8-bit asynchronous counter using T flip-flops. You will output the results on the segment display. The left number will display the MSB, and the right one will display the LSB. Therefore your pattern will look like: 00, 01, 02, 03, ... 0F, 10, 11, ... , F0, F1, ... FF. Therefore you will need two 4-bit binary display modules to output the correct number on the segment display.

We provide you the VHDL code (you are free to use the display module you made in lab 1) DEC_7SEG.vhd for the two LED digits for you to use. Implement this the same way as the tutorial demonstrated. You will also need to learn how to use bus inputs for this part.
Another thing, pressing the left button should speed up the clock 10x (think of a mux you made in lab 1), and the right will reset.

- Include schematic diagrams of your circuit
- Include functional and timing diagrams of your simulation.
- Explain why this is an asynchronous counter, as opposed to your synchronous shift register.
- Write one to two paragraphs explaining how an asynchronous counter works. Convince us you know how and why the numbers get counted up every cycle.

Part 3. Fibonacci Series Design

Design a circuit which displays fibonacci series number every clock cycle. Pressing the left button should start the process (series progression) and pressing the right button should reset it. You only generate a 4 bit number and display the bits on four 7-segment displays. The series equations is f(n+1) = f(n) + f(n-1) where n-1 is the previous output, n is the current output and n+1 is the required output. At every clock cycle, the output changes in the sequence 0001 (1), 0010 (2), 0011 (3), 0101 (5), 1000 (8), 1101 (13). When you start the progression you don't have any previous output which means you put 0.
So first equation: f(1) = 1 + 0 = 1
second equation: f(2) = 1 + 1 = 2
and so on...

- Include schematic diagrams of your circuit
- Include functional and timing diagrams of your simulation.

Part 4. Johnson Counter

You will design an 8-bit Johnson counter in this part of the lab. The 8-bit output will be mapped to LED using the same way as part 1. The right button will be used to reset your counter.

- Include schematic diagrams of your circuit
- Include functional and timing diagrams of your simulation.
- Explain how a Johnson Counter is similar and different from your 8-bit shift register.

Part 5. Fibonacci series index track

In this part, you will use your design from part 3 along with a counter to keep track of fibonacci number's index. What this means is, you have 4 bit fibonacci series whose outputs will be 1,2,3,5,8,13. So the index of 13 would be 6 because it's the 6th output. Just display the value of index on the 7-segment display.

- Include schematic diagram of your additional circuit
- Can you make a clock now? Write 2-3 paragraphs on how would you design an actual clock which goes from 0 - 59 (seconds)


You will need to demonstrate your project to a lab TA. Please look at the office hours for when we are available.


30% of your grade will be from the demonstration, so this is an easy 30%. Another 40% will be in your logic schematics and timing diagrams. Easy points assuming you were able to demonstrate this for us. 30% will be in your answers to the questions.