Generated reference › API — ICoreSDK/ICoreVerification
kind: generated#api#icoresdk-icoreverification

API — ICoreSDK/ICoreVerification

The public contract of 4 header(s) under src/ICoreSDK/ICoreVerification — 7 class/struct definition(s), 25 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.

ICoreCRuntime.h#

src/ICoreSDK/ICoreVerification/CRuntime/ICoreCRuntime.h

ICoreCBlockProgram#

ICoreCRuntime.h:22 · class · pImpl · 3 declaration(s)

One compiled user program: the user's C source, prefixed with the runtime's prelude (the ICoreCMatrix struct + helpers), compiled by the system C compiler into a shared library in a private temp di...

class ICoreCBlockProgram {
public:
    ICoreCBlockProgram();
    ~ICoreCBlockProgram();

    // Reload the shared library so the user code's statics are re-zeroed
    // (called at every simulation start). False + errorOut when the reload
    // fails; the program is unusable afterwards and must be recompiled.
    bool resetState(std::string& errorOut);

    // One solver step: compute(t, u, uCount, y, yCount). Every u entry is
    // handed to the user as a row-major ICoreCMatrix; y arrives as
    // `outputCount` matrices whose rows/cols the USER must set (they start
    // at 0x0), each with a data capacity of ICORE_MAX_MATRIX_ELEMENTS
    // doubles. Unlike Python — where the returned list's length carries the
    // arity — C outputs are caller-allocated, so the expected count is a
    // parameter. Returns false with a compiler/loader/contract error message
    // without touching yOut.
    bool run(double t, const std::vector<ICoreMatrix>& u, size_t outputCount,
             std::vector<ICoreMatrix>& yOut, std::string& errorOut);

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

ICoreCRuntime#

ICoreCRuntime.h:50 · class · 2 declaration(s)

class ICoreCRuntime {
public:
    // False when no C compiler (cc / clang / gcc) is on the PATH.
    static bool isAvailable();

    // First line of `<compiler> --version` plus its path — for diagnostics.
    static std::string runtimeInfo();

    // Element capacity of every output matrix handed to compute — the
    // prelude's ICORE_MAX_MATRIX_ELEMENTS.
    static constexpr size_t MAX_MATRIX_ELEMENTS = 4096;

    // Writes prelude + user source to a temp dir, compiles it into a shared
    // library and validates it exports compute (the prelude's prototype makes
    // a wrong signature a compile error, not a mid-run surprise). Null +
    // errorOut (the compiler's stderr included) on any failure. Thread-safe;
    // may be called from the solver worker thread.
    static std::unique_ptr<ICoreCBlockProgram> compileBlockProgram(
        const std::string& sourceCode, std::string& errorOut);
};
};

ICoreCodeExportVerifier.h#

src/ICoreSDK/ICoreVerification/CodeExportVerification/ICoreCodeExportVerifier.h

ICoreVerificationResult#

ICoreCodeExportVerifier.h:10 · struct · 0 declaration(s)

struct ICoreVerificationResult {
public:
    bool passed = false;
    std::string failureReason;

    // Aligned data (time col + signal cols), ready to hand to ICoreChart::plot
    ICoreMatrix alignedEmulated;
    ICoreMatrix alignedSimulated;
    ICoreMatrix residuals;       // col0 = time, col j = emulated_j - simulated_j

    // Time metadata
    bool fixedStep = false;
    double stepTime = 0.0;       // valid if fixedStep
    double startTime = 0.0;      // start of compared window
    double endTime = 0.0;        // end of compared window
    double choppedFromStart = 0.0; // duration trimmed from the longer vector's head
    double choppedFromEnd = 0.0;   // duration trimmed from the longer vector's tail
    size_t comparedRows = 0;
    size_t signalCount = 0;      // number of non-time columns

    // Per-signal + overall stats
    double maxAbsError = 0.0;
    double rmsError = 0.0;
    double meanAbsError = 0.0;
    std::vector<double> perSignalMaxAbsError; // size = signalCount

    // Relative-error metrics: maxAbsError expressed as a percentage of the simulated signal's
    // peak (largest absolute value across the aligned simulated signal columns). residualPercent
    // is infinite when the simulated peak is ~0 but there is a non-zero error.
    double maxAbsSimulated = 0.0;
    double residualPercent = 0.0;
};
};

ICoreCodeExportVerifier#

ICoreCodeExportVerifier.h:42 · class · pImpl · 10 declaration(s)

class ICoreCodeExportVerifier {
public:
    explicit ICoreCodeExportVerifier();
    ~ICoreCodeExportVerifier();

    static ICoreVerificationResult verifyMatrices(const ICoreMatrix &emulated, const ICoreMatrix &simulated);

    static std::string resolveCompiler(const ICoreCodeExportTarget* target);

    // Generates a random pulse-train test input for the top node's input gates
    // and writes it to <project>/CodeExportTests/<name>_input.csv. The same CSV
    // drives both the native simulation and the emulated Python testbench.
    static bool generateAndExportTestInputs(const ICoreCodeExportTarget* target);

    // Builds & runs the exported testbench for the target. If compilerLog is non-null, every
    // shell command (compile/transpile/run) is appended to it with its combined stdout+stderr
    // and exit code, so the caller can surface the full toolchain output to the user.
    // Returns an empty matrix when the code could not be generated/built/run; failureReason
    // (if non-null) then carries the reason so the caller can report it instead of letting
    // the empty result surface as a misleading comparison error.
    static ICoreMatrix emulateTarget(const ICoreCodeExportTarget* target, std::string* compilerLog = nullptr,
                                     std::string* failureReason = nullptr);

    static ICoreMatrix getSimulatedSourceData(const ICoreCodeExportTarget* target);
    static std::vector<std::string> getSimulatedSignalNames(const ICoreCodeExportTarget* target);
    static std::vector<std::pair<std::string, std::string>> getSimulatedSignalMap(const ICoreCodeExportTarget* target);

    static std::vector<std::string> getAvailableVerificationLevels();

    void showUI() const;

    static const std::string VERIFICATION_TYPE_NONE;
    static const std::string VERIFICATION_TYPE_LEVEL1;
    static const std::string VERIFICATION_TYPE_LEVEL2;
    static const std::string VERIFICATION_TYPE_STRICT;

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

ICoreModelVerification.h#

src/ICoreSDK/ICoreVerification/ModelVerification/ICoreModelVerification.h

ICoreModelVerification#

ICoreModelVerification.h:9 · class · 5 declaration(s)

class ICoreModelVerification {
public:
    static bool verifyProject();
    static bool verifyAllDescendentsAreAlive(const ICoreSubsystemTreeNode* treenode);
    static bool verifyAllDescendentsHaveUniquePaths(const ICoreSubsystemTreeNode *treenode);
    static bool verifyAllLinksHaveValidRoots(const ICoreSubsystemTreeNode *treenode);
    static bool verifyConnections(const ICoreSubsystemTreeNode *treenode);
};
};

ICorePythonRuntime.h#

src/ICoreSDK/ICoreVerification/PythonRuntime/ICorePythonRuntime.h

ICorePythonBlockProgram#

ICorePythonRuntime.h:10 · class · pImpl · 3 declaration(s)

One compiled user program (a module scope that must define compute(t, u, state)).

class ICorePythonBlockProgram {
public:
    ICorePythonBlockProgram();
    ~ICorePythonBlockProgram();

    // Fresh empty `state` dict (called at every simulation start).
    void resetState();

    // One solver step: y = compute(t, u, state). Every u entry is handed to
    // the user as a 2D numpy float matrix; the returned sequence is coerced
    // back to 2D ICoreMatrix values (scalars/1D rows are promoted via
    // numpy.atleast_2d). Returns false with a Python-style error message —
    // wrong return arity/shape included — without touching yOut.
    bool run(double t, const std::vector<ICoreMatrix>& u,
             std::vector<ICoreMatrix>& yOut, std::string& errorOut);

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

ICorePythonRuntime#

ICorePythonRuntime.h:33 · class · 2 declaration(s)

class ICorePythonRuntime {
public:
    // False when the app was built without ICORE_PYTHON_EMBED (no headers /
    // libpython at build time) or the interpreter failed to boot.
    static bool isAvailable();

    // "Python 3.14.4 | numpy 2.3.5" — for diagnostics.
    static std::string runtimeInfo();

    // Compiles user source in a fresh module scope (numpy pre-imported as
    // both `np` and `numpy`) and validates it defines a callable
    // compute(t, u, state) taking exactly 3 parameters. Null + errorOut on
    // any failure. Thread-safe; may be called from the solver worker thread.
    static std::unique_ptr<ICorePythonBlockProgram> compileBlockProgram(
        const std::string& sourceCode, std::string& errorOut);
};
};