17 #include <cerata/api.h>
24 #include "fletchgen/basic_types.h"
28 using cerata::Instance;
29 using cerata::Component;
35 PARAM_DECL_FACTORY(bus_addr_width, 64)
36 PARAM_DECL_FACTORY(bus_data_width, 512)
37 PARAM_DECL_FACTORY(bus_len_width, 8)
38 PARAM_DECL_FACTORY(bus_burst_step_len, 4)
39 PARAM_DECL_FACTORY(bus_burst_max_len, 16)
59 [[nodiscard]] std::string
ToString()
const;
61 [[nodiscard]] std::string
ToName()
const;
72 explicit BusDimParams(
const std::shared_ptr<cerata::Graph> &parent,
74 const std::string &prefix =
"")
79 std::shared_ptr<Node>
aw;
80 std::shared_ptr<Node>
dw;
81 std::shared_ptr<Node>
lw;
82 std::shared_ptr<Node>
bs;
83 std::shared_ptr<Node>
bm;
86 [[nodiscard]] std::vector<std::shared_ptr<Object>>
all()
const;
96 [[nodiscard]] std::string
ToName()
const;
110 [[nodiscard]] std::string
ToName()
const;
117 std::shared_ptr<Type>
bus_read(
const std::shared_ptr<Node> &addr_width,
118 const std::shared_ptr<Node> &data_width,
119 const std::shared_ptr<Node> &len_width);
122 std::shared_ptr<Type>
bus_write(
const std::shared_ptr<Node> &addr_width,
123 const std::shared_ptr<Node> &data_width,
124 const std::shared_ptr<Node> &len_width);
135 std::shared_ptr<ClockDomain> domain =
bus_cd())
136 : Port(name,
bus(params), dir, std::move(domain)),
spec_(params) {}
142 std::shared_ptr<Object>
Copy()
const override;
145 std::shared_ptr<BusPort>
bus_port(
const std::string &name, Port::Dir dir,
const BusSpecParams ¶ms);
152 const std::string &prefix,
154 cerata::NodeMap *rebinding);
185 auto str = spec.ToName();
186 return std::hash<std::string>()(str);
Contains all classes and functions related to Fletchgen.
std::shared_ptr< Component > BusWriteSerializer()
Return a BusWriteSerializer component.
std::shared_ptr< Type > bus_write(const std::shared_ptr< Node > &addr_width, const std::shared_ptr< Node > &data_width, const std::shared_ptr< Node > &len_width)
Return a Cerata type for a Fletcher bus write interface.
std::shared_ptr< Type > bus_read(const std::shared_ptr< Node > &addr_width, const std::shared_ptr< Node > &data_width, const std::shared_ptr< Node > &len_width)
Return a Cerata type for a Fletcher bus read interface.
std::shared_ptr< Component > BusReadSerializer()
Return a BusReadSerializer component.
Component * bus_arbiter(BusFunction function)
Return a Cerata model of a BusArbiter.
std::shared_ptr< Type > bus(const BusSpecParams &spec)
Fletcher bus type with access mode conveyed through spec of params.
void ConnectBusParam(cerata::Graph *dst, const std::string &prefix, const BusDimParams &src, cerata::NodeMap *rebinding)
Find and connect all prefixed bus params on a graph to the supplied source params,...
std::shared_ptr< ClockDomain > bus_cd()
Fletcher bus clock domain.
std::shared_ptr< BusPort > bus_port(const std::string &name, Port::Dir dir, const BusSpecParams ¶ms)
Make a new port and return a shared pointer to it.
bool operator==(const BusSpec &lhs, const BusSpec &rhs)
Returns true if BusSpecs are equal.
BusFunction
Defines function of a bus interface (read/write).
@ READ
Interface reads from memory.
@ WRITE
Interface writes to memory.
Holds bus interface dimensions.
std::string ToString() const
Return a human-readable version of the bus dimensions.
std::string ToName() const
Return a shorter somewhat human-readable name for this BusDims, can be used for comparisons.
static BusDim FromString(const std::string &str, BusDim default_to)
Returns a BusDim from a string. See [common/cpp/include/fletcher/arrow-utils.h] for more info.
uint32_t bs
Burst step length.
uint32_t aw
Address width.
uint32_t bm
Burst max length.
Holds bus parameters based on bus dimensions, that has actual nodes representing the dimensions.
BusDim plain
Plain bus dimensions, not as nodes.
BusDimParams(const std::shared_ptr< cerata::Graph > &parent, BusDim spec=BusDim{}, const std::string &prefix="")
Construct a new bunch of bus parameters based on a bus spec and function, and add them to a graph.
std::shared_ptr< Node > aw
Value nodes.
std::shared_ptr< Node > lw
Len width node.
BusDimParams(cerata::Graph *parent, BusDim dim=BusDim{}, const std::string &prefix="")
Construct a new bunch of bus parameters based on a bus spec and function, and add them to a graph.
std::shared_ptr< Node > dw
Data width node.
std::vector< std::shared_ptr< Object > > all() const
Return all parameters as an object vector.
std::shared_ptr< Node > bs
Burst step length node.
std::shared_ptr< Node > bm
Burst max length node.
A port derived from bus parameters.
std::shared_ptr< Object > Copy() const override
Deep-copy the BusPort.
BusSpecParams spec_
The bus spec to which the type generics of the bus port are bound.
BusPort(const std::string &name, Port::Dir dir, const BusSpecParams ¶ms, std::shared_ptr< ClockDomain > domain=bus_cd())
Construct a new port based on a bus parameters..
Holds bus dimensions and function, without instantiating Cerata nodes.
BusSpec(const BusSpecParams ¶ms)
BusSpec constructor.
std::string ToName() const
Return a shorter somewhat human-readable name, can be used for comparisons.
BusDim dim
Bus dimensions.
BusSpec()=default
Default BusSpec constructor.
BusFunction func
Bus function.
Holds bus parameters and function based on bus dimensions, that has actual nodes representing the dim...
std::string ToName() const
Return a shorter somewhat human-readable name, can be used for comparisons.
BusFunction func
Bus function.
BusDimParams dim
Bus dimensions.
size_t operator()(fletchgen::BusSpec const &spec) const noexcept
Hash a BusSpec.