CIRCT 22.0.0git
Loading...
Searching...
No Matches
Macros | Functions
ArcRuntime.cpp File Reference
#include "circt/Dialect/Arc/Runtime/ArcRuntime.h"
#include "circt/Dialect/Arc/Runtime/Common.h"
#include "circt/Dialect/Arc/Runtime/IRInterface.h"
#include "circt/Dialect/Arc/Runtime/ModelInstance.h"
#include <cassert>
#include <cstdlib>
#include <iostream>
Include dependency graph for ArcRuntime.cpp:

Go to the source code of this file.

Macros

#define ARC_RUNTIME_ENABLE_EXPORT
 

Functions

static void internalError (const char *message)
 
static ModelInstancegetModelInstance (ArcState *instance)
 
ArcStatearcRuntimeAllocateInstance (const ArcRuntimeModelInfo *model, const char *args)
 
void arcRuntimeDeleteInstance (ArcState *instance)
 Destroy and deallocate the state of a model instance.
 
uint64_t arcRuntimeGetAPIVersion ()
 Return the API version of the runtime library.
 
void arcRuntimeOnEval (ArcState *instance)
 Pre-Eval hook. Must be called by the driver once before every eval step.
 
ArcStatearcRuntimeGetStateFromModelState (uint8_t *modelState, uint64_t offset)
 Project a pointer to the model state to its ArcState container.
 
uint8_t * arcRuntimeIR_allocInstance (const ArcRuntimeModelInfo *model, const char *args)
 Allocate and initialize the state for a new instance of the given hardware model.
 
void arcRuntimeIR_onEval (uint8_t *modelState)
 Pre-Eval hook of the runtime library.
 
void arcRuntimeIR_deleteInstance (uint8_t *modelState)
 Destroy and deallocate the state of a model instance.
 

Macro Definition Documentation

◆ ARC_RUNTIME_ENABLE_EXPORT

#define ARC_RUNTIME_ENABLE_EXPORT

Definition at line 14 of file ArcRuntime.cpp.

Function Documentation

◆ arcRuntimeAllocateInstance()

ArcState * arcRuntimeAllocateInstance ( const ArcRuntimeModelInfo model,
const char *  args 
)

◆ arcRuntimeDeleteInstance()

void arcRuntimeDeleteInstance ( ArcState instance)

Destroy and deallocate the state of a model instance.

Definition at line 61 of file ArcRuntime.cpp.

References ArcState::impl.

Referenced by arcRuntimeIR_deleteInstance().

◆ arcRuntimeGetAPIVersion()

uint64_t arcRuntimeGetAPIVersion ( )

Return the API version of the runtime library.

Definition at line 67 of file ArcRuntime.cpp.

References ARC_RUNTIME_API_VERSION.

◆ arcRuntimeGetStateFromModelState()

ArcState * arcRuntimeGetStateFromModelState ( uint8_t *  modelState,
uint64_t  offset 
)

Project a pointer to the model state to its ArcState container.

offset is the byte offset of the given pointer within the model state.

Definition at line 73 of file ArcRuntime.cpp.

References ARC_RUNTIME_MAGIC, internalError(), and ArcState::magic.

Referenced by arcRuntimeIR_deleteInstance(), and arcRuntimeIR_onEval().

◆ arcRuntimeIR_allocInstance()

uint8_t * arcRuntimeIR_allocInstance ( const ArcRuntimeModelInfo model,
const char *  args 
)

Allocate and initialize the state for a new instance of the given hardware model.

This function must allocate an ArcState struct with at least model->numStateBytes bytes provided for the modelState array. It must return the pointer to the zero initialized model state which is required to be 16-byte-aligned.

args is a zero terminated string containing implementation specific options for the new instance or null.

Definition at line 86 of file ArcRuntime.cpp.

References arcRuntimeAllocateInstance(), and ArcState::modelState.

◆ arcRuntimeIR_deleteInstance()

void arcRuntimeIR_deleteInstance ( uint8_t *  modelState)

Destroy and deallocate the state of a model instance.

This function is responsible for releasing all resources that previously have been allocated by arcRuntimeIR_allocInstance.

Definition at line 96 of file ArcRuntime.cpp.

References arcRuntimeDeleteInstance(), and arcRuntimeGetStateFromModelState().

◆ arcRuntimeIR_onEval()

void arcRuntimeIR_onEval ( uint8_t *  modelState)

Pre-Eval hook of the runtime library.

Simulation drivers must call this once before every invocation of the model's eval function.

Definition at line 92 of file ArcRuntime.cpp.

References arcRuntimeGetStateFromModelState(), and arcRuntimeOnEval().

◆ arcRuntimeOnEval()

void arcRuntimeOnEval ( ArcState instance)

Pre-Eval hook. Must be called by the driver once before every eval step.

Definition at line 69 of file ArcRuntime.cpp.

References getModelInstance(), and circt::arc::runtime::ModelInstance::onEval().

Referenced by arcRuntimeIR_onEval().

◆ getModelInstance()

static ModelInstance * getModelInstance ( ArcState instance)
inlinestatic

Definition at line 38 of file ArcRuntime.cpp.

References assert(), and ArcState::impl.

Referenced by arcRuntimeOnEval().

◆ internalError()

static void internalError ( const char *  message)
static

Definition at line 32 of file ArcRuntime.cpp.

References assert().

Referenced by arcRuntimeAllocateInstance(), and arcRuntimeGetStateFromModelState().