Professional Documents
Culture Documents
We first wanted to check that the clock was actually By utilizing the counter function from Lab 3.1 we were
50MHz as was stated. We used a stopwatch and let it able to construct a timer. However, we first needed
count up for an arbitrary amount of time, then stopped to introduce the “modulus” attribute into our counters.
it by turning off cin using the key input. In 27 ± 0.5 The modulus attribute makes it so whenever the counter
seconds, the counter reached a value of 5074dca2, which reaches a certain number, the counter will reset back to
is 1,349,835,938 in decimal. This gives a frequency of 0 and the carry-out output pin will be 1 for one tick.
2
First, we connected our 50 MHz clock to the count in the 1-bit are 1, and the 3-bit similarly only alternates
pin on a 20-bit, modulus-500,000 counter. This creates only if all of the 2-bit, 1-bit, and 0-bits are 1.
one carry out pulse every 1/100 of a second, since the We started with a modulus-50M counter with an input
clock ticks 50 million times a second and the counter of 50MHz. This will output one c out tick every second.
sends one carry out pulse once every 500 thousand This single uptick enters a circuit involving four D flip-
counts. flops all turned into trigger flip-flops using XOR gates.
Next, we utilized a series of 16-bit, modulus-10 coun- To simulate the binary counting logic described in the
ters to display our timer in decimal numbers. Our above paragraph, each of the last three T flip-flops also
carry out of the main modulus-500,000 counter is con- starts with an AND gate. The first T flip-flop starts with
nected to the carry in pin of our first modulus-10 counter. cout and qOut[0] going into the XOR gate. If the out-
Thus, every 1/100 of a second the first modulus-10 put of the flip-flop is 0, then the XOR gate will activate
counter will go up one digit until it reaches 10, in which with the incoming cout high pulse, and the clock tick will
case it resets back to 0 and sends one carry out pulse. change the output from 0 to 1. In the time before the
The number the first modulus-10 counter has currently next cout pulse, the XOR gate will always be outputting
counted to (the q output) is input into the HEX2 hex- a 1 from the 1 of the qOut[0], until the pulse, at which
adecimal display. The carry out of the first modulus-10 time both inputs to the XOR will be 1, output will be 0,
counter is input into the carry in of the second modulus- and the flip-flop will change to a 0 output until the next
10 counter, thus making the second modulus-10 counter clock cycle.
count up one every 1/10 of a second. The outputs of the For the next flip-flops, we added an AND gate before
second counter to the hexadecimal displays and the third where cout used to be. The requirement here is that
counter mirrors those of the first counter to the hexadec- both cout and qOut[0] must be 1 for qOut[1] to switch.
imal displays and the second counter. This process of If that is true, then the AND gate will give a 1 to the
stacking modulus-10 counters is repeated until there is 6 XOR gate, and the logic in the above paragraph precedes
modulus-10 counters total, allowing us to track up to the just as before.
1000 seconds place on our timer. To convert to decimal, we combine the four qOut[3..0]
Lastly, we connected the the 50 MHz clock to all of bits into a divide-by-10 module. The output is named
our counters and connected a not-gated input VCC con- hexOut10[3..0] and the remainder is fed into a second
trolled by KEY[0] (the right-most push button) into the identical divider, for which the name is hexOut1[3..0].
setclear input pin of each counter. These two hexOut outputs are fed into two 7segment
converters for hex display output at HEX0 and HEX1.
2. Analysis and Discussion
FIG. 4. Lab 3.1: The bottom five bits of the 40 bit OUT[39..0]
pin, which are shown to just count upwards in binary, 00000,
00001, 00010, 00011, 00100, ...
4