System Design: Hex Coder - werydude/FPGA-Demo GitHub Wiki

While my ultimate goal is to create a variant on the 6502, I started with the simple requirements:

"Use four of the sixteen switches on the Basys 3 to as binary encoder, and display the their converted Hex Values on the built in 7-Segment display."

I later expanded this to allow each segment to be individually encoded.

Language Choice

In traditional programming, languages are compiled to machine code. But wait, we don't have a machine yet; the point is make one. Instead, Hardware Design Languages (HDL) are compiled to a design. There are several choices for writing HDL:

  • Verilog: the "basic" choice.
  • VHDL: Designed for use in the defense industry, it orients itself towards preemptive design verification through the use of types.
  • SystemVerilog: A modern superset of Verilog that supports ideas similar to OOP. It's been compared to Java.

Because this project is for a C Class (Weird right? Somehow this professor trusts me), I chose Verilog 2001. Like C, its a minimal language, and has C-like ideas, including how easy to shoot yourself in the foot. (Or maybe EE is hard, who knows?) In a similar sense, I chose against using VHDL and SystemVerilog because they:

  1. Provide ideas that come from software engineering in a way that doesn't make sense (at least to me) for hardware engineering.
  2. Added unneeded complexity (especially for a beginner like myself).

References

While working this project, I used the following as references:

Basic Setup

When designing for a particular piece of hardware, access to the hardware is defined using a hardware constraint file (.xdc), which maps the pins and ports of the board to variables for use as inputs and outputs. Thankfully, a master file is provided by AMD and Digilent

Hardware Constraints

While we don't have to write the constraint, we do have to uncomment out the parts we want to use. While its temping to uncomment everything, unused variables will give annoying warnings. See this repo's xdc file.

Project Structure

While I started with a single file, I eventually chose to split the design into four components and a "main" file:

Component Designs

Full Design Schematic

Binary to Hex Encoder

Binary to Hex Encoder Schematic

Display Segment Selector

Display Segment Selector Schematic

Data State Manager

Data State Manager Schematic

7-Segement Display Driver

7-Segement Display Driver Schematic