Home / Learn Verilog / Project 17: Ethernet Frame Builder

Project 17: Ethernet Frame Builder

Create a frame with preamble, header, payload and CRC32.

The gistCreate a frame with preamble, header, payload and CRC32.

The idea, explained simply

Ethernet TXpayloadheaderCRC32MII nibblesPHY
Ethernet TX

What it is

Build the transmit side of an Ethernet MAC: preamble, destination, source, type, payload and CRC32.

Why it matters

Projects turn knowledge into skill: you design, simulate, debug and finally see real hardware react.

Mechanically speaking

Simulate in the browser, then build for your board following the steps.

Shows up in

  • Portfolio
  • Interviews
  • Learning by doing

What you will build

Build the transmit side of an Ethernet MAC: preamble, destination, source, type, payload and CRC32.

LevelTimeWorks in simulation only?
Advanced12 hoursSimulation

What you need (equipment and tools)

Read this table once and you will know exactly what to buy or prepare. You can do the simulation part with only a computer and the free tools.

ItemWhat it is (in simple words)Why you need itApprox. cost
Computer (Windows, Linux or macOS)Your normal laptop or desktop. You write Verilog here and run the free tools.Simulator, synthesis and programmer all run on it.you have it
Free software: Icarus Verilog + GTKWave (simulation), Yosys + nextpnr or the vendor IDE (build), openFPGALoader (program)The programs that compile and simulate your design.Everything in this course can be simulated with only these free tools.free
FPGA development board (e.g. Tang Nano 9K, Basys 3, iCEBreaker, Arty A7)A small circuit board with an FPGA chip, an oscillator (clock), LEDs, buttons and a USB port. The FPGA is the "blank hardware" that your Verilog turns into a real circuit.This is where your design actually runs. Without it you can only simulate.about $15 (Tang Nano 9K) to $150 (Arty A7)
Ethernet PHY module (LAN8720 RMII) + RJ45 cable + routerA chip that turns the FPGA digital signals into the real Ethernet line signals.The FPGA cannot drive the Ethernet cable directly.$6
Logic analyzer (8-channel USB, e.g. Saleae-clone) - optional but very usefulA tool that records digital signals over time and shows them as waveforms on the PC, like the simulator but for the real board.Lets you check what the pins really do (UART bits, SPI clock, VGA sync).$10 for a clone, use with PulseView (free)

Connections

SignalDirectionGoes toNote
txd[3:0]outputPHY TXD (MII)
tx_enoutputPHY TX_EN
tx_clkinputPHY TX_CLK25 MHz for 100 Mbit

Step 1: simulate the design

CRC32 of a byte sequenceVerilog: edit and run

The standard check value for "123456789" is CBF43926.

Step by step

  1. Verify CRC32 against the check value.
  2. Build the frame bytes in a small ROM.
  3. Send nibbles with tx_en high.
  4. Capture the packet with a PC and Wireshark.
  5. Add an inter-frame gap.

If it does not work

SymptomLikely causeFix
Board not detectedCharge-only cable or no driverUse a data cable, install the vendor driver
Nothing happensWrong pin constraintsRecheck every pin against the board manual
PC sees nothingWrong PHY mode or clockCheck the PHY strap pins and 25 MHz clock
Bad FCS errorsBit orderCRC is sent LSB first, complemented
Tip:Keep your first board test tiny: if the LED blinks, the toolchain, cable and clock are fine. Then add your project piece by piece.

Check yourself

1. Preamble pattern?