enjoy-digital / litex

Build your hardware, easily!
Other
2.99k stars 565 forks source link

RFC: Split LiteX CPU cores into their own Python modules #394

Closed mithro closed 4 years ago

mithro commented 4 years ago

With the increasing number of CPU cores supported by LiteX, cloning the LiteX repository means cloning a large number of submodules which can get very big.

I think we should convert each of the supported LiteX CPUs into their own Python packages.

litex/soc/cores/cpu becomes a "namespace module" which other Python packages can provide modules under. See https://packaging.python.org/guides/packaging-namespace-packages/

The CPUs can be split into;

This allows projects which are only using a single CPU like VexRISCV to only pay the cost of that CPU.

The setup process then becomes;

git clone git+ssh://github.com/enjoy-digital/litex.git
(cd litex; python setup.py install)
git clone git+ssh://github.com/enjoy-digital/litex-cpu-vexriscv.git
(cd litex-cpu-vexriscv; python setup.py install)

People can also submodule the repository in using the normal method of;

git submodule add third_party/litex git+ssh://github.com/enjoy-digital/litex.git
(cd third_party/litex; python setup.py -e install)
git submodule add third_party/litex-cpu-vexriscv git+ssh://github.com/enjoy-digital/litex-cpu-vexriscv.git
(cd third_party/litex-cpu-vexriscv; python setup.py -e install)

Or specify a Python requirements file using;

-e https://github.com/enjoy-digital/litex.git#egg=litex
-e https://github.com/enjoy-digital/litex-cpu-vexriscv.git#egg=litex-cpu-vexriscv

We can easily set up Travis CI so that any push to the LiteX repository causes each of the CPU packages to be tested in combination with the based LiteX.

As VexRISCV is currently the most popular CPU to use with LiteX, we could also make VexRISCV the "default" CPU that is included with LiteX by default and just move the other CPU cores into their own modules. I personally don't think we should preference VexRISCV like that, but it could be a possible compromise?

Thoughts?

enjoy-digital commented 4 years ago

https://github.com/enjoy-digital/litex/pull/399 has been merged and a first 2020.04 release has been created for this breaking change with https://github.com/enjoy-digital/litex/commit/56aa7897df99d7ad68ea537ab096c3abdc683666. There is a note in the README and Wiki for existing users explaining LiteX will have to be reinstalled. Thanks all for the discussions, ideas and work, i think we managed to find a good compromise.