Design API

  • root.hasPorts()

  • root.getPorts(): returns a list of all the ports (see port API below)

  • root.hasParameters()

  • root.getParameters(): returns a list of all the parameters (see parameter API below)

Port API

  • port.getDirection()

  • port.getData(): returns the port data (see port data API below)

  • port.isInterfacePort()

  • port.isGenericInterfacePort()

  • port.getInterface(): returns the interface for interface ports

Port Data API

  • portData.getType()

  • portData.getNetType()

  • portData.hasPackedDimension()

  • portData.getPackedDimension()

  • portData.hasUnpackedDimension()

  • portData.getUnpackedDimension()

  • portData.hasSign()

  • portData.getSign()

Parameter API

  • parameter.getInitialValue()

  • parameter.hasInitialValue()

  • parameter.isLocal()

Example

<#assign module = root>
<#assign max_port_name_chr = 0>
<#assign max_port_type_chr = 5>
<#--Determine the max length for ports -->
<#if module.hasPorts()>
        <#list module.getPorts() as port>
                <#assign port_name_chr = (port.getName())?length>
                <#if max_port_name_chr < port_name_chr>
                        <#assign max_port_name_chr = port_name_chr>
                </#if>
                <#assign port_type_chr = (port.getData().getType())?length>
                <#if max_port_type_chr < port_type_chr>
                        <#assign max_port_type_chr = port_type_chr>
                </#if>
        </#list>
</#if>
<#--print ports -->
<#if module.hasPorts()>
        <#list module.getPorts() as port>
                <#assign port_name = r"${" + port.getName() + "}">
                <#assign pad = max_port_name_chr + 3>
                <#assign data = port.getData()>
                <#assign type = data.getType()?lower_case>
                <#if !(type?has_content)>
                        <#assign type = "logic">
                </#if>
                ${type?right_pad(max_port_type_chr) + " " + port_name?right_pad(pad) + ";"}
        </#list>
</#if>