 |
Cerata
A library to generate structural hardware designs
|
15 #include "cerata/stream.h"
19 #include "cerata/type.h"
31 fields_.back()->SetType(std::move(type));
37 const std::string &data_name,
38 const std::shared_ptr<Type> &data_type,
39 const std::vector<std::shared_ptr<Field>> &control)
41 for (
const auto &f : control) {
48 static auto result =
bit(
"valid");
53 static auto result =
bit(
"ready");
57 std::shared_ptr<Stream>
stream(
const std::string &name,
58 const std::string &element_name,
59 const std::shared_ptr<Type> &element_type,
60 const std::vector<std::shared_ptr<Field>> &control) {
61 return std::make_shared<Stream>(name, element_name, element_type, control);
64 std::shared_ptr<Stream>
stream(
const std::string &element_name,
const std::shared_ptr<Type> &element_type) {
65 return stream(element_name +
"_stream", element_name, element_type);
68 std::shared_ptr<Stream>
stream(
const std::shared_ptr<Type> &element_type) {
69 return stream(element_type->name(), element_type);
std::vector< std::shared_ptr< Field > > fields_
The fields of this Record.
std::shared_ptr< Field > field(const std::string &name, const std::shared_ptr< Type > &type, bool reverse, bool sep)
Create a new RecordField, and return a shared pointer to it.
static std::shared_ptr< Type > ready()
Return a 'ready' bit type.
Stream & SetElementType(std::shared_ptr< Type > type)
Set the element type of this stream.
A Record type containing zero or more fields.
Contains every Cerata class, function, etc...
int RemoveMappersTo(Type *other)
Remove all mappers to a specific type.
std::vector< std::shared_ptr< TypeMapper > > mappers_
A list of mappers that can map this type to another type.
static std::shared_ptr< Type > valid()
Return a 'valid' bit type.
std::shared_ptr< Stream > stream(const std::string &name, const std::string &element_name, const std::shared_ptr< Type > &element_type, const std::vector< std::shared_ptr< Field >> &control)
Construct a new Stream type and return a shared pointer to it.
Record & AddField(const std::shared_ptr< Field > &field, std::optional< size_t > index=std::nullopt)
Add a field to this Record.
Stream(const std::string &name, const std::string &element_name, const std::shared_ptr< Type > &element_type, const std::vector< std::shared_ptr< Field >> &control)
Stream constructor.
std::shared_ptr< Type > bit(const std::string &name)
Return a static bit type.