package:
  name: cva6
  authors:
    - "Florian Zaruba <zarubaf@iis.ee.ethz.ch>"
    - "Michael Schaffner <schaffner@iis.ee.ethz.ch>"
    - "Andreas Kuster <kustera@ethz.ch>"

# WT_DCACHE
dependencies:
  axi: { git: "https://github.com/pulp-platform/axi.git", version: 0.31.0 }
  common_cells:
    { git: "https://github.com/pulp-platform/common_cells", version: 1.23.0 }
  fpnew: { git: "https://github.com/openhwgroup/cvfpu.git", version: 0.7.0 }
  tech_cells_generic:
    { git: "https://github.com/pulp-platform/tech_cells_generic.git", version: 0.2.13 }

export_include_dirs:
  - core/include

sources:
  - include_dirs:
      - core/include
    files:
      - core/include/config_pkg.sv
      # Pick the right configuration by passing the right bender flag.
      - target: cv64a6_imafdcv_sv39
        files:
          - core/include/cv64a6_imafdcv_sv39_config_pkg.sv

      - target: cv64a6_imafdc_sv39
        files:
          - core/include/cv64a6_imafdc_sv39_config_pkg.sv

      - target: cv64a6_imafdc_sv39_wb
        files:
          - core/include/cv64a6_imafdc_sv39_wb_config_pkg.sv

      - target: cv64a6_imafdch_sv39
        files:
          - core/include/cv64a6_imafdch_sv39_config_pkg.sv

      - target: cv64a6_imafdch_sv39_wb
        files:
          - core/include/cv64a6_imafdch_sv39_wb_config_pkg.sv

      - target: cv32a6_imac_sv0
        files:
          - core/include/cv32a6_imac_sv0_config_pkg.sv

      - target: cv32a6_imac_sv32
        files:
          - core/include/cv32a6_imac_sv32_config_pkg.sv

      - target: cv32a6_imafc_sv32
        files:
          - core/include/cv32a6_imafc_sv32_config_pkg.sv

      # General config infrastructure
      - core/include/riscv_pkg.sv
      - core/include/ariane_pkg.sv
      - core/include/build_config_pkg.sv

      - target: not(exclude_first_pass_decoder)
        files:
          - core/cva6_accel_first_pass_decoder_stub.sv

      # MMU
      - target: any(cv64a6_imafdcv_sv39, cv64a6_imafdc_sv39, cv64a6_imafdc_sv39_wb, cv64a6_imafdch_sv39, cv64a6_imafdch_sv39_wb, cv32a6_imac_sv0, cv32a6_imac_sv32, cv32a6_imafc_sv32)
        files:
          - core/cva6_mmu/cva6_tlb.sv
          - core/cva6_mmu/cva6_shared_tlb.sv
          - core/cva6_mmu/cva6_mmu.sv
          - core/cva6_mmu/cva6_ptw.sv

      # Packages
      - core/include/wt_cache_pkg.sv
      - core/include/std_cache_pkg.sv

      # Extension Interface
      - core/cvxif_example/include/cvxif_instr_pkg.sv
      - core/cvxif_fu.sv
      - core/cvxif_issue_register_commit_if_driver.sv
      - core/cvxif_compressed_if_driver.sv
      - core/cvxif_example/cvxif_example_coprocessor.sv
      - core/cvxif_example/instr_decoder.sv

      # Tracing
      - core/cva6_rvfi_probes.sv
      - core/cva6_fifo_v3.sv
      # Top-level source files (not necessarily instantiated at the top of the cva6).
      - core/cva6.sv
      - core/alu.sv
      - core/fpu_wrap.sv # depends on fpnew_pkg, above
      - core/branch_unit.sv
      - core/compressed_decoder.sv
      - core/controller.sv
      - core/csr_buffer.sv
      - core/csr_regfile.sv
      - core/decoder.sv
      - core/ex_stage.sv
      - core/acc_dispatcher.sv
      - core/instr_realign.sv
      - core/id_stage.sv
      - core/issue_read_operands.sv
      - core/issue_stage.sv
      - core/load_unit.sv
      - core/load_store_unit.sv
      - core/lsu_bypass.sv
      - core/mult.sv
      - core/multiplier.sv
      - core/serdiv.sv
      - core/perf_counters.sv
      - core/ariane_regfile_ff.sv
      - core/ariane_regfile_fpga.sv
      - core/scoreboard.sv
      - core/store_buffer.sv
      - core/amo_buffer.sv
      - core/store_unit.sv
      - core/commit_stage.sv
      - core/axi_shim.sv

      # Frontend (i.e., fetch, decode, dispatch)
      - core/frontend/btb.sv
      - core/frontend/bht.sv
      - core/frontend/ras.sv
      - core/frontend/instr_scan.sv
      - core/frontend/instr_queue.sv
      - core/frontend/frontend.sv
      # Cache subsystem(s)
      - core/cache_subsystem/wt_dcache_ctrl.sv
      - core/cache_subsystem/wt_dcache_mem.sv
      - core/cache_subsystem/wt_dcache_missunit.sv
      - core/cache_subsystem/wt_dcache_wbuffer.sv
      - core/cache_subsystem/wt_dcache.sv
      - core/cache_subsystem/wt_cache_subsystem.sv
      - core/cache_subsystem/wt_axi_adapter.sv
      - core/cache_subsystem/cva6_icache.sv
      - core/cache_subsystem/tag_cmp.sv
      - core/cache_subsystem/cva6_icache_axi_wrapper.sv
      - core/cache_subsystem/axi_adapter.sv
      - core/cache_subsystem/miss_handler.sv
      - core/cache_subsystem/cache_ctrl.sv
      - core/cache_subsystem/std_nbdcache.sv
      - core/cache_subsystem/std_cache_subsystem.sv

      # Physical Memory Protection
      - core/pmp/src/pmp.sv
      - core/pmp/src/pmp_entry.sv
      - core/pmp/src/pmp_data_if.sv

      - include_dirs:
        - common/local/util
        files:
          - common/local/util/sram.sv

      - target: not(all(fpga, xilinx))
        include_dirs:
          - common/local/util
        files:
          - common/local/util/tc_sram_wrapper.sv
          - common/local/util/sram_cache.sv

      - target: all(fpga, xilinx)
        include_dirs:
          - common/local/util
        files:
          - common/local/util/sram_cache.sv
          - common/local/util/tc_sram_fpga_wrapper.sv
          - vendor/pulp-platform/fpga-support/rtl/SyncSpRamBeNx64.sv

      - target: not(synthesis)
        include_dirs:
          - core/include
          - common/local/util
        files:
          # Tracer (behavioral code, not RTL)
          - core/include/instr_tracer_pkg.sv
          - common/local/util/instr_tracer.sv
