6.2. Adding ports

Two ports are required for this component. See Figure 6.1:

Both ports use serial data and they must therefore use the SerialData protocol that is provided in Fast Model Portfolio.

Add the ports to the component:

  1. In the Block Diagram view of the SerialCharDoubler component, right click into the blank diagram and select context menu item Add port...

  2. The Self Port dialog is displayed. See Figure 6.2. Enter in for the ports Instance Name.

    Figure 6.2. Self Port dialog

    Self Port dialog

  3. For Type select Slave Port.

  4. To choose the protocol, click the Select... button Protocol. Select SerialData from the displayed list and click OK.

    Figure 6.3. Select Protocol dialog

    Select Protocol dialog

  5. Leave the Self Port dialog by pressing the OK button. A port is added to the block diagram. Click to drop the port on the canvas.

  6. Repeat the procedure for the out master port:

    • Instance Name is out

    • Type is Master Port

    • Protocol is SerialData.

  7. Click the Source tab for the SerialCharDoubler component. The code is updated as shown in Example 6.2:

    Example 6.2. Ports added to char doubler

    // This file was generated by System Generator Canvas
    // --------------------------------------------------
    component SerialCharDoubler
    {
        composition
        {
        }
        connection
        {
        }
        resources
        {
       		// remember whether we are inside an escape sequence
        		// which came through 'in'
            bool inEscape;
        }
        slave port<SerialData> in
    	{
    		behavior dataTransmit(uint16_t data):void
    		{
    			// TODO: place your code here
    		}
    
    		behavior dataReceive():uint16_t
    		{
    			// TODO: place your code here
    		}
    
    		behavior signalsSet(uint8_t signal):void
    		{
    			// TODO: place your code here
    		}
    
    		behavior signalsGet():uint8_t
    		{
    			// TODO: place your code here
    		}
    	}
        master port<SerialData> out;
    	{
    		behavior dataTransmit(uint16_t data):void
    		{
    			// TODO: place your code here
    		}
    
    		behavior dataReceive():uint16_t
    		{
    			// TODO: place your code here
    		}
    
    		behavior signalsSet(uint8_t signal):void
    		{
    			// TODO: place your code here
    		}
    
    		behavior signalsGet():uint8_t
    		{
    			// TODO: place your code here
    		}
    	}
    }
    
    

Copyright © 2007-2010 ARM Limited. All rights reserved.ARM DUI 0370K
Non-ConfidentialID110210