# Introduction

Part 1 of this lab involved the implementation of a simple counter using a Quartus Megafunction. After hooking up the counter to the FPGA’s onboard clock, I tested that the counter worked as intended. Then, using Quartus’s simulation features, I was able to look at the individual logic states of the parts of my logic both by tying the line to an output line on the board as well as using registers which were able to provide byte level inspection at any location on the board. Using an iPhone, I was able to record the clock as it incremented. In the 10 seconds I recorded the counter, it incremented $$1.99\times10^9$$ times which gives the clock a period of

$$\frac{10}{1.9\times10^9} = 50.25 MHz$$

Which is pretty close to the 50 MHz that is expected by the FPGA.

After timing the clock, I simulated its performance using the Quartus simulator and verified that the counter incrememented to the right value at the right time.

The 2$$^{nd}$$ part of the lab involved the creation of a binary-coded decimal counter which was made out of 5 up counters with a modulus of 10 as described in Section 2.2. In order to drive the system every hundredth of a second, I connected the FPGA’s CLOCK_50 to a modulus 500000 counter whose cout went high at the desired frequency.

Part 3 of the lab involved the creation of a 4 bit counter from elementary gates and a D flop. I did use a Quartus megafunction in order to create a modulus counter that would drive the system every second. In constructing this diagram, I needed to create a 1 bit adder without a carry-in (done with an xor and and) 1 bit multiplexer (created with an inverter) which acts as the carry-in for the counter as a whole.

# Circuits

Part 1 of this lab involved the implementation of a simple counter using a Quartus Megafunction. By attaching the 50 MHz to an upcounter I was able to display a counter that incremented every clock cycle. I verified that the circuit was performing as intended using an output (pictured below the first up counter) as well as an oboard register that was made availible to me through Quartus.

This is the simulation screen presented by Quartus to show specific logic values at the defined inputs and outputs. Since the output of the hexidecimal displays are not very readable, I attached a register to an onboard register in order to read the value more clearly. I also connected the counter to one of the predefined outputs and simulated the value of the outputs in the simulator to further verify the behavior of the counter.