olofk / edalize

An abstraction library for interfacing EDA tools
BSD 2-Clause "Simplified" License
624 stars 185 forks source link

Symbiflow tool doesn't pass Yosys parameters when using VPR as PnR #434

Open carlosedp opened 3 months ago

carlosedp commented 3 months ago

In my core, I use Symbiflow tool to synthesize and generate bitstream to an Artix 7 FPGA.

I recently needed to pass a vlogdefine to Yosys due to memory initialization but the parameter is not passed to Yosys correctly. It used to work before I needed to pass the DEFINE to Yosys.

...
  artya7-35t-oss:
    default_tool: symbiflow
    description: Digilent ArtyA7-35T Board using Symbiflow OSS Toolchain
    filesets: [base, artya7-35t, proginfo, progload]
    generate: [artya7-35t]
    hooks:
      post_run: [artya7-35t]
    tools:
      symbiflow:
        part: xc7a35t
        package: csg324-1
        vendor: xilinx
        pnr: vpr
    toplevel: Toplevel
    parameters:
      - ENABLE_INITIAL_MEM_

parameters:
  ENABLE_INITIAL_MEM_:
    description: Used by firtool so the memories are initialized with readmemh. https://github.com/llvm/circt/pull/5237
    paramtype: vlogdefine
    datatype: bool
    default: true

In other tools like Trellis, the param is passed fine. Apparently using NextPNR it's also passed but I need to investigate it more since it requires a NextPNR which supports Xilinx.

carlosedp commented 3 months ago

I've added a workaround on https://github.com/carlosedp/edalize/commit/4a806a8f719787a13b8e122d59af6def6c4c5879 that allows passing defines in the filelist array. This can be used until symbiflow has a proper flag for defines which I've sent here: https://github.com/chipsalliance/f4pga/pull/669

I don't plan to open a PR for the workaround. I'll wait until the solution is added to symbiflow_synth and then I can get a final PR.