






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







In this experiment, you will design, implement and verify two different synchronous counters. After performing this experiment, you should be able to:
In this lab, there are two principal circuits that you will design. The first is a synchronous binary-coded-decimal (BCD) counter with asynchronous reset and a clock enable input to permit individual counters to be cascaded into multi-digit synchronous counters. You will design this counter from individual flip-flops and input logic. You will also convert this circuit to a hierarchy block to make it simpler to create multiple instances of the counter. To test your counter, a schematic sheet acting as a test platform is provided for you. The second circuit to be designed is a divide-by-N counter, where N is a specified constant. However, in this case, you will implement this counter using a counter primitive that provides a 16-bit counter with synchronous reset, and simply add logic to force a counter reset at the desired count.
In synchronous design, our efforts are premised on the assumption that the clock is occurring simultaneously at all flip-flops. While this is simple to assume, actually getting the clock to all flip-flops with an acceptable delay is not always so easy. To facilitate this, the FPGA has dedicated pins, buffers and routing channels specifically designed to be used for clock distribution. When doing synchronous design, we need to ensure that our clocks are in fact using these resources.
In the lab, you will also do a study of the difference in time-based behavior between a latch and a flip-flop. The bit file for this part of the experiment will be provided. As preparation, review the subsection on the D Latch and the section on Flip-Flops in Mano and Kime.
For the prelab, you will design and test (in simulation) a cascadable BCD counter and a divide-by-N counter.
Design a BCD counter using D flip-flops. In particular, you will use the Altera primitive DFFE , which is a D flip- flop with clock enable (ENA) input and asynchronous preset/clear inputs. You will design your counter in the manner illustrated in Mano & Kime 3rd^ edition, pages 337-339. A state table and K-maps are provided for your use
CE Clock Enable
Inputs
CLR Clear (asynchronous) Outputs Q8, Q4, Q2, Q1 Counter value (Q8 = most significant bit) TC Terminal count output for cascading (high only when count = 9 and CE = 1)
First, to run a bus from the output of the counter to your logic, you use the “Orthogonal Bus tool” button pictured here. The operation of the bus drawing button is vary similar to drawing nets. Select the button, and starting at the counter block, run the bus out. End the bus, the right click it and set its name to match the counter outputs, i.e. Q[15..0]. With that done, you can now connect whatever logic you have to the bus. Draw a regular wire from the desired pin on the gate and connect it to the bus. You then name this net as the bus name followed by the desired number. So for example, name the net Q15 to connect to the counter’s most significant bit. The below exampleshows bits Q3 and Q4 being connected to an AND gate.
Changing the Simulation Length: To change the default length of the vector waveform files used for simulation, select Tools Æ Options from the Quartus menu, then select Waveform Editor to see the waveform file options. You can set the " default file end time " here; the setting will affect all new VWF files that you create. Also, the VWF files are simply ASCII text files, so you can open them using File Æ Open... (but specify " Text " instead of "Auto" in the Open as: box at the bottom of the open file dialog) and then edit the file directly. If you look at a simple VWF file (i.e. just a clock signal), it's pretty obvious how the basic syntax works.
Your report on 8.5 by 11 inch pages should consist of the following:
W ARNING : All lab results and all answers to questions or discussion are to appear in the lab reports of individual students. All tangible lab results are to be identical (unless indicated otherwise). When a printout of results is specified, a copy should be made for each team member. All answers to questions or discussion are to be the work of individual students, not the lab team. Evidence of collaboration on these aspects of a report within or between teams will be noted and is subject to University disciplinary action.
In addition to the equipment already on the lab bench, your instructor will have you check out a plastic tray containing:
W ARNING – LAB EQUIPMENT HANDLING : Much of the lab equipment is small and delicate. In particular, this applies to the XESS prototyping boards, scopes, scope probes, and logic analyzer probes. So please be careful and handle the equipment with a light and careful touch and do not use the scope probes with the grabbers removed. Perform wiring on the board ONLY with the power disconnected.
The circuit you will be exploring, given in Figure 2, consists of two nearly identical circuits, one of which contains a D flip-flop and the other of which contains a D latch. The bit file for this design is provided for you, you don’t need to do the actual design.
CHECKPOINT: Have your instructor observe the operation of your counter.
Your individual report on 8.5 by 11 inch pages should follow the report format available on the course web page and consist of:
1. MANO, M. M AND C. R. K IME. Logic and Computer Design Fundamentals, 3rd ed_._ Upper Saddle River, NJ: Prentice Hall, 2003.
Inputs Next State Output Flip-Flop Inputs Q8 Q4 Q2 Q1 CE CLR Q8 Q4 Q2 Q1 TC D8 D4 D2 D
0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 1 0 0 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 1 1 0
00 01 11
10
11
01
00
Q2 Q Q8 Q
K-map for FF Input D
00 01 11 10
10
11
01
00
Q2 Q Q8 Q
K-map for FF Input D
00 01 11 10
10
11
01
00
Q2 Q Q8 Q
K-map for FF Input D
00 01 11 10
10
11
01
00
Q2 Q Q8 Q
K-map for Output TC
00 01 11 10
10
11
01
00
Q2 Q Q8 Q