CAPI=2:

name : award-winning:serv:servant:1.4.0
description: Simple reference system for SERV
license: ISC

filesets:
  # Common filesets
  mem_files:
    files:
      - sw/blinky.hex       : {copyto : blinky.hex}
      - sw/zephyr_hello.hex : {copyto : zephyr_hello.hex}
    file_type : user

  servant_tb:
    files:
      - sw/hello_uart.hex : {file_type: user, copyto: .}
      - bench/servant_sim.v
      - bench/uart_decoder.v
      - bench/servant_tb.v
    file_type : verilogSource
    depend : [vlog_tb_utils]

  service:
    files:
      - servant/ice40_pll.v
      - servant/service_clock_gen.v
      - servant/service.v
    file_type : verilogSource
    depend : ["fusesoc:utils:generators"]

  soc:
    files:
      - servant/servant_timer.v
      - servant/servant_gpio.v
      - servant/servant_mux.v
      -  "tool_quartus? (servant/servant_ram_quartus.sv)" : {file_type : systemVerilogSource}
      - "!tool_quartus? (servant/servant_ram.v)"
      - servant/servant.v
    file_type : verilogSource
    depend : [award-winning:serv:servile, "mdu? (mdu)"]

  verilator_tb:
    files:
      - bench/servant_sim.v
      - "vidbo? (bench/servant_tb_vidbo.cpp)" : {file_type : cppSource}
      - "!vidbo? (bench/servant_tb.cpp)" : {file_type : cppSource}
    file_type : verilogSource
    depend : ["vidbo? (vidbo)"]

  # Target-specific filesets. Alphabetically sorted

  ac701:
    files:
      - servant/servix.v : {file_type : verilogSource}
      - servant/servant_ac701.v : {file_type : verilogSource}
      - data/ac701.xdc : {file_type : xdc}

  alhambra   : {files: [data/alhambra.pcf : {file_type : PCF}]}

  alchitry_au:
    files:
      - servant/servix_clock_gen.v : {file_type : verilogSource}
      - servant/servix.v : {file_type : verilogSource}
      - data/alchitry_au.xdc : {file_type : xdc}

  arty_a7_35t:
    files:
      - servant/servix_clock_gen.v : {file_type : verilogSource}
      - servant/servix.v : {file_type : verilogSource}
      - data/arty_a7_35t.xdc : {file_type : xdc}

  arty_s7_50t:
    files:
      - servant/servix_clock_gen.v : {file_type : verilogSource}
      - servant/servix.v : {file_type : verilogSource}
      - data/arty_s7_50t.xdc : {file_type : xdc}

  ax309:
    files:
      - servant/servant_ax309_clock_gen.v : {file_type : verilogSource}
      - servant/servant_ax309.v : {file_type : verilogSource}
      - data/ax309.ucf : {file_type : UCF}

  chameleon96:
    files:
      - data/chameleon96/chameleon96.sdc : {file_type : SDC}
      - data/chameleon96/pinmap.tcl   : {file_type: tclSource}
      - data/chameleon96/HPS.sv : {file_type : systemVerilogSource}
      - data/chameleon96/CV_96.v : {file_type : verilogSource}
      - servant/servive_clock_gen.v : {file_type : verilogSource}
      - servant/servive.v : {file_type : verilogSource}

  cmod_a7_35t:
    files:
      - servant/servant_cmod_a7_clock_gen.v : {file_type : verilogSource}
      - servant/servant_cmod_a7.v : {file_type : verilogSource}
      - data/cmod_a7_35t.xdc : {file_type : xdc}

  cyc1000:
    files:
      - data/cyc1000.sdc : {file_type : SDC}
      - data/cyc1000.tcl : {file_type : tclSource}
      - servant/servclone10_clock_gen.v : {file_type : verilogSource}
      - servant/servclone10.v : {file_type : verilogSource}

  deca:
    files:
      - data/deca.sdc : {file_type : SDC}
      - data/deca.tcl : {file_type : tclSource}
      - servant/servive_clock_gen.v : {file_type : verilogSource}
      - servant/servive.v : {file_type : verilogSource}

  de0_nano:
    files:
      - data/de0_nano.sdc : {file_type : SDC}
      - data/de0_nano.tcl : {file_type : tclSource}
      - servant/servive_clock_gen.v : {file_type : verilogSource}
      - servant/servive.v : {file_type : verilogSource}

  de1_soc_revF:
    files:
      - data/de1_soc_revF.sdc : {file_type : SDC}
      - data/de1_soc_revF.tcl : {file_type : tclSource}
      - servant/servde1_soc_revF_clock_gen.v : {file_type : verilogSource}
      - servant/servde1_soc_revF.v : {file_type : verilogSource}


  de10_nano:
    files:
      - data/de10_nano.sdc : {file_type : SDC}
      - data/de10_nano.tcl : {file_type : tclSource}
      - servant/servive_clock_gen.v : {file_type : verilogSource}
      - servant/servive.v : {file_type : verilogSource}

  ebaz4205:
    files:
      - servant/servix_ebaz4205_clock_gen.v : {file_type : verilogSource}
      - servant/servix_ebaz4205.v : {file_type : verilogSource}
      - data/ebaz4205.xdc : {file_type : xdc}

  ecp5_evn:
    files:
      - data/ecp5_evn.lpf : {file_type : LPF}
      - servant/ecp5_evn_pll.v : {file_type : verilogSource}
      - servant/servant_ecp5_evn_clock_gen.v : {file_type : verilogSource}
      - servant/servant_ecp5_evn.v : {file_type : verilogSource}

  go_board:
    files:
      - data/go_board.pcf : {file_type : PCF}
      - servant/service_go_board.v : {file_type : verilogSource}

  icebreaker : {files: [data/icebreaker.pcf  : {file_type : PCF}]}

  icestick   : {files: [data/icestick.pcf  : {file_type : PCF}]}

  icesugar   : {files: [data/icesugar.pcf : {file_type : PCF}]}

  icev_wireless : {files: [data/icev_wireless.pcf  : {file_type : PCF}]}

  gmm7550:
    files:
      - data/gmm7550.ccf : {file_type : CCF}
      - servant/servant_gmm7550.v : {file_type : verilogSource}

  lx9_microboard:
    files:
      - servant/servant_lx9_clock_gen.v : {file_type : verilogSource}
      - servant/servant_lx9.v : {file_type : verilogSource}
      - data/lx9_microboard.ucf : {file_type : UCF}

  machdyne_kolibri:
    files:
      - servant/servant_md_kolibri.v : {file_type : verilogSource}
      - data/machdyne_kolibri.pcf : {file_type : PCF}

  max10_10m08evk:
    files:
      - data/max10_10m08evk.sdc : {file_type : SDC}
      - data/max10_10m08evk.tcl : {file_type : tclSource}
      - servant/servive_clock_gen.v : {file_type : verilogSource}
      - servant/servive.v : {file_type : verilogSource}

  nexys_2:
    files:
      - servant/servax_clock_gen.v : {file_type : verilogSource}
      - servant/servax.v : {file_type : verilogSource}
      - data/nexys_2.tcl : {file_type : tclSource}
      - data/nexys_2.ucf : {file_type : UCF}

  nexys_a7:
    files:
      - servant/servix_clock_gen.v : {file_type : verilogSource}
      - servant/servix.v : {file_type : verilogSource}
      - data/nexys_a7.xdc : {file_type : xdc}

  orangecrab:
    files:
      - data/orangecrab_r02.lpf : {file_type : LPF}
      - servant/servant_orangecrab.v : {file_type : verilogSource}

  pipistrello:
    files:
      - servant/servis_clock_gen.v : {file_type : verilogSource}
      - servant/servis.v : {file_type : verilogSource}
      - data/pipistrello.ucf : {file_type : UCF}

  polarfire_splashkit:
    files:
      - servant/servant_pf.v : {file_type : verilogSource}
      - servant/servant_pf_clock_gen.v : {file_type : verilogSource}
      - data/polarfire_splashkit.pdc : {file_type : PDC}

  sockit:
    files:
      - data/sockit.sdc : {file_type : SDC}
      - data/sockit.tcl : {file_type : tclSource}
      - servant/servive_clock_gen.v : {file_type : verilogSource}
      - servant/servive.v : {file_type : verilogSource}

  te0802:
    files:
      - servant/servant_te0802_clock_gen.v : {file_type : verilogSource}
      - servant/servant_te0802.v : {file_type : verilogSource}
      - data/te0802.xdc : {file_type : xdc}

  tinyfpga_bx: {files: [data/tinyfpga_bx.pcf : {file_type : PCF}]}

  ulx3s:
    files:
      - data/ulx3s.lpf : {file_type : LPF}
      - servant/ecppll.v : {file_type : verilogSource}
      - servant/servant_ecp5_clock_gen.v : {file_type : verilogSource}
      - servant/servant_ecp5.v : {file_type : verilogSource}

  upduino2:
    files:
      - servant/servant_upduino2.v : {file_type : verilogSource}
      - data/upduino2.pcf : {file_type : PCF}

  zcu106:
    files:
      - servant/servus_clock_gen.v : {file_type : verilogSource}
      - servant/servus.v : {file_type : verilogSource}
      - data/zcu106.xdc : {file_type : xdc}

targets:
  default:
    filesets : [soc]

  ac701:
    default_tool: vivado
    description: AC701 Evaluation Kit
    filesets : [mem_files, soc, ac701]
    parameters : [memfile, memsize, frequency=32]
    tools:
      vivado: {part : xc7a200t-fbg676-2}
    toplevel : servant_ac701

  alchitry_au:
    default_tool: vivado
    description: Open-hardware Alchitry AU FPGA board
    filesets : [mem_files, soc, alchitry_au]
    parameters : [memfile, memsize, frequency=16, "mdu? (MDU=1)", WITH_RESET]
    tools:
      vivado: {part : xc7a35tftg256-1}
    toplevel : servix

  alhambra:
    default_tool : icestorm
    description: Open-hardware iCE40HX4K FPGA board
    filesets : [mem_files, soc, service, alhambra]
    generate: [ice40pll: {freq_in : 12, freq_out : 32}]
    parameters : [memfile, memsize, PLL=ICE40_CORE]
    tools:
      icestorm:
        nextpnr_options : [--hx8k, --package, "tq144:4k", --freq, 32]
        pnr: next
    toplevel : service

  arty_a7_35t:
    default_tool: vivado
    description: Digilent Arty A7-35
    filesets : [mem_files, soc, arty_a7_35t]
    parameters : [memfile, memsize, frequency=16, "mdu? (MDU=1)", WITH_RESET]
    tools:
      vivado: {part : xc7a35ticsg324-1L}
    toplevel : servix

  arty_s7_50t:
    default_tool: vivado
    description: Digilent Arty S7-50
    filesets : [mem_files, soc, arty_s7_50t]
    parameters : [memfile, memsize, frequency=16, "mdu? (MDU=1)", WITH_RESET]
    tools:
      vivado: {part : xc7s50csga324-1}
    toplevel : servix

  ax309:
    default_tool : ise
    description : XILINX Spartan-6 XC6SLX9 FPGA Development Board
    filesets : [mem_files, soc, ax309]
    parameters : [memfile, memsize]
    tools:
      ise:
        family  : Spartan6
        device  : xc6slx9
        package : ftg256
        speed   : -3
    toplevel : servant_ax309

  chameleon96:
    default_tool : quartus
    description : Chameleon96 (Arrow 96 CV SoC Board)
    filesets : [mem_files, soc, chameleon96]
    parameters : [memfile, memsize]
    tools:
      quartus:
        family : Cyclone V
        device : 5CSEBA6U19I7
        board_device_index : 2
    toplevel: CV_96

  cmod_a7_35t:
    description: Digilent CMOD A7-35
    filesets : [mem_files, soc, cmod_a7_35t]
    flow: vivado
    flow_options:
      part : xc7a35tcpg236-1
    parameters : [memfile, memsize]
    toplevel : servant_cmod_a7

  cyc1000:
    default_tool: quartus
    description: cyc1000 FPGA board
    filesets : [mem_files, soc, cyc1000]
    parameters : [memfile, memsize=32768]
    tools:
      quartus:
        family : Cyclone 10 LP
        device : 10CL025YU256C8G
    toplevel : servclone10

  de0_nano:
    default_tool : quartus
    description: Terasic DE0 Nano
    filesets : [mem_files, soc, de0_nano]
    parameters : [memfile, memsize]
    tools:
      quartus:
        family : Cyclone IV E
        device : EP4CE22F17C6
    toplevel: servive

  de10_nano:
    default_tool: quartus
    description: Terasic DE10 Nano Kit
    filesets : [mem_files, soc, de10_nano]
    parameters : [memfile, memsize=32768]
    tools:
      quartus:
        family : Cyclone V
        device : 5CSEBA6U23I7
        board_device_index : 2
    toplevel : servive

  deca:
    default_tool : quartus
    description: DECA development kit by Arrow / Terasic
    filesets : [mem_files, soc, deca]
    parameters : [memfile, memsize]
    tools:
      quartus:
        family : MAX 10
        device : 10M50DAF484C6GES
    toplevel: servive

  ebaz4205:
    default_tool: vivado
    description: EBAZ4205 'Development' Board
    filesets : [mem_files, soc, ebaz4205]
    parameters : [memfile, memsize, frequency=16]
    tools:
      vivado: {part : xc7z010clg400-1}
    toplevel : servix_ebaz4205

  ecp5_evn:
    default_tool: trellis
    description : ECP5 evaluation board
    filesets : [mem_files, soc, ecp5_evn]
    parameters : [memfile, memsize]
    tools:
      trellis:
        nextpnr_options : [--package, CABGA381, --um5g-85k]
    toplevel: servant_ecp5_evn

  go_board:
    default_tool : icestorm
    description: Nandland Go Board
    filesets : [mem_files, soc, go_board]
    tools:
      icestorm:
        nextpnr_options : [--hx1k, --package, vq100, --freq, 20]
        pnr: next
    toplevel : service_go_board

  icebreaker:
    default_tool : icestorm
    description: 1Bit Squared iCEBreaker
    filesets : [mem_files, soc, service, icebreaker]
    generate: [ice40pll : {freq_out : 16}]
    parameters : [memfile, memsize, PLL=ICE40_PAD]
    tools:
      icestorm:
        nextpnr_options: [--up5k, --freq, 16]
        pnr: next
    toplevel : service

  icestick:
    default_tool : icestorm
    description: Lattice iCEstick
    filesets : [mem_files, soc, service, icestick]
    generate: [ice40pll: {freq_in : 12, freq_out : 32}]
    parameters : [memfile=blinky.hex, memsize=7168, PLL=ICE40_CORE]
    tools:
      icestorm:
        nextpnr_options : [--hx1k, --package, tq144, --freq, 32]
        pnr: next
    toplevel : service

  icesugar:
    default_tool : icestorm
    description : iCE40UP5K Development Board by MuseLab
    filesets : [mem_files, soc, service, icesugar]
    generate: [ice40pll : {freq_in : 12, freq_out : 32}]
    parameters : [memfile, memsize, PLL=ICE40_PAD]
    tools:
      icestorm:
        nextpnr_options: [--up5k, --package, sg48, --freq, 32]
        pnr: next
    toplevel : service

  icev_wireless:
    default_tool : icestorm
    description: ICE-V Wireless
    filesets : [mem_files, soc, service, icev_wireless]
    generate: [ice40pll : {freq_out : 16}]
    parameters : [memfile, memsize, PLL=ICE40_PAD]
    tools:
      icestorm:
        nextpnr_options: [--up5k, --freq, 16]
        pnr: next
    toplevel : service

  gmm7550:
    default_tool: gatemate
    description: CologneChip GateMate FPGA Module
    filesets : [mem_files, soc, gmm7550]
    parameters : [memfile=blinky.hex, memsize=8192]
    toplevel : servant_gmm7550
    flow: gatemate
    flow_options:
        device : CCGM1A1

  lint:
    description: Run static code checks (linting)
    filesets : [soc]
    flow: lint
    flow_options:
      tool : verilator
    parameters : [width]
    toplevel : servant

  lx9_microboard:
    default_tool: ise
    description : LX9 Microboard
    filesets : [mem_files, soc, lx9_microboard]
    parameters : [memfile, memsize]
    tools:
      ise:
        family  : Spartan6
        device  : xc6slx9
        package : csg324
        speed   : -2
    toplevel : servant_lx9

  machdyne_kolibri:
    default_tool: icestorm
    description : Machdyne Kolibri FPGA Dongle
    filesets : [mem_files, soc, machdyne_kolibri]
    parameters : [memfile, memsize]
    tools:
      icestorm:
        nextpnr_options : [--hx4k, --package, bg121, --freq, 48]
        pnr: next
    toplevel : servant_md_kolibri

  max10_10m08evk:
    default_tool : quartus
    description: MAX10 10M08 evaluation kit
    hooks:
      post_run: [jbc]
    filesets : [mem_files, soc, max10_10m08evk]
    parameters : [memfile, memsize]
    tools:
      quartus:
        family : MAX 10
        device : 10M08SAE144C8G
    toplevel: servive

  nexys_2_500:
    default_tool: ise
    description: Digilent Nexys 2-500
    filesets : [mem_files, soc, nexys_2]
    parameters : [memfile, memsize, compressed]
    tools:
      ise:
        family  : Spartan3E
        device  : xc3s500e
        package : fg320
        speed   : -4
    toplevel : servax

  nexys_2_1200:
    default_tool: ise
    description: Digilent Nexys 2-1200
    filesets : [mem_files, soc, nexys_2]
    parameters : [memfile, memsize, compressed]
    tools:
      ise:
        family  : Spartan3E
        device  : xc3s1600e
        package : fg320
        speed   : -4
    toplevel : servax

  nexys_a7:
    description: Digilent Nexys A7
    filesets : [mem_files, soc, nexys_a7]
    flow: vivado
    flow_options:
      part : xc7a100tcsg324-1
    parameters : [memfile, memsize, frequency=32]
    toplevel : servix

  orangecrab_r0.2:
    default_tool: trellis
    description : OrangeCrab R0.2
    filesets : [mem_files, soc, orangecrab]
    parameters : [memfile, memsize]
    tools:
      trellis:
        nextpnr_options : [--package, CSFBGA285, --25k]
    toplevel: servant_orangecrab

  pipistrello:
    default_tool: ise
    description : Saanlima pipistrello
    filesets : [mem_files, soc, pipistrello]
    parameters : [memfile, memsize]
    tools:
      ise:
        family  : Spartan6
        device  : xc6slx45
        package : csg324
        speed   : -3
    toplevel : servis

  polarfire_splashkit:
    default_tool: libero
    description : Microsemi Polarfire Splash Kit
    filesets : [mem_files, soc, polarfire_splashkit]
    parameters : [memfile, memsize]
    tools:
      libero:
        family : PolarFire
        die : MPF300TS
        package : FCG484
    toplevel : servant_pf

  sim:
    default_tool: icarus
    description: Simulation target
    filesets : [soc, servant_tb]
    parameters :
      - RISCV_FORMAL
      - width
      - "mdu? (MDU=1)"
      - SERV_CLEAR_RAM=true
      - firmware
      - memsize
    toplevel : servant_tb

  sockit:
    default_tool : quartus
    description: SoCKit development kit by Arrow / Terasic
    filesets : [mem_files, soc, sockit]
    parameters : [memfile, memsize]
    tools:
      quartus:
        family : CycloneV
        device : 5CSXFC6D6F31C6
    toplevel: servive

  te0802:
    default_tool: vivado
    description : Trenz Electronic TE0802
    filesets : [mem_files, soc, te0802]
    parameters : [memfile, memsize]
    tools:
      vivado: {part : xczu2cg-sbva484-1-e}
    toplevel : servant_te0802

  tinyfpga_bx:
    description: TinyFPGA BX
    filesets : [mem_files, soc, service, tinyfpga_bx]
    flow: icestorm
    flow_options:
      nextpnr_options : [--lp8k, --package, cm81, --freq, '32']
    generate: [ice40pll: {freq_in : 16, freq_out : 32}]
    parameters : [memfile, memsize, PLL=ICE40_CORE]
    toplevel : service

  ulx3s_85:
    default_tool: diamond
    description : ULX3S 85k version
    filesets : [mem_files, soc, ulx3s]
    parameters : [memfile, memsize]
    tools:
      diamond:
        part : LFE5U-85F-6BG381C
      trellis:
        nextpnr_options : [--package, CABGA381, --85k]
    toplevel: servant_ecp5

  upduino2:
    default_tool : icestorm
    description: Upduino2
    filesets : [mem_files, soc, upduino2]
    parameters : [memfile, memsize]
    tools:
      icestorm:
        nextpnr_options: [--package, sg48, --up5k, --freq, 24]
        pnr: next
    toplevel : servant_upduino2

  verilator_tb:
    description: Verilator testbench
    filesets : [soc, verilator_tb]
    flow: sim
    flow_options:
      tool: verilator
      verilator_options : [--trace]
    parameters :
      - RISCV_FORMAL
      - "mdu? (MDU=1)"
      - cps
      - firmware
      - memsize
      - signature
      - timeout
      - trace_pc
      - uart_baudrate
      - vcd
      - vcd_start
      - width
      - compressed
      - align
      - with_csr=1
    toplevel : servant_sim

  zcu106:
    default_tool: vivado
    description : Zynq UltraScale+ MPSoC ZCU106 Evaluation Kit
    filesets : [mem_files, soc, zcu106]
    parameters : [memfile, memsize]
    tools:
      vivado: {part : xczu7ev-ffvc1156-2-e}
    toplevel : servus

parameters:
  align:
    datatype    : int
    description : Enable/Disable the Misaligned access of instruction
    paramtype   : vlogparam

  compressed:
    datatype    : int
    description : Enable/Disable the Compressed extension
    paramtype   : vlogparam

  cps:
    datatype : bool
    description: Write simulated cycles per second to a text file named cps
    paramtype : plusarg

  firmware:
    datatype : file
    description : Preload RAM with a hex file at runtime (overrides memfile)
    paramtype : plusarg

  frequency:
    datatype    : int
    description : PLL output frequency in MHz
    paramtype   : vlogparam

  MDU:
    datatype  : int
    description : Enables RISC-V standard M-extension
    paramtype : vlogdefine

  memfile:
    datatype    : file
    description : Preload RAM with a hex file at compile-time
    paramtype   : vlogparam

  memsize:
    datatype    : int
    default     : 8192
    description : Memory size in bytes for RAM (default 8kiB)
    paramtype   : vlogparam

  PLL:
    datatype : str
    description : PLL type to use for main clock generation
    paramtype : vlogparam

  RISCV_FORMAL:
    datatype  : bool
    paramtype : vlogdefine

  SERV_CLEAR_RAM:
    datatype  : bool
    paramtype : vlogdefine

  signature:
    datatype : file
    paramtype : plusarg

  timeout:
    datatype : int
    paramtype : plusarg

  trace_pc:
    datatype : bool
    paramtype : plusarg

  uart_baudrate:
    datatype : int
    description : Treat q output as an UART with the specified baudrate (0 or omitted parameter disables UART decoding)
    paramtype : plusarg

  vcd:
    datatype : bool
    paramtype : plusarg

  vcd_start:
    datatype    : int
    description : Delay start of VCD dumping until the specified time
    paramtype   : plusarg

  width:
    datatype    : int
    description : Interal datapath width (1=SERV, 4=QERV)
    paramtype   : vlogparam

  with_csr:
    datatype    : int
    description : Enable/Disable CSR support
    paramtype   : vlogparam

  WITH_RESET:
    datatype    : bool
    default     : true
    description : Enable reset input (for supported targets)
    paramtype   : vlogdefine

generate:
  ice40pll:
    generator: icepll

scripts:
  jbc:
    cmd : [quartus_jbcc, "-n", servant_1_2_1_pof.jam, servant_1_2_1_pof.jbc]

