CIRCT  18.0.0git
Types.h
Go to the documentation of this file.
1 //===- Types.h - ESI type system -------------------------------*- C++ -*-===//
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 // DO NOT EDIT!
10 // This file is distributed as part of an ESI package. The source for this file
11 // should always be modified within CIRCT.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 // NOLINTNEXTLINE(llvm-header-guard)
16 #ifndef ESI_TYPES_H
17 #define ESI_TYPES_H
18 
19 #include <any>
20 #include <assert.h>
21 #include <cstdint>
22 #include <map>
23 #include <memory>
24 #include <optional>
25 #include <stdexcept>
26 #include <string>
27 #include <vector>
28 
29 namespace esi {
30 
31 /// Root class of the ESI type system.
32 class Type {
33 public:
34  using ID = std::string;
35  Type(const ID &id) : id(id) {}
36  virtual ~Type() = default;
37 
38  ID getID() { return id; }
39 
40 protected:
41  ID id;
42 };
43 
44 /// Bundles represent a collection of channels. Services exclusively expose
45 /// bundles (sometimes of just one channel). As such, they are the type of
46 /// accessible ports on an accelerator, from a host API perspective.
47 /// TODO: Add a good description of direction?
48 class BundleType : public Type {
49 public:
50  enum Direction { To, From };
51 
52  using ChannelVector =
53  std::vector<std::tuple<std::string, Direction, const Type &>>;
54 
55  BundleType(const ID &id, const ChannelVector &channels)
56  : Type(id), channels(channels) {}
57 
58  const ChannelVector &getChannels() const { return channels; }
59 
60 protected:
62 };
63 
64 } // namespace esi
65 
66 #endif // ESI_TYPES_H
Bundles represent a collection of channels.
Definition: Types.h:48
BundleType(const ID &id, const ChannelVector &channels)
Definition: Types.h:55
const ChannelVector & getChannels() const
Definition: Types.h:58
ChannelVector channels
Definition: Types.h:61
std::vector< std::tuple< std::string, Direction, const Type & > > ChannelVector
Definition: Types.h:53
Root class of the ESI type system.
Definition: Types.h:32
ID id
Definition: Types.h:41
virtual ~Type()=default
Type(const ID &id)
Definition: Types.h:35
std::string ID
Definition: Types.h:34
ID getID()
Definition: Types.h:38
Definition: esi.py:1