CARLETON UNIVERSITY. Facts without theory is trivia. Theory without facts is bull 2607-LRB

Similar documents
1. Synopsis: 2. Description of the Circuit:

Lab #10 Hexadecimal-to-Seven-Segment Decoder, 4-bit Adder-Subtractor and Shift Register. Fall 2017

Design of a Binary Number Lock (using schematic entry method) 1. Synopsis: 2. Description of the Circuit:

The basic logic gates are the inverter (or NOT gate), the AND gate, the OR gate and the exclusive-or gate (XOR). If you put an inverter in front of

EE 200 Problem Set 3 Cover Sheet Fall 2015

CARLETON UNIVERSITY. The Tug-of-War Game. Player 1 RESET

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science. EECS 150 Spring 2000

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science

Final Exam review: chapter 4 and 5. Supplement 3 and 4

CPS311 Lecture: Sequential Circuits

CSE Latches and Flip-flops Dr. Izadi. NOR gate property: A B Z Cross coupled NOR gates: S M S R Q M

YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING. EXPERIMENT VIII: FLIP-FLOPS, COUNTERS 2014 Fall

Switching Circuits & Logic Design, Fall Final Examination (1/13/2012, 3:30pm~5:20pm)

Why FPGAs? FPGA Overview. Why FPGAs?

Digital Circuit Engineering

Logic Design II (17.342) Spring Lecture Outline

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science SOLUTIONS

EE178 Lecture Module 4. Eric Crabill SJSU / Xilinx Fall 2005

Review : 2 Release Date : 2019 Last Amendment : 2013 Course Code : SKEE 2742 Procedure Number : PK-UTM-FKE-(0)-10

EECS 140 Laboratory Exercise 7 PLD Programming

Section 6.8 Synthesis of Sequential Logic Page 1 of 8

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE

Laboratory 1 - Introduction to Digital Electronics and Lab Equipment (Logic Analyzers, Digital Oscilloscope, and FPGA-based Labkit)

UNIT IV. Sequential circuit

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

COMP2611: Computer Organization. Introduction to Digital Logic

ECE 2274 Pre-Lab for Experiment Timer Chip

Inside Digital Design Accompany Lab Manual

LATCHES & FLIP-FLOP. Chapter 7

DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 220. Experiment 4 - Latches and Flip-Flops

Logic Design II (17.342) Spring Lecture Outline

Asynchronous (Ripple) Counters

Long and Fast Up/Down Counters Pushpinder Kaur CHOUHAN 6 th Jan, 2003

Experiment # 12. Traffic Light Controller

Lecture 8: Sequential Logic

Flip-Flops and Sequential Circuit Design

CPSC 121: Models of Computation Lab #5: Flip-Flops and Frequency Division

Logic Design. Flip Flops, Registers and Counters

Chapter 5 Sequential Circuits

Name: Date: Suggested Reading Chapter 7, Digital Systems, Principals and Applications; Tocci

Chapter 4: One-Shots, Counters, and Clocks

Unit 12 Design Solutions Solutions to Unit 12 Design and Simulation Problems

Laboratory 4 A MIDI Interface

Rensselaer Polytechnic Institute Computer Hardware Design ECSE Report. Lab Three Xilinx Richards Controller and Logic Analyzer Laboratory

Chapter 9 Counters. Clock Edge Output Q 2 Q 1 Q

Final Project [Tic-Tac-Toe]

CS61C : Machine Structures

Laboratory 4 A MIDI Interface

EE178 Spring 2018 Lecture Module 5. Eric Crabill

CSCB58 - Lab 4. Prelab /3 Part I (in-lab) /1 Part II (in-lab) /1 Part III (in-lab) /2 TOTAL /8

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

SEMESTER ONE EXAMINATIONS 2002

Digital Fundamentals: A Systems Approach

Digital Fundamentals. Lab 5 Latches & Flip-Flops CETT Name: Date:

Computer Organization & Architecture Lecture #5

Faculty of Electrical & Electronics Engineering BEE3233 Electronics System Design. Laboratory 3: Finite State Machine (FSM)

VARIABLE FREQUENCY CLOCKING HARDWARE

Combinational vs Sequential

Introduction to Microprocessor & Digital Logic

Computer Systems Architecture

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Introductory Digital Systems Laboratory

More design examples, state assignment and reduction. Page 1

Sequential Design Basics

COMP sequential logic 1 Jan. 25, 2016

Step 1 - shaft decoder to generate clockwise/anticlockwise signals

CPSC 121: Models of Computation Lab #5: Flip-Flops and Frequency Division

Individual Project Report

MC9211 Computer Organization

Synchronous Sequential Logic

DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 2200

Electrical and Telecommunications Engineering Technology_TCET3122/TC520. NEW YORK CITY COLLEGE OF TECHNOLOGY The City University of New York

RS flip-flop using NOR gate

CHAPTER 4: Logic Circuits

DIGITAL ELECTRONICS: LOGIC AND CLOCKS

Counters

Name Of The Experiment: Sequential circuit design Latch, Flip-flop and Registers

Sequential Elements con t Synchronous Digital Systems

IT T35 Digital system desigm y - ii /s - iii

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District UNIT-III SEQUENTIAL CIRCUITS

Unit 11. Latches and Flip-Flops

Chapter 5 Flip-Flops and Related Devices

Modeling Latches and Flip-flops

CSE 275 Digital Design Lab Lab 8 Serial Adder/Subtractor Penn State Erie, The Behrend College Fall Semester 2007 Number of Lab Periods: 2

Chapter 1: Switching Algebra Chapter 2: Logical Levels, Timing & Delays. Introduction to latches Chapter 9: Binary Arithmetic

ECE 270 Lab Verification / Evaluation Form. Experiment 9

Efficient Architecture for Flexible Prescaler Using Multimodulo Prescaler

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Introductory Digital Systems Laboratory

Lab #10: Building Output Ports with the 6811

University of Pennsylvania Department of Electrical and Systems Engineering. Digital Design Laboratory. Lab8 Calculator

Course Plan. Course Articulation Matrix: Mapping of Course Outcomes (COs) with Program Outcomes (POs) PSO-1 PSO-2

EE292: Fundamentals of ECE

CSE140L: Components and Design Techniques for Digital Systems Lab. CPU design and PLDs. Tajana Simunic Rosing. Source: Vahid, Katz

CS 110 Computer Architecture. Finite State Machines, Functional Units. Instructor: Sören Schwertfeger.

1. a) For the circuit shown in figure 1.1, draw a truth table showing the output Q for all combinations of inputs A, B and C. [4] Figure 1.

CHAPTER 6 DESIGN OF HIGH SPEED COUNTER USING PIPELINING

ASYNCHRONOUS COUNTER CIRCUITS

CS3350B Computer Architecture Winter 2015

Digital Logic. ECE 206, Fall 2001: Lab 1. Learning Objectives. The Logic Simulator

Sequential Digital Design. Laboratory Manual. Experiment #3. Flip Flop Storage Elements

Chapter 4. Logic Design

Transcription:

CARLETON UNIVERSITY Deparment of Electronics ELEC 267 Switching Circuits February 7, 25 Facts without theory is trivia. Theory without facts is bull Anon Laboratory 3.: The T-Bird Tail-Light Control Using a CPLD FIGURE 3. The focal point for this lab: 267-LRB Overview The T-Bird of this lab, has two sets of three tail lights in a row. The direction signals of this car sequence in. Thus before a right turn, the right lights would flash in the following sequence. There is half a second between each step in the sequence. Then the sequence repeats. The lights are controlled by three switches, labeled L, R, and B. Turning on both L and R turns on the emergency flashers. Then all six lights flash are on for half-a-second and off for half-a-second. When L and R are both off, pushing B lights all six lights. If L or R (not both) is on with B, the tail lights on the appropriate side should flash as for a turn. The lights on the other side should be steady light to show braking The steady brake light overrides the ency flashers. L B R Left signal Brake Right signal The designs will use a continuously running clock which is not turned on and off.. Some usually reliable people say this should be a Cougar. SWITCHING CIRCUITS J.Knight, 2/7/5

3. A Block Diagram of a Possible Circuit One always tries to design a circuit by partitioning it into smaller circuits. One partitioning gives three subcircuits:. A counter which emits four signals that go on and off at the proper s for controlling the lights. 2 and 3. Left and right control boxes that apply the counter signals to the correct lights. FIGURE 3.shows such a partition. FIGURE 3. The block diagram of a possible implementation of the T-Bird tail lights. BULB_L3 BULB_L2 LEFT CONTROL BOX BULB_L 3-wires in a cable 3 4 4 3 BULB_R BULB_R2 RIGHT CONTROL BOX BULB_R3 4 3 +V CLOCK 8 to 6 HZ Lite_! L B Left signal f Clock divider Slows the clock ~ HZ clk COUNTER R Brake Right signal The counter uses a flip-flop to generate the four waveforms from the clock. The control boxes take the waveforms and route them to the proper lights. There are no flip-flops in the control boxes. For example, for the emergency flashers, (L and R both on), the control boxes would send the waveform to all the tail lights. Alternately, when L is on, it would send to BULB_L, to BULB_L2, and to BULB_L3 The COUNTER circuit generates all four waveforms from the square wave, and a halffrequency signal obtained by dividing the clock by two. See FIGURE 3.2. FIGURE 3.2 Inside COUNTER, there is a flip-flop which divides the input clock by two. This gives a signal of half the clock frequency. This and the clock signal are used to generate the other four signals. ency Q = divide by two.s Q The clock is a square wave. The circuit shown here differs slightly from the one you will be building. In the lab, you may have to add the two redundant inverters shown, because the software does not like wires to go directly from an input to an output. Department of Electronics February 7, 25 2

3.2 The T-Bird COUNTER Circuit During turns, the lights must sequence - -> -> -> -> {4-state sequence} These are four different sets of output values which come at four different s, the last is a repeat. One must have some way to tell which of the four steps one is in. The signal is a square wave. One can use = to distinguish one interval and = to distinguish another. But this only distinguishes two different intervals. Here we use another signal Q, which runs at half the clock frequency. The combination of the and Q lets us distinguish 4 unique intervals which can be used to generate,, and The Q signal sequence used in FIGURE 3.2 gave the sequence - Q steps: -> -> -> -> This system could be said to have 4 states. Here this is done using the and one flip-flop. 2 3.2. The Design of The Divide by Two Circuit In order to divide by two, one must have a circuit that can remember. The most common memory element in logic circuits is called the D flip flop. The D Flip-Flop. FIGURE 3.3 Rising edge This flip-flop has two inputs, D and C, and an output Falling edge D Q usually called Q. The C or clock input has a square wave applied to it. The D input receives the signal to be remembered. 3 C indicates D just before the clock rises. When the clock rises (goes from to ) the flip flop output Q will capture the value of the D input just before and at shows how long Q remembers that D. show where Q starts to remember that D the of this rising clock edge. It remember that value of D D for the rest of the clock cycle. After that rising edge, D can change, and the clock can fall back to zero. Nothing will change Q until another rising clock edge. Then, if D has changed, Q will change. Q =C The Divide By Two Circuit The clock is a square wave. The rising clock edge here is called the active edge. This circuit generates a square wave at half the clock FIGURE 3.4 D Q frequency. It does this by making a flip-flop change the Q C value on every second rising clock edge. Q will change if and only if D changes. Values of D needed to make Q run at half the clock frequency. We only care about D just Thus one needs a D signal that inverts every rising clock before and at the rising clock edge (green line) edge. This turns out to be easy to find. Look just before the clock edge. What is the relationship between the desired D and the value of Q before the edge.? D Q =C 2. In ELEC35 you will be taught that the clock should go only to the flip-flop clk inputs, and not to the D input, or gates that feed the D input of other flip-flops. To do otherwise can cause timing problems. The circuits in the lectures all send the clock only to flip-flop clock inputs. However it is all right for the clock to feed gates that only go to outputs, and these gates never fed into the D inputs of other flip-flops. For the T-Bird lights, we save half the flip-flops ( in this case) by letting the clock directly feed the gates that control the output lights. 3. Many flip-flops also have a reset input, R which will come up later. They may also have a Q output. Department of Electronics February 7, 25 3

Remember it does not matter where the D signal changes as long as it has the desired value just before and at the rising clock edge. If D changes just after the clock edge, Q does not change. Thus to divide the clock frequency by two one connects Q back to the D input. The Timing Circuit Signals, Q, You will need to work out the exact waveforms for Q and. /2 will have a different phase relationship with, than that shown in FIGURE 3.2.. Fill in the waveform for Q and D in the space given in FIGURE 3.5. Take Q = at the start as shown, and then take D = Q. (D is already done at the start.) () From D at the st clock edge, you can tell what Q will be for the rest of the cycle. (2) From this Q, you can tell what D will be for the rest of the st clock cycle. (3) The D during this first cycle will be the D at the next rising clock edge. From this D you can tell what Q will be for the 2nd clock cycle. (4) Continue; one waveform error will mess up the rest of the lab big. Flip Flop Reset Besides and D, practical flip-flops have one other input called Reset or R. Whenever R= the Q output immediately and unconditionally goes to. You will be connecting your reset pin to a wire called RST which will allow you to reset Q to when you press a button. 3.2.2 COUNTER Outputs The clock is a square wave. The active clock edge here is the rising edge. D The box called COUNTER has four outputs. Three of the outputs are used to flash the turn signals in the proper sequence. The signal flashes the lights on and off every cycle. If the flashing cycle starts at Q = all four signals should be off. Assuming you got Q = at the end of your flashing sequence, then all three LITE signals and should be on. FIGURE 3.6 Q,,,, Q. s D Q Q = /2 /2 FIGURE 3.5 The signals Q and. One must know exactly where the Q =/2 signal rises, in order to derive the logic to generate the Lite and signals. D=Q,,,,,, Q R divideby two Fill in Q, simultaneously fill in D= Q Table : State Truth table with values of Q shown in sequence Outputs Q From FIGURE 3.5, you can fill in values for Q. From FIGURE 3.6, you can fill in the values for the various LITE_ signals. Department of Electronics February 7, 25 4

From the truth table (Table I), derive the equations for the outputs, much like you did in the last two labs. = = = = Q 3.3 The Left Control Box The four inputs from COUNTER to the control box are:,,, and. There are also three switch inputs: L, left turn signal R, right turn signal B, brake Table 2: shows the type of output for the left side, for different switch inputs. From the table, and the Overview on page, it is relatively easy to derive the left-side output signals. Switches B L R Table 2: Flash Turn Sig The Left Side Output Type for Various Switch Inputs Type of outputs for (Left side) Flash Steady Brake Fill in the blank spots. If the L is on alone (BLR) or with B signal (BLR), then flash BULB_L in with the signal. If both L and R are on with no brake (BLR), then flash BULB_L in with the signal. With B and L, hold a steady on BULB_L Also if all three are on (BLR) the brake overrides the ency flashers. These three statements are described in the equation BULB_L = ()(BLR + BLR) + ()(BLR) + (BL R + BLR + BLR) (Equ ) This equation can be reduced easily(?) with a variable entered Karnaugh map as described in the lectures. The variables and, which only appear once each, are entered as variables on the map. This avoids a 32 square 5-variable map. Use the map to reduce the equation to BULB_L = ()LR + ()(BLR) + (BL + BR) If you can t figure out this map, use a 32 square map, or simplify by algebra. In the same way as for (Equ ), the other bulbs should light when: LR B BULB_L2 = ()(BLR + BLR) + ()(BLR) + (BL R + BLR + BLR) (Equ 2) BULB_L3 = ()(BLR + BLR) + ()(BLR) + (BL R + BLR + BLR) (Equ 3) Do a logic reduction on the expressions for BULB_L2 and BULB_L3. Department of Electronics February 7, 25 5

3.4 The Prelab (This must be prepared prior the scheduled lab session.). Design the divide-by-two circuit. Draw the schematic. 2. Derive the waveform for Q, the output of the divide-by-two circuit, and D, in relation to the signal; use a rising-edge-triggered flip-flop. 3. Derive the logic to calculate the three Lite_- and the signals from Q and. Draw the circuit. 4. Finish the derivation and simplification of the equations for the Left Control Box relating BULB_L, BULB_L2, BULB_L3 to the B, L and R switches as well as to the three Lite_- and the signals. Q D=Q Draw the circuit.. s 5. Derive the equations for the Right Control Box. Draw the circuit. 6. Look at the sample test fixture file shown on page 6. You will be given a file like that one. How many input combinations can be done with three input switches? Which tests should be added? Write down what must be added to the Test Fixture file to include them. 3.5 In the Laboratory The software used will be the Xilinx ECS Graphic Entry System, and the logic will be simulated using the ModelSim simulator. In your schematics, use the fdc flip-flop symbol You will be then programming hardware on a CPLD (complex Programmable Logic Device), so you can see the lights flashing. Unfortunately a T-Bird is not supplied. 3.5. Simulation The Verilog test fixture file To simulate your circuit, you need a file to generate the clock and switch signals. This file is usually called a test bench file. The ECS software calls it a.tf or test fixture file. This file is given at the end of the lab. // precedes a comment. #3 means a delay of 3 units before the next instruction is simulated. The units for this simulation are seconds, as given by the `scale s / ms command. The delays accumulate., thus #7 x= ; #5 y = ; give a total delay of 2 before the simulator finishes making y zero. The included test fixture file generates signals for only four of the possible button combinations. You must add statements to test the others. Print out a copy of your revised test fixture file (up to the $stop) for your report. Department of Electronics February 7, 25 6

Sample Verilog Test Fixture File for the Simulator // Verilog tbirdtestfixture.tf - Feb 5, 25 `scale s / ms // Means # represents a sec delay, min resolvable is ms. (#.) module TBirdTestFixture; // Outputs from your circuit wire BULB_L, BULB_L2, BULB_L3, BULB_R, BULB_R2, BULB_R3; // Inputs to your circuit reg, L, R, B, RST; // Generate a clock initial =; always #.5 =~ initial begin // Set all the switches low initially L=; R=; B=; // An initial reset makes Q = at the start of the simulation. RST = ; #. RST = ; // Set RST high after a. s delay #.7 RST = ; // Set RST low after an additional.7 s delay //Test : No switches on L = ; R = ; B = ; #5 // Delay 5s for a total of 6.8s #3 // Delay 3s for a total of 9.8s //Test : Left signal; // These tests start about sec. L = ; // B and R are still at #7 // Delay 7s for a total of 6.8s L = ; #3 // Delay 3s for a total of 9.8s //Test 2: Right signal on, Left off; 2 sec R = ; L = ; #7 // Delay 7s for a total of 26.8s R = ; #3 // Delay 3s for a total of 29.8s B R BULB_L //Test 3: Brake; 3 sec BULB_L2 B = ; R = ; #7 // Delay 7s for a total of 36.8s B = ; #3 // Delay 3s for a total of 39.8s BULB_L3 BULB_R BULB_R2 //Test 4: Brake and left flashers; 4 sec B = ; L = ; #7 // Delay 7s for a total of 46.8s BULB_R3 L = ; B = ; #3 // Leave some flat space between tests // It is easy to find test 5 if it starts at about 5 s // Test 5: Q L The actual test fixture uses f which is 8Hz. A divider in tbirdtop.sch divides this frequency by 8 to generate a Hz clock called. This test fixture pretends it generates a Hz here, which is what you may pretend when adding your tests..5..5 2. RST Typical simulation results for L only followed by L and B, followed by B alone. Your simulation will be longer, and differ in detail, from these. Left signal turned on brake pushed right signal off Left turn Left turn and Brake left signal off # $stop; // When one reaches here, the simulation is over. end Department of Electronics February 7, 25 7

3.5.2 Implementation This program was intended to be implemented a Complex Programmable Logic Device (CPLD). The particular device will be a Xilinx XCR364XL-6 PC44, 44-pin logic-array. They run from a 3.3 V power supply and have a pin-to-pin delay of 2ns. Obviously your tail lights will not need to run that fast. It is basically a large collection of ANDs feeding a smaller collection of ORs, which feed flip-flops. How these arrays work will be described later in the Array Logic course notes. f and The circuit board containing the CPLD has a clock generator on it. This generator is set up for the MIDI lab and is so fast that the tail-light flashes become a blur. For this reason there is a frequency divider circuit built into the tbirdtop.sch file, which divides down the 8 Hz f signal to a Hz for flash timing. Department of Electronics February 7, 25 8