{#
  PCILeech header template
  Generates a unified include file for PCILeech SV packages.
  Keeps content minimal and configurable via context to avoid hardcoding.
#}
`ifndef PCILEECH_HEADER_SVH
`define PCILEECH_HEADER_SVH

// Generated by PCILeech Firmware Generator
// Version: {{ __version__ | default('dev') }}

{# Allow callers to override include list; sanitize to a list of strings #}
{%- set _default_includes = ['tlp_pkg.svh', 'bar_layout_pkg.svh'] -%}
{%- if header_includes is defined and header_includes -%}
  {%- if header_includes is string -%}
    {%- set header_includes = [header_includes] -%}
  {%- elif header_includes is mapping -%}
    {# If a mapping was provided, attempt to use a common key; otherwise fall back #}
    {%- set header_includes = header_includes.get('files', _default_includes) -%}
  {%- elif header_includes is iterable -%}
    {# Filter non-strings defensively #}
    {%- set header_includes = header_includes | select('string') | list -%}
    {%- if header_includes | length == 0 -%}
      {%- set header_includes = _default_includes -%}
    {%- endif -%}
  {%- else -%}
    {%- set header_includes = _default_includes -%}
  {%- endif -%}
{%- else -%}
  {%- set header_includes = _default_includes -%}
{%- endif -%}

{%- for inc in header_includes %}
`include "{{ inc }}"
{%- endfor %}

`endif // PCILEECH_HEADER_SVH
