一、Corundum簡介
GitHub repository: https://github.com/corundum/corundum
GitHub wiki: https://github.com/corundum/corundum/wiki
Corundum是一個基于FPGA的開源原型平臺,用于高達100Gbps及更高的網絡接口開發。Corundum平臺包括一些用于實現實時,高線速操作的核心功能,包括:高性能數據路徑,10G/ 25G / 100G以太網MAC,PCIExpress第3代,自定義PCIeDMA引擎以及本機高精確的IEEE 1588 PTP時間戳。一個關鍵功能是可擴展隊列管理,它可以支持超過10,000個隊列以及可擴展的傳輸調度程序,從而可以對包傳輸進行細粒度的硬件控制。結合多個網絡接口,每個接口多個端口以及每個端口事件驅動的傳輸調度,這些功能可實現高級網絡接口,體系結構和協議的開發。這些硬件功能的軟件接口是Linux網絡協議棧的高性能驅動程序。該平臺還支持分散/聚集DMA,校驗和卸載,接收流散列和接收端縮放。一個全面的,基于Python的開放源代碼仿真框架促進了開發和調試,該框架包括整個系統,從驅動程序和PCIExpress接口的仿真模型到以太網接口。通過實現微秒級時分多址(TDMA)硬件調度程序,以100Gbps的線速執行TDMA調度,而沒有CPU開銷,證明了Corundum的強大功能和靈活性。
二、環境準備
2.1:Linux系統
本機為win10專業版,由于環境需要
在VMware虛擬機安裝Ubuntu 20.04 LTS系統供日常學習測試使用
安裝python庫
使用tox嘗試仿真
安裝雙系統Ubuntu 20.04 LTS
在Ubuntu系統上安裝vivado 2019.2
注意vivado 2019.2的license,基本組件的license會編譯出錯,需要添加IP license。
2.2:Obtaining the source code
直接從git地址下載zip壓縮包使用;
$ git clone https://github.com/corundum/corundum.git
2.3:FPGA仿真環境搭建
2.3.1 system packages
Python3.9;當前ubuntu 20.04自帶python3版本為python3.8,需要下載python3.9并配置系統python3為python3.9。其中遇到很多問題需要百度自行解決。。。
$ sudo apt-get install python3.9
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
$ sudo update-alternatives --config python3
There are 2 choices for the alternative python3 (providing /usr/bin/python3).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.8 2 auto mode
1 /usr/bin/python3.8 2 manual mode
2 /usr/bin/python3.9 1 manual mode
Press to keep the current choice[*], or type selection number: 2
測試python版本:
$ python3 -V
Python 3.9
安裝/升級pip
$ sudo apt-get install python3-pip
$ sudo pip3 install --upgrade pip
安裝python-dev
$ sudo apt install python3-dev
安裝Icarus Verilog
$ sudo apt-get install iverilog
安裝GTKWave
$ sudo apt-get install gtkwave
2.3.2 required python packages
cocotb
cocotb-bus
cocotb-test
cocotbext-axi
cocotbext-eth
cocotbext-pcie
pytest
scapy
Recommended additional python packages:
tox (to run pytest inside a python virtual environment)
pytest-xdist (to run tests in parallel with pytest -n auto)
pytest-sugar (makes pytest output a bit nicer)
$ pip3 install cocotb
$ pip3 install cocotb-bus
$ pip3 install cocotb-test
$ pip3 install cocotbext-axi
$ pip3 install cocotbext-eth
$ pip3 install cocotbext-pcie
$ pip3 install pytest
$ pip3 install scapy
$ pip3 install tox
$ pip3 install pytest-xdist
$ pip3 install pytest-sugar
注意:安裝完package可能會報warning提示package不在PATH內
此時需要將package添加到系統PATH中
$ sudo gedit ~/.bashrc
在bashrc中添加
export PAT
然后在終端source
$ sudo source ~/.bashrc
2.4 安裝雙系統Ubuntu 20.04
在win10下的機械盤上分了一塊200G大小的空間用于安裝新系統,事實證明200G有點小。
安裝過程見:
https://www.jianshu.com/p/54d9a3a695cc
https://zhuanlan.zhihu.com/p/135953477
https://www.zhihu.com/question/34611974
注意分區時:/boot在UEFI上是非必要的,系統直接安在efi上即可。
將分區/:的空間設置足夠大,這是總目錄,以后安裝的軟件默認在此目錄下,vivado2019占用90多G,因此此塊空間或者/home的空間要足夠大。
安裝完系統配置環境,同時安裝vivado2019.2,裝在/opt/xilinx下即可。
三、Running test
單核的PC不建議(太慢了),建議上服務器跑。
確保Linux下所需要的package都安裝完畢。
在corundum根目錄下運行仿真。
$ cd /path/to/corundum-master
$ tox
py39 installed: apipkg==1.5,attrs==21.2.0,cocotb==1.5.2,cocotb-bus==0.1.1,cocotb-test==0.2.0,cocotbext-axi==0.1.12,cocotbext-eth==0.1.14,cocotbext-pcie==0.1.10,execnet==1.8.0,iniconfig==1.1.1,packaging==20.9,pluggy==0.13.1,py==1.10.0,pyparsing==2.4.7,pytest==6.2.4,pytest-forked==1.3.0,pytest-split==0.1.5,pytest-xdist==2.2.1,scapy==2.4.5,toml==0.10.2
py39 run-test-pre: PYTHONHASHSEED='438068548'
py39 run-test: commands[0] | pytest -n auto
============================= test session starts ==============================
platform linux -- Python 3.9.2, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
cachedir: .tox/py39/.pytest_cache
rootdir: /path/to/corundum, configfile: tox.ini, testpaths: fpga/common/tb, fpga/mqnic, fpga/mqnic_tdma
plugins: xdist-2.2.1, forked-1.3.0, cocotb-test-0.2.0, split-0.1.5
gw0 [38] / gw1 [38] / gw2 [38] / gw3 [38] / gw4 [38] / gw5 [38] / gw6 [38] / gw7 [38] / gw8 [38] / gw9 [38] / gw10 [38] / gw11 [38] / gw12 [38] / gw13 [38] / gw14 [38] / gw15 [38] / gw16 [38] / gw17 [38] / gw18 [38] / gw19 [38] / gw20 [38] / gw21 [38] / gw22 [38] / gw23 [38] / gw24 [38] / gw25 [38] / gw26 [38] / gw27 [38] / gw28 [38] / gw29 [38] / gw30 [38] / gw31 [38] / gw32 [38] / gw33 [38] / gw34 [38] / gw35 [38] / gw36 [38] / gw37 [38] / gw38 [38] / gw39 [38] / gw40 [38] / gw41 [38] / gw42 [38] / gw43 [38] / gw44 [38] / gw45 [38] / gw46 [38] / gw47 [38] / gw48 [38] / gw49 [38] / gw50 [38] / gw51 [38] / gw52 [38] / gw53 [38] / gw54 [38] / gw55 [38] / gw56 [38] / gw57 [38] / gw58 [38] / gw59 [38] / gw60 [38] gw0 [38] / gw1 [38] / gw2 [38] / gw3 [38] / gw4 [38] / gw5 [38] / gw6 [38] / gw7 [38] / gw8 [38] / gw9 [38] / gw10 [38] / gw11 [38] / gw12 [38] / gw13 [38] / gw14 [38] / gw15 [38] / gw16 [38] / gw17 [38] / gw18 [38] / gw19 [38] / gw20 [38] / gw21 [38] / gw22 [38] / gw23 [38] / gw24 [38] / gw25 [38] / gw26 [38] / gw27 [38] / gw28 [38] / gw29 [38] / gw30 [38] / gw31 [38] / gw32 [38] / gw33 [38] / gw34 [38] / gw35 [38] / gw36 [38] / gw37 [38] / gw38 [38] / gw39 [38] / gw40 [38] / gw41 [38] / gw42 [38] / gw43 [38] / gw44 [38] / gw45 [38] / gw46 [38] / gw47 [38] / gw48 [38] / gw49 [38] / gw50 [38] / gw51 [38] / gw52 [38] / gw53 [38] / gw54 [38] / gw55 [38] / gw56 [38] / gw57 [38] / gw58 [38] / gw59 [38] / gw60 [38] / gw61 [38] / gw62 [38] / gw63 [38]
...................................... [100%]
======================== 38 passed in 792.90s (0:13:12) ========================
___________________________________ summary ____________________________________
py39: commands succeeded
congratulations :)
我在虛擬機里面跑的大概時間37分鐘。。。
$ cd /path/to/corundum-master
$ pytest -n auto (多核)
$ pytest (單核)
$ cd /path/to/corundum/
$ pytest -n auto
Test session starts (platform: linux, Python 3.9.2, pytest 6.2.2, pytest-sugar 0.9.4)
rootdir: /path/to/corundum, configfile: tox.ini, testpaths: fpga/common/tb, fpga/mqnic, fpga/mqnic_tdma
plugins: parallel-0.1.0, cocotb-test-0.2.0, split-0.1.6.dev1+g97d96c2, sugar-0.9.4, xdist-2.2.1, forked-1.3.0, metadata-1.11.0, html-3.1.1, flake8-1.0.7, cov-2.11.1
gw0 [38] / gw1 [38] / gw2 [38] / gw3 [38] / gw4 [38] / gw5 [38] / gw6 [38] / gw7 [38] / gw8 [38] / gw9 [38] / gw10 [38] / gw11 [38] / gw12 [38] / gw13 [38] / gw14 [38] / gw15 [38] / gw16 [38] / gw17 [38] / gw18 [38] / gw19 [38] / gw20 [38] / gw21 [38] / gw22 [38] / gw23 [38] / gw24 [38] / gw25 [38] / gw26 [38] / gw27 [38] / gw28 [38] / gw29 [38] / gw30 [38] / gw31 [38] / gw32 [38] / gw33 [38] / gw34 [38] / gw35 [38] / gw36 [38] / gw37 [38] / gw38 [38] / gw39 [38] / gw40 [38] / gw41 [38] / gw42 [38] / gw43 [38] / gw44 [38] / gw45 [38] / gw46 [38] / gw47 [38] / gw48 [38] / gw49 [38] / gw50 [38] / gw51 [38] / gw52 [38] / gw53 [38] / gw54 [38] / gw55 [38] / gw56 [38] / gw57 [38] / gw58 [38] / gw59 [38] / gw60 [38] gw0 [38] / gw1 [38] / gw2 [38] / gw3 [38] / gw4 [38] / gw5 [38] / gw6 [38] / gw7 [38] / gw8 [38] / gw9 [38] / gw10 [38] / gw11 [38] / gw12 [38] / gw13 [38] / gw14 [38] / gw15 [38] / gw16 [38] / gw17 [38] / gw18 [38] / gw19 [38] / gw20 [38] / gw21 [38] / gw22 [38] / gw23 [38] / gw24 [38] / gw25 [38] / gw26 [38] / gw27 [38] / gw28 [38] / gw29 [38] / gw30 [38] / gw31 [38] / gw32 [38] / gw33 [38] / gw34 [38] / gw35 [38] / gw36 [38] / gw37 [38] / gw38 [38] / gw39 [38] / gw40 [38] / gw41 [38] / gw42 [38] / gw43 [38] / gw44 [38] / gw45 [38] / gw46 [38] / gw47 [38] / gw48 [38] / gw49 [38] / gw50 [38] / gw51 [38] / gw52 [38] / gw53 [38] / gw54 [38] / gw55 [38] / gw56 [38] / gw57 [38] / gw58 [38] / gw59 [38] / gw60 [38] / gw61 [38] / gw62 [38] / gw63 [38]
fpga/common/tb/tdma_scheduler/test_tdma_scheduler.py ? 3% ▍
fpga/common/tb/tdma_ber/test_tdma_ber.py ? 5% ▌
fpga/common/tb/queue_manager/test_queue_manager.py ? 8% ▊
fpga/common/tb/cpl_queue_manager/test_cpl_queue_manager.py ? 11% █▏
fpga/common/tb/rx_checksum/test_rx_checksum.py ?? 18% █▉
fpga/common/tb/rx_hash/test_rx_hash.py ?? 24% ██▍
fpga/common/tb/tdma_ber_ch/test_tdma_ber_ch.py ? 21% ██▏
fpga/common/tb/tx_checksum/test_tx_checksum.py ?? 29% ██▉
fpga/mqnic/VCU108/fpga_10g/tb/fpga_core/test_fpga_core.py ? 32% ███▎
fpga/mqnic/ExaNIC_X10/fpga/tb/fpga_core/test_fpga_core.py ? 34% ███▌
fpga/mqnic/AU50/fpga_100g/tb/fpga_core/test_fpga_core.py ? 37% ███▊
######## SNIP ########
fpga/mqnic/fb2CG/fpga_25g/tb/fpga_core/test_fpga_core.py ? 92% █████████▎
...ic/ADM_PCIE_9V3/fpga_25g/tb/fpga_core/test_fpga_core.py ? 95% █████████▌
...nic_tdma/VCU118/fpga_10g/tb/fpga_core/test_fpga_core.py ? 97% █████████▊
...ma/ADM_PCIE_9V3/fpga_10g/tb/fpga_core/test_fpga_core.py ? 100% ██████████
Results (797.62s):
38 passed
電腦還在跑。。。
審核編輯:郭婷
-
FPGA
+關注
關注
1626文章
21665瀏覽量
601828 -
接口
+關注
關注
33文章
8497瀏覽量
150834 -
python
+關注
關注
56文章
4782瀏覽量
84452
發布評論請先 登錄
相關推薦
評論