15 #include "fletchgen/axi4_lite.h"
17 #include <cerata/api.h>
19 #include "fletchgen/utils.h"
31 auto opt_existing_axi_typename = cerata::default_type_pool()->Get(axi_typename);
32 if (opt_existing_axi_typename) {
34 return opt_existing_axi_typename.value()->shared_from_this();
36 auto new_axi_lite_type = record(axi_typename, {
37 NoSep(field(
"aw", stream(
"addr", vector(spec.
addr_width)))),
38 NoSep(field(
"w", stream(record({field(
"data", vector(spec.
data_width)),
39 field(
"strb", vector(spec.
data_width / 8))})))),
40 NoSep(field(
"b", stream(
"resp", vector(2)))->Reverse()),
41 NoSep(field(
"ar", stream(
"addr", vector(spec.
addr_width)))),
42 NoSep(field(
"r", stream(record({field(
"data", vector(spec.
data_width)),
43 field(
"resp", vector(2))})))->Reverse())
45 cerata::default_type_pool()->Add(new_axi_lite_type);
46 return new_axi_lite_type;
51 std::stringstream str;
60 std::stringstream str;
67 std::shared_ptr<Axi4LitePort>
axi4_lite(Port::Dir dir,
const std::shared_ptr<ClockDomain> &domain,
Axi4LiteSpec spec) {
68 return std::make_shared<Axi4LitePort>(dir, spec,
"mmio", domain);
72 Port(std::move(name),
axi4_lite_type(spec), dir, std::move(domain)), spec_(spec) {}
Contains all classes and functions related to Fletchgen.
std::shared_ptr< Type > axi4_lite_type(Axi4LiteSpec spec)
AXI4-lite port type.
std::shared_ptr< Axi4LitePort > axi4_lite(Port::Dir dir, const std::shared_ptr< ClockDomain > &domain, Axi4LiteSpec spec)
Make a new AXI4-lite port, returning a shared pointer to it.
Axi4LitePort(Port::Dir dir, Axi4LiteSpec spec, std::string name="mmio", std::shared_ptr< ClockDomain > domain=cerata::default_domain())
Construct a new MmioPort.
Axi4LiteSpec spec_
The specification this port was derived from.
std::shared_ptr< Object > Copy() const override
Make a copy of this AXI4-lite port.
AXI4-lite bus specification.
std::string ToString() const
Return a human-readable representation of this Axi4LiteSpec.
std::string ToAxiTypeName() const
Return a Cerata type name based on this Axi4LiteSpec.
size_t data_width
The data width.
size_t addr_width
The address width.