29 int main(
int argc,
const char *argv[]) {
32 std::cerr <<
"Expected usage: " << argv[0]
33 <<
" <backend> <connection specifier> [command]" << std::endl;
39 const char *backend = argv[1];
40 const char *conn = argv[2];
46 std::unique_ptr<AcceleratorConnection> acc =
ctxt.connect(backend, conn);
50 std::cout <<
"ESI system version: " << info.
getEsiVersion() << std::endl;
51 else if (cmd ==
"json_manifest")
52 std::cout << info.getJsonManifest() << std::endl;
53 else if (cmd ==
"info")
55 else if (cmd ==
"hier")
58 std::cout <<
"Connection successful." << std::endl;
60 std::cerr <<
"Unknown command: " << cmd << std::endl;
65 }
catch (std::exception &e) {
66 std::cerr <<
"Error: " << e.what() << std::endl;
72 std::string jsonManifest =
75 os <<
"API version: " << m.
getApiVersion() << std::endl << std::endl;
76 os <<
"********************************" << std::endl;
77 os <<
"* Module information" << std::endl;
78 os <<
"********************************" << std::endl;
84 os <<
"********************************" << std::endl;
85 os <<
"* Type table" << std::endl;
86 os <<
"********************************" << std::endl;
90 os <<
" " << i++ <<
": " << t->getID() << std::endl;
94 std::string indent =
"") {
95 os << indent <<
" " << port.
getID() <<
":";
97 if (
auto svcPortStr = svcPort->toString()) {
98 os <<
" " << *svcPortStr << std::endl;
102 for (
const auto &[name, chan] : port.
getChannels())
103 os << indent <<
" " << name <<
": " << chan.getType()->getID()
108 std::string indent =
"") {
109 os << indent <<
"* Instance:";
110 if (
auto inst =
dynamic_cast<const Instance *
>(d))
111 os << inst->getID() << std::endl;
113 os <<
"top" << std::endl;
114 os << indent <<
"* Ports:" << std::endl;
118 if (!children.empty()) {
119 os << indent <<
"* Children:" << std::endl;
130 os <<
"********************************" << std::endl;
131 os <<
"* Design hierarchy" << std::endl;
132 os <<
"********************************" << std::endl;
Abstract class representing a connection to an accelerator.
Context & getCtxt() const
ServiceClass * getService(AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
Get a typed reference to a particular service type.
Top level accelerator class.
Services provide connections to 'bundles' – collections of named, unidirectional communication channe...
const std::map< std::string, ChannelPort & > & getChannels() const
AppID getID() const
Get the ID of the port.
AcceleratorConnections, Accelerators, and Manifests must all share a context.
Represents either the top level or an instance of a hardware module.
std::vector< const Instance * > getChildrenOrdered() const
Get a vector of the module's children in a deterministic order.
std::vector< std::reference_wrapper< BundlePort > > getPortsOrdered() const
Get the module's ports in a deterministic order.
Subclass of HWModule which represents a submodule instance.
Class to parse a manifest.
const std::vector< const Type * > & getTypeTable() const
The Type Table is an ordered list of types.
uint32_t getApiVersion() const
std::vector< ModuleInfo > getModuleInfos() const
Accelerator * buildAccelerator(AcceleratorConnection &acc) const
Root class of the ESI type system.
Add a custom interface to a service client at a particular point in the design hierarchy.
Information about the Accelerator system.
virtual std::string getJsonManifest() const
Return the JSON-formatted system manifest.
virtual uint32_t getEsiVersion() const =0
Get the ESI version number to check version compatibility.
void printHier(std::ostream &os, AcceleratorConnection &acc)
void printInfo(std::ostream &os, AcceleratorConnection &acc)
void printInstance(std::ostream &os, const HWModule *d, std::string indent="")
int main(int argc, const char *argv[])
void printPort(std::ostream &os, const BundlePort &port, std::string indent="")