Cerata
A library to generate structural hardware designs
vhdl.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 <vector>
18 #include <string>
19 #include <utility>
20 
21 #include "cerata/vhdl/architecture.h"
22 #include "cerata/vhdl/block.h"
23 #include "cerata/vhdl/declaration.h"
24 #include "cerata/vhdl/design.h"
25 #include "cerata/vhdl/instantiation.h"
26 #include "cerata/vhdl/resolve.h"
27 #include "cerata/vhdl/defaults.h"
28 #include "cerata/vhdl/template.h"
29 
30 #include "cerata/output.h"
31 #include "cerata/logging.h"
32 
34 namespace cerata::vhdl {
35 
36 // Metadata that this back-end understands
37 namespace meta {
39 constexpr char BACKUP_EXISTING[] = "vhdl_backup";
41 constexpr char PRIMITIVE[] = "vhdl_primitive";
43 constexpr char LIBRARY[] = "vhdl_library";
45 constexpr char PACKAGE[] = "vhdl_package";
47 constexpr char NAME[] = "vhdl_name";
49 constexpr char FORCE_VECTOR[] = "vhdl_force_vector";
51 constexpr char WAS_EXPANDED[] = "vhdl_expanded_stream_done";
53 constexpr char EXPAND_TYPE[] = "vhdl_expand_stream";
55 constexpr char NO_INSERT_SIGNAL[] = "vhdl_no_insert_signal";
56 } // namespace meta
57 
60  public:
62  std::string notice_;
63 
65  explicit VHDLOutputGenerator(std::string root_dir,
66  std::vector<OutputSpec> outputs = {},
67  std::string notice = "")
68  : OutputGenerator(std::move(root_dir), std::move(outputs)), notice_(std::move(notice)) {}
69 
71  void Generate() override;
72 
74  std::string subdir() override { return DEFAULT_SUBDIR; }
75 };
76 
77 } // namespace cerata::vhdl
cerata::vhdl::VHDLOutputGenerator::Generate
void Generate() override
Generate the output.
Definition: vhdl.cc:28
cerata::vhdl::VHDLOutputGenerator::notice_
std::string notice_
Copyright notice to place on top of a file.
Definition: vhdl.h:62
cerata::vhdl::VHDLOutputGenerator::VHDLOutputGenerator
VHDLOutputGenerator(std::string root_dir, std::vector< OutputSpec > outputs={}, std::string notice="")
Construct a new VHDLOutputGenerator.
Definition: vhdl.h:65
cerata::OutputGenerator
Abstract class to generate language specific output from Graphs.
Definition: output.h:38
cerata::vhdl::VHDLOutputGenerator::subdir
std::string subdir() override
Return that the VHDLOutputGenerator will place the files in.
Definition: vhdl.h:74
cerata::vhdl::VHDLOutputGenerator
VHDL Output Generator.
Definition: vhdl.h:59
cerata::OutputGenerator::OutputGenerator
OutputGenerator(std::string root_dir, std::vector< OutputSpec > outputs={})
Construct an OutputGenerator.
Definition: output.cc:23
cerata::vhdl::DEFAULT_SUBDIR
constexpr char DEFAULT_SUBDIR[]
Default subdirectory for output generation.
Definition: defaults.h:20
cerata::vhdl
Contains everything related to the VHDL back-end.
Definition: architecture.cc:31