You are on page 1of 31

7-4 Counters with MOD Number < 2N

 Decade counters/BCD counters


 A decade counter is any counter with 10 distinct states,
regardless of the sequence. Any MOD-10 counter is a
decade counter.
 A BCD counter is a decade counter that counts from
binary 0000 to 1001.
 Decade counters are widely used for counting events
and displaying results in decimal form.

Ronald Tocci/Neal Widmer/Gregory


Moss Copyright ©2007 by Pearson Education, Inc.
Digital Systems: Principles and Columbus, OH 43235
Applications, 10e All rights reserved..
7-8 Decoding a Counter
 Decoding is the conversion of a binary output to a
decimal value.
 The active high decoder shown in Figure 7-20 could
be used to light an LED representing each decimal
number 0 to 7.
 Active low decoding is obtained by replacing the
AND gates with NAND gates.

Ronald Tocci/Neal Widmer/Gregory


Moss Copyright ©2007 by Pearson Education, Inc.
Digital Systems: Principles and Columbus, OH 43235
Applications, 10e All rights reserved..
Figure 7-20 Using AND gates to decode a MOD-8 counter.
Ring Counters

 The shift register we discussed earlier can be converted into a simple counter
by connecting the output of its last stage to the input of its first stage. Initially,
we set the first stage to 1 and clear the rest of the stages (set to 0). Each clock
pulse then shifts the 1 along to the next stage until it reaches the last stage. At
this point the next clock pulse loads the 1 back into the first stage. Such a
counter that contains n-stages is called a modulo-n ring counter.

 Figure 3.20 shows an example of a modulo-4 ring counter, the timing


waveforms and a count table.

Notice that this counter is not a binary counter. It does not count in a binary
count sequence.

Although less efficient than other counters the output of the ring counter can
be decoded without the use of decoding gates such as the previous slide
Ring Counters

Q0 Q1 Q2 Q3

D Q D Q D Q D Q
CLK C C C C

Count Q3 Q2 Q1 Q0

T1 T2 T3 T4 T5 T6 0 0 0 0 1
1
CLK 1 0 0 1 0
0
1
Q0 2 0 1 0 0
0
1 3 1 0 0 0
Q1
0 4 0 0 0 1
1
Q2
0
1
Q3
0

 Figure 3.20 shows an example of a modulo-4 ring counter, the timing waveforms and a count table.
Introduction to HCPLDs
 All our working in digital electronics up until now
has dealt with digital logic gates and devices
themselves, that is, how they operate and perform

 We have also looked at combinational logic circuits,


counters and registers

 You know that certain chips contain logic gates, for


example the 7400 IC contains four NAND gates

 You now have the knowledge to design digital


circuits to perform the required job
Introduction to HCPLDs
 The problem with creating a digital circuit with ICs
(Integrated Circuits) containing discrete gates is that
a lot of real estate (space) is required on a PCB
(printed circuit board)

 Devices such as (PLDs) programmable logic devices


are sometimes used to overcome this problem

 PLDs offer the ability to program a limited amount of


logic functions on one chip

 PLDs however normally contain a limited number of


gates and can only be programmed once
Introduction to HCPLDs
 PLDs provided limited ability to replace many digital
components with one digital IC

 In most cases this involved making a truth table and


using it to program the PLD

 In many instances the required digital circuits cannot


be described by a simple truth table

 Many circuits require memory (flip-flops and latches),


more than one output and delays

 None of these functions were readily available with


the old PLDs
Introduction to HCPLDs
 PLDs could only be programmed once and if the
programming was incorrect the device needed to be
discarded

 Furthermore, PLDs could only replace portions of


digital circuits

 The HCPLD (High Capacity Programmable Logic


Device) can be programmed to contain any digital
logic circuit!
Introduction to HCPLDs
 The HCPLD can also be reprogrammed!

 The HCPLD module looks at how we can design


digital systems using such a chip

 We will also look at how to describe circuits


graphically
Introduction to HCPLDs
 The Quartus software package and AHDL are
utilised

 Quartus is simply the newer version of Max+PlusII


and operates in a very similar manner, so where
reference material makes reference to Max+Plus
you can just use Quartus instead
HCPLDs with Quartus
 We are going to look at how to design, program and
simulate logic circuits for a HCPLD using the
Quartus software package

 We will be considering ALTERA’s


EPM7128SLC84-7 HCPLD
You can Google search for ‘EPM7128SLC84-7’ to find
the specs and datasheet

 This device has 64 pins available as I/O


HCPLDs
 Have EEPROM memory

 Can be re-programmed in-circuit

 Can perform any digital functions


HCPLDs and assessment
Important:
 The quizzes and exam will test your ability to create
circuits using AHDL

 If you prefer to venture into VHDL you can use it


instead of AHDL for the assessment tasks and exam
Accessing Quartus
• The Quartus software package
is installed on the computers
in the Electronics lab Kc1.018

• You can also download it for free from Altera

• Make sure you download the free Web Edition as


listed on the following slide

• For the purposes of SEE202 it is best if we use


Quartus II 9.1 sp2 Web Edition because it makes
simulation straightforward
Accessing Quartus
 Quartus II Web Edition v9.1 Service Pack 2

 https://www.altera.com/download/software/quartus-
ii-we

 Using version 9.1 sp2 allows us to use the built in


simulator and saves us a lot of effort
Using Quartus
 Quartus offers an extensive help Search
accessed by Help -> Search
HCPLDs with Quartus
 Quartus provides us various methods to design our
digital system as well as to validate it
 We are already familiar with designing digital
systems using logic diagrams and this can be
achieved in Quartus
HCPLDs with Quartus
 The true power of programming HCPLDs with a
package like Quartus however is the ability to use a
HDL as well as the ability to simulate the behaviour
of our circuits without needing to physically create
them!

 For these reason, in this unit, we focus on AHDL for


designing circuits and simulating them in Quartus
HCPLDs with Quartus
 Knowing where to start when designing an AHDL
component of your system may seem daunting
however using Quartus help can simplify the task

 Consider the following task……

 We know the input and output behaviour (truth


table) of our digital system, how can we design an
AHDL module based on this information alone?
AHDL Example – Truth Tables
We use the Quartus help!
Search for Help on..

Choose suitable topic


AHDL Example – Truth Tables
Quartus help

Topic

Description

Example
AHDL Example – Truth Tables
Alternatively we can use the Index of Digital Systems,
Ronald J. Tocci and Search for Truth Tables, using
AHDL 181-182
AHDL Example – Truth Tables
The AHDL solution:

Lets look at our Boolean expression and truth table


from the textbook

Figure 4-11. c) Ronald J. Tocci Digital Systems, Principles and Applications, pg 134
AHDL Example – Truth Tables

Define 4 Inputs

Define 1 Output

Truth table statement

Set up inputs and outputs

Truth table

End of Truth table statement


AHDL Example – Templates
Can we save time when writing the AHDL for common
statements such as the Truth Table Statement?

Yes, we can use templates


AHDL Example – Templates
Can we save time when writing the AHDL for common
statements such as the Truth Table Statement?

Yes, we can use templates


AHDL Example – Templates
In the case of the Truth Table statement the template
We then need to modify the template to suit our needs
AHDL Example – Templates
We can also use templates to help set up our basic
structure
AHDL vs Graphical Programming
• We have already mentioned that using Quartus we
design circuits graphically - but because we are
already familiar with designing circuits using logic
diagrams we are focusing on using Quartus for
ADHL
• It is however worth considering the costs-benefits of
graphical vs AHDL irrespective of whether we are
using Quartus for our graphical designs
• It is also worth considering the costs-benefits of
AHDL versus VHDL
AHDL vs Graphical Programming
Graphical logic design
Advantage
Easier than wiring physical gates
Disadvantage
We still need to know which gates to use and how to connect
them
ADHL design using the Quartus Text Editor
Advantage
We just tell Quartis software how to program our PLD and it
determines the individual connections
Disadvantage
Initial setup cost means it can be more time consuming for
simple designs

You might also like