Cerata
A library to generate structural hardware designs
vhdl_types.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 <memory>
19 #include <string>
20 
21 #include "cerata/type.h"
22 #include "cerata/flattype.h"
23 #include "cerata/node.h"
24 #include "cerata/port.h"
25 
26 namespace cerata::vhdl {
27 
28 // VHDL specific type data
29 
31 std::shared_ptr<Node> GetWidth(const std::shared_ptr<Type> &type);
32 
33 // VHDL implementation specific types
34 
36 std::shared_ptr<Type> valid();
38 std::shared_ptr<Type> ready();
39 
40 // VHDL port stuff
42 std::string ToString(Term::Dir dir);
45 
51 std::vector<FlatType> FilterForVHDL(const std::vector<FlatType> &list);
52 
54 struct Range {
56  enum {
57  NIL,
60  } type = NIL;
61 
63  std::string bottom;
65  std::string top;
66 
68  std::string ToString();
69 };
70 
71 } // namespace cerata::vhdl
cerata::vhdl::Range::top
std::string top
Top of the range.
Definition: vhdl_types.h:65
cerata::vhdl::ready
std::shared_ptr< Type > ready()
A stream ready-valid handshake "ready" signal.
Definition: vhdl_types.cc:31
cerata::vhdl::valid
std::shared_ptr< Type > valid()
A stream ready-valid handshake "valid" signal.
Definition: vhdl_types.cc:25
cerata::Term::Dir
Dir
Terminator direction.
Definition: port.h:30
cerata::vhdl::Range::type
enum cerata::vhdl::Range::@0 type
Range types.
cerata::vhdl::FilterForVHDL
std::vector< FlatType > FilterForVHDL(const std::vector< FlatType > &list)
Filter abstract types from a list of flattened types.
Definition: vhdl_types.cc:53
cerata::vhdl::Range::SINGLE
@ SINGLE
For range of size 1.
Definition: vhdl_types.h:58
cerata::vhdl::Range
A VHDL range.
Definition: vhdl_types.h:54
cerata::vhdl::Range::NIL
@ NIL
For null ranges.
Definition: vhdl_types.h:57
cerata::vhdl::Range::bottom
std::string bottom
Bottom of the range.
Definition: vhdl_types.h:63
cerata::vhdl::Range::MULTI
@ MULTI
For a range of size > 1.
Definition: vhdl_types.h:59
cerata::vhdl::ToString
std::string ToString(const std::vector< Block > &blocks)
Return a vector of blocks as a single string.
Definition: block.cc:186
cerata::vhdl::GetWidth
std::shared_ptr< Node > GetWidth(const std::shared_ptr< Type > &type)
Obtain the width of a primitive, synthesizable type. If it is not primitive, returns a Literal 0 node...
cerata::vhdl::Reverse
Port::Dir Reverse(Port::Dir dir)
Reverse a terminator direction.
Definition: vhdl_types.cc:45
cerata::vhdl::Range::ToString
std::string ToString()
Return a human-readable version of the range.
Definition: vhdl_types.cc:66
cerata::vhdl
Contains everything related to the VHDL back-end.
Definition: architecture.cc:31