openlane2 icon indicating copy to clipboard operation
openlane2 copied to clipboard

GHDL not available on aarch64 platforms

Open fred-corp opened this issue 10 months ago • 4 comments

Description

When trying to use a VHDL source with the --flow VHDLClassic argument, I get the following Yosys error :

ERROR: Can't load module './ghdl':                                                                                               
                    dlopen(/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so, 0x0005): tried:               
                    '/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so' (no such file),                     
                    '/System/Volumes/Preboot/Cryptexes/OS/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plug             
                    ins/ghdl.so' (no such file),                                                                                                     
                    '/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so' (no such file)   

Expected Behavior

GHDL plugin should be loaded with Yosys.

Environment report

Failed to get Docker info: [Errno 2] No such file or directory: 'docker'
Failed to get Nix info: [Errno 2] No such file or directory: 'nix'
kernel: Darwin
kernel_version: 24.3.0
supported: True
distro: macOS
distro_version: 15.3.1
python_version: 3.11.9
python_path:
  - /nix/store/fgazxsglfa1iamspfj984vl3n76l7zm7-python3.11-openlane-2.3.8/bin
  - /nix/store/0hhzvkw889bsybhqxy12ky4jx6a95p2d-python3-3.11.9/lib/python311.zip
  - /nix/store/0hhzvkw889bsybhqxy12ky4jx6a95p2d-python3-3.11.9/lib/python3.11
  - /nix/store/0hhzvkw889bsybhqxy12ky4jx6a95p2d-python3-3.11.9/lib/python3.11/lib-dynload
  - /nix/store/0hhzvkw889bsybhqxy12ky4jx6a95p2d-python3-3.11.9/lib/python3.11/site-packages
  - /nix/store/jjrp8fzcacibh621cl9klw5yvbqc6476-python3-3.11.9-env/lib/python3.11/site-packages
  - /nix/store/fgazxsglfa1iamspfj984vl3n76l7zm7-python3.11-openlane-2.3.8/lib/python3.11/site-packages
  - /nix/store/qad8ymplf9aq4jxwm007wfsiwpmf95l5-python3.11-click-8.1.7/lib/python3.11/site-packages
  - /nix/store/r367wx2bi3gra6ikc1xa8iv061phdfii-python3.11-cloup-3.0.5/lib/python3.11/site-packages
  - /nix/store/63k20scvxwd200mjnx8hxrjklj0m0mq1-python3.11-pyyaml-6.0.1/lib/python3.11/site-packages
  - /nix/store/dp8qpjnz7kflqqpfxdycri5lb5r2gqaj-python3.11-yamlcore-0.0.2/lib/python3.11/site-packages
  - /nix/store/kjssj1yfgn2pm1kfrlym4qqd4a7rrkk3-python3.11-rich-13.7.1/lib/python3.11/site-packages
  - /nix/store/shh3xl0l5c2izimp610lkbvbgmbm4p4z-python3.11-markdown-it-py-3.0.0/lib/python3.11/site-packages
  - /nix/store/p3xzw8rg1lf6w6yhd3ipwv6r475x74n5-python3.11-mdurl-0.1.2/lib/python3.11/site-packages
  - /nix/store/dlvrsixwy8xz1lr2c4vq828659nv5a3l-python3.11-pygments-2.17.2/lib/python3.11/site-packages
  - /nix/store/kfibrjs2mwaq12h12lx5jmmfzbw6nivx-python3.11-requests-2.31.0/lib/python3.11/site-packages
  - /nix/store/yg6lw7apm174pzc8gl5xni75vyrbd70z-python3.11-brotlicffi-1.1.0.0/lib/python3.11/site-packages
  - /nix/store/vmq8580x9imwzjy61cjjmxfjps73lh2b-python3.11-cffi-1.16.0/lib/python3.11/site-packages
  - /nix/store/ir0ixl0yvpv4x7vf7ysl39z0410ksiq8-python3.11-pycparser-2.22/lib/python3.11/site-packages
  - /nix/store/ik2pw8i84jv5whx3kxyywbdh84rzn5yn-python3.11-certifi-2024.02.02/lib/python3.11/site-packages
  - /nix/store/cw9m8ibz3n35l6vizs9vnlxk4khw5vi9-python3.11-charset-normalizer-3.3.2/lib/python3.11/site-packages
  - /nix/store/j2l1ywgfp9zc5a4x4bmc8b1gvmcl0fab-python3.11-idna-3.7/lib/python3.11/site-packages
  - /nix/store/9wdx14v42vcvrnl5pliqp6qckfc8mbzn-python3.11-urllib3-2.2.1/lib/python3.11/site-packages
  - /nix/store/wrv8bajabpkmc6phq3czc7vrz173adhn-python3.11-pcpp-1.30/lib/python3.11/site-packages
  - /nix/store/sgnh9k4di8v48cnihw8vlvzl6n88gqjv-python3.11-volare/lib/python3.11/site-packages
  - /nix/store/vq5frh1k00r0zzyn9iklrr1k4p6lfscx-python3.11-httpx-0.27.0/lib/python3.11/site-packages
  - /nix/store/s3q5yy84nfx239ll4dqa3mfkbsv6azv2-python3.11-anyio-4.3.0/lib/python3.11/site-packages
  - /nix/store/3nl0zigzfwn3irr241qk884i6cclg74h-python3.11-sniffio-1.3.1/lib/python3.11/site-packages
  - /nix/store/rxjcs59dhbgwdxn0bdxxaaycki5j84sx-python3.11-httpcore-1.0.5/lib/python3.11/site-packages
  - /nix/store/w4gcp9l3b7vfhnkn39gp63p1vqzkyvw5-python3.11-h11-0.14.0/lib/python3.11/site-packages
  - /nix/store/zbwr6q3jgdzlgc248f0my23s9k9l6nd9-python3.11-zstandard-0.22.0/lib/python3.11/site-packages
  - /nix/store/57xrhrl9wlqida3p0rxhh7ph89n1037x-python3.11-truststore-0.8.0/lib/python3.11/site-packages
  - /nix/store/39g07na1shijvdnkr9wwnl8dk5nnrrvm-python3.11-aiohttp-3.9.5/lib/python3.11/site-packages
  - /nix/store/vb1ca4jz2n9c75kky9r0sc3xsr0731b0-python3.11-attrs-23.2.0/lib/python3.11/site-packages
  - /nix/store/l2qkhsrkrrigs4i78x7v7g65kjnliggs-python3.11-multidict-6.0.5/lib/python3.11/site-packages
  - /nix/store/nfr0i2c962c9k19pw8mrjxsc01wx8i8z-python3.11-async-timeout-4.0.3/lib/python3.11/site-packages
  - /nix/store/hzqqlma9lav56qnswl0mcvfl05m9xk80-python3.11-typing-extensions-4.11.0/lib/python3.11/site-packages
  - /nix/store/9qgc7a4916xwrya9m54hwmrahikh72zi-python3.11-yarl-1.9.4/lib/python3.11/site-packages
  - /nix/store/r19j7nlm7k8l1h9knh5p070ihkliprsp-python3.11-frozenlist-1.4.1/lib/python3.11/site-packages
  - /nix/store/mc4zw9pi2l3jqqrhv6z3cxvni3x4r5yw-python3.11-aiosignal-1.3.1/lib/python3.11/site-packages
  - /nix/store/j6zv5rz0pr1h4il6d7qxs5791sxj7ai2-python3.11-aiodns-3.2.0/lib/python3.11/site-packages
  - /nix/store/72d7rlmv10899dv7vj8p21l5na3pyc92-python3.11-pycares-4.4.0/lib/python3.11/site-packages
  - /nix/store/mclrgk3z5bzpl8c6qjlc4y8p8fvyc1ns-python3.11-brotli-1.1.0/lib/python3.11/site-packages
  - /nix/store/9x4xp5q79nz9jramqzbm3m0vcbir7kxg-python3.11-cryptography-42.0.5/lib/python3.11/site-packages
  - /nix/store/h9m232y1np7kcya8670q5n3jr674avhd-python3.11-pyopenssl-24.1.0/lib/python3.11/site-packages
  - /nix/store/jr9yzyykv7dqv3sblkwaghgd5lfn7rsj-python3.11-trustme-1.1.0/lib/python3.11/site-packages
  - /nix/store/j2qvrfmwzdyhm5q8drxzsq51dfjarlkz-python3.11-socksio-1.0.0/lib/python3.11/site-packages
  - /nix/store/lb2hdy98jafxbx38klkas57hggf4pc78-python3.11-tkinter-3.11.9/lib/python3.11/site-packages
  - /nix/store/j4z09sw0sl9j0jngaqyd84xg4d82ypl4-python3.11-lxml-5.1.0/lib/python3.11/site-packages
  - /nix/store/hd68zfkm82lips4b5drh0il2snn0x0ln-python3.11-deprecated-1.2.14/lib/python3.11/site-packages
  - /nix/store/ca5cyxkw5crvvjin1ldysscrp9k0qnj2-python3.11-wrapt-1.16.0/lib/python3.11/site-packages
  - /nix/store/0swv0bwpm1sjzamxaavqla9s4sljn5m1-python3.11-libparse/lib/python3.11/site-packages
  - /nix/store/q2yjpj6lnr9p3vp89grfkf2w88kwa0dq-python3.11-psutil-5.9.8/lib/python3.11/site-packages
  - /nix/store/9bmgqgsaf8f0hypb7hxqsqx9xlrm86dz-python3-3.11.9-klayout/lib/python3.11/site-packages
  - /nix/store/75li3gyslwpfg63j2k27kgxwskfnzwww-python3.11-rapidfuzz-3.9.1/lib/python3.11/site-packages
  - /nix/store/naxlyjgwl8kxv2hl84p3j6ks1acvlm5c-python3.11-ioplace_parser/lib/python3.11/site-packages
  - /nix/store/dc7937ygjxws7k9jiavimlppz0j33ijr-python3.11-antlr-python3-runtime-4.9.3/lib/python3.11/site-packages
  - /nix/store/0pb8586253p91rw2njly08hmagyfm37r-python3.11-semver-3.0.2/lib/python3.11/site-packages
tkinter: True
container_info: None
nix_info: None

Reproduction material

config.json

{
    "DESIGN_NAME": "led",
    "VHDL_FILES": ["Led.vhd"],
    "CLOCK_PERIOD": 25,
    "CLOCK_PORT": "clk"
}

Led.vhd (GitHub doesn't allow me to upload the file directly) :

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.all;

entity led is
  port (
    clk    : in std_logic; -- clock, 12MHz
    led_r  : out std_logic := '1'; -- red led, active low
    led_g  : out std_logic := '1'; -- green led, active low
    led_b  : out std_logic := '1'; -- blue led, active low
    button : in std_logic -- push button, active low
  );
end entity led;

architecture rtl of led is
  signal counter_r : unsigned(20 downto 0) := (others => '0'); -- red led counter
  signal counter_g : unsigned(22 downto 0) := (others => '0'); -- green led counter

begin
  -- write state to red led
  led_r <= '0' when counter_r(counter_r'high) = '1' else 'Z';

  process (clk)
  begin
    -- check for rising edge
    if rising_edge(clk) then
      -- increment counters
      counter_r <= counter_r + 1;
      counter_g <= counter_g + 1;

      -- reset green led counter after 6M cycles (12MHz clock -> 0.5s)
      if counter_g > 6000000 then
        counter_g <= (others => '0');
      end if;

      -- toggle green led every 3M cycles (12MHz clock -> 0.25s -> 2Hz)
      if counter_g < 3000000 then
        led_g <= '1';
      else
        led_g <= '0';
      end if;

      -- turn on blue led when button is pressed
      -- reset green led counter when button is pressed
      if button = '0' then
        counter_g <= (others => '0');
        led_b     <= '0';
      else
        led_b <= 'Z';
      end if;
    end if;
  end process;

end architecture;

Relevant log output

[nix-shell:~/opt/vlsi-toolchain/tests/pm32]$ openlane --flow VHDLClassic config.json
[23:58:09] INFO     Starting a new run of the 'VHDLClassic' flow with the tag 'RUN_2025-02-19_23-58-09'.                                                                                                                                                                               flow.py:628
[23:58:09] INFO     Starting…                                                                                                                                                                                                                                                    sequential.py:294
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Synthesis (VHDL) ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[23:58:09] VERBOSE  Running 'Yosys.VHDLSynthesis' at 'runs/RUN_2025-02-19_23-58-09/01-yosys-vhdlsynthesis'…                                                                                                                                                                           step.py:1122
[23:58:09] VERBOSE  Logging subprocess to 'runs/RUN_2025-02-19_23-58-09/01-yosys-vhdlsynthesis/yosys-vhdlsynthesis.log'…                                                                                                                                                              step.py:1318
                                                                                                                                                                                                                                                                                                  
/----------------------------------------------------------------------------\                                                                                                                                                                                                                    
|  yosys -- Yosys Open SYnthesis Suite                                       |                                                                                                                                                                                                                    
|  Copyright (C) 2012 - 2024  Claire Xenia Wolf <[email protected]>         |                                                                                                                                                                                                                    
|  Distributed under an ISC-like license, type "license" to see terms        |                                                                                                                                                                                                                    
\----------------------------------------------------------------------------/                                                                                                                                                                                                                    
Yosys 0.46 (git sha1 e97731b9dda91fa5fa53ed87df7c34163ba59a41, clang++ 16.0.6 -fPIC -O3)                                                                                                                                                                                                          
Loaded SDC plugin                                                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                  
1. Executing Liberty frontend: /Users/fredericdruppel/.volare/volare/sky130/versions/0fe599b2afb6708d281543108caf8310912f54af/sky130A/libs.ref/sky130_fd_sc_hd/lib/sky130_fd_sc_hd__tt_025C_1v80.lib                                                                                              
ERROR: Can't load module `./ghdl': dlopen(/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so, 0x0005): tried: '/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so' (no such file),                                
'/System/Volumes/Preboot/Cryptexes/OS/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so' (no such file), '/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so' (no such file)                                      
[23:58:09] ERROR    Subprocess had a non-zero exit.                                                                                                                                                                                                                                   step.py:1364
[23:58:09] ERROR    Last 10 line(s):                                                                                                                                                                                                                                                  step.py:1369
                     /----------------------------------------------------------------------------\                                                                                                                                                                                               
                     |  yosys -- Yosys Open SYnthesis Suite                                       |                                                                                                                                                                                               
                     |  Copyright (C) 2012 - 2024  Claire Xenia Wolf <[email protected]>         |                                                                                                                                                                                               
                     |  Distributed under an ISC-like license, type "license" to see terms        |                                                                                                                                                                                               
                     \----------------------------------------------------------------------------/                                                                                                                                                                                               
                     Yosys 0.46 (git sha1 e97731b9dda91fa5fa53ed87df7c34163ba59a41, clang++ 16.0.6 -fPIC -O3)                                                                                                                                                                                     
                    Loaded SDC plugin                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                  
                    1. Executing Liberty frontend: /Users/fredericdruppel/.volare/volare/sky130/versions/0fe599b2afb6708d281543108caf8310912f54af/sky130A/libs.ref/sky130_fd_sc_hd/lib/sky130_fd_sc_hd__tt_025C_1v80.lib                                                                          
                    ERROR: Can't load module `./ghdl': dlopen(/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so, 0x0005): tried: '/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so' (no such                   
                    file), '/System/Volumes/Preboot/Cryptexes/OS/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so' (no such file), '/nix/store/zxzmb2hdyjahy1lq6yglcx6sxy6zrddi-yosys-with-plugins/share/yosys/plugins/ghdl.so' (no such                 
                    file)                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                  
[23:58:09] ERROR    Full log file: 'runs/RUN_2025-02-19_23-58-09/01-yosys-vhdlsynthesis/yosys-vhdlsynthesis.log'                                                                                                                                                                      step.py:1372
VHDLClassic - Stage 1 - Synthesis (VHDL) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  0/70 0:00:00
[23:58:09] ERROR    The following error was encountered while running the flow:                                                                                                                                                                                                    __main__.py:187
                    Synthesis (VHDL): subprocess (1, ['yosys', '-y', '/nix/store/jjrp8fzcacibh621cl9klw5yvbqc6476-python3-3.11.9-env/lib/python3.11/site-packages/openlane/scripts/pyosys/synthesize.py', '--', '--config-in',                                                                    
                    '/Users/fredericdruppel/opt/vlsi-toolchain/tests/pm32/runs/RUN_2025-02-19_23-58-09/01-yosys-vhdlsynthesis/config.json', '--extra-in', '/Users/fredericdruppel/opt/vlsi-toolchain/tests/pm32/runs/RUN_2025-02-19_23-58-09/01-yosys-vhdlsynthesis/extra.json',                  
                    '--output', '/Users/fredericdruppel/opt/vlsi-toolchain/tests/pm32/runs/RUN_2025-02-19_23-58-09/01-yosys-vhdlsynthesis/led.nl.v']) failed                                                                                                                                      
[23:58:09] ERROR    OpenLane will now quit.

fred-corp avatar Feb 19 '25 22:02 fred-corp

So I neglected to include the architecture in the environment report but if you're on an Apple Silicon Mac:

GHDL is only supported on x86-64 platforms because that's what the Ada compiler supports for Nix, unfortunately. Also, upstream does not release for aarch64 on either Mac OR Linux:

~% file ~/Downloads/ghdl-macos-11-llvm/bin/ghdl
/Users/donn/Downloads/ghdl-macos-11-llvm/bin/ghdl: Mach-O 64-bit executable x86_64

Fortunately, if you have Rosetta installed, there's a workaround. You may type nix develop .#devShells.x86_64-darwin.default instead of nix-shell, which will use the x86-64 version of Yosys with the GHDL plugin (at a performance penalty.)


Can you confirm if you're on Apple Silicon?

donn avatar Feb 20 '25 15:02 donn

Yes, Running on Apple Silicon. yosys -m ghdl works for FPGA synthesis (with ICE40 toolchains, and oss-cad-suite) but doesn't in the nix-shell for VLSI synthesis.

After running nix develop .#devShells.x86_64-darwin.default in my openlane2 installation folder, I can happily run openlane --flow VHDLClassic config.json and the workflow seems to run smoothly. I'm also able to check the layout with openlane --last-run --flow openinklayout config.json
There doesn't seem to be that much of a performance hit, though my design is quite basic. I'll try to translate it to Verilog and run some performance benchmarks when I have some time.

fred-corp avatar Feb 20 '25 15:02 fred-corp

If the oss-cad-suite builds for macOS/aarch64 I think I may be able to monkey-patch their shared object to work with Nix. I'll look into it.

donn avatar Feb 20 '25 15:02 donn

All right, thanks !
I wasn't able to build the oss-cad-suite from source, so I used the latest darwin-arm64 build from the YosysHQ repo.

fred-corp avatar Feb 20 '25 16:02 fred-corp