olofk / fusesoc

Package manager and build abstraction tool for FPGA/ASIC development
BSD 2-Clause "Simplified" License
1.21k stars 246 forks source link

script order with conditional statements #689

Open BaseHardware opened 6 months ago

BaseHardware commented 6 months ago

The CAPI 2 format supports the conditional inclusion as follows:

    hooks:
      post_build:
        - "target_chip_AA ? (generate_mcs_AA)"
        - "target_chip_BB ? (generate_mcs_BB)"
        - post_build_script

This is a simple example of hooks at the post-build stage of fusesoc. In my sense, the hook MUST be executed in order of specification of each item. (i.e., generate_mcs_AA (if target_chip_AA is defined) -> generate_chip_BB (if target_chip_BB is defined) -> post_build_script) However, I found if there are hook items with the conditional statements, they go to the back of the list. So, if target_chip_AA is defined, fusesoc executes the hook items in this order: post_build_script -> target_chip_AA. This sense is not intuition and must be fixed as the order will be kept.

Currently, I am using the following configuration to keep the order.

    hooks:
      post_build:
        - "target_chip_AA ? (generate_mcs_AA)"
        - "target_chip_BB ? (generate_mcs_BB)"
        - "_ ? (post_build_script)"
        - "!_ ? (post_build_script)"

Please fix this problem at the next patch.