 |
Cerata
A library to generate structural hardware designs
|
15 #include "cerata/port.h"
22 std::shared_ptr<Port>
port(
const std::string &name,
23 const std::shared_ptr<Type> &type,
25 const std::shared_ptr<ClockDomain> &domain) {
26 return std::make_shared<Port>(name, type, dir, domain);
29 std::shared_ptr<Port>
port(
const std::shared_ptr<Type> &type,
31 const std::shared_ptr<ClockDomain> &domain) {
32 return std::make_shared<Port>(type->name(), type, dir, domain);
41 Port::Port(std::string name, std::shared_ptr<Type> type,
Term::Dir dir, std::shared_ptr<ClockDomain> domain)
45 for (
auto &e :
edges()) {
59 case OUT:
return "out";
69 CERATA_LOG(FATAL,
"Corrupted terminator direction.");
std::shared_ptr< Object > Copy() const override
Deep-copy the port.
Port & Reverse()
Invert the direction of this port. Removes any edges.
std::unordered_map< std::string, std::string > meta
KV storage for metadata of tools or specific backend implementations.
A terminator structure to enable terminator sanity checks.
static std::string str(Dir dir)
Convert a Dir to a human-readable string.
Dir dir() const
Return the direction of this terminator.
Contains every Cerata class, function, etc...
std::shared_ptr< Type > type_
The Type of this Node.
Class to mark nodes with information for synchronous designs, e.g. clock domain.
std::string name() const
Return the name of the object.
NodeID
Node type IDs with different properties.
virtual std::vector< Edge * > edges() const
Return all edges this Node is on.
std::shared_ptr< ClockDomain > domain_
The clock domain.
A single-input, multiple-outputs node.
std::string ToString() const override
Return a human-readable string of this node.
static Dir Reverse(Dir dir)
Return the inverse of a direction.
Port(std::string name, std::shared_ptr< Type > type, Term::Dir dir, std::shared_ptr< ClockDomain > domain)
Construct a new port.
Dir dir_
The direction of this terminator.
A port is a terminator node on a graph.
std::shared_ptr< Port > port(const std::string &name, const std::shared_ptr< Type > &type, Term::Dir dir, const std::shared_ptr< ClockDomain > &domain)
Make a new port with some name, type and direction.
Type * type() const
Return the node Type.
bool RemoveEdge(Edge *edge) override
Remove an edge from this node.