|
CIRCT 22.0.0git
|
#include "dpi.h"#include "esi/Context.h"#include "esi/Ports.h"#include "esi/backends/RpcServer.h"#include <algorithm>#include <cassert>#include <cstdlib>#include <format>
Go to the source code of this file.
Functions | |
| static Logger & | getLogger () |
| Get the logger from the context. | |
| static void | log (char *epId, bool toClient, const MessageData &msg) |
| Emit the contents of 'msg' to the log file in hex. | |
| static int | findPort () |
| Get the TCP port on which to listen. | |
| static int | validateSvOpenArray (const svOpenArrayHandle data, int expectedElemSize) |
| Check that an array is an array of bytes and has some size. | |
| DPI int | sv2cCosimserverEpRegister (char *endpointId, char *fromHostTypeIdC, int fromHostTypeSize, char *toHostTypeIdC, int toHostTypeSize) |
| Register an endpoint. | |
| DPI int | sv2cCosimserverEpTryGet (char *endpointId, const svOpenArrayHandle data, unsigned int *dataSize) |
| Try to get a message from a client. | |
| DPI int | sv2cCosimserverEpTryPut (char *endpointId, const svOpenArrayHandle data, int dataSize) |
| Send a message to a client. | |
| DPI void | sv2cCosimserverFinish () |
| Shutdown the RPC server. | |
| DPI int | sv2cCosimserverInit () |
| Start the server. | |
| DPI void | sv2cCosimserverSetManifest (int esiVersion, const svOpenArrayHandle compressedManifest) |
| Set the system zlib-compressed manifest. | |
| DPI int | sv2cCosimserverMMIORegister () |
| Register an MMIO module. Just checks that there is only one instantiated. | |
| DPI int | sv2cCosimserverMMIOReadTryGet (uint32_t *address) |
| Read MMIO function pair. | |
| DPI void | sv2cCosimserverMMIOReadRespond (uint32_t data, char error) |
| DPI void | sv2cCosimserverMMIOWriteRespond (char error) |
| DPI int | sv2cCosimserverMMIOWriteTryGet (uint32_t *address, uint32_t *data) |
| Write MMIO function pair. | |
Variables | |
| static FILE * | logFile |
| If non-null, log to this file. Protected by 'serverMutex`. | |
| static std::unique_ptr< Context > | context = nullptr |
| static std::unique_ptr< RpcServer > | server = nullptr |
| static std::mutex | serverMutex |
| std::map< std::string, ReadChannelPort & > | readPorts |
| std::map< ReadChannelPort *, std::future< MessageData > > | readFutures |
| std::map< std::string, WriteChannelPort & > | writePorts |
| static bool | mmioRegistered = false |
|
static |
Get the TCP port on which to listen.
If the port isn't specified via an environment variable, return 0 to allow automatic selection.
Definition at line 76 of file DpiEntryPoints.cpp.
References getLogger(), and esi::Logger::info().
Referenced by sv2cCosimserverInit().
|
static |
Get the logger from the context.
Definition at line 42 of file DpiEntryPoints.cpp.
References context.
Referenced by findPort(), sv2cCosimserverEpRegister(), sv2cCosimserverEpTryGet(), sv2cCosimserverEpTryPut(), sv2cCosimserverFinish(), sv2cCosimserverInit(), sv2cCosimserverMMIORegister(), sv2cCosimserverSetManifest(), and validateSvOpenArray().
|
static |
Emit the contents of 'msg' to the log file in hex.
Definition at line 52 of file DpiEntryPoints.cpp.
References esi::MessageData::getBytes(), esi::MessageData::getSize(), logFile, and serverMutex.
Referenced by sv2cCosimserverEpTryGet(), and sv2cCosimserverEpTryPut().
| DPI int sv2cCosimserverEpRegister | ( | char * | endpointId, |
| char * | fromHostTypeIdC, | ||
| int | fromHostTypeSize, | ||
| char * | toHostTypeIdC, | ||
| int | toHostTypeSize | ||
| ) |
Register an endpoint.
Definition at line 135 of file DpiEntryPoints.cpp.
References esi::WriteChannelPort::connect(), esi::ReadChannelPort::connect(), esi::Logger::error(), getLogger(), esi::ReadChannelPort::readAsync(), readFutures, readPorts, server, sv2cCosimserverInit(), and writePorts.
| DPI int sv2cCosimserverEpTryGet | ( | char * | endpointId, |
| const svOpenArrayHandle | data, | ||
| unsigned int * | dataSize | ||
| ) |
Try to get a message from a client.
Definition at line 176 of file DpiEntryPoints.cpp.
References esi::Logger::error(), esi::MessageData::getBytes(), getLogger(), esi::MessageData::getSize(), log(), esi::ReadChannelPort::readAsync(), readFutures, readPorts, server, svGetArrElemPtr1(), svSizeOfArray(), and validateSvOpenArray().
| DPI int sv2cCosimserverEpTryPut | ( | char * | endpointId, |
| const svOpenArrayHandle | data, | ||
| int | dataSize | ||
| ) |
Send a message to a client.
Definition at line 248 of file DpiEntryPoints.cpp.
References esi::Logger::error(), getLogger(), log(), server, svGetArrElemPtr1(), svSizeOfArray(), validateSvOpenArray(), esi::WriteChannelPort::write(), and writePorts.
| DPI void sv2cCosimserverFinish | ( | ) |
Shutdown the RPC server.
Definition at line 293 of file DpiEntryPoints.cpp.
References getLogger(), esi::Logger::info(), logFile, server, and serverMutex.
| DPI int sv2cCosimserverInit | ( | ) |
Start the server.
Not required as the first endpoint registration will do this. Provided if one wants to start the server early.
Definition at line 307 of file DpiEntryPoints.cpp.
References context, findPort(), getLogger(), esi::Logger::info(), logFile, server, and serverMutex.
Referenced by sv2cCosimserverEpRegister(), sv2cCosimserverMMIORegister(), and sv2cCosimserverSetManifest().
| DPI void sv2cCosimserverMMIOReadRespond | ( | uint32_t | data, |
| char | error | ||
| ) |
Definition at line 383 of file DpiEntryPoints.cpp.
References assert().
| DPI int sv2cCosimserverMMIOReadTryGet | ( | uint32_t * | address | ) |
Read MMIO function pair.
Assumes that reads come back in the order in which they were requested.
Definition at line 372 of file DpiEntryPoints.cpp.
| DPI int sv2cCosimserverMMIORegister | ( | ) |
Register an MMIO module. Just checks that there is only one instantiated.
Definition at line 362 of file DpiEntryPoints.cpp.
References esi::Logger::error(), getLogger(), mmioRegistered, and sv2cCosimserverInit().
| DPI void sv2cCosimserverMMIOWriteRespond | ( | char | error | ) |
Definition at line 395 of file DpiEntryPoints.cpp.
References assert().
| DPI int sv2cCosimserverMMIOWriteTryGet | ( | uint32_t * | address, |
| uint32_t * | data | ||
| ) |
Write MMIO function pair.
Assumes that write errors come back in the order in which the writes were issued.
Definition at line 409 of file DpiEntryPoints.cpp.
| DPI void sv2cCosimserverSetManifest | ( | int | esiVersion, |
| const svOpenArrayHandle | compressedManifest | ||
| ) |
Set the system zlib-compressed manifest.
Definition at line 331 of file DpiEntryPoints.cpp.
References esi::Logger::error(), getLogger(), esi::Logger::info(), server, sv2cCosimserverInit(), svGetArrElemPtr1(), svSizeOfArray(), and validateSvOpenArray().
|
static |
Check that an array is an array of bytes and has some size.
Definition at line 90 of file DpiEntryPoints.cpp.
References esi::Logger::error(), getLogger(), svDimensions(), svGetArrayPtr(), svSize(), and svSizeOfArray().
Referenced by sv2cCosimserverEpTryGet(), sv2cCosimserverEpTryPut(), and sv2cCosimserverSetManifest().
|
static |
Definition at line 37 of file DpiEntryPoints.cpp.
Referenced by addAnnotation(), Deduper::addAnnotationContext(), append(), circt::firrtl::applyGCTView(), applyOutputDirAnno(), applyToPort(), circt::firrtl::applyTraceName(), circt::firrtl::applyWiring(), arrayOrEmpty(), circt::sv::CaseBitPattern::CaseBitPattern(), Circt_Init(), circtMSFTPhysicalBoundsAttrGet(), circtTclFunction(), Deduper::cloneAnnotation(), collectFields(), circt::impl::ConvertToLLVMPass::convertFuncOp(), convertLocation(), convertToExcludeFromFullResetAnnotation(), convertToFullResetAnnotation(), Deduper::createNLAs(), circt::firrtl::createPathRef(), customTypeParser(), circt::ExportVerilog::SharedEmitterState::emitOps(), Equivalence::Equivalence(), circt::om::Evaluator::evaluateObjectInstance(), fixDomainInfoDeletions(), fixDomainInfoInsertions(), circt::om::evaluator::AttributeValue::get(), circt::systemc::IntBaseType::get(), circt::systemc::UIntBaseType::get(), circt::systemc::SignedType::get(), circt::systemc::UnsignedType::get(), circt::systemc::BitVectorBaseType::get(), circt::systemc::LogicVectorBaseType::get(), circt::StringAttrOrRef::get(), circt::firrtl::IntType::get(), circt::systemc::IntType::get(), circt::systemc::UIntType::get(), circt::systemc::BigIntType::get(), circt::systemc::BigUIntType::get(), circt::systemc::BitVectorType::get(), circt::systemc::LogicVectorType::get(), circt::om::evaluator::AttributeValue::get(), getAllBuriedRegs(), getAnnotationsFrom(), esi::backends::cosim::RpcClient::Impl::getChannelDesc(), getFunctionSignature(), getInnerSymFor(), getIntAttr(), getLogger(), getMainBufferNameIdentifier(), esi::backends::cosim::RpcClient::Impl::getManifest(), esi::cosim::RpcServer::Impl::GetManifest(), circt::parsing_util::getNameFromSSA(), circt::firrtl::getOrAddInnerSym(), getRemainingBankingInfo(), getSelectIndex(), getTimeScaleInFemtoseconds(), handleRoot(), inferAndLikeReturnTypes(), circt::inferImplicitSSAName(), esi::backends::cosim::RpcClient::Impl::listChannels(), esi::cosim::RpcServer::Impl::ListChannels(), loadFirMlirFile(), materializePackedToSBVConversion(), materializeSBVToPackedConversion(), circt::firrtl::maybeStringToLocation(), maybeUpcastHandle(), Deduper::mergeAnnotations(), Deduper::mergeBlocks(), Deduper::mergeInnerSymbols(), mergeLoc(), Deduper::mergeOps(), modifyModuleArgs(), modifyModulePorts(), NB_MODULE(), omEvaluatorBasePathGetEmpty(), circt::firrtl::direction::packAttribute(), circt::firrtl::direction::packAttribute(), circt::om::parseBasePath(), parseBasePathString(), parseCHIRRTLOp(), parseClassLike(), parseComponentSignature(), parseFModuleLikeOp(), parseMethodLikeOp(), parseModportStructs(), circt::hw::module_like_impl::parseModuleFunctionSignature(), parseModulePorts(), circt::hw::module_like_impl::parseModuleSignature(), circt::om::parsePath(), parsePathString(), parseSubfieldLikeOp(), circt::ExportSystemC::populateBuiltinOpEmitters(), circt::ExportSystemC::populateEmitCOpEmitters(), circt::populateGenericReducePatterns(), circt::ExportSystemC::populateHWEmitters(), populateOpConversion(), circt::ExportSystemC::populateSystemCOpEmitters(), circt::ExportSystemC::registerAllOpEmitters(), circt::firrtl::registerFromFIRFileTranslation(), circt::registerFromVerilogTranslation(), circt::aiger::registerImportAIGERTranslation(), resizeType(), resolve(), circt::pipelinetocalyx::LoopScheduleToCalyxPass::runOnOperation(), circt::SeqToSVPass::runOnOperation(), BalanceMuxPass::runOnOperation(), ResolveTracesPass::runOnOperation(), esi::cosim::RpcServer::Impl::SendToServer(), StructuralHasherSharedConstants::StructuralHasherSharedConstants(), sv2cCosimserverInit(), circt::firrtl::TokenAnnoTarget::toStringAttr(), circt::transformReduce(), circt::transformReduce(), uniqueInNamespace(), circt::ExportVerilog::OpLocMap::updateIRWithLoc(), visitClassProperty(), and esi::backends::cosim::RpcClient::Impl::writeToServer().
|
static |
If non-null, log to this file. Protected by 'serverMutex`.
Definition at line 33 of file DpiEntryPoints.cpp.
Referenced by log(), sv2cCosimserverFinish(), and sv2cCosimserverInit().
|
static |
Definition at line 361 of file DpiEntryPoints.cpp.
Referenced by sv2cCosimserverMMIORegister().
| std::map<ReadChannelPort *, std::future<MessageData> > readFutures |
Definition at line 128 of file DpiEntryPoints.cpp.
Referenced by sv2cCosimserverEpRegister(), and sv2cCosimserverEpTryGet().
| std::map<std::string, ReadChannelPort &> readPorts |
Definition at line 127 of file DpiEntryPoints.cpp.
Referenced by sv2cCosimserverEpRegister(), and sv2cCosimserverEpTryGet().
|
static |
Definition at line 38 of file DpiEntryPoints.cpp.
Referenced by circt::lsp::CirctVerilogLspServerMain(), sv2cCosimserverEpRegister(), sv2cCosimserverEpTryGet(), sv2cCosimserverEpTryPut(), sv2cCosimserverFinish(), sv2cCosimserverInit(), and sv2cCosimserverSetManifest().
|
static |
Definition at line 39 of file DpiEntryPoints.cpp.
Referenced by log(), sv2cCosimserverFinish(), and sv2cCosimserverInit().
| std::map<std::string, WriteChannelPort &> writePorts |
Definition at line 129 of file DpiEntryPoints.cpp.
Referenced by isCombinational(), sv2cCosimserverEpRegister(), and sv2cCosimserverEpTryPut().