Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libresoc: centralize existing packages, fix bitrot, and enable all test suites #168

Merged
merged 50 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
7f8b64f
wip
L-as Sep 11, 2021
1f4572f
Python dependencies
L-as Sep 11, 2021
e0a94f7
Package dependencies successfully
L-as Sep 11, 2021
5edfa93
Get build starting
L-as Sep 11, 2021
6ad2fff
Fix openpower-isa
L-as Sep 12, 2021
43ec1f1
Package c4m-jtag
L-as Sep 12, 2021
d931d72
Fix c4m-jtag
L-as Sep 12, 2021
a0541c7
Get pinmux working
L-as Sep 13, 2021
2eb6beb
Fix nmigen dependencies
L-as Sep 13, 2021
1450caf
WIP
L-as Sep 15, 2021
256ce82
Include Litex dependency
L-as Sep 15, 2021
5f2c46b
wip
L-as Sep 16, 2021
0960d56
Split up into several derivations
L-as Sep 16, 2021
9aa4f0f
Litex work
L-as Sep 18, 2021
06958b3
Litex work
L-as Sep 19, 2021
620162c
Add ppc64le cross compiler
L-as Sep 19, 2021
5f40418
Use LiteX from 2020-08-22
L-as Sep 19, 2021
2f47270
Attempt to build for versa ecp5
L-as Sep 24, 2021
1dd312e
Fix building for a Versa ECP5
L-as Sep 25, 2021
29a43dd
Add script for loading Libre-SOC onto Versa ECP5 board!
L-as Sep 26, 2021
0ebaf6f
ecp5-program: Delete garbage
L-as Oct 5, 2021
6eada29
flake.nix: Clean up
L-as Oct 6, 2021
015581a
libresoc: move used derivations to pkgs/libresoc and delete unused de…
albertchae Apr 26, 2024
a82f708
libresoc: nmigen fixup
jleightcap May 10, 2024
88107e1
libresoc: nmigen-soc init
jleightcap Apr 11, 2024
666f837
libresoc: c4m-jtag init
jleightcap Apr 30, 2024
8e2e15f
libresoc: pinmux init
jleightcap Apr 30, 2024
a56a180
libresoc: power-instruction-analyzer init
jleightcap Apr 30, 2024
734b2c6
libresoc: pytest-output-to-files init
jleightcap Apr 30, 2024
f1eb49e
libresoc: nmutil init
jleightcap Apr 11, 2024
ab50a02
libresoc: ieee754fpu init
jleightcap Apr 11, 2024
a010382
libresoc: sfyp init
jleightcap May 10, 2024
77bbb1d
libresoc: bigfloat init
jleightcap May 10, 2024
80b92dc
libresoc: ieee754fpu enable test suite
jleightcap May 10, 2024
13d22ea
libresoc: openpower-isa inclue missing __init__.py
jleightcap Apr 11, 2024
672e227
libresoc: openpower-isa powerpc64le toolchain
jleightcap Apr 11, 2024
696df4c
libresoc: openpower-isa fix @git dependencies
jleightcap Apr 11, 2024
fd64645
libresoc: openpower-isa fix empty directory hack
jleightcap Apr 11, 2024
1e6d8dd
libresoc: openpower-isa include linker scripts
jleightcap Apr 11, 2024
d5ef764
libresoc: openpower-isa building
jleightcap Apr 11, 2024
3219a64
libresoc: openpower-isa enable test suite
jleightcap Apr 30, 2024
b815760
libresoc: openpower-isa abstract python definitions
jleightcap May 11, 2024
34492bf
libresoc: soc init
jleightcap Apr 30, 2024
64ec453
libresoc: soc enable test suite
jleightcap Apr 30, 2024
19c4d5c
libresoc: verilog init
jleightcap Apr 30, 2024
65604e5
libresoc: expose package.nix
jleightcap Apr 30, 2024
2de0a32
libresoc: use GitHub mirrors instead for reliability
albertchae Apr 29, 2024
d9f7c4d
libresoc: split nmigen and verilog export packages
jleightcap May 13, 2024
be94acf
libresoc: add aligned with nlnet
jleightcap May 13, 2024
81bd319
libresoc: structure to match nlnet funding schema
jleightcap May 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions pkgs/by-name/libresoc-nmigen/bigfloat.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
lib,
python39Packages,
fetchPypi,
mpfr,
}:
python39Packages.buildPythonPackage rec {
pname = "bigfloat";
version = "0.4.0";

src = fetchPypi {
inherit pname version;
hash = "sha256-WLlr3ocqylmJ0T2C66Os8qoblOIhF91yoWulkRsMDLg=";
};

propagatedBuildInputs = [mpfr] ++ (with python39Packages; [six]);

meta = {
description = "Arbitrary-precision correctly-rounded floating-point arithmetic, via MPFR.";
homepage = "http://github.com/mdickinson/bigfloat";
license = lib.licenses.lgpl3;
};
}
84 changes: 84 additions & 0 deletions pkgs/by-name/libresoc-nmigen/ieee754fpu.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
lib,
python39Packages,
fetchFromLibresoc,
bigfloat,
sfpy,
symbiyosys,
nmutil,
nmigen,
pytest-output-to-files,
}:
python39Packages.buildPythonPackage rec {
pname = "ieee754fpu";
version = "unstable-2024-03-31";

src = fetchFromLibresoc {
inherit pname;
hash = "sha256-Ghbvg2Y4YlmxVEa3EtcvEVai4hC4VU4q+XIQh4pQ7+c=";
rev = "829dfbc53ba38ec17bc544cb0b862e73cee223db"; # HEAD @ version date
};

prePatch = ''
touch ./src/ieee754/part{,_ass,_cat,_repl}/__init__.py
'';

propagatedBuildInputs = [nmutil];

nativeCheckInputs =
[pytest-output-to-files nmigen symbiyosys sfpy bigfloat]
++ (with python39Packages; [pytestCheckHook pytest-xdist]);

disabledTests = [
"test_fadd_f16_rna_formal"
"test_fadd_f16_rne_formal"
"test_fadd_f16_rtn_formal"
"test_fadd_f16_rton_formal"
"test_fadd_f16_rtop_formal"
"test_fadd_f16_rtp_formal"
"test_fadd_f16_rtz_formal"
"test_fmadd_f8_rna_formal"
"test_fmadd_f8_rne_formal"
"test_fmadd_f8_rtn_formal"
"test_fmadd_f8_rton_formal"
"test_fmadd_f8_rtop_formal"
"test_fmadd_f8_rtp_formal"
"test_fmadd_f8_rtz_formal"
"test_fmsub_f8_rna_formal"
"test_fmsub_f8_rne_formal"
"test_fmsub_f8_rtn_formal"
"test_fmsub_f8_rton_formal"
"test_fmsub_f8_rtop_formal"
"test_fmsub_f8_rtp_formal"
"test_fmsub_f8_rtz_formal"
"test_fnmadd_f8_rna_formal"
"test_fnmadd_f8_rne_formal"
"test_fnmadd_f8_rtn_formal"
"test_fnmadd_f8_rton_formal"
"test_fnmadd_f8_rtop_formal"
"test_fnmadd_f8_rtp_formal"
"test_fnmadd_f8_rtz_formal"
"test_fnmsub_f8_rna_formal"
"test_fnmsub_f8_rne_formal"
"test_fnmsub_f8_rtn_formal"
"test_fnmsub_f8_rton_formal"
"test_fnmsub_f8_rtop_formal"
"test_fnmsub_f8_rtp_formal"
"test_fnmsub_f8_rtz_formal"
"test_fsub_f16_rna_formal"
"test_fsub_f16_rne_formal"
"test_fsub_f16_rtn_formal"
"test_fsub_f16_rton_formal"
"test_fsub_f16_rtop_formal"
"test_fsub_f16_rtp_formal"
"test_fsub_f16_rtz_formal"
];

pythonImportsCheck = ["ieee754.part"];

meta = {
description = "A nmigen (HDL) IEEE754 Floating-Point library";
homepage = "https://git.libre-soc.org/?p=ieee754fpu.git;a=summary";
license = lib.licenses.gpl3Plus;
};
}
15 changes: 15 additions & 0 deletions pkgs/by-name/libresoc-nmigen/lib.nix
lorenzleutgeb marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{fetchgit}: {
# given recent poor availability of upstream https://git.libre-soc.org/,
# define a dedicated fetcher for current mirror source
# (currently github.com/Libre-SOC-mirrors, cc @jleightcap @albertchae)
fetchFromLibresoc = {
pname,
hash,
rev,
fetchSubmodules ? true,
}:
fetchgit {
jleightcap marked this conversation as resolved.
Show resolved Hide resolved
url = "https://github.com/Libre-SOC-mirrors/${pname}.git";
inherit rev hash fetchSubmodules;
};
}
36 changes: 36 additions & 0 deletions pkgs/by-name/libresoc-nmigen/libresoc-c4m-jtag.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
lib,
fetchFromLibresoc,
python39,
python39Packages,
nmigen-soc,
nmigen,
}:
python39Packages.buildPythonPackage rec {
pname = "c4m-jtag";
version = "unstable-2024-03-31";
realVersion = "0.3.dev243+g${lib.substring 0 7 src.rev}";

src = fetchFromLibresoc {
inherit pname;
rev = "f5322d804e8228a2a5715c77185c60148ff96da8"; # HEAD @ version date
hash = "sha256-0yF/yqcknCq1fre5pnKux4V7guu2oDa6duPO9mU46n8=3";
};

prePatch = ''
export SETUPTOOLS_SCM_PRETEND_VERSION="${realVersion}"
'';

nativeBuildInputs = with python39Packages; [setuptools-scm];
propagatedBuildInputs = [nmigen-soc];

nativeCheckInputs = with python39Packages; [nose];
checkPhase = "nosetests";

pythonImportsCheck = ["c4m.nmigen.jtag.tap"];

meta = {
description = "Chip4Makers nmigen JTAG implementation";
homepage = "https://git.libre-soc.org/?p=c4m-jtag.git;a=summary";
};
}
26 changes: 26 additions & 0 deletions pkgs/by-name/libresoc-nmigen/libresoc-pyelftools.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
lib,
python39Packages,
fetchFromGitHub,
}:
python39Packages.pyelftools.overrideAttrs (_: rec {
name = "pyelftools";
version = "unstable-2024-03-31";

# upstream Libre-SOC uses a mirror,
# and while this would be best handled as github.com/Libre-SOC-mirrors copy,
# an included GitHub workflow interferes with the automated mirror.
# instead,
src = fetchFromGitHub {
owner = "eliben";
repo = name;
rev = "8b97f5da6838791fd5c6b47b1623fb414daed2f0";
hash = "sha256-E+grMrl0NJMl+yUzRyzTVIb/MjMOUOgq6YynGJhnMZg=";
};

meta = {
description = "Library for analyzing ELF files and DWARF debugging information";
homepage = "https://git.libre-soc.org/?p=pyelftools.git;a=summary";
license = lib.licenses.unlicense;
};
})
20 changes: 20 additions & 0 deletions pkgs/by-name/libresoc-nmigen/mdis.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
lib,
python39Packages,
fetchPypi,
}:
python39Packages.buildPythonPackage rec {
pname = "mdis";
version = "0.5.1";

src = fetchPypi {
inherit pname version;
sha256 = "sha256-gvXtP8NO5XPDAs0XMbGknG79FscN/7lxqmF1kg3nhxg=";
};

meta = {
description = "Python dispatching library";
homepage = "https://git.libre-soc.org/?p=mdis.git";
license = lib.licenses.bsd3;
};
}
39 changes: 39 additions & 0 deletions pkgs/by-name/libresoc-nmigen/nmigen-soc.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
lib,
python39Packages,
fetchFromGitLab,
nmigen,
}:
python39Packages.buildPythonPackage rec {
pname = "nmigen-soc";
version = "unstable-2024-03-31";
# python setup.py --version
realVersion = "0.1.dev243+g${lib.substring 0 7 src.rev}";

# NOTE(jleightcap): libresoc's nmigen-soc fork has been renamed to https://github.com/amaranth-lang/amaranth-soc.
# suffers from the same rename issue as the previous commit with renaming issue as nmigen/amaranth
# NOTE(jleightcap): while libre-soc project does have local forks of nmigen* projects,
# HEADs of repos are incompatible.
# dev-env-setup implies that these forks are unused in build process, so using upstream.
src = fetchFromGitLab {
owner = "nmigen";
repo = "nmigen-soc";
hash = "sha256-RI481chXiD9kP/6vNLzYGOfcbwHH0Cvhk+CgloCY9JU=";
rev = "fd2aaa336283cff2e46f489bf3897780cd217b8b"; # HEAD @ version date
};

nativeBuildInputs = with python39Packages; [setuptools-scm];
propagatedBuildInputs = with python39Packages; [nmigen setuptools];

preBuild = ''
export SETUPTOOLS_SCM_PRETEND_VERSION="${realVersion}"
'';

nativeCheckInputs = with python39Packages; [pytestCheckHook];

meta = {
description = "Python toolbox for building complex digital hardware";
license = lib.licenses.bsd3;
homepage = "https://git.libre-soc.org/?p=nmigen.git;a=summary";
};
}
58 changes: 58 additions & 0 deletions pkgs/by-name/libresoc-nmigen/nmigen.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
lib,
fetchFromGitLab,
git,
python39Packages,
symbiyosys,
yices,
yosys,
}:
python39Packages.buildPythonPackage rec {
pname = "nmigen";
version = "unstable-2024-03-31";
realVersion = "0.3.dev243+g${lib.substring 0 7 src.rev}";

# libresoc's nmigen fork has been renamed to https://github.com/amaranth-lang/amaranth
# amaranth is packaged in nixpkgs but we can't just override a few of the attributes the way we did for pyelftools,
# because the names are different, so much of this is copied from the amaranth build recipe
src = fetchFromGitLab {
owner = "nmigen";
repo = "nmigen";
hash = "sha256-tpcA+FFHhm4gF37Z+rB/uZopSRtAtNxU8j5IXnSGeCg=";
rev = "29dec30f628356828aa2aa2b91ce205a570d664e"; # HEAD @ version date
};

preBuild = ''
export SETUPTOOLS_SCM_PRETEND_VERSION="${realVersion}"
'';

nativeBuildInputs = [git] ++ (with python39Packages; [setuptools-scm]);

propagatedBuildInputs =
[yosys]
++ (with python39Packages; [
jinja2
pyvcd
]);

nativeCheckInputs =
[
symbiyosys
yices
yosys
]
++ (with python39Packages; [pytestCheckHook]);

# TODO: upstream nixpkgs Amaranth package uses a patch for Python >3.8 compatibility in setuptools:
# https://github.com/amaranth-lang/amaranth/commit/64771a065a280fa683c1e6692383bec4f59f20fa.patch
# without this upgraded version, the C/C++ compiler used in tests via setuptools.distutils.ccompiler breaks.
# Given the pre-fork nmigen release being used in Libre-SOC, this patch isn't directly portable to this package,
# so disabling the test suite for now.
doCheck = false;

meta = {
description = "Python toolbox for building complex digital hardware";
homepage = "https://git.libre-soc.org/?p=nmigen.git;a=summary";
license = lib.licenses.mit;
};
}
48 changes: 48 additions & 0 deletions pkgs/by-name/libresoc-nmigen/nmutil.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
lib,
fetchFromLibresoc,
python39Packages,
symbiyosys,
yices,
nmigen,
pytest-output-to-files,
}:
python39Packages.buildPythonPackage rec {
pname = "libresoc-nmutil"; # Libre-SOC's bespoke fork
version = "unstable-2024-03-31";

src = fetchFromLibresoc {
pname = "nmutil";
rev = "4bf2f20bddc057df1597d14e0b990c0b9bdeb10e"; # HEAD @ version date
hash = "sha256-8jXQGO4IeB6WjGtjuHO8UBh9n3ei7LukmRoXSbNJ1vM=";
};

propagatedNativeBuildInputs =
[
symbiyosys
yices
]
++ (with python39Packages; [
pyvcd
]);

nativeCheckInputs =
[
nmigen
symbiyosys
yices
]
++ (with python39Packages; [
pytestCheckHook
pytest-xdist
pytest-output-to-files
]);

pythonImportsCheck = ["nmutil"];

meta = {
description = "A nmigen utility library";
homepage = "https://git.libre-soc.org/?p=nmutil.git;a=summary";
license = lib.licenses.lgpl3Plus;
};
}
Loading