【教程】f4pga-examples 配置及操作手册
参考文档
https://f4pga-examples.readthedocs.io/en/latest/getting.html
环境准备
系统环境
这里以Ubuntu 20.04 为例
- 将当前包更新到最新版本
apt update -y
- 安装git
- 如果已有git环境请跳过此步
apt install -y git wget xz-utils
- 下载源码
- Git安装成功后,克隆F4PGA example仓库到本地
# ~/Source/
# 官方仓库
git clone https://github.com/chipsalliance/f4pga-examples
miniconda下载及路径配置
这段内容中的路径不必与我完全一致,但为了后续使用不出歧义,建议一致。
路径配置
# 配置f4pga安装路径
export F4PGA_INSTALL_DIR=~/Source/f4pga
# 配置FPGA芯片所属系列
export FPGA_FAM=xc7
下载
- 下载包管理工具miniconda
mkdir $F4PGA_INSTALL_DIR
cd $F4PGA_INSTALL_DIR
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O conda_installer.sh
安装
# -b:无交互直接解压到安装路径
# -p:指定安装路径,默认为/root/miniconda3
# -u:覆盖并更新现有安装
bash conda_installer.sh -u -b -p $F4PGA_INSTALL_DIR/$FPGA_FAM/conda
source "$F4PGA_INSTALL_DIR/$FPGA_FAM/conda/etc/profile.d/conda.sh"
创建虚拟环境
- 根据 $FPGA_FAM/environment.yml 环境描述文件,创建虚拟环境,名为 xc7
# f4pga-examples/xc7
conda env create -f environment.yml
导入依赖
下载
mkdir -p $F4PGA_INSTALL_DIR/$FPGA_FAM
cd $F4PGA_INSTALL_DIR/$FPGA_FAM
wget https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/20220920-124259/symbiflow-arch-defs-install-xc7-007d1c1.tar.xz
wget https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/20220920-124259/symbiflow-arch-defs-xc7a50t_test-007d1c1.tar.xz
wget https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/20220920-124259/symbiflow-arch-defs-xc7a100t_test-007d1c1.tar.xz
解压
# ~/Source/f4pga/xc7
xz -d symbiflow-arch-defs-install-xc7-007d1c1.tar.xz
tar -xvf symbiflow-arch-defs-install-xc7-007d1c1.tar
xz -d symbiflow-arch-defs-xc7a50t_test-007d1c1.tar.xz
tar -xvf symbiflow-arch-defs-xc7a50t_test-007d1c1.tar
xz -d symbiflow-arch-defs-xc7a100t_test-007d1c1.tar.xz
tar -xvf symbiflow-arch-defs-xc7a100t_test-007d1c1.tar
执行
定义环境变量
# 路径与安装时路径匹配
export F4PGA_INSTALL_DIR=~/Source/f4pga
export FPGA_FAM=xc7
export F4PGA_SHARE_DIR="$F4PGA_INSTALL_DIR/xc7/share/f4pga"
source "$F4PGA_INSTALL_DIR/$FPGA_FAM/conda/etc/profile.d/conda.sh"
激活虚拟环境
conda activate $FPGA_FAM
编译,生成bit流
# f4pga-example/xc7/
TARGET="arty_35" make -C counter_test