CIRCT 20.0.0git
Loading...
Searching...
No Matches
RpcServer.h
Go to the documentation of this file.
1//===- RpcServer.h - Run a cosim server -------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Setup and run a server accepting connections via the 'cosim' RPC protocol.
10// Then, one can request ports to and from the clients.
11//
12// Abstract this out to support multi-party communication in the future.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef ESI_COSIM_RPCSERVER_H
17#define ESI_COSIM_RPCSERVER_H
18
19#include "esi/Ports.h"
20
21namespace esi {
22namespace cosim {
23
24/// TODO: make this a proper backend (as much as possible).
25class RpcServer {
26public:
27 ~RpcServer();
28
29 /// Set the manifest and version. There is a race condition here in that the
30 /// RPC server can be started and a connection from the client could happen
31 /// before the manifest is set. TODO: rework the DPI API to require that the
32 /// manifest gets set first.
33 void setManifest(int esiVersion,
34 const std::vector<uint8_t> &compressedManifest);
35
36 /// Register a read or write port which communicates over RPC.
37 ReadChannelPort &registerReadPort(const std::string &name,
38 const std::string &type);
39 WriteChannelPort &registerWritePort(const std::string &name,
40 const std::string &type);
41
42 void stop();
43 void run(int port);
44
45 /// Hide the implementation details from this header file.
46 class Impl;
47
48private:
49 Impl *impl = nullptr;
50};
51
52} // namespace cosim
53} // namespace esi
54
55#endif // ESI_COSIM_RPCSERVER_H
A ChannelPort which reads data from the accelerator.
Definition Ports.h:103
A ChannelPort which sends data to the accelerator.
Definition Ports.h:74
TODO: make this a proper backend (as much as possible).
Definition RpcServer.h:25
ReadChannelPort & registerReadPort(const std::string &name, const std::string &type)
Register a read or write port which communicates over RPC.
void run(int port)
void setManifest(int esiVersion, const std::vector< uint8_t > &compressedManifest)
Set the manifest and version.
WriteChannelPort & registerWritePort(const std::string &name, const std::string &type)
Definition esi.py:1