[bug#78390,electronics-team] gnu: nextpnr: Add ecp5 and himbaechel architectures.

Message ID 279f0c297865b8963b03dd173d171d4d3fe2eaa7.1747051833.git.csantosb@inventati.org
State New
Headers
Series [bug#78390,electronics-team] gnu: nextpnr: Add ecp5 and himbaechel architectures. |

Commit Message

Cayetano Santos May 12, 2025, 12:10 p.m. UTC
* gnu/packages/fpga.scm (nextpnr): Add ecp5 and himbaechel architectures.

Change-Id: Ia4b92f6cd1693b844b35949fdc23369e958e73c1

---

[arguments] <#:configure-flags>: Add Add ecp5 and himbaechel.
<#:phases> {get-prjbeyond-db}: New phase.
{unbundle-sanitizers-cmake}: Simplify lambda.
[native-inputs]: Add prjtrellis.

 gnu/packages/fpga.scm | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)


base-commit: e4e43cebbacbbb7982d08f691636f3234fd60184
--
2.49.0
  

Comments

Maxim Cournoyer May 15, 2025, 1:49 a.m. UTC | #1
tags 78390 + moreinfo
thanks

Hello!

Cayetano Santos <csantosb@inventati.org> writes:

> * gnu/packages/fpga.scm (nextpnr): Add ecp5 and himbaechel architectures.
>
> Change-Id: Ia4b92f6cd1693b844b35949fdc23369e958e73c1
>
> ---
>
> [arguments] <#:configure-flags>: Add Add ecp5 and himbaechel.
> <#:phases> {get-prjbeyond-db}: New phase.
> {unbundle-sanitizers-cmake}: Simplify lambda.
> [native-inputs]: Add prjtrellis.
>
>  gnu/packages/fpga.scm | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
> index 2019700d72..4d767340cb 100644
> --- a/gnu/packages/fpga.scm
> +++ b/gnu/packages/fpga.scm
> @@ -54,6 +54,7 @@ (define-module (gnu packages fpga)
>    #:use-module (gnu packages cmake)
>    #:use-module (gnu packages compression)
>    #:use-module (gnu packages cpp)
> +  #:use-module (gnu packages electronics)
>    #:use-module (gnu packages elf)
>    #:use-module (gnu packages flex)
>    #:use-module (gnu packages gawk)
> @@ -408,18 +409,36 @@ (define-public nextpnr
>       (list
>        #:cmake cmake                     ;CMake 3.25 or higher is required.
>        #:configure-flags
> -      #~(list "-DARCH=generic;ice40"    ;TODO: enable more architectures?
> +      ;;TODO: enable more architectures?

punctuation nitpick: should be ';; TODO: Enable more architectures?'

> +      #~(list "-DARCH=generic;ice40;ecp5;himbaechel"
>                "-DBUILD_GUI=ON"
>                "-DUSE_OPENMP=ON"
>                "-DBUILD_TESTS=ON"
> +              "-DHIMBAECHEL_UARCH=ng-ultra" ;gowin requires python-apycula.

Feel free to drop punctuation for margin commits, such as the trailing
dot here.

> +              "-DHIMBAECHEL_NGULTRA_DEVICES=ng-ultra"
> +              "-DHIMBAECHEL_PRJBEYOND_DB=/tmp/prjbeyond-db"
>                (string-append "-DCURRENT_GIT_VERSION=nextpnr-" #$version)
>                (string-append "-DICESTORM_INSTALL_PREFIX="
>                               #$(this-package-input "icestorm"))
> +              (string-append "-DTRELLIS_INSTALL_PREFIX="
> +                             #$(this-package-input "prjtrellis"))
>                "-DUSE_IPO=OFF")
>        #:phases
>        #~(modify-phases %standard-phases
> +          (add-after 'unpack 'get-prjbeyond-db
> +            (lambda _

It'd be nice to add a comment explaining why this is useful here, and
perhaps mentioning which commit should be used when updating (the latest
one?) nextpnr.

Otherwise, LGTM!
  
Cayetano Santos May 19, 2025, 9:14 a.m. UTC | #2
>jeu. 15 mai 2025 at 10:49, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

>> +      #~(list "-DARCH=generic;ice40;ecp5;himbaechel"
>>                "-DBUILD_GUI=ON"
>>                "-DUSE_OPENMP=ON"
>>                "-DBUILD_TESTS=ON"
>> +              "-DHIMBAECHEL_UARCH=ng-ultra" ;gowin requires python-apycula.
>
> Feel free to drop punctuation for margin commits, such as the trailing
> dot here.

No need to specify what do we don’t yet provide, after all, I drop the
whole comment.
  

Patch

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 2019700d72..4d767340cb 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -54,6 +54,7 @@  (define-module (gnu packages fpga)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
+  #:use-module (gnu packages electronics)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages gawk)
@@ -408,18 +409,36 @@  (define-public nextpnr
      (list
       #:cmake cmake                     ;CMake 3.25 or higher is required.
       #:configure-flags
-      #~(list "-DARCH=generic;ice40"    ;TODO: enable more architectures?
+      ;;TODO: enable more architectures?
+      #~(list "-DARCH=generic;ice40;ecp5;himbaechel"
               "-DBUILD_GUI=ON"
               "-DUSE_OPENMP=ON"
               "-DBUILD_TESTS=ON"
+              "-DHIMBAECHEL_UARCH=ng-ultra" ;gowin requires python-apycula.
+              "-DHIMBAECHEL_NGULTRA_DEVICES=ng-ultra"
+              "-DHIMBAECHEL_PRJBEYOND_DB=/tmp/prjbeyond-db"
               (string-append "-DCURRENT_GIT_VERSION=nextpnr-" #$version)
               (string-append "-DICESTORM_INSTALL_PREFIX="
                              #$(this-package-input "icestorm"))
+              (string-append "-DTRELLIS_INSTALL_PREFIX="
+                             #$(this-package-input "prjtrellis"))
               "-DUSE_IPO=OFF")
       #:phases
       #~(modify-phases %standard-phases
+          (add-after 'unpack 'get-prjbeyond-db
+            (lambda _
+              (copy-recursively
+               #$(origin
+                   (method git-fetch)
+                   (uri (git-reference
+                         (url "https://github.com/yosyshq-GmbH/prjbeyond-db/")
+                         (commit "06d3b424dd0e52d678087c891c022544238fb9e3")))
+                   (sha256
+                    (base32
+                     "17dd3cgms2fy6xvz7magdmvv92km4cqh2kz9dyjrvz5y8caqav4y")))
+               "/tmp/prjbeyond-db")))
           (add-after 'unpack 'unbundle-sanitizers-cmake
-            (lambda* (#:key inputs #:allow-other-keys)
+            (lambda _
               (substitute* "CMakeLists.txt"
                 ;; Use the system sanitizers-cmake module.  This is made
                 ;; necessary 'sanitizers-cmake' installing a FindPackage
@@ -436,6 +455,7 @@  (define-public nextpnr
            corrosion
            eigen
            icestorm
+           prjtrellis
            pybind11
            python
            qtbase-5