3.4.1. CADIProtocol

You must define an internal slave port of this type, and the name of this port must always be cadi_port. In this port, the following functionality can be implemented:

    optional slave behavior CADIBptGetList(uint32_t, uint32_t, uint32_t *, eslapi::CADIBptDescription_t *):eslapi::CADIReturn_t;
    optional slave behavior CADIBptRead(eslapi::CADIBptNumber_t, eslapi::CADIBptRequest_t *):eslapi::CADIReturn_t;
    optional slave behavior CADIBptSet(eslapi::CADIBptRequest_t *, eslapi::CADIBptNumber_t *):eslapi::CADIReturn_t;
    optional slave behavior CADIBptClear(eslapi::CADIBptNumber_t):eslapi::CADIReturn_t;
    optional slave behavior CADIBptConfigure(eslapi::CADIBptNumber_t, eslapi::CADIBptConfigure_t):eslapi::CADIReturn_t;
    optional slave behavior CADIModifyTargetFeatures(eslapi::CADITargetFeatures_t *):eslapi::CADIReturn_t;

All these functions need to be implemented to enable any kind of breakpoint for the component. The component needs to maintain and keep track of all existing breakpoints. For example:

The component must also implement CADIModifyTargetFeatures. This function permits you to override the automatic default CADITargetFeatures_t that is provided for this component by System Generator just before it is returned to the debugger. Specifically, a component that wants to support any kind of breakpoint must override the handledBreakpoints and nrBreakpointsAvailable fields of CADITargetFeatures_t. For example:

targetFeatures->handledBreakpoints = CADI_TARGET_FEATURE_BPT_PROGRAM | CADI_TARGET_FEATURE_BPT_REGISTER; 
// code and register breakpoints supported 
targetFeatures->nrBreakpointsAvailable = 0x7fffffff; 
// virtually infinite number of breakpoints supported.

By default, LISA components do not support any type of breakpoints. By implementing CADIBpt...() functions, breakpoint support of any kind can be added. In addition to implementing the stated functions, the component must call simBreakpointHit(bptNumber) and then simHalt() when an enabled breakpoint is hit. On a breakpoint hit the component must first call simBreakpointHit() for each breakpoint that was hit (one or more, usually just one) and then call simHalt() once after all simBreakpointHit() calls. The simHalt() call must always be the last call in the sequence.

A component that wants to provide disassembly must implement the following CADIGetDisassembler() behavior and return a CADIDisassembler interface implementation. This is automatically placed behind the CADI::CADIGetDisassembler() and the CADI::ObtainInterface(“eslapi.CADIDisassembler2”) functions.

	optional slave behavior CADIGetDisassembler():eslapi::CADIDisassembler*;

To do this, instantiate a CADIDisassemblerAdapter object in behavior init and return its address in this CADIGetDisassembler() function. This object must point to an internal slave port that implements the CADIDisassemblerProtocol protocol. See Example 3.1:

Example 3.1. Skeleton code for implementing disassembly

component FOO
{
    behavior init()
    {
        disassemblerAdapter = new CADIDisassemblerAdapter(disassPort.getAbstractInterface());
        // ...
    }
    internal slave port <CADIProtocol> cadi_port
    {
        slave behavior CADIGetDisassembler():eslapi::CADIDisassembler*
        {
            return disassemblerAdapter;
        }
        // ...
    }
    internal slave port<CADIDisassemblerProtocol> disassPort
    {
        // ...
    }
}

The following function implements the instruction stepping a component. It must set up an internal state that stops the simulation when the requested number of instructions is executed completely (exactly like a breakpoint). It must call simRun() from within CADIExecSingleStep() after setting up this stepping state, and later it must call simHalt() when the execution of the required number of instructions is finished.

    optional slave behavior CADIExecSingleStep(uint32_t instructionCount, int8_t stepCycle, int8_t stepOver):eslapi::CADIReturn_t;

The following function is used for debugging purposes only, and should not be implemented. The function must not alter the state of any component in any way.

    optional slave behavior callbackModeChange(uint32_t newMode, eslapi::CADIBptNumber_t bptNumber);

By implementing any of the following functions, the component can enable the instruction and cycle count display:

    optional slave behavior CADIGetInstructionCount(uint64_t &instructionCount):eslapi::CADIReturn_t;
    optional slave behavior CADIGetCycleCount(uint64_t &instructionCount, bool systemCycles):eslapi::CADIReturn_t;

Note

Fast Models systems are not cycle accurate, so you usually only implement an instruction counter, if at all.

Copyright © 2008-2013 ARM. All rights reserved.ARM DUI 0423O
Non-ConfidentialID060613