Sie sind auf Seite 1von 2

Laboratory practice 11.

Binary Counters
Jesús Alejandro Marrufo Reyes
Guillermo Antonio Matos Uc
Carlos Andrés Solis Pech
Pablo Alberto Villoria Quiñones
Mérida, México
Faculty of Engineering UADY
Abstract — This laboratory practice consisted in design and ● The binary number must be shown in 4 different leds
implement one binary counter using a hierarchical structured and the circuit has to obtain the decimal
VHDL code. The objective of the circuit was to modify the representation of each number and show it in one 7-
frequency of the FPGA clock signal from 50 MHz to 1 Hz in segment display.
order to count from the number 0 to 9 in binary and show the
result in four different leds and also obtain its decimal
● When the count reaches the number 9, it has to be
representation in one 7-segment display. restarted from 0.

I. INTRODUCTION
A counter is a “sequential circuit that goes through a III. IMPLEMENTATION OF THE CIRCUIT
prescribed sequence of state upon the application of input
pulses” [1]. The logical circuit shown in fig. 2.1 was implemented in a
hierarchical structured VHDL code using the software ISEE
The circuits inside the counters consist in a series of
synchronized flip-flops, interconnected with logic gates that Design Suite in order to program the binary counter.
enables the flip-flops to follow a certain sequence of states. The VHDL code was written based in the figure 2.1 and
those three important points. First, the top module of the
“In a counter, the sequence of states may follow a binary
binary counter was implemented declaring three entry signals
count or any other sequence of states”[1].
and two out signals:
Counters are found in many equipments that contain
clkr : in std_logic;
digital logic for counting the number of occurrences of an
event. They are also useful for control operations because they clr : in std_logic;
generate timing sequences in a digital system. led : out std_logic_vector(3 downto 0);
seg : out std_logic_vector(6 downto 0);
A binary counter follows the binary sequence. ann : out std_logic_vector(3 downto 0);

II. DESIGN OF THE CIRCUIT The circuit has two important inputs and three outputs.
The 50 MHz input signal was declared as “clkr” and the reset
In order to implement the binary counter, we must design signal was named “clr”. The outputs “led”, “seg” and “ann”
two counters that work together: the first one will generate a controlled the leds and the 7-segment display to show the
1 second signal, that divides the main clock from 50 MHz to binary and decimal representation of the numbers.
1 Hz. The second counter will serve to count 10 counts from
the first clock, thats is, 10 seconds. After this process is The first step of the binary counter implementation
finished, the clock must reset to 0. consisted in design one frequency converter to transform the
frequency of the FPGA clock signal from 50 MHz to 1 Hz,
The following schematic diagram shows the binary this means that the counter should behave like a basic
counter architecture implemented on this laboratory practice: chronometer adjusted to count in seconds. This entity
consisted in two signals: one input and output.

clk50mhz: in std_logic;
clk: out std_logic;

This counter generates a 1 Hz pulse for each 50 × 106


pulses of the input signal using two if processes. With this
Fig 2.1. Schematic diagram of the binary counter.
entity, it was possible to convert the frequency of the FPGA
main clock from 50 MHz to 1 Hz.
The physical circuit must work according to these
restrictions: The output signal of the frequency converter was
introduced in a second entity that consisted in another binary
● The circuit must start from 0 and add 1 each second counter that counts from 0 to 9 adding 1 to the previous
until it reaches the number 9. number each second. The inputs and output were:

clk, st : in std_logic;
cnt_out : out std_logic_vector(3 downto 0); The binary counter designed worked correctly. Finally, the
UCF file was created to program the FPGA with it and the
The 1 Hz input signal was declared as “clk” and the reset physical circuit worked exactly as its behavior was defined.
signal was named “st”. The counter adds 1 to one binary
number for each pulse of the input signal and generates a 1- What is the amount of LUT’s used in the synthesis?
binary number from 0000 to 1001. Finally, the output was 17 out of 1920..
connected to three different leds of the FPGA to show the 2- What is the amount of FlipFlops used in the synthesis?
binary representation of each number. 4 out of 1920.
3- What is the amount of IOB’s used in the synthesis?
Finally, the 4-bit binary number was introduced to one 17 out of 83.
decoder to show its decimal representation on a 7-segment 4- What is the total percentage of logic gates used in the
display. design?
122 out of 100000 were used, 0.00122%.
A testbench file based in the architecture was created and,
with this, the logical circuit was simulated in the ISim tool to CONCLUSIONS
analyze the waveforms of each output.
Its important to now how it works the clock of the FPGA to
made good works and to easier some works that needs to wait
and a counter, another option for this work is made a
chronometer or a clock with the specific hour and use this for
another projects that need it, principally in the Finite state
Machine.

REFERENCES
Fig. 2.2. Waveforms of the clock input and the states of leds and 7-segment
display leds.. [1] M. Mano, Digital logic and computer design, 1st ed. New Delhi:
Prentice-Hall of India
, 2008, p.243.

Das könnte Ihnen auch gefallen