Cerata
A library to generate structural hardware designs
design.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 <memory>
18 #include <string>
19 #include <utility>
20 
21 #include "cerata/graph.h"
22 #include "cerata/vhdl/vhdl.h"
23 #include "cerata/vhdl/block.h"
24 #include "cerata/vhdl/defaults.h"
25 
26 namespace cerata::vhdl {
27 
29 struct Design {
33  std::string notice_;
35  std::string libs_;
36 
38  explicit Design(Component *component, std::string notice = "", std::string header = DEFAULT_LIBS)
39  : component_(component), notice_(std::move(notice)), libs_(std::move(header)) {}
40 
42  explicit Design(const std::shared_ptr<Component> &component,
43  std::string notice = "",
44  std::string header = DEFAULT_LIBS)
45  : Design(component.get(), std::move(notice), std::move(header)) {}
46 
49 };
50 
51 } // namespace cerata::vhdl
cerata::vhdl::Design
A VHDL design that can generate code for a single file.
Definition: design.h:29
cerata::Component
A Component graph.
Definition: graph.h:158
cerata::vhdl::Design::notice_
std::string notice_
A potential copyright notice to place in the header.
Definition: design.h:33
cerata::vhdl::Design::Generate
MultiBlock Generate()
Generate the design VHDL code.
Definition: design.cc:29
cerata::vhdl::DEFAULT_LIBS
constexpr char DEFAULT_LIBS[]
Default libraries to include.
Definition: defaults.h:23
cerata::vhdl::MultiBlock
A structure to hold multiple blocks.
Definition: block.h:77
cerata::vhdl::Design::Design
Design(const std::shared_ptr< Component > &component, std::string notice="", std::string header=DEFAULT_LIBS)
Design constructor.
Definition: design.h:42
cerata::vhdl::Design::component_
Component * component_
The component for this design file.
Definition: design.h:31
cerata::component
std::shared_ptr< Component > component(std::string name, const std::vector< std::shared_ptr< Object >> &objects, ComponentPool *component_pool)
Construct a Component with initial nodes.
Definition: graph.cc:248
cerata::vhdl::Design::libs_
std::string libs_
Libraries to place after the header.
Definition: design.h:35
cerata::vhdl::Design::Design
Design(Component *component, std::string notice="", std::string header=DEFAULT_LIBS)
Design constructor.
Definition: design.h:38
cerata::vhdl
Contains everything related to the VHDL back-end.
Definition: architecture.cc:31