2.6.3. Port arrays

A LISA+ component can contain arrays of ports such as, for example, multiple interrupt ports in an IRQ controller.

It is useful to declare multiple instances of a port at the same time using the array construct:

slave port<MyType> access[2];

This declares two slave ports using the protocol MyType. In the behavior that implements the protocol MyType, an additional parameter of type unsigned int is available and denotes the port index. As an example protocol MyType has a behavior read:

protocol MyType
{
    slave behavior read(uint32_t addr, uint32_t &data)
}

Example 2.23 shows the parameter list and implementation of a read method.

Note

The portIndex parameter enables distinguishing between the different ports.

Example 2.23. Implementing read() for a port vector

slave port <MyType> access[2]
{
    behavior read( /* additional parameter */ unsigned int portIndex,
                uint32_t addr, uint32_t &data)
    {
        // implementation of read behavior
        if (portIndex == 0)
            // do something for port 0
            ;
        else
            // do something for port 1
            ;
    }
}

The length of the port must be a literal number. Expressions and parameter references are not allowed.

More details on connecting port arrays is available. See Port array connections.

Copyright © 2007-2009 ARM Limited. All rights reserved.ARM DUI 0372G
Non-Confidential