30int main(
int argc,
const char *argv[]) {
32 cli.description(
"Query an ESI system for information from the manifest.");
34 CLI::App *versionSub =
35 cli.add_subcommand(
"version",
"Print ESI system version");
37 cli.add_subcommand(
"info",
"Print ESI system information");
38 CLI::App *hierSub = cli.add_subcommand(
"hier",
"Print ESI system hierarchy");
40 if (
int rc = cli.
esiParse(argc, argv))
42 if (!cli.get_help_ptr()->empty())
47 std::unique_ptr<AcceleratorConnection> acc = cli.
connect();
51 std::cout << info.getEsiVersion() << std::endl;
57 }
catch (std::exception &e) {
58 ctxt.getLogger().error(
"esiquery", e.what());
64 std::string jsonManifest =
67 os <<
"API version: " << m.
getApiVersion() << std::endl << std::endl;
68 os <<
"********************************" << std::endl;
69 os <<
"* Module information" << std::endl;
70 os <<
"********************************" << std::endl;
76 os <<
"********************************" << std::endl;
77 os <<
"* Type table" << std::endl;
78 os <<
"********************************" << std::endl;
82 os <<
" " << i++ <<
": " << t->getID() << std::endl;
86 std::string indent =
"") {
87 os << indent <<
" " << port.
getID() <<
":";
89 if (
auto svcPortStr = svcPort->toString()) {
90 os <<
" " << *svcPortStr << std::endl;
95 os << indent <<
" " << name <<
": " << chan.getType()->getID()
100 std::string indent =
"") {
101 os << indent <<
"* Instance:";
102 if (
auto inst =
dynamic_cast<const Instance *
>(d))
103 os << inst->getID() << std::endl;
105 os <<
"top" << std::endl;
106 os << indent <<
"* Ports:" << std::endl;
110 if (!children.empty()) {
111 os << indent <<
"* Children:" << std::endl;
122 os <<
"********************************" << std::endl;
123 os <<
"* Design hierarchy" << std::endl;
124 os <<
"********************************" << std::endl;
Abstract class representing a connection to an accelerator.
ServiceClass * getService(AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
Get a typed reference to a particular service type.
Context & getCtxt() const
Top level accelerator class.
Services provide connections to 'bundles' – collections of named, unidirectional communication channe...
const PortMap & getChannels() const
AppID getID() const
Get the ID of the port.
Common options and code for ESI runtime tools.
Context & getContext()
Get the context.
std::unique_ptr< AcceleratorConnection > connect()
Connect to the accelerator using the specified backend and connection.
int esiParse(int argc, const char **argv)
Run the parser.
AcceleratorConnections, Accelerators, and Manifests must all share a context.
Represents either the top level or an instance of a hardware module.
std::vector< std::reference_wrapper< BundlePort > > getPortsOrdered() const
Get the module's ports in a deterministic order.
std::vector< const Instance * > getChildrenOrdered() const
Get a vector of the module's children in a deterministic order.
Subclass of HWModule which represents a submodule instance.
Class to parse a manifest.
uint32_t getApiVersion() const
Accelerator * buildAccelerator(AcceleratorConnection &acc) const
const std::vector< const Type * > & getTypeTable() const
The Type Table is an ordered list of types.
std::vector< ModuleInfo > getModuleInfos() 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.
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="")