CIRCT  19.0.0git
Public Member Functions | Private Member Functions | Private Attributes | List of all members
circt::llhd::sim::Engine Class Reference

#include <Engine.h>

Collaboration diagram for circt::llhd::sim::Engine:
Collaboration graph
[legend]

Public Member Functions

 Engine (llvm::raw_ostream &out, ModuleOp module, llvm::function_ref< mlir::LogicalResult(mlir::ModuleOp)> mlirTransformer, llvm::function_ref< llvm::Error(llvm::Module *)> llvmTransformer, std::string root, TraceMode tm, ArrayRef< StringRef > sharedLibPaths)
 Initialize an LLHD simulation engine. More...
 
 ~Engine ()
 Default destructor. More...
 
int simulate (int n, uint64_t maxTime)
 Run simulation up to n steps or maxTime picoseconds of simulation time. More...
 
void buildLayout (ModuleOp module)
 Build the instance layout of the design. More...
 
const ModuleOp getModule () const
 Get the MLIR module. More...
 
const StategetState () const
 Get the simulation state. More...
 
void dumpStateLayout ()
 Dump the instance layout stored in the State. More...
 
void dumpStateSignalTriggers ()
 Dump the instances each signal triggers. More...
 

Private Member Functions

void walkEntity (EntityOp entity, Instance &child)
 

Private Attributes

llvm::raw_ostream & out
 
std::string root
 
std::unique_ptr< Statestate
 
std::unique_ptr< mlir::ExecutionEngine > engine
 
ModuleOp module
 
TraceMode traceMode
 

Detailed Description

Definition at line 35 of file Engine.h.

Constructor & Destructor Documentation

◆ Engine()

Engine::Engine ( llvm::raw_ostream &  out,
ModuleOp  module,
llvm::function_ref< mlir::LogicalResult(mlir::ModuleOp)>  mlirTransformer,
llvm::function_ref< llvm::Error(llvm::Module *)>  llvmTransformer,
std::string  root,
TraceMode  tm,
ArrayRef< StringRef >  sharedLibPaths 
)

Initialize an LLHD simulation engine.

This initializes the state, as well as the mlir::ExecutionEngine with the given module.

Definition at line 23 of file Engine.cpp.

References assert(), buildLayout(), engine, module, root, and state.

◆ ~Engine()

Engine::~Engine ( )
default

Default destructor.

Member Function Documentation

◆ buildLayout()

void Engine::buildLayout ( ModuleOp  module)

Build the instance layout of the design.

Definition at line 217 of file Engine.cpp.

References assert(), circt::llhd::sim::Instance::isEntity, module, circt::llhd::sim::Instance::path, root, state, circt::llhd::sim::Instance::unit, and walkEntity().

Referenced by Engine().

◆ dumpStateLayout()

void Engine::dumpStateLayout ( )

Dump the instance layout stored in the State.

Definition at line 63 of file Engine.cpp.

References state.

◆ dumpStateSignalTriggers()

void Engine::dumpStateSignalTriggers ( )

Dump the instances each signal triggers.

Definition at line 65 of file Engine.cpp.

References state.

◆ getModule()

const ModuleOp circt::llhd::sim::Engine::getModule ( ) const
inline

Get the MLIR module.

Definition at line 56 of file Engine.h.

References module.

◆ getState()

const State* circt::llhd::sim::Engine::getState ( ) const
inline

Get the simulation state.

Definition at line 59 of file Engine.h.

References state.

◆ simulate()

int Engine::simulate ( int  n,
uint64_t  maxTime 
)

Run simulation up to n steps or maxTime picoseconds of simulation time.

n=0 and T=0 make the simulation run indefinitely.

Definition at line 67 of file Engine.cpp.

References circt::llhd::sim::Trace::addChange(), assert(), engine, circt::llhd::sim::Trace::flush(), circt::llhd::sim::None, out, state, and traceMode.

◆ walkEntity()

void Engine::walkEntity ( EntityOp  entity,
Instance child 
)
private

Member Data Documentation

◆ engine

std::unique_ptr<mlir::ExecutionEngine> circt::llhd::sim::Engine::engine
private

Definition at line 73 of file Engine.h.

Referenced by Engine(), and simulate().

◆ module

ModuleOp circt::llhd::sim::Engine::module
private

◆ out

llvm::raw_ostream& circt::llhd::sim::Engine::out
private

Definition at line 70 of file Engine.h.

Referenced by simulate().

◆ root

std::string circt::llhd::sim::Engine::root
private

Definition at line 71 of file Engine.h.

Referenced by buildLayout(), and Engine().

◆ state

std::unique_ptr<State> circt::llhd::sim::Engine::state
private

◆ traceMode

TraceMode circt::llhd::sim::Engine::traceMode
private

Definition at line 75 of file Engine.h.

Referenced by simulate().


The documentation for this class was generated from the following files: