15 #include "fletchgen/kernel.h"
17 #include <cerata/api.h>
22 #include "fletchgen/basic_types.h"
23 #include "fletchgen/mmio.h"
24 #include "fletchgen/array.h"
25 #include "fletchgen/external.h"
32 cerata::NodeMap rebinding;
33 for (
const auto &fp : field_ports) {
35 auto copied_port =
dynamic_cast<FieldPort *
>(fp->CopyOnto(
kernel, fp->name(), &rebinding));
36 copied_port->Reverse();
41 const std::vector<std::shared_ptr<RecordBatch>> &recordbatches,
42 const std::shared_ptr<Component> &
mmio)
43 : Component(std::move(name)) {
48 auto iw = index_width();
49 auto tw = tag_width();
54 for (
const auto &r : recordbatches) {
56 CopyFieldPorts(
this, *r, FieldPort::Function::ARROW);
57 CopyFieldPorts(
this, *r, FieldPort::Function::UNLOCK);
62 auto rb_cmds = r->GetFieldPorts(FieldPort::Function::COMMAND);
63 for (
auto &rb_cmd : rb_cmds) {
67 kernel_cmd->Reverse();
73 for (
const auto &p :
mmio->GetAll<Port>()) {
78 auto kernel_port = std::dynamic_pointer_cast<MmioPort>(p->Copy());
79 kernel_port->Reverse();
80 kernel_port->SetName(
mmio_port->reg.name);
87 auto ext = external();
89 Add(cerata::port(
"ext", ext.value(), Port::Dir::OUT));
93 std::shared_ptr<Kernel>
kernel(
const std::string &name,
94 const std::vector<std::shared_ptr<RecordBatch>> &recordbatches,
95 const std::shared_ptr<Component> &
mmio) {
96 return std::make_shared<Kernel>(name, recordbatches,
mmio);
Contains all classes and functions related to Fletchgen.
std::shared_ptr< MmioPort > mmio_port(Port::Dir dir, const MmioReg ®, const std::shared_ptr< ClockDomain > &domain)
Create an mmio port.
std::shared_ptr< ClockDomain > kernel_cd()
Fletcher accelerator clock domain.
std::shared_ptr< Type > cr()
Fletcher clock/reset;.
std::shared_ptr< Kernel > kernel(const std::string &name, const std::vector< std::shared_ptr< RecordBatch >> &recordbatches, const std::shared_ptr< Component > &mmio)
Make a kernel component based on RecordBatch and MMIO components.
bool ExposeToKernel(MmioFunction fun)
Return true if an mmio register's function must cause it to be exposed to the user kernel.
std::shared_ptr< RecordBatch > record_batch(const std::string &name, const std::shared_ptr< FletcherSchema > &fletcher_schema, const fletcher::RecordBatchDescription &batch_desc)
Make a new RecordBatch(Reader/Writer) component, based on a Fletcher schema.
std::shared_ptr< FieldPort > command_port(const std::shared_ptr< FletcherSchema > &schema, const std::shared_ptr< arrow::Field > &field, const std::shared_ptr< Node > &index_width, const std::shared_ptr< Node > &tag_width, std::optional< std::shared_ptr< Node >> addr_width, const std::shared_ptr< ClockDomain > &domain)
Construct a field-derived command port.
std::shared_ptr< Component > mmio(const std::vector< fletcher::RecordBatchDescription > &batches, const std::vector< MmioReg > ®s, Axi4LiteSpec axi_spec)
Generate the MMIO component for the nucleus.
Function
Enumeration of FieldPort functions.
Kernel(std::string name, const std::vector< std::shared_ptr< RecordBatch >> &recordbatches, const std::shared_ptr< Component > &mmio)
Construct a new kernel.
A port on the vhdmmio component. Remembers what register spec it came from.