m-labs / nmigen

A refreshed Python toolbox for building complex digital hardware. See https://gitlab.com/nmigen/nmigen
https://nmigen.org
Other
646 stars 55 forks source link

Add initial support for Symbiflow toolchain for Xilinx 7-series #334

Open mglb opened 3 years ago

mglb commented 3 years ago

The PR adds initial support for Symbiflow for XC7 devices. To use Symbiflow instead of Vivado, a platform should inherit Xilinx7SeriesSymbiflowPlatform instead of Xilinx7SeriesPlatform. The example used below is a copy of arty_a7.py from nmigen-boards, where in addition to changing the base class, the device (part) name has also been changed (original part is not present in prjxray/symbiflow database).

Test:

wget 'https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh' -O miniconda.sh
bash miniconda.sh -b -p ./miniconda
source ./miniconda/etc/profile.d/conda.sh
hash -r

conda config --set always_yes yes --set changeps1 no
conda config --add channels conda-forge
conda config --add channels symbiflow
conda update -q conda
conda activate
conda install -c symbiflow yosys yosys-plugins vtr prjxray-tools
conda install lxml simplejson intervaltree python-constraint git pip
pip install git+https://github.com/symbiflow/fasm

git clone https://github.com/SymbiFlow/prjxray.git
git clone https://github.com/SymbiFlow/prjxray-db.git

cd ./prjxray
python setup.py install
cd ..

wget 'https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/presubmit/install/385/20200702-165441/symbiflow-arch-defs-install-3f58546e.tar.xz'
tar -xf symbiflow-arch-defs-install-3f58546e.tar.xz

export PATH=$(realpath ./install/bin/):$PATH
export XRAY_DATABASE_DIR=$(realpath ./prjxray-db)
export XRAY_FASM2FRAMES=$(realpath ./prjxray/utils/fasm2frames.py)
export XRAY_TOOLS_DIR=$(realpath ./miniconda/bin)

# Get PR code
git clone https://github.com/antmicro/nmigen.git -b mglb/initial-symbiflow-support
cd nmigen
python setup.py develop
cd ..

# The example uses nmigen-boards
pip install git+https://github.com/m-labs/nmigen-boards.git

# Download and run example target for Arty A7
wget 'https://raw.githubusercontent.com/antmicro/nmigen/mglb/initial-symbiflow-support-example/examples/symbiflow/arty_a7_symbiflow.py'
python arty_a7_symbiflow.py