Skip to content

Latest commit

 

History

History
95 lines (75 loc) · 2.58 KB

README.md

File metadata and controls

95 lines (75 loc) · 2.58 KB

svMII2tap

svMII2tap is a virtual network device for Systemverilog testbench for FPGA-based network devices such as NIC and Switch/Routers.

	+------------------------------+  
	|                              |  
	| ping, wireshark, httpd, etc  |  
	|        +------------+        |  
	+--------|   Socket   |--------+  
	         +----|--^----+             
	              |  |
	         +----V--|----+
	+--------|   Socket   |--------+  
	|        +------------+        |  
	|                              |  
	|          TAP device          |
	|                              |  
	|        +------------+        |  
	+--------| Named PIPE |--------+  
	         +----|--^----+          
	              |  |
	        stdin |  | stdout
	              |  |
	         +----V--|----+          
	+--------|   DPI-C    |--------+
	|        +------------+        |
	|                              |
	|    Systemverilog testbench   |
	|                              |
	|        +------------+        |
	|    +---|Ethernet MII|---+    |
	|    |   +------------+   |    |
	|    |        DUT         |    |
	|    +--------------------+    |
	+------------------------------+

Features

QuickStart

Data flow

# wall-clock time----->> simulated time--------------------------->> wall-clock time--------------->>
Linux -> tapdev(phy0) -> testbench -> dut/loopback.v -> testbench -> tapdev(phy0) -> Linux -> tcpdump

Install

$ git clone https://github.com/sora/svmii2tap
$ cd svmii2tap
$ make
$ sudo ./tapdev phy0 &
$ sudo ifconfig phy0 inet 10.0.0.100 netmask 255.255.255.0 up
$ sudo tcpdump -i phy0 -w phy0.pcap &
$ make sim
$ gtkwave wave.vcd

wave.vcd

gtkwave.png

phy0.pcap

tcpdump.png

Requirements

  • Linux
    • TUN/TAP
    • Named PIPE
  • Modelsim ASE (DPI-C)
  • GTKWave

Todo

  • XGMII (10G)
  • Multiple ports
  • Ethernet FCS check

License

MIT