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
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.
| Level | Time | Works in simulation only? |
|---|---|---|
| Advanced | 12 hours | Simulation |
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.
| Item | What it is (in simple words) | Why you need it | Approx. 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 + router | A 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 useful | A 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
| Signal | Direction | Goes to | Note |
|---|---|---|---|
| txd[3:0] | output | PHY TXD (MII) | |
| tx_en | output | PHY TX_EN | |
| tx_clk | input | PHY TX_CLK | 25 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
- Verify CRC32 against the check value.
- Build the frame bytes in a small ROM.
- Send nibbles with tx_en high.
- Capture the packet with a PC and Wireshark.
- Add an inter-frame gap.
If it does not work
| Symptom | Likely cause | Fix |
|---|---|---|
| Board not detected | Charge-only cable or no driver | Use a data cable, install the vendor driver |
| Nothing happens | Wrong pin constraints | Recheck every pin against the board manual |
| PC sees nothing | Wrong PHY mode or clock | Check the PHY strap pins and 25 MHz clock |
| Bad FCS errors | Bit order | CRC 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?
Synchronizes the receiver.