SlideShare a Scribd company logo
1 of 11
Download to read offline
Katrina Little
Experiment #9
Designing with D-Flip Flops:
Shift Register and Sequence Counter
Objective:
 Introduce the design of sequential circuits using D- Flip Flops.
 Implement a 4-bit parallel, right shift, load register.
 Design and build a sequence counter using D- Flip Flop
Equipment List:
 BASYS1 (Spartan 3e family) board
 Xilinx ISE foundation
 Generated bit file
Part I: Shift Register
Block Diagram:
Figure I.a
Block diagram of a parallel in parallel out
shift register. For the experiment, the
outputs will be called O3, O2, O1, O0
respectively.
Background:
Given 4 D flip-flops with inputs D0, D1, D2, D3, and outputs O0, O1, O2, O3, a right shift produces an output of
D0 O0, O0 O1, O1 O2, and O2 O3. In this case, the original content of Q3 is lost.
A shift left operation produces an output O0 O1, O1 O2, O2 Q3, and O3 D3. In the shift left case, the
original content of 00 is lost.
A shift register can also have a parallel load feature that allows all of the D flip-flops to be loaded in one clock
edge to produce D0 O0, D1 O1, D2 O2, and D3 O3.
Design Methodology:
Inputs Next State Action
sh(shift) ld(load) O3 O2 O1 O0
0 0 O3 O2 O1 O0
no change
(hold)
0 1 D3 D2 D1 D0 load
1 X SI Q3 Q2 Q1 right shift
Table I.a
Logic behind a right shift register. When sh
=ld =0 no state change occurs (the register
is in a hold state.) When sh = 0 ld =1 the
register loads the inputs with data. when sh
= 1. ld =X the register right shifts. NOTE:
Next state action only occurs at rising edges
of the clock!! The same logic was applied to
left shift.
Figure I.b
Sample timing diagram for a right shift
register with that operates on the falling
edge of the clock. As you can see, when load
= shift = 0, the outputs hold. When shift =0
and load = 1, the outputs get loaded with the
inputs. (Q3 = D3, Q2= D2, Q1 =D1, Q0 =D0)
Finally when shift =1 and load =X, you can
see that right shift occurs, (Q3 gets the serial
input, Q2 gets the current value of Q1, Q1
gets the value of Q2 and Q0 gets the value of
Q1)
Design Specification Plan:
‘
Figure I.c
Configuration of 7495 shift register. The clock will NOT be run on an inverter since we want it to
operate on the rising edges. The load, clock, and shift of each flip flop will be connected to a 4-bit bus.
The design will be similar to this for the experiment.
Figure I.d
Debouncer that will be added to the shift register
to prevent outputs from “jumping”.
Test Plan (Procedure):
1. Design the four bit left and right shift register in the schematic tool of the ISE using four D flip-flops
(Symbols – Categories (Flip Flop) – Symbols (fd)) one for each bit of storage. Draw a logic schematic in
your notebook of the final design. The clock input should be connected to a push button so that every
time the push button is pressed, the shift register sees a clock pulse to either load data into it or shift its
data left or right. Switches are notorious of producing many edge transitions when they go from ‘on’ to
‘off’ or ‘off’ to ‘on.’ These extra edges result in extra clock edges to the shift register clock input when a
single clock edge is expected. Since the D flip-flops are edge triggered in the shift register, these extra
edges result in the shifting of its bits by more than one bit at a time.
2. Consider the switch de-bounce circuit given below. The CLK input should be connected to push button
0 (BTN0) and the CLK25MHz should be connected to pin 54 of the FPGA, which is a 25 MHz clock
input. The circuit works as follows: When CLK input is ‘0’, the 4 and 16 bit counters are cleared and
held at a count of zero. Also the terminal count TC output on the 4 bit counter is zero during a clear
operation. When CLK input is ‘1’, the clear line is set to zero and the count enable CE inputs to the
counters are set to one allowing the counters to start counting up. When the count of 220
-1 (20 bits = 16
bits + 4 bits) is reached, the terminal count TC output is set to ‘1’ on the four bit counter. It takes a total
time of (220
-1) /25,000,000 = 0.04794 seconds for the TC output to go high. By this time the switch
contact noise has diminished.
When the TC on the four bit counter goes high, it sets one of the inputs to the AND gate to zero and thus
prevents the counter from counting any further until the CLK input goes low. Hence, this produces a
single rising edge on the TC output from the four bit counter independent of the number of edges on the
input clock CLK. If the CLK line is noisy producing many edges then the counter is reset and is delayed
until the TC on the four bit counter is set to one. In summary, this circuit solves the problem of many
edges on the CLK input due to switch contact noise (switch bounce) and the output from this circuit
produces a clean rising edge on the TC output of the four bit counter. This rising edge can be used to
clock the shift register without any switch noise.
3. Simulate the circuit designed in Step 1 and verify that it correctly implements the function of a left /
right shift register. Ignore the de-bounce circuit discussed in step 2 above for this simulation.
4. Download this circuit implemented in Step 3 to the BASYS board with D0 through D3 set to SW0 –
SW3 and O0 through O3 set to LED0 – LED3. The LOAD input should be connected to SW7, L/R
should be on SW6, and the CLK input should be connected to push button 0 (BTN0). You will need to
overwrite the pin for the CLK signal. Please ignore the warning in the PACER program due to over
riding the global clock pin to push button 0. Ignore the de-bounce circuit for this step. Refer to Table I.b
below:
Inputs Switch Pin# Outputs LED Pin#
D(0) SW0 38 O(0) LED0 15
D(1) SW1 36 O(1) LED1 14
D(2) SW2 29 O(2) LED2 8
D(3) SW3 24 O(3) LED3 7
Table I.b
5. Use the EXPORT program to download the program. Run several cases showing that the shift register
works correctly. Describe what is observed during these tests in your laboratory report.
6. Modify the shift register circuit of steps 1, 3, 4, and 5 above to include the de-bounce circuit of step 2.
Connect the push button 0 to the CLK input which is one of the inputs of the AND gate shown in figure
above. The output of this AND gate is connected to the count enable CE input of the 16 bit counter.
Make sure that the 25MHz Clock input is connected to pin P54, which forms the clock inputs for the 4
and 16 bit counters. Finally, tie the terminal count TC output of the four bit counter to the clock inputs
of the four D flip-flops of the shift register. Refer to table I.c below:
Inputs/Outputs
Push
Button Pin#
clock BTN0 69
clock (25MHz) 54
Table I.c
7. Download the design in Step 6 to the BASYS board with D0 through D3 set to SW0 – SW3 and O0
through O3 set to LED0 - LED3. The LOAD input should be connected to SW7, L/R should be on SW6,
and the CLK input should be connected as described in step 6. This signal will need its pin over written.
Ignore the warning in the PACER program due to overriding the global clock pin to push button 0. This
step includes the de-bounce circuit given in step 2. Refer to table I.d below:
Input Switch Pin#
load SW7 6
L/R shift SW6 10
Table I.d
8. Use the EXPORT program to download the program. Run several cases showing that the shift register
works correctly. Describe what is observed during these tests in your laboratory report. Compare the
results obtained in this step to that of step 5. Include this comparison in your laboratory report for this
experiment.
Part II: Sequence Counter
Block Diagram:
Design Methodology:
0000
0010
0100
01100001
0011
0101
0111
DCBA D+C+B+A+
0000 0010
0001 0011
0010 0100
0011 0101
0100 0110
0101 0111
0110 0001
0111 0000
1000 XXXX
1001 XXXX
1010 XXXX
1011 XXXX
1100 XXXX
1101 XXXX
1110 XXXX
1111 XXXX
A+ B+
0 0 X X 1 1 X X
1 1 X X 1 1 X X
1 0 X X 0 0 X X
0 1 X X 0 0 X X
C+ D+
0 1 X X 0 0 X X
0 1 X X 0 0 X X
1 0 X X 0 0 X X
1 0 X X 0 0 X X
Figure II.a
Sequence counts:
0,2,4,6,1,3,5,7…repeat
The following equations can be written from the K-maps:
 D+ = A’
 C+ = A’B’C +BC’
 B+ = C’
 A+ = C’D + A’B’ + BC’D’
Test Plan (Procedure):
1. Design the sequence counter in the schematic tool of the ISE using the require number of D flip-flops
(fd) under Flip Flop category (one for each bit of storage). Draw a logic schematic in your notebook of
the final design.
2. Simulate the design implemented in Step 1 and verify that is correctly implements the sequence counter.
Ignore the de-bounce circuit in step 2 above when performing the simulation.
3. Download the design in Step 1 to the BASYS board with O0 through ON set to LED0 to LEDN (N is the
number of bits required to implement the sequence counter). The CLK input should be connected to
push button 0. Use the EXPORT program to download this circuit to the FPGA. Generate a new state
transition table to verify that the design works correctly. Ignore the de-bounce circuit in step 2. Describe
what was observed during this test in you laboratory report. Refer to table II.a.
Input/Output LED
Push
button Pin#
O0 LED0 15
O1 LED1 14
O2 LED2 8
O3 LED3 7
CLK 0 69
Table II.a
4. Modify the sequence counter circuit of steps 1, 2, and 3 above to include the de-bounce circuit of step 2
of Part 1 of this experiment. Connect the push button 0 to the CLK input which is one of the inputs of
the AND gate shown in figure above. The output of this AND gate is connected to the count enable CE
input of the 16 bit counter. Make sure that the 25MHz Clock input is connected to pin P54, which forms
the clock inputs for the 4 and 16 bit counters. Finally, tie the terminal count TC output of the four bit
counter to the clock inputs of the four D flip-flops of the sequence counter.
Input Push Button Pin#
CLK 0 69
CLK (25MHz) 54
5. Download the design in Step 4 to the BASYS board with O0 through ON set to LED0 to LEDN. The
CLK input should be connected to push button 0. Use the EXPORT program to download the program.
Generate a new state transition table to verify that the design works correctly. Include the de-bounce
circuit in step 2 of Part 1. Describe what is observed during these tests in your laboratory report.
Compare the results obtained in this step to that of step 3. Include this comparison in the laboratory
report.
Conclusion:
For both parts I&II, if noise was present the outputs would “jump” when the clock was
activated. If Do was connected to O3 during left-shift O3 would return Do. Similarly, if D3 was
connected to O0 during a right-shift O0 would return D3. A don’t care in the next states would
make the transition of state impossible to predict if the “in” and “out” of a state were both
don’t cares. This situation could be avoided by making a chain of command of each in/ out
transition. D- flip flops are edge triggered. Therefore, if using switches it makes it difficult to
clock the outputs correctly. The clock would also be changing continuously which would
change the outputs unless the switch were at zero.
An 8 bit register could be constructed as follows:
The objectives of the lab were completed successfully. Knowledge of registers and sequence
counters have been expanded and designs of both were implemented as planned.

More Related Content

What's hot (20)

Lab 4 Three-Bit Binary Adder
Lab 4 Three-Bit Binary AdderLab 4 Three-Bit Binary Adder
Lab 4 Three-Bit Binary Adder
 
Ring Counter.pptx
Ring Counter.pptxRing Counter.pptx
Ring Counter.pptx
 
G. ripple counter
G. ripple counterG. ripple counter
G. ripple counter
 
Counters
CountersCounters
Counters
 
Shift registers
Shift registersShift registers
Shift registers
 
Flip Flop
Flip FlopFlip Flop
Flip Flop
 
Chapter 4 flip flop for students
Chapter 4 flip flop for studentsChapter 4 flip flop for students
Chapter 4 flip flop for students
 
decoder and encoder
 decoder and encoder decoder and encoder
decoder and encoder
 
Ripple counter
Ripple counterRipple counter
Ripple counter
 
Registers
RegistersRegisters
Registers
 
state diagrams of flip flops
 state diagrams of flip flops state diagrams of flip flops
state diagrams of flip flops
 
Lecture 5 Synchronous Sequential Logic
Lecture 5 Synchronous Sequential LogicLecture 5 Synchronous Sequential Logic
Lecture 5 Synchronous Sequential Logic
 
latches
 latches latches
latches
 
Shifters
ShiftersShifters
Shifters
 
Latches and flip flop
Latches and flip flopLatches and flip flop
Latches and flip flop
 
Counters
CountersCounters
Counters
 
Sequential circuits in Digital Electronics
Sequential circuits in Digital ElectronicsSequential circuits in Digital Electronics
Sequential circuits in Digital Electronics
 
Counters
Counters Counters
Counters
 
Sequential circuits in digital logic design
Sequential circuits in digital logic designSequential circuits in digital logic design
Sequential circuits in digital logic design
 
Jk flip flop
Jk flip flopJk flip flop
Jk flip flop
 

Similar to Lab 9 D-Flip Flops: Shift Register and Sequence Counter

Digital Electronics Registers and Counters.pptx
Digital Electronics Registers and Counters.pptxDigital Electronics Registers and Counters.pptx
Digital Electronics Registers and Counters.pptxnavaneethakrishnanec
 
Computer Organization And Architecture lab manual
Computer Organization And Architecture lab manualComputer Organization And Architecture lab manual
Computer Organization And Architecture lab manualNitesh Dubey
 
Admission in india 2015
Admission in india 2015Admission in india 2015
Admission in india 2015Edhole.com
 
Registers and counters
Registers and countersRegisters and counters
Registers and countersHeman Pathak
 
Admission in india 2015
Admission in india 2015Admission in india 2015
Admission in india 2015Edhole.com
 
counter using 4 master slave flip-flops
counter using 4 master slave flip-flops counter using 4 master slave flip-flops
counter using 4 master slave flip-flops ZunAib Ali
 
Digital Clock Using Logic Gates
Digital Clock Using Logic GatesDigital Clock Using Logic Gates
Digital Clock Using Logic GatesJalpaMaheshwari1
 
Chapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 InstructionsChapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 Instructionscmkandemir
 

Similar to Lab 9 D-Flip Flops: Shift Register and Sequence Counter (20)

8051 FINIAL
8051 FINIAL8051 FINIAL
8051 FINIAL
 
Dee2034 chapter 6 register
Dee2034 chapter 6 registerDee2034 chapter 6 register
Dee2034 chapter 6 register
 
Digital Electronics Registers and Counters.pptx
Digital Electronics Registers and Counters.pptxDigital Electronics Registers and Counters.pptx
Digital Electronics Registers and Counters.pptx
 
Dee2034 chapter 5 counter
Dee2034 chapter 5 counterDee2034 chapter 5 counter
Dee2034 chapter 5 counter
 
Chapter5 dek3133
Chapter5 dek3133Chapter5 dek3133
Chapter5 dek3133
 
Chapter 6 register
Chapter 6 registerChapter 6 register
Chapter 6 register
 
Computer Organization And Architecture lab manual
Computer Organization And Architecture lab manualComputer Organization And Architecture lab manual
Computer Organization And Architecture lab manual
 
Mcsl 17 ALP lab manual
Mcsl 17 ALP lab manualMcsl 17 ALP lab manual
Mcsl 17 ALP lab manual
 
Dns module3 p3
Dns module3 p3Dns module3 p3
Dns module3 p3
 
Dns module3 p3_shift registers
Dns module3 p3_shift registersDns module3 p3_shift registers
Dns module3 p3_shift registers
 
Admission in india 2015
Admission in india 2015Admission in india 2015
Admission in india 2015
 
Registers and counters
Registers and countersRegisters and counters
Registers and counters
 
Adc interfacing
Adc interfacingAdc interfacing
Adc interfacing
 
Admission in india 2015
Admission in india 2015Admission in india 2015
Admission in india 2015
 
8255
82558255
8255
 
Bds lab 4
Bds lab 4Bds lab 4
Bds lab 4
 
Switch Control and Time Delay - Keypad
Switch Control and Time Delay - KeypadSwitch Control and Time Delay - Keypad
Switch Control and Time Delay - Keypad
 
counter using 4 master slave flip-flops
counter using 4 master slave flip-flops counter using 4 master slave flip-flops
counter using 4 master slave flip-flops
 
Digital Clock Using Logic Gates
Digital Clock Using Logic GatesDigital Clock Using Logic Gates
Digital Clock Using Logic Gates
 
Chapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 InstructionsChapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 Instructions
 

More from Katrina Little

Electronics ii hand written formula sheets
Electronics ii hand written formula sheetsElectronics ii hand written formula sheets
Electronics ii hand written formula sheetsKatrina Little
 
Embedded Systems Design of Hexidecimal Calculator
Embedded Systems Design of Hexidecimal Calculator Embedded Systems Design of Hexidecimal Calculator
Embedded Systems Design of Hexidecimal Calculator Katrina Little
 
MATLAB / Simulink: Inverted Pendulum on a Moving Cart
MATLAB / Simulink: Inverted Pendulum on a Moving Cart MATLAB / Simulink: Inverted Pendulum on a Moving Cart
MATLAB / Simulink: Inverted Pendulum on a Moving Cart Katrina Little
 
MATLAB / Simulink HW for Linear Control Systems
MATLAB / Simulink HW for Linear Control Systems MATLAB / Simulink HW for Linear Control Systems
MATLAB / Simulink HW for Linear Control Systems Katrina Little
 
Lab 5 Report Precision Diodes and Applications
Lab 5 Report Precision Diodes and ApplicationsLab 5 Report Precision Diodes and Applications
Lab 5 Report Precision Diodes and ApplicationsKatrina Little
 
Lab 7 Report Voltage Comparators and Schmitt Triggers
Lab 7 Report Voltage Comparators and Schmitt TriggersLab 7 Report Voltage Comparators and Schmitt Triggers
Lab 7 Report Voltage Comparators and Schmitt TriggersKatrina Little
 
Lab 4 Report Switching Voltage Regulators
Lab 4 Report Switching Voltage Regulators Lab 4 Report Switching Voltage Regulators
Lab 4 Report Switching Voltage Regulators Katrina Little
 
Lab 3 Report Linear Voltage Regulators
Lab 3 Report Linear Voltage RegulatorsLab 3 Report Linear Voltage Regulators
Lab 3 Report Linear Voltage RegulatorsKatrina Little
 
Lab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational AmplifiersLab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational AmplifiersKatrina Little
 
Experiment 2, Diode Applications
Experiment 2, Diode ApplicationsExperiment 2, Diode Applications
Experiment 2, Diode ApplicationsKatrina Little
 
Experiment 6, 3-Stage BJT Amplifier Design Project
Experiment 6, 3-Stage BJT Amplifier Design ProjectExperiment 6, 3-Stage BJT Amplifier Design Project
Experiment 6, 3-Stage BJT Amplifier Design ProjectKatrina Little
 
Experiment 5, Transistor Small Signal Amplifiers
Experiment 5, Transistor Small Signal AmplifiersExperiment 5, Transistor Small Signal Amplifiers
Experiment 5, Transistor Small Signal AmplifiersKatrina Little
 
Experiment 4, Transistor AC Amplifiers
Experiment 4, Transistor AC AmplifiersExperiment 4, Transistor AC Amplifiers
Experiment 4, Transistor AC AmplifiersKatrina Little
 
Experiment 3 Low Pass Filter
Experiment 3 Low Pass Filter Experiment 3 Low Pass Filter
Experiment 3 Low Pass Filter Katrina Little
 
Lab 4 EEL 3552 Amplitude Modulation with MATLAB Simulations
Lab 4 EEL 3552 Amplitude Modulation with MATLAB SimulationsLab 4 EEL 3552 Amplitude Modulation with MATLAB Simulations
Lab 4 EEL 3552 Amplitude Modulation with MATLAB SimulationsKatrina Little
 
RC Circuit Transfer Functions with Bode Diagrams
RC Circuit Transfer Functions with Bode Diagrams RC Circuit Transfer Functions with Bode Diagrams
RC Circuit Transfer Functions with Bode Diagrams Katrina Little
 
Lab 7 -RAM and ROM, Xilinx, Digelent BASYS experimentor board
Lab 7 -RAM and ROM, Xilinx, Digelent BASYS experimentor boardLab 7 -RAM and ROM, Xilinx, Digelent BASYS experimentor board
Lab 7 -RAM and ROM, Xilinx, Digelent BASYS experimentor boardKatrina Little
 
Lab 3 Multi-Function Gate
Lab 3   Multi-Function GateLab 3   Multi-Function Gate
Lab 3 Multi-Function GateKatrina Little
 
Lab 2-Simple Combinational Logic
Lab 2-Simple Combinational LogicLab 2-Simple Combinational Logic
Lab 2-Simple Combinational LogicKatrina Little
 
Senior design power supply pcb eagle_cad
Senior design power supply pcb eagle_cadSenior design power supply pcb eagle_cad
Senior design power supply pcb eagle_cadKatrina Little
 

More from Katrina Little (20)

Electronics ii hand written formula sheets
Electronics ii hand written formula sheetsElectronics ii hand written formula sheets
Electronics ii hand written formula sheets
 
Embedded Systems Design of Hexidecimal Calculator
Embedded Systems Design of Hexidecimal Calculator Embedded Systems Design of Hexidecimal Calculator
Embedded Systems Design of Hexidecimal Calculator
 
MATLAB / Simulink: Inverted Pendulum on a Moving Cart
MATLAB / Simulink: Inverted Pendulum on a Moving Cart MATLAB / Simulink: Inverted Pendulum on a Moving Cart
MATLAB / Simulink: Inverted Pendulum on a Moving Cart
 
MATLAB / Simulink HW for Linear Control Systems
MATLAB / Simulink HW for Linear Control Systems MATLAB / Simulink HW for Linear Control Systems
MATLAB / Simulink HW for Linear Control Systems
 
Lab 5 Report Precision Diodes and Applications
Lab 5 Report Precision Diodes and ApplicationsLab 5 Report Precision Diodes and Applications
Lab 5 Report Precision Diodes and Applications
 
Lab 7 Report Voltage Comparators and Schmitt Triggers
Lab 7 Report Voltage Comparators and Schmitt TriggersLab 7 Report Voltage Comparators and Schmitt Triggers
Lab 7 Report Voltage Comparators and Schmitt Triggers
 
Lab 4 Report Switching Voltage Regulators
Lab 4 Report Switching Voltage Regulators Lab 4 Report Switching Voltage Regulators
Lab 4 Report Switching Voltage Regulators
 
Lab 3 Report Linear Voltage Regulators
Lab 3 Report Linear Voltage RegulatorsLab 3 Report Linear Voltage Regulators
Lab 3 Report Linear Voltage Regulators
 
Lab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational AmplifiersLab 2 Report More Linear Operational Amplifiers
Lab 2 Report More Linear Operational Amplifiers
 
Experiment 2, Diode Applications
Experiment 2, Diode ApplicationsExperiment 2, Diode Applications
Experiment 2, Diode Applications
 
Experiment 6, 3-Stage BJT Amplifier Design Project
Experiment 6, 3-Stage BJT Amplifier Design ProjectExperiment 6, 3-Stage BJT Amplifier Design Project
Experiment 6, 3-Stage BJT Amplifier Design Project
 
Experiment 5, Transistor Small Signal Amplifiers
Experiment 5, Transistor Small Signal AmplifiersExperiment 5, Transistor Small Signal Amplifiers
Experiment 5, Transistor Small Signal Amplifiers
 
Experiment 4, Transistor AC Amplifiers
Experiment 4, Transistor AC AmplifiersExperiment 4, Transistor AC Amplifiers
Experiment 4, Transistor AC Amplifiers
 
Experiment 3 Low Pass Filter
Experiment 3 Low Pass Filter Experiment 3 Low Pass Filter
Experiment 3 Low Pass Filter
 
Lab 4 EEL 3552 Amplitude Modulation with MATLAB Simulations
Lab 4 EEL 3552 Amplitude Modulation with MATLAB SimulationsLab 4 EEL 3552 Amplitude Modulation with MATLAB Simulations
Lab 4 EEL 3552 Amplitude Modulation with MATLAB Simulations
 
RC Circuit Transfer Functions with Bode Diagrams
RC Circuit Transfer Functions with Bode Diagrams RC Circuit Transfer Functions with Bode Diagrams
RC Circuit Transfer Functions with Bode Diagrams
 
Lab 7 -RAM and ROM, Xilinx, Digelent BASYS experimentor board
Lab 7 -RAM and ROM, Xilinx, Digelent BASYS experimentor boardLab 7 -RAM and ROM, Xilinx, Digelent BASYS experimentor board
Lab 7 -RAM and ROM, Xilinx, Digelent BASYS experimentor board
 
Lab 3 Multi-Function Gate
Lab 3   Multi-Function GateLab 3   Multi-Function Gate
Lab 3 Multi-Function Gate
 
Lab 2-Simple Combinational Logic
Lab 2-Simple Combinational LogicLab 2-Simple Combinational Logic
Lab 2-Simple Combinational Logic
 
Senior design power supply pcb eagle_cad
Senior design power supply pcb eagle_cadSenior design power supply pcb eagle_cad
Senior design power supply pcb eagle_cad
 

Recently uploaded

定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一zul5vf0pq
 
Papular No 1 Online Istikhara Amil Baba Pakistan Amil Baba In Karachi Amil B...
Papular No 1 Online Istikhara Amil Baba Pakistan  Amil Baba In Karachi Amil B...Papular No 1 Online Istikhara Amil Baba Pakistan  Amil Baba In Karachi Amil B...
Papular No 1 Online Istikhara Amil Baba Pakistan Amil Baba In Karachi Amil B...Authentic No 1 Amil Baba In Pakistan
 
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》o8wvnojp
 
(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一C SSS
 
VIP Call Girl Saharanpur Aashi 8250192130 Independent Escort Service Saharanpur
VIP Call Girl Saharanpur Aashi 8250192130 Independent Escort Service SaharanpurVIP Call Girl Saharanpur Aashi 8250192130 Independent Escort Service Saharanpur
VIP Call Girl Saharanpur Aashi 8250192130 Independent Escort Service SaharanpurSuhani Kapoor
 
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一ga6c6bdl
 
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一ga6c6bdl
 
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311  Call Girls in Thane , Independent Escort Service ThanePallawi 9167673311  Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service ThanePooja Nehwal
 
定制(RHUL学位证)伦敦大学皇家霍洛威学院毕业证成绩单原版一比一
定制(RHUL学位证)伦敦大学皇家霍洛威学院毕业证成绩单原版一比一定制(RHUL学位证)伦敦大学皇家霍洛威学院毕业证成绩单原版一比一
定制(RHUL学位证)伦敦大学皇家霍洛威学院毕业证成绩单原版一比一ss ss
 
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,Pooja Nehwal
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一ga6c6bdl
 
Gaya Call Girls #9907093804 Contact Number Escorts Service Gaya
Gaya Call Girls #9907093804 Contact Number Escorts Service GayaGaya Call Girls #9907093804 Contact Number Escorts Service Gaya
Gaya Call Girls #9907093804 Contact Number Escorts Service Gayasrsj9000
 
Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝
Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝
Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls Service Kolkata Aishwarya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Call Girls Service Kolkata Aishwarya 🤌  8250192130 🚀 Vip Call Girls KolkataCall Girls Service Kolkata Aishwarya 🤌  8250192130 🚀 Vip Call Girls Kolkata
Call Girls Service Kolkata Aishwarya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一Fi sss
 
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一ss ss
 
萨斯喀彻温大学毕业证学位证成绩单-购买流程
萨斯喀彻温大学毕业证学位证成绩单-购买流程萨斯喀彻温大学毕业证学位证成绩单-购买流程
萨斯喀彻温大学毕业证学位证成绩单-购买流程1k98h0e1
 
Hifi Defence Colony Call Girls Service WhatsApp -> 9999965857 Available 24x7 ...
Hifi Defence Colony Call Girls Service WhatsApp -> 9999965857 Available 24x7 ...Hifi Defence Colony Call Girls Service WhatsApp -> 9999965857 Available 24x7 ...
Hifi Defence Colony Call Girls Service WhatsApp -> 9999965857 Available 24x7 ...srsj9000
 

Recently uploaded (20)

定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
定制加拿大滑铁卢大学毕业证(Waterloo毕业证书)成绩单(文凭)原版一比一
 
Papular No 1 Online Istikhara Amil Baba Pakistan Amil Baba In Karachi Amil B...
Papular No 1 Online Istikhara Amil Baba Pakistan  Amil Baba In Karachi Amil B...Papular No 1 Online Istikhara Amil Baba Pakistan  Amil Baba In Karachi Amil B...
Papular No 1 Online Istikhara Amil Baba Pakistan Amil Baba In Karachi Amil B...
 
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》
 
(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一
 
VIP Call Girl Saharanpur Aashi 8250192130 Independent Escort Service Saharanpur
VIP Call Girl Saharanpur Aashi 8250192130 Independent Escort Service SaharanpurVIP Call Girl Saharanpur Aashi 8250192130 Independent Escort Service Saharanpur
VIP Call Girl Saharanpur Aashi 8250192130 Independent Escort Service Saharanpur
 
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一
 
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
 
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311  Call Girls in Thane , Independent Escort Service ThanePallawi 9167673311  Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service Thane
 
定制(RHUL学位证)伦敦大学皇家霍洛威学院毕业证成绩单原版一比一
定制(RHUL学位证)伦敦大学皇家霍洛威学院毕业证成绩单原版一比一定制(RHUL学位证)伦敦大学皇家霍洛威学院毕业证成绩单原版一比一
定制(RHUL学位证)伦敦大学皇家霍洛威学院毕业证成绩单原版一比一
 
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
Call Girls In Andheri East Call 9892124323 Book Hot And Sexy Girls,
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
 
Gaya Call Girls #9907093804 Contact Number Escorts Service Gaya
Gaya Call Girls #9907093804 Contact Number Escorts Service GayaGaya Call Girls #9907093804 Contact Number Escorts Service Gaya
Gaya Call Girls #9907093804 Contact Number Escorts Service Gaya
 
CIVIL ENGINEERING
CIVIL ENGINEERINGCIVIL ENGINEERING
CIVIL ENGINEERING
 
Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝
Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝
Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝
 
Call Girls Service Kolkata Aishwarya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Call Girls Service Kolkata Aishwarya 🤌  8250192130 🚀 Vip Call Girls KolkataCall Girls Service Kolkata Aishwarya 🤌  8250192130 🚀 Vip Call Girls Kolkata
Call Girls Service Kolkata Aishwarya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一
 
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
 
Low rate Call girls in Delhi Justdial | 9953330565
Low rate Call girls in Delhi Justdial | 9953330565Low rate Call girls in Delhi Justdial | 9953330565
Low rate Call girls in Delhi Justdial | 9953330565
 
萨斯喀彻温大学毕业证学位证成绩单-购买流程
萨斯喀彻温大学毕业证学位证成绩单-购买流程萨斯喀彻温大学毕业证学位证成绩单-购买流程
萨斯喀彻温大学毕业证学位证成绩单-购买流程
 
Hifi Defence Colony Call Girls Service WhatsApp -> 9999965857 Available 24x7 ...
Hifi Defence Colony Call Girls Service WhatsApp -> 9999965857 Available 24x7 ...Hifi Defence Colony Call Girls Service WhatsApp -> 9999965857 Available 24x7 ...
Hifi Defence Colony Call Girls Service WhatsApp -> 9999965857 Available 24x7 ...
 

Lab 9 D-Flip Flops: Shift Register and Sequence Counter

  • 1. Katrina Little Experiment #9 Designing with D-Flip Flops: Shift Register and Sequence Counter
  • 2. Objective:  Introduce the design of sequential circuits using D- Flip Flops.  Implement a 4-bit parallel, right shift, load register.  Design and build a sequence counter using D- Flip Flop Equipment List:  BASYS1 (Spartan 3e family) board  Xilinx ISE foundation  Generated bit file Part I: Shift Register Block Diagram: Figure I.a Block diagram of a parallel in parallel out shift register. For the experiment, the outputs will be called O3, O2, O1, O0 respectively.
  • 3. Background: Given 4 D flip-flops with inputs D0, D1, D2, D3, and outputs O0, O1, O2, O3, a right shift produces an output of D0 O0, O0 O1, O1 O2, and O2 O3. In this case, the original content of Q3 is lost. A shift left operation produces an output O0 O1, O1 O2, O2 Q3, and O3 D3. In the shift left case, the original content of 00 is lost. A shift register can also have a parallel load feature that allows all of the D flip-flops to be loaded in one clock edge to produce D0 O0, D1 O1, D2 O2, and D3 O3. Design Methodology: Inputs Next State Action sh(shift) ld(load) O3 O2 O1 O0 0 0 O3 O2 O1 O0 no change (hold) 0 1 D3 D2 D1 D0 load 1 X SI Q3 Q2 Q1 right shift Table I.a Logic behind a right shift register. When sh =ld =0 no state change occurs (the register is in a hold state.) When sh = 0 ld =1 the register loads the inputs with data. when sh = 1. ld =X the register right shifts. NOTE: Next state action only occurs at rising edges of the clock!! The same logic was applied to left shift. Figure I.b Sample timing diagram for a right shift register with that operates on the falling edge of the clock. As you can see, when load = shift = 0, the outputs hold. When shift =0 and load = 1, the outputs get loaded with the inputs. (Q3 = D3, Q2= D2, Q1 =D1, Q0 =D0) Finally when shift =1 and load =X, you can see that right shift occurs, (Q3 gets the serial input, Q2 gets the current value of Q1, Q1 gets the value of Q2 and Q0 gets the value of Q1)
  • 4. Design Specification Plan: ‘ Figure I.c Configuration of 7495 shift register. The clock will NOT be run on an inverter since we want it to operate on the rising edges. The load, clock, and shift of each flip flop will be connected to a 4-bit bus. The design will be similar to this for the experiment. Figure I.d Debouncer that will be added to the shift register to prevent outputs from “jumping”.
  • 5. Test Plan (Procedure): 1. Design the four bit left and right shift register in the schematic tool of the ISE using four D flip-flops (Symbols – Categories (Flip Flop) – Symbols (fd)) one for each bit of storage. Draw a logic schematic in your notebook of the final design. The clock input should be connected to a push button so that every time the push button is pressed, the shift register sees a clock pulse to either load data into it or shift its data left or right. Switches are notorious of producing many edge transitions when they go from ‘on’ to ‘off’ or ‘off’ to ‘on.’ These extra edges result in extra clock edges to the shift register clock input when a single clock edge is expected. Since the D flip-flops are edge triggered in the shift register, these extra edges result in the shifting of its bits by more than one bit at a time. 2. Consider the switch de-bounce circuit given below. The CLK input should be connected to push button 0 (BTN0) and the CLK25MHz should be connected to pin 54 of the FPGA, which is a 25 MHz clock input. The circuit works as follows: When CLK input is ‘0’, the 4 and 16 bit counters are cleared and held at a count of zero. Also the terminal count TC output on the 4 bit counter is zero during a clear operation. When CLK input is ‘1’, the clear line is set to zero and the count enable CE inputs to the counters are set to one allowing the counters to start counting up. When the count of 220 -1 (20 bits = 16 bits + 4 bits) is reached, the terminal count TC output is set to ‘1’ on the four bit counter. It takes a total time of (220 -1) /25,000,000 = 0.04794 seconds for the TC output to go high. By this time the switch contact noise has diminished. When the TC on the four bit counter goes high, it sets one of the inputs to the AND gate to zero and thus prevents the counter from counting any further until the CLK input goes low. Hence, this produces a single rising edge on the TC output from the four bit counter independent of the number of edges on the input clock CLK. If the CLK line is noisy producing many edges then the counter is reset and is delayed until the TC on the four bit counter is set to one. In summary, this circuit solves the problem of many
  • 6. edges on the CLK input due to switch contact noise (switch bounce) and the output from this circuit produces a clean rising edge on the TC output of the four bit counter. This rising edge can be used to clock the shift register without any switch noise. 3. Simulate the circuit designed in Step 1 and verify that it correctly implements the function of a left / right shift register. Ignore the de-bounce circuit discussed in step 2 above for this simulation. 4. Download this circuit implemented in Step 3 to the BASYS board with D0 through D3 set to SW0 – SW3 and O0 through O3 set to LED0 – LED3. The LOAD input should be connected to SW7, L/R should be on SW6, and the CLK input should be connected to push button 0 (BTN0). You will need to overwrite the pin for the CLK signal. Please ignore the warning in the PACER program due to over riding the global clock pin to push button 0. Ignore the de-bounce circuit for this step. Refer to Table I.b below: Inputs Switch Pin# Outputs LED Pin# D(0) SW0 38 O(0) LED0 15 D(1) SW1 36 O(1) LED1 14 D(2) SW2 29 O(2) LED2 8 D(3) SW3 24 O(3) LED3 7 Table I.b 5. Use the EXPORT program to download the program. Run several cases showing that the shift register works correctly. Describe what is observed during these tests in your laboratory report. 6. Modify the shift register circuit of steps 1, 3, 4, and 5 above to include the de-bounce circuit of step 2. Connect the push button 0 to the CLK input which is one of the inputs of the AND gate shown in figure above. The output of this AND gate is connected to the count enable CE input of the 16 bit counter. Make sure that the 25MHz Clock input is connected to pin P54, which forms the clock inputs for the 4 and 16 bit counters. Finally, tie the terminal count TC output of the four bit counter to the clock inputs of the four D flip-flops of the shift register. Refer to table I.c below: Inputs/Outputs Push Button Pin# clock BTN0 69 clock (25MHz) 54 Table I.c
  • 7. 7. Download the design in Step 6 to the BASYS board with D0 through D3 set to SW0 – SW3 and O0 through O3 set to LED0 - LED3. The LOAD input should be connected to SW7, L/R should be on SW6, and the CLK input should be connected as described in step 6. This signal will need its pin over written. Ignore the warning in the PACER program due to overriding the global clock pin to push button 0. This step includes the de-bounce circuit given in step 2. Refer to table I.d below: Input Switch Pin# load SW7 6 L/R shift SW6 10 Table I.d 8. Use the EXPORT program to download the program. Run several cases showing that the shift register works correctly. Describe what is observed during these tests in your laboratory report. Compare the results obtained in this step to that of step 5. Include this comparison in your laboratory report for this experiment.
  • 8. Part II: Sequence Counter Block Diagram: Design Methodology: 0000 0010 0100 01100001 0011 0101 0111 DCBA D+C+B+A+ 0000 0010 0001 0011 0010 0100 0011 0101 0100 0110 0101 0111 0110 0001 0111 0000 1000 XXXX 1001 XXXX 1010 XXXX 1011 XXXX 1100 XXXX 1101 XXXX 1110 XXXX 1111 XXXX A+ B+ 0 0 X X 1 1 X X 1 1 X X 1 1 X X 1 0 X X 0 0 X X 0 1 X X 0 0 X X C+ D+ 0 1 X X 0 0 X X 0 1 X X 0 0 X X 1 0 X X 0 0 X X 1 0 X X 0 0 X X Figure II.a Sequence counts: 0,2,4,6,1,3,5,7…repeat
  • 9. The following equations can be written from the K-maps:  D+ = A’  C+ = A’B’C +BC’  B+ = C’  A+ = C’D + A’B’ + BC’D’ Test Plan (Procedure): 1. Design the sequence counter in the schematic tool of the ISE using the require number of D flip-flops (fd) under Flip Flop category (one for each bit of storage). Draw a logic schematic in your notebook of the final design. 2. Simulate the design implemented in Step 1 and verify that is correctly implements the sequence counter. Ignore the de-bounce circuit in step 2 above when performing the simulation. 3. Download the design in Step 1 to the BASYS board with O0 through ON set to LED0 to LEDN (N is the number of bits required to implement the sequence counter). The CLK input should be connected to push button 0. Use the EXPORT program to download this circuit to the FPGA. Generate a new state transition table to verify that the design works correctly. Ignore the de-bounce circuit in step 2. Describe what was observed during this test in you laboratory report. Refer to table II.a. Input/Output LED Push button Pin# O0 LED0 15 O1 LED1 14 O2 LED2 8 O3 LED3 7 CLK 0 69 Table II.a
  • 10. 4. Modify the sequence counter circuit of steps 1, 2, and 3 above to include the de-bounce circuit of step 2 of Part 1 of this experiment. Connect the push button 0 to the CLK input which is one of the inputs of the AND gate shown in figure above. The output of this AND gate is connected to the count enable CE input of the 16 bit counter. Make sure that the 25MHz Clock input is connected to pin P54, which forms the clock inputs for the 4 and 16 bit counters. Finally, tie the terminal count TC output of the four bit counter to the clock inputs of the four D flip-flops of the sequence counter. Input Push Button Pin# CLK 0 69 CLK (25MHz) 54 5. Download the design in Step 4 to the BASYS board with O0 through ON set to LED0 to LEDN. The CLK input should be connected to push button 0. Use the EXPORT program to download the program. Generate a new state transition table to verify that the design works correctly. Include the de-bounce circuit in step 2 of Part 1. Describe what is observed during these tests in your laboratory report. Compare the results obtained in this step to that of step 3. Include this comparison in the laboratory report. Conclusion: For both parts I&II, if noise was present the outputs would “jump” when the clock was activated. If Do was connected to O3 during left-shift O3 would return Do. Similarly, if D3 was connected to O0 during a right-shift O0 would return D3. A don’t care in the next states would make the transition of state impossible to predict if the “in” and “out” of a state were both don’t cares. This situation could be avoided by making a chain of command of each in/ out
  • 11. transition. D- flip flops are edge triggered. Therefore, if using switches it makes it difficult to clock the outputs correctly. The clock would also be changing continuously which would change the outputs unless the switch were at zero. An 8 bit register could be constructed as follows: The objectives of the lab were completed successfully. Knowledge of registers and sequence counters have been expanded and designs of both were implemented as planned.