Fletchgen
The Fletcher Design Generator
mantle.h
1 // Copyright 2018-2019 Delft University of Technology
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <cerata/api.h>
18 
19 #include <string>
20 #include <unordered_map>
21 #include <memory>
22 #include <vector>
23 #include <utility>
24 
25 #include "fletchgen/kernel.h"
26 #include "fletchgen/bus.h"
27 #include "fletchgen/nucleus.h"
28 
29 namespace fletchgen {
30 
31 using cerata::Instance;
32 
36 class Mantle : public Component {
37  public:
39  explicit Mantle(std::string name,
40  const std::vector<std::shared_ptr<RecordBatch>> &recordbatches,
41  const std::shared_ptr<Nucleus> &nucleus,
42  BusDim bus_dim,
43  Axi4LiteSpec axi_spec);
45  std::shared_ptr<Nucleus> nucleus() const { return nucleus_; }
47  std::vector<Instance *> recordbatch_instances() const { return recordbatch_instances_; }
49  std::vector<std::shared_ptr<RecordBatch>> recordbatch_components() const { return recordbatch_components_; }
50 
51  protected:
55  std::shared_ptr<Nucleus> nucleus_;
57  Instance *nucleus_inst_;
59  std::vector<Instance *> recordbatch_instances_;
61  std::vector<std::shared_ptr<RecordBatch>> recordbatch_components_;
63  std::unordered_map<BusPort *, Instance *> arbiters_;
64 };
65 
75 std::shared_ptr<Mantle> mantle(const std::string &name,
76  const std::vector<std::shared_ptr<RecordBatch>> &recordbatches,
77  const std::shared_ptr<Nucleus> &nucleus,
78  BusDim bus_spec,
79  Axi4LiteSpec axi_spec);
80 
81 } // namespace fletchgen
A component that wraps a Kernel and all ArrayReaders/Writers resulting from a Schema set.
Definition: mantle.h:36
std::vector< Instance * > recordbatch_instances_
The RecordBatch instances.
Definition: mantle.h:59
std::vector< std::shared_ptr< RecordBatch > > recordbatch_components() const
Return all RecordBatch(Reader/Writer) components of this Mantle.
Definition: mantle.h:49
Mantle(std::string name, const std::vector< std::shared_ptr< RecordBatch >> &recordbatches, const std::shared_ptr< Nucleus > &nucleus, BusDim bus_dim, Axi4LiteSpec axi_spec)
Construct a Mantle based on a SchemaSet.
Definition: mantle.cc:40
std::unordered_map< BusPort *, Instance * > arbiters_
A mapping of bus port (containing the bus parameters and function) to arbiter instances.
Definition: mantle.h:63
std::shared_ptr< Nucleus > nucleus_
The Nucleus to be instantiated by this Mantle.
Definition: mantle.h:55
BusDim bus_dim_
Top-level bus dimensions.
Definition: mantle.h:53
std::shared_ptr< Nucleus > nucleus() const
Return the kernel component of this Mantle.
Definition: mantle.h:45
std::vector< std::shared_ptr< RecordBatch > > recordbatch_components_
The RecordBatch components.
Definition: mantle.h:61
Instance * nucleus_inst_
Shortcut to the instantiated Nucleus.
Definition: mantle.h:57
std::vector< Instance * > recordbatch_instances() const
Return all RecordBatch(Reader/Writer) instances of this Mantle.
Definition: mantle.h:47
Contains all classes and functions related to Fletchgen.
Definition: array.cc:29
std::shared_ptr< Mantle > mantle(const std::string &name, const std::vector< std::shared_ptr< RecordBatch >> &recordbatches, const std::shared_ptr< Nucleus > &nucleus, BusDim bus_spec, Axi4LiteSpec axi_spec)
Construct a Mantle and return a shared pointer to it.
Definition: mantle.cc:189
std::shared_ptr< Nucleus > nucleus(const std::string &name, const std::vector< std::shared_ptr< RecordBatch >> &recordbatches, const std::shared_ptr< Kernel > &kernel, const std::shared_ptr< Component > &mmio, Axi4LiteSpec axi_spec)
Make an Nucleus component based on RecordBatch components. Returns a shared pointer to the new Nucleu...
Definition: nucleus.cc:222
AXI4-lite bus specification.
Definition: axi4_lite.h:29
Holds bus interface dimensions.
Definition: bus.h:48