2.3.3 CADIProtocol protocol

This protocol supports debugging. To add breakpoint support, implement CADIBpt...() functions.


All CADIProtocol protocol behaviors, that is, all sets of functionalities, are optional. A component only has to implement the set of functions for the functionality that it intends to support.

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

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;

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

  • CADIBptSet() and CADIBptClear() add and remove breakpoints.
  • CADIBptConfigure() enable and disable breakpoints.
  • CADIBptGetList() and CADIBptRead() return the current state of the breakpoint list.

The component must also implement CADIModifyTargetFeatures. This function permits you to override the automatic default CADITargetFeatures_t that System Generator provides for this component 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:

    // 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, you can add breakpoint support. 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 automatically follows 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.

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 finishes.

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

The following function is for debugging purposes only. Do not implement it. 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;


Fast Models systems are not cycle accurate, so you usually only implement an instruction counter, if at all.
Non-ConfidentialPDF file icon PDF version100964_1110_00_en
Copyright © 2014–2020 Arm Limited or its affiliates. All rights reserved.