|
|
========================
|
========================
|
10GE MAC Core
|
10GE MAC Core
|
========================
|
========================
|
|
|
|
|
------------------------
|
------------------------
|
1. Directory Structure
|
1. Directory Structure
|
------------------------
|
------------------------
|
|
|
The directory structure for this project is shown below.
|
The directory structure for this project is shown below.
|
|
|
.
|
.
|
|-- doc - Documentation files
|
|-- doc - Documentation files
|
|
|
|
|
|-- rtl
|
|-- rtl
|
| |-- include - Verilog defines and utils
|
| |-- include - Verilog defines and utils
|
| `-- verilog - Verilog source files for xge_mac
|
| `-- verilog - Verilog source files for xge_mac
|
|
|
|
|
|-- sim
|
|-- sim
|
| |-- systemc - SystemC simulation directory
|
| |-- systemc - SystemC simulation directory
|
| `-- verilog - Verilog simulation directory
|
| `-- verilog - Verilog simulation directory
|
|
|
|
|
`-- tbench
|
`-- tbench
|
|-- systemc - SystemC test-bench source files
|
|-- systemc - SystemC test-bench source files
|
`-- verilog - Verilog test-bench source files
|
`-- verilog - Verilog test-bench source files
|
|
|
|
|
|
|
------------------------
|
------------------------
|
2. Simulation
|
2. Simulation
|
------------------------
|
------------------------
|
|
|
There are two simulation environments that can be used to validate the code.
|
There are two simulation environments that can be used to validate the code.
|
The verilog simulation is very basic and meant for those who want to look
|
The verilog simulation is very basic and meant for those who want to look
|
at how the MAC operates without going through the effort of setting up SystemC.
|
at how the MAC operates without going through the effort of setting up SystemC.
|
The SystemC environment is more sophisticated and covers all features of the MAC.
|
The SystemC environment is more sophisticated and covers all features of the MAC.
|
|
|
|
|
|
|
------------------------
|
------------------------
|
2.1 Verilog Simulation
|
2.1 Verilog Simulation
|
------------------------
|
------------------------
|
|
|
To run the verilog simulation, compile all project files under rtl/verilog along with
|
To run the verilog simulation, compile all project files under rtl/verilog along with
|
top level testbench file:
|
top level testbench file:
|
|
|
- tbench/verilog/tb_xge_mac.v
|
- tbench/verilog/tb_xge_mac.v
|
|
|
There is a Modelsim "do" file called "sim.do" under sim/verilog for those using Modelsim.
|
There is a Modelsim "do" file called "sim.do" under sim/verilog for those using Modelsim.
|
Once all the files are compiled, start simulation using entity "tb".
|
Once all the files are compiled, start simulation using entity "tb".
|
|
|
|
|
The verilog simulation reads packets from "packet_tx.txt" and writes them to the MAC
|
The verilog simulation reads packets from "packet_tx.txt" and writes them to the MAC
|
transmit fifo using the packet transmit interface (pkt_tx_data). As frames become
|
transmit fifo using the packet transmit interface (pkt_tx_data). As frames become
|
available in the transmit fifo, the MAC calulates the CRC and sends them out on xgmii_tx.
|
available in the transmit fifo, the MAC calulates the CRC and sends them out on xgmii_tx.
|
The xgmii_tx interface is looped-back to xgmii_rx in the testbench. The frames are thus
|
The xgmii_tx interface is looped-back to xgmii_rx in the testbench. The frames are thus
|
processed by the MAC receive engine and stored in the receive fifo. The testbench reads
|
processed by the MAC receive engine and stored in the receive fifo. The testbench reads
|
frames from the receive interface (pkt_rx_data) and prints out the results.
|
frames from the receive interface (pkt_rx_data) and prints out the results.
|
|
|
|
|
Simulation output:
|
Simulation output:
|
|
|
------------------------
|
------------------------
|
Received Packet
|
Received Packet
|
------------------------
|
------------------------
|
0000010000010010
|
0000010000010010
|
9400000288b50001
|
9400000288b50001
|
0203040506070809
|
0203040506070809
|
0a0b0c0d0e0f1011
|
0a0b0c0d0e0f1011
|
1213141516171819
|
1213141516171819
|
1a1b1c1d1e1f2021
|
1a1b1c1d1e1f2021
|
2223242526272829
|
2223242526272829
|
2a2b2c2d2e2f3031
|
2a2b2c2d2e2f3031
|
3233343506b33d40
|
3233343506b33d40
|
------------------------
|
------------------------
|
All packets received. Sumulation done!!!
|
All packets received. Sumulation done!!!
|
|
|
|
|
------------------------
|
------------------------
|
2.2 SystemC Simulation
|
2.2 SystemC Simulation
|
------------------------
|
------------------------
|
|
|
In order to use the SystemC environment it is required to first install SystemC from
|
In order to use the SystemC environment it is required to first install SystemC from
|
www.systemc.org. Free membership may be required to download the core SystemC files.
|
www.systemc.org. Free membership may be required to download the core SystemC files.
|
|
|
The testbench was developed and tested with Verilator, a free HDL simulator that
|
The testbench was developed and tested with Verilator, a free HDL simulator that
|
compiles verilog into C++ or SystemC code. You can download Verilator from
|
compiles verilog into C++ or SystemC code. You can download Verilator from
|
www.veripool.org. You also need to install SystemPerl and Verilog-Perl for waveform
|
www.veripool.org. You also need to install SystemPerl and Verilog-Perl for waveform
|
traces.
|
traces.
|
|
|
|
Add the following exports to your .bashrc file, adjust based on your version:
|
|
|
|
export SYSTEMC=/opt/systemc-2.3.1a
|
|
export SYSTEMC_INCLUDE=/opt/systemc-2.3.1a/include # with systemc.h
|
|
export SYSTEMC_LIBDIR=/opt/systemc-2.3.1a/lib # with libsystemc.a
|
|
export VERILATOR_ROOT=/opt/verilator-3.900
|
|
export SYSTEMPERL=/opt/SystemPerl-1.344
|
|
export LD_LIBRARY_PATH=/opt/systemc-2.3.1a/lib-linux64
|
|
|
Once all the required tools are installed:
|
Once all the required tools are installed:
|
|
|
- Move to directory sim/systemc
|
- Move to directory sim/systemc
|
|
|
- Type "./compile.sh"
|
- Type "./compile.sh"
|
|
|
- Type "./run.sh"
|
- Type "./run.sh"
|
|
|
|
|
If the simulation is running correctly you should see messages from the scoreboard
|
If the simulation is running correctly you should see messages from the scoreboard
|
as packets are transmited and received on the various interfaces.
|
as packets are transmited and received on the various interfaces.
|
|
|
Simulation output:
|
Simulation output:
|
|
|
-----------------------
|
-----------------------
|
Packet size
|
Packet size
|
-----------------------
|
-----------------------
|
SCOREBOARD XGMII INTERFACE TX (60)
|
SCOREBOARD XGMII INTERFACE TX (60)
|
SCOREBOARD XGMII INTERFACE TX (60)
|
SCOREBOARD XGMII INTERFACE TX (60)
|
SCOREBOARD PACKET INTERFACE TX (50)
|
SCOREBOARD PACKET INTERFACE TX (50)
|
SCOREBOARD XGMII INTERFACE TX (60)
|
SCOREBOARD XGMII INTERFACE TX (60)
|
SCOREBOARD PACKET INTERFACE TX (51)
|
SCOREBOARD PACKET INTERFACE TX (51)
|
SCOREBOARD XGMII INTERFACE TX (60)
|
SCOREBOARD XGMII INTERFACE TX (60)
|
SCOREBOARD PACKET INTERFACE RX (TX SIZE=60 RX SIZE=60)
|
SCOREBOARD PACKET INTERFACE RX (TX SIZE=60 RX SIZE=60)
|
...
|
...
|
|
|