SvPortSim.Server (SvPortSim v0.1.0)

Copy Markdown View Source

Internal GenServer implementation for a single Verilated simulator instance.

SvPortSim.Server owns one simulator transport worker. The server keeps the observable instance state, assigns request IDs, serializes protocol requests, validates response envelopes, and closes the transport when the instance terminates.

Summary

Functions

Returns a specification to start this module under a supervisor.

Sends one already-normalized runtime operation to the simulator transport.

Starts one simulator server without linking it to the caller.

Starts one simulator server and links it to the caller.

Sends the terminal "shutdown" operation and stops the simulator server.

Types

error_body()

@type error_body() :: %{required(String.t()) => term()}

instance()

@type instance() :: GenServer.server()

request_body()

@type request_body() :: %{required(String.t()) => term()}

response_body()

@type response_body() :: %{required(String.t()) => term()}

timeout_override()

@type timeout_override() :: :default | timeout()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

request(instance, op, body, timeout_override)

@spec request(instance(), String.t(), request_body(), timeout_override()) ::
  {:ok, response_body()} | {:error, error_body()}

Sends one already-normalized runtime operation to the simulator transport.

start(opts)

@spec start(keyword()) :: GenServer.on_start()

Starts one simulator server without linking it to the caller.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts one simulator server and links it to the caller.

stop(instance, timeout_override)

@spec stop(instance(), timeout_override()) :: :ok | {:error, error_body()}

Sends the terminal "shutdown" operation and stops the simulator server.