CIRCT 23.0.0git
Loading...
Searching...
No Matches
ModelInstance.h
Go to the documentation of this file.
1//===- ModelInstance.h - Instance of a model in the ArcRuntime ------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This declares the context for a model instance in the default implementation
10// of the ArcRuntime library.
11//
12// This file is implementation specific and not part of the ArcRuntime's API.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef CIRCT_DIALECT_ARC_RUNTIME_MODELINSTANCE_H
17#define CIRCT_DIALECT_ARC_RUNTIME_MODELINSTANCE_H
18
22
23#include <filesystem>
24#include <memory>
25#include <string>
26
27namespace circt {
28namespace arc {
29namespace runtime {
30namespace impl {
31
33public:
34 ModelInstance() = delete;
35 ModelInstance(const ArcRuntimeModelInfo *modelInfo, const char *args,
38
39 const char *getModelName() const {
40 return !!modelInfo->modelName ? modelInfo->modelName : "<NULL>";
41 }
42
43 void onInitialized(ArcState *mutableState);
44 void onEval(ArcState *mutableState);
45 uint64_t *swapTraceBuffer();
46
47private:
48 void parseArgs(const char *args);
49 std::filesystem::path getTraceFilePath(const std::string &suffix);
50
51 const uint64_t instanceID;
53 const ArcState *const state;
54 enum class TraceMode { DUMMY, VCD };
56 std::optional<std::string> traceFileArg;
57 std::unique_ptr<TraceEncoder> traceEncoder;
58 bool verbose = false;
59 uint64_t stepCounter = 0;
60};
61
62} // namespace impl
63} // namespace runtime
64} // namespace arc
65} // namespace circt
66
67#endif // CIRCT_DIALECT_ARC_RUNTIME_MODELINSTANCE_H
std::filesystem::path getTraceFilePath(const std::string &suffix)
void onEval(ArcState *mutableState)
std::optional< std::string > traceFileArg
std::unique_ptr< TraceEncoder > traceEncoder
void onInitialized(ArcState *mutableState)
const ArcRuntimeModelInfo *const modelInfo
Definition arc.py:1
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Static information for a compiled hardware model, generated by the MLIR lowering.
Definition Common.h:70
const char * modelName
Name of the compiled model.
Definition Common.h:76
Combined runtime and model state for a hardware model instance.
Definition Common.h:44