Unable to use # operator on nested ports

port def TestPort {
    port subPorts [10] ordered;
}

interface def TestInterface {
    end port p1 : TestPort;
    end port p2 : TestPort;

    interface connect p1.subPorts#(1) to p2.subPorts#(1);
}

This seems to upset the linter, and I am getting “(parsing-error) unexpected DECIMAL_VALUE” on both of the # operators.

Perhaps the # operator is not valid in this instance and I am misunderstanding. It seems to be working well in some of my other tests.

Thank you!

Hi Mason,

This is an interesting case. My colleague @Daumantas is better equipped to respond. I’ll draw his attention to your question.

Best,

Adam Layne, PhD

1 Like

Hi,

Expressions as interface ends are not supported by the grammar. The only valid syntax for interface ends is (<cross multiplicity>)? (<name> ::>)? <target> which does not allow indexing. The relevant grammar rule is InterfaceEnd.

Perhaps explicit end syntax is what you are looking for which allows binding values:

interface {
  end ::> p1.subPorts = p1.subPorts#(1);
  end ::> p2.subPorts = p2.subPorts#(1);
}