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 <map>
25#include <memory>
26#include <optional>
27#include <string>
28
29namespace circt {
30namespace arc {
31namespace runtime {
32namespace impl {
33
35public:
36 ModelInstance() = delete;
37 ModelInstance(const ArcRuntimeModelInfo *modelInfo, const char *args,
40
41 const char *getModelName() const {
42 return !!modelInfo->modelName ? modelInfo->modelName : "<NULL>";
43 }
44
45 void onInitialized(ArcState *mutableState);
46 void onEval(ArcState *mutableState);
47 uint64_t *swapTraceBuffer();
48
49private:
50 void parseArgs(const char *args);
51 std::filesystem::path getTraceFilePath(const std::string &suffix);
52
53 const uint64_t instanceID;
55 const ArcState *const state;
56 std::map<std::string, std::optional<std::string>> arguments;
57 // FST is always in the enum so headers don't depend on build configuration.
58 // If FST is selected at runtime but not compiled in, an error is emitted.
59 enum class TraceMode { DUMMY, VCD, FST };
61 std::unique_ptr<TraceEncoder> traceEncoder;
62 bool verbose = false;
63 uint64_t stepCounter = 0;
64};
65
66} // namespace impl
67} // namespace runtime
68} // namespace arc
69} // namespace circt
70
71#endif // CIRCT_DIALECT_ARC_RUNTIME_MODELINSTANCE_H
std::filesystem::path getTraceFilePath(const std::string &suffix)
void onEval(ArcState *mutableState)
std::unique_ptr< TraceEncoder > traceEncoder
std::map< std::string, std::optional< std::string > > arguments
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