Cerata
A library to generate structural hardware designs
signal.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 <memory>
20 
21 #include "cerata/node.h"
22 
23 namespace cerata {
24 
30 class Signal : public NormalNode, public Synchronous {
31  public:
33  Signal(std::string name, std::shared_ptr<Type> type, std::shared_ptr<ClockDomain> domain = default_domain());
35  std::shared_ptr<Object> Copy() const override;
36 
37  std::string ToString() const override;
38 };
39 
41 std::shared_ptr<Signal> signal(const std::string &name,
42  const std::shared_ptr<Type> &type,
43  const std::shared_ptr<ClockDomain> &domain = default_domain());
45 std::shared_ptr<Signal> signal(const std::shared_ptr<Type> &type,
46  const std::shared_ptr<ClockDomain> &domain = default_domain());
47 
48 } // namespace cerata
cerata::Signal::ToString
std::string ToString() const override
Return a human-readable string of this node.
Definition: signal.cc:32
cerata::Signal::Signal
Signal(std::string name, std::shared_ptr< Type > type, std::shared_ptr< ClockDomain > domain=default_domain())
Signal constructor.
Definition: signal.cc:23
cerata::Signal::Copy
std::shared_ptr< Object > Copy() const override
Create a copy of this Signal.
Definition: signal.cc:26
cerata::Signal
A Signal Node.
Definition: signal.h:30
cerata
Contains every Cerata class, function, etc...
Definition: api.h:41
cerata::Synchronous
Class to mark nodes with information for synchronous designs, e.g. clock domain.
Definition: domain.h:46
cerata::Named::name
std::string name() const
Return the name of the object.
Definition: utils.h:45
cerata::NormalNode
A single-input, multiple-outputs node.
Definition: node.h:167
cerata::default_domain
std::shared_ptr< ClockDomain > default_domain()
Return a static default clock domain.
Definition: domain.cc:28
cerata::Synchronous::domain
std::shared_ptr< ClockDomain > domain() const
Return the clock domain to which something is synchronized.
Definition: domain.h:51
cerata::signal
std::shared_ptr< Signal > signal(const std::string &name, const std::shared_ptr< Type > &type, const std::shared_ptr< ClockDomain > &domain)
Create a new Signal and return a smart pointer to it.
Definition: signal.cc:36
cerata::Node::type
Type * type() const
Return the node Type.
Definition: node.h:57