Control Unit Design - Digital Logic - Laboratory, Lecture notes of Computer Science

These are the Laboratory of Digital Logic which includes Implementation, Altera Cyclone, Subfunction, Inputs to Outputs, Multiplexers and Pass Transistors, Interconnections, Maximum Expected, Two Circuits, Flip Flop etc. Key important points are: Control Unit Design, Designing, State Machine, Frequency Counter, Signal Frequency, Major Building Blocks, Functional Blocks, Useful Machine, Frequency Counter Based, Contents

Typology: Lecture notes

2012/2013

Uploaded on 03/22/2013

dhritiman
dhritiman 🇮🇳

4.7

(6)

106 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EXPERIMENT
5
CONTROL UNIT DESIGN
VERSION S07
In this experiment, you will design a finite state machine controller, and integrate it into a design using the logic
functions you have created previsously. After performing this experiment, you should be able to:
1) Design a one flip-flop per state control unit to implement a given algorithmic state machine (ASM) diagram,
2) Use simulation to test the operation of your controller independent of other circuit modules, and
3) Integrate your controller into a fully functional design, performing testing and debugging as needed to ensure
proper operation.
5-1 PRELAB
In this prelab, you will be designing a state machine to act as a control unit for a frequency counter. Perhaps the
most obvious way to implement a frequency counter is to simply count signal changes (C = number of 0Æ1 edges)
for a fixed period of time (T), then the signal frequency can be calculated as FSIGNAL = C / T. We have already
created all of the major building blocks (i.e. BCD counters and decoders, divide-by-N counter) that we will need for
this in previous labs, now we need to design and implement a state machine to control the operation of those blocks.
In particular, we will be implementing the controller as a state machine using the one FF per state method (also
referred to as a one-hot controller); as preparation for this prelab and lab you should first review Mano and Kime [1]
pages 406-410.
Fewer step-by-step instructions are provided for tasks you have completed in earlier labs, as you should be
becoming fairly accomplished in using the Altera Quartus II toolset. The issues of tool complexity and the learning
curves associated with the tools are something that you will deal with routinely as a design engineer. Since we will
often be designing with the most recent technology, the tool sets are often immature and less than robust. So, we
will need to be able to fight our way through the various errors and omissions (and our own self-inflicted troubles)
that we will discover in our hardware, software and documentation in order to bring our design to fruition. If you
need to, review the previous labs as a reminder of how to accomplish tasks that you encounter in this lab.
OVERVIEW
This lab will build on the functional blocks that you created in experiments 3 and 4, and we will add a finite state
machine (FSM) to create a useful machine. We will be developing a frequency counter based on the block diagram
shown below in Figure 1. The blocks that are highlighted in thicker blue lines are logic that you have already
designed or that will be provided for you. All of the items in the thicker blue blocks are contained in a schematic
sheet FREQCNT.BDF that will be provided for you to use. The contents of FREQCNT.BDF are shown below in
Figure 2. Although the logic is largely complete, you will still need to add synchronizing flip-flops to the external
inputs, add circuitry to generate a pulse on input transitions, and make the various connections to your controller.
You will design your controller on a separate sheet (CONTROL.BDF), then create a symbol for it, add that symbol
FREQCNT.BDF, and make the necessary connections.
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Control Unit Design - Digital Logic - Laboratory and more Lecture notes Computer Science in PDF only on Docsity!

E X P E R I M E N T

CONTROL UNIT DESIGN

VERSION S

In this experiment, you will design a finite state machine controller, and integrate it into a design using the logic functions you have created previsously. After performing this experiment, you should be able to:

  1. Design a one flip-flop per state control unit to implement a given algorithmic state machine (ASM) diagram,
  2. Use simulation to test the operation of your controller independent of other circuit modules, and
  3. Integrate your controller into a fully functional design, performing testing and debugging as needed to ensure proper operation.

5-1 PRELAB

In this prelab, you will be designing a state machine to act as a control unit for a frequency counter. Perhaps the most obvious way to implement a frequency counter is to simply count signal changes (C = number of 0Æ1 edges) for a fixed period of time (T), then the signal frequency can be calculated as FSIGNAL = C / T. We have already created all of the major building blocks (i.e. BCD counters and decoders, divide-by-N counter) that we will need for this in previous labs, now we need to design and implement a state machine to control the operation of those blocks. In particular, we will be implementing the controller as a state machine using the one FF per state method (also referred to as a one-hot controller); as preparation for this prelab and lab you should first review Mano and Kime [1] pages 406-410.

Fewer step-by-step instructions are provided for tasks you have completed in earlier labs, as you should be becoming fairly accomplished in using the Altera Quartus II toolset. The issues of tool complexity and the learning curves associated with the tools are something that you will deal with routinely as a design engineer. Since we will often be designing with the most recent technology, the tool sets are often immature and less than robust. So, we will need to be able to fight our way through the various errors and omissions (and our own self-inflicted troubles) that we will discover in our hardware, software and documentation in order to bring our design to fruition. If you need to, review the previous labs as a reminder of how to accomplish tasks that you encounter in this lab.

OVERVIEW

This lab will build on the functional blocks that you created in experiments 3 and 4, and we will add a finite state machine (FSM) to create a useful machine. We will be developing a frequency counter based on the block diagram shown below in Figure 1. The blocks that are highlighted in thicker blue lines are logic that you have already designed or that will be provided for you. All of the items in the thicker blue blocks are contained in a schematic sheet FREQCNT.BDF that will be provided for you to use. The contents of FREQCNT.BDF are shown below in Figure 2. Although the logic is largely complete, you will still need to add synchronizing flip-flops to the external inputs, add circuitry to generate a pulse on input transitions, and make the various connections to your controller. You will design your controller on a separate sheet (CONTROL.BDF), then create a symbol for it, add that symbol FREQCNT.BDF, and make the necessary connections.

SYNCHRONIZER

COUNT_CLEAR

2-DIGIT BCD COUNTER

ONE-HOT CONTROLLER

BCD-TO- SEGMENT DECODER

OCTAL D-FF LED DISPLAYS

CLOCK

DIVIDE-BY- COUNTER

CLR

CE

RESET

CLOCK TC

TIMER_RESET

TIME_UP

CLOCK

2.000MHz CLOCK

START_S TIMER_RESET

COUNT_CLEAR

COUNT_ENABLE

DATA_STORE

LED BAR1_

LED BAR1_

LED BAR1_

COUNT

IDLE

WAIT

INPUTS

OUTPUTS

Start SYNCHRONIZER CLOCK

TIME_UP

START_S

RESET

RESET

CLR

SIGNAL_S

CLOCK

ENA

DATA_STORE

Figure 1 Frequency Counter Block Diagram

Figure 3 Synchronizer

One more thing we will need to do is to add a synchronous reset capability to the divide-by-2000 counter that you designed in Experiment #4. This is a very simple change, we simply OR the external reset input with the reset logic, as shown below. Note that the logic in FREQCNT.BDF already incorporates this change.

Figure 4 Divide-by-2000 Counter with Reset Input

PRELAB DESIGN AND SIMULATION

To begin your controller design;

  1. Create a new Quartus project named FREQCNT. Copy the files bcd_7seg.bdf, bcd_cntr.bdf, and count16.v from your earlier lab work into the project directory. Update the pin assignments for the project as done for previous labs.
  2. Download the files FREQCNT.BDF and CONTROL.BDF (you will need to unzip these files from lab5.zip) from the course web page and place them into your project directory. CONTROL.BDF contains all of the required inputs and outputs for your controller.
  3. The schematic sheet CONTROL.BDF is where you will place all of your logic to implement the state machine design, and then you will create a symbol from this file and place the symbol into FREQCNT.BDF.
  4. The required external signals are summarized below. Also, note that PB1 and PB4 are active-low, so you will need to invert these signals. Type Signal name

Net name

FPG

A

Pin

Purpose

INPUT 2.000MHz CLK0 10 Master clock for FPGA INPUT Start PB1 28 Signal to initiate a frequency capture INPUT Reset PB4 35 Master reset signal, when asserted it should place controller in state IDLE and reset all synchronizer flip-flops to 0. INPUT External signal

S1_1 (^36) External signal to be measured – you must place S1-1 in the OFF position. OUTPUT IDLE BAR1_1 48 Indicator for state IDLE, connects to Q (^) IDLE OUTPUT COUNT BAR1_2 49 Indicator for state COUNT, connects to Q (^) COUNT OUTPUT WAIT BAR1_3 50 Indicator for state WAIT, connects to Q (^) WAIT

EXPERIMENT 6 PROJECT PROPOSAL

Review the Experiment 6 project requirements. You will be required to furnish a more formal project proposal with the Experiment 6 prelab report, but if your project idea ends up being unsuitable for one reason or another your team may end up having to start over after doing significant work on it. To minimize that sort of thing, as a team , you will submit a single page document containing a narrative and/or diagrammatic description of your proposed project to be accomplished in Lab 6. This will allow your instructor a chance to quickly review it and give you rapid feedback before you invest any significant time in it. Only one submission is required for each team.

PRELAB SUBMISSION

Submit:

  1. answers to all questions,
  2. state diagram, input equation, and output equation for the 0Æ1 transition detector,
  3. a printout of your CONTROL.BDF,
  4. a printout of the simulation trace for your control unit,
  5. the completed table for control unit state FF input logic,
  6. the completed table for control unit output logic, and
  7. your team’s initial proposal for your Experiment 6 project.

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.

EQUIPMENT NEEDED

In addition to the equipment already on the lab bench, your instructor will have you check out a plastic tray containing:

  1. an FPGA prototyping board.
  2. a power supply module for the prototyping board,
  3. two scope probes,
  4. a logic analyzer probe,
  5. and, a coaxial cable with BNC and mini-grabber connectors

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.

DESIGN I NTEGRATION

  1. Open your project, add FREQCNT.BDF to the project, and make it the top level entity.
  2. Open CONTROL.BDF and create a symbol from it. Add the symbol to FREQCNT.BDF and complete the logic in FREQCNT.BDF. You will need to add; a. Synchronizers b. Logic so that the BCD counters are only enabled when COUNT_ENABLE is a 1 and the input has transitioned from a 0 to a 1. c. Connections as required.
  3. Implement your design.

CHECKPOINT: Show your instructor your schematic and your Pin-Out File verifying the correct pin assignments.

F REQUENCY COUNTER T EST

  1. Ensure the Wavetek signal generator is OFF. Connect the coaxial cable with mini-grabbers to MAIN OUT on the Wavetek. Do NOT connect the Wavetek to the FPGA board yet.
  2. Turn on the oscilloscope and connect the channel A1 probe to the mini-grabbers on the cable from the Wavetek (the black mini-grabber is ground).
  3. Turn on the signal generator power, and adjust the signal generator to obtain a 0-3.3V square wave at 25KHz. Verify the signal using the oscilloscope.

CHECKPOINT: Have your instructor observe the signal generator waveform BEFORE connecting to the FPGA board.

  1. Turn off the signal generator.
  2. Connect the black mini grabber and the scope probe ground to the GROUND pins on the FPGA board. Connect the red mini-grabber and the scope probe to the S1_1 pin of JP7. Ensure that switch S1_1 is in the open (off) position.
  3. Perform the POWER UP sequence.
  4. Verify that you still have a 0-3.3V square wave at 25KHz.
  5. Download your freqcnt.sof file to the FPGA board.

IDLE DIDLE =

COUNT DCOUNT =

WAIT DWAIT =

Logic for controller outputs

Output signal logic expressions

TIMER_RESET =

COUNT_CLEAR =

COUNT_ENABLE =

DATA_STORE =