Logging Memory Transactions
API Reference Manual  /  Device API  /  Device API Functions  / 

Transactions

ATOM_flags, ATOM_data, ATOM_size, ATOM_initiator, ATOM_completion, ATOM_list_end

Name

ATOM_flags, ATOM_data, ATOM_size, ATOM_initiator, ATOM_completion, ATOM_list_end — transaction atom’s constructor

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

static inline atom_t ATOM_flags(transaction_flags_t val);
static inline atom_t ATOM_data(uint8 *val);
static inline atom_t ATOM_size(uint32 val);
static inline atom_t ATOM_initiator(conf_object_t *val);
static inline atom_t ATOM_completion(transaction_completion_t val);
static inline atom_t ATOM_list_end(int val);

Description

The functions construct transaction atoms.

ATOM_flags returns a transaction atom specifying transaction flags (see description of transaction_flags_t for information about available transaction flags).

ATOM_data returns a transaction atom that holds the pointer to a buffer that is used to get the data from (for write transactions) to store the data to (for read and instruction fetch transactions).

ATOM_size returns a transaction atom that holds the size of a transaction.

ATOM_initiator returns a transaction atom that holds the initiator of a transaction.

ATOM_completion creates a completion atom - a special atom that holds a callback that is invoked when a transaction is completed asynchronously.

ATOM_list_end returns a special atom that should end the list of transaction atoms. One can use the ATOM_LIST_END macro instead.

Execution Context

All contexts (including Threaded Context)

Example

Sample C code to create a 1-byte read transaction:


    uint8 val;
    atom_t atoms[] = {
        // the flags atom value specifies the transaction type:
        // - 0 defines a read transaction
        // - Sim_Transaction_Write - a write transaction
        // - Sim_Transaction_Fetch - an instruction fetch transaction
        ATOM_flags(0),

        ATOM_data(&val),
        ATOM_size(sizeof val),
        ATOM_initiator(obj),
        ATOM_LIST_END
    };
    transaction_t t = { atoms };

See Also

transaction_t, transaction_flags_t, transaction_completion_t

SIM_complete_transaction

Name

SIM_complete_transaction — complete a deferred transaction

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

void
SIM_complete_transaction(transaction_t *t, exception_type_t status);

Python

import simics

simics.SIM_complete_transaction(...)

Description

The SIM_complete_transaction completes a previously deferred transaction t using the exception status status. The transaction t must be the return value of a previous call to SIM_defer_transaction or a transaction passed to SIM_defer_owned_transaction.

If the transaction t has not been monitored, then the completion code is stored in an internal transaction field until the transaction is monitored with SIM_monitor_transaction or SIM_monitor_chained_transaction, at which time the completion callback is invoked using the stored completion code.

Note that SIM_complete_transaction is normally only used to complete asynchronous transactions. Synchronous transactions are completed by returning the appropriate return code directly from the issue method.

See Also

SIM_defer_transaction, SIM_monitor_transaction, SIM_monitor_chained_transaction, SIM_poll_transaction

Execution Context

Cell Context

SIM_defer_owned_transaction

Name

SIM_defer_owned_transaction — defer transaction completion using an existing transaction

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

transaction_t *
SIM_defer_owned_transaction(transaction_t *t);

Python

import simics

simics.SIM_defer_owned_transaction(...)

Description

When a transaction cannot be completed immediately in the issue method of the transaction interface, then the completion can be deferred to a later time by calling SIM_defer_transaction which allocates a new transaction. One alternative is calling SIM_defer_owned_transaction which allows the caller to allocate the deferred transaction explicitly, in which case provides a heap-allocated transaction t which is linked to the transaction which should be deferred through its prev field. The provided transaction should have an owner and a completion atoms, which are used when the deferred transaction is completed.

When a transaction is deferred, the status code Sim_PE_Deferred must be returned from the issue method of the transaction interface.

Return Value

The transaction t, or NULL if the transaction was issued synchronously and cannot be deferred. When a transaction cannot be deferred, the issue method may choose to return the error status Sim_PE_Async_Required.

Execution Context

Cell Context

SIM_defer_transaction

Name

SIM_defer_transaction — defer transaction completion

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

transaction_t *
SIM_defer_transaction(conf_object_t *obj, transaction_t *t);

Python

import simics

simics.SIM_defer_transaction(...)

Description

When a transaction cannot be completed immediately in the issue method of the transaction interface, then the completion can be deferred to a later time by calling SIM_defer_transaction with the transaction as a parameter.

The SIM_defer_transaction function returns a new transaction pointer which is guaranteed to be available until it is completed with a call to SIM_complete_transaction. When a transaction is deferred, the status code Sim_PE_Deferred must be returned from the issue method of the transaction interface.

Return Value

Deferred transaction, or NULL if the transaction was issued synchronously and cannot be deferred. When a transaction cannot be deferred, the issue method may choose to return the error status Sim_PE_Async_Required.

Execution Context

Cell Context

SIM_get_transaction_bytes, SIM_get_transaction_bytes_offs, SIM_get_transaction_value_le, SIM_get_transaction_value_be

Name

SIM_get_transaction_bytes, SIM_get_transaction_bytes_offs, SIM_get_transaction_value_le, SIM_get_transaction_value_be — get transaction data payload

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

void
SIM_get_transaction_bytes(const transaction_t *t, buffer_t buf);

void
SIM_get_transaction_bytes_offs(const transaction_t *t, unsigned offs,
                               buffer_t buf, bool zerofill_holes);

uint64
SIM_get_transaction_value_le(const transaction_t *t);

uint64
SIM_get_transaction_value_be(const transaction_t *t);

Python

import simics

simics.SIM_get_transaction_bytes(...)
simics.SIM_get_transaction_bytes_offs(...)
simics.SIM_get_transaction_value_le(...)
simics.SIM_get_transaction_value_be(...)

Description

Copy the data payload from a transaction to the provided buffer buf. The size of the buffer must match the size of the transaction.

SIM_get_transaction_bytes_offs retrieves the bytes of the transaction which starts at offset offs. The sum of the offset and the buffer size must not exceed the transaction size.

SIM_get_transaction_value_le returns the value obtained when the transaction buffer is interpreted as an encoded little endian integer. The size of the transaction must not exceed 8 for this function to be used.

SIM_get_transaction_value_be returns the value obtained when the transaction buffer is interpreted as an encoded big endian integer.

Execution Context

All contexts (including Threaded Context)

SIM_get_transaction_id

Name

SIM_get_transaction_id — obtain checkpoint ID for a deferred a transaction

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

int64
SIM_get_transaction_id(transaction_t *t);

Python

import simics

simics.SIM_get_transaction_id(...)

Description

The SIM_get_transaction_id function is used by objects that checkpoint the transaction state. The returned ID uniquely identifies the transaction and should be stored in a checkpoint together with the relevant state that the object keeps for the transaction. The same ID should then be given to SIM_reconnect_transaction during checkpoint load.

This function must only be called on a deferred transaction.

Execution Context

Global Context

See Also

SIM_reconnect_transaction

SIM_inspect_address_routing

Name

SIM_inspect_address_routing — track the route of a transaction through memory hierarchy

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

bool
SIM_inspect_address_routing(const map_target_t *NOTNULL mt,
                            transaction_t *NOTNULL t,
                            uint64 addr,
                            bool (*NOTNULL callback)(
                                    const map_target_t *mt,
                                    const transaction_t *t,
                                    uint64 addr,
                                    uint64 base,
                                    uint64 start,
                                    uint64 size,
                                    access_t access,
                                    translation_flags_t flags,
                                    lang_void *data),
                            lang_void *data);

Python

import simics

simics.SIM_inspect_address_routing(...)

Description

This function allows to track the route of a transaction through memory hierarchy. The route is traced as if the transaction t was issued at the address addr to the destination represented by the map target mt. Note that when this function is used the endpoint of the transaction will not be accessed.

The transaction t can be of any type: a read, a write, or an instruction fetch. Please note that the type of the transaction may affect its path through memory hierarchy. The size of the transaction t is ignored: when accesses are done larger transactions may be split depending on how the memory mapping are set up; no such splitting is occurred while the transaction route is traced with SIM_inspect_address_routing. It is allowed to use transactions with zero size.

The callback callback will be called for every device (memory spaces and translator objects) encountered on the transaction’s route to the destination as well as for the destination device (this is usually a device implementing the transaction interface or the io_memory interface). The first invocation of callback is done with the mt argument itself.

The arguments passed to the callback are:

The callback callback may return false to stop inspection. I.e. if the false value is returned callback will not be invoked any more.

Return Value

The function returns false if callback returned false in order to stop the inspection. Otherwise, true is returned.

Example

# The following example shows how one can determine
# the destination of a read transaction sent from a CPU object:

import conf, simics

def get_destination(memory_space, address):
    '''Example function returning destination object for the access
    sent to address in the memory space memory_space.'''
    mt = simics.SIM_new_map_target(memory_space, None, None)
    t = simics.transaction_t()  # read transaction of zero size
    l = [None]  # data for the callback

    def callback(mt, t, addr, base, start, size, access, flags, l):
        l[0] = (simics.SIM_map_target_object(mt)
                if mt is not None
                else None)
        return True

    simics.SIM_inspect_address_routing(mt, t, address, callback, l)

    # We free mt here but it can be saved and reused if needed.
    # Transaction t can also be reused.
    simics.SIM_free_map_target(mt)
    return l[0]

# Please specify here CPU object and address you are interested in:
cpu = simics.SIM_get_processor(0)
address_of_access = 0x1000

dest = get_destination(
    cpu.iface.processor_info_v2.get_physical_memory(),
    address_of_access)

print("Destination: ",
      dest.name if dest is not None else "'nothing is mapped'")

Execution Context

Cell Context

SIM_inspect_breakpoints

Name

SIM_inspect_breakpoints — find out breakpoints that a transaction would trigger

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

bool
SIM_inspect_breakpoints(
        const map_target_t *NOTNULL mt,
        transaction_t *NOTNULL t,
        uint64 start,
        uint64 end,
        bool (*NOTNULL callback)(
                conf_object_t *trigger_object,
                breakpoint_set_t bp_set,
                const transaction_t *t,
                uint64 start,
                uint64 end,
                lang_void *data),
        lang_void *data);

Python

import simics

simics.SIM_inspect_breakpoints(...)

Description

The function allows to find out the breakpoints that would be triggered if a transaction t would be sent to the address range inside the map target mt. The address range is specified by the start and end arguments and includes both start and end of the range. Only breakpoints matching the transaction t’s type (i.e., a read, a write, or an instruction fetch) are reported. The size of the transaction t is ignored and can be zero.

For all matching breakpoints Simics invokes callback. The callback function may be called multiple times: with different trigger_object objects. The callback function gets the following two arguments that describe the breakpoints:

Auxiliary information is provided to callback via the following arguments:

The callback function may return false to stop searching for breakpoints. I.e. if the false value is returned callback will not be invoked any more even if more breakpoints are present.

The SIM_inspect_breakpoints function is an inspection function: the endpoint of the transaction is never accessed when the function is used.

Return Value

The function returns false if callback returned false in order to stop the inspection. Otherwise, true is returned.

Execution Context

Cell Context

SIM_issue_read_transaction, SIM_issue_write_transaction

Name

SIM_issue_read_transaction, SIM_issue_write_transaction — functions for issuing transaction_t transactions

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

FORCE_INLINE exception_type_t
SIM_issue_read_transaction(
        map_target_t *NOTNULL mt, uint64 addr, buffer_t buf,
        bool inquiry, conf_object_t *initiator);

FORCE_INLINE exception_type_t
SIM_issue_write_transaction(
        map_target_t *NOTNULL mt, uint64 addr, bytes_t bytes,
        bool inquiry, conf_object_t *initiator);

Description

These functions provide a simple way to issue read and write transaction_t transactions in C code. In Python, please use the SIM_issue_transaction function.

The functions have the following parameters:

These functions don’t support the case when a model needs to provide custom atoms in transaction_t transactions. For such cases as well as when using Python the SIM_issue_transaction function should be used.

Return Value

Status of the issued transaction, usually Sim_PE_No_Exception or Sim_PE_IO_Not_Taken. See the exception_type_t’s documentation for more information.

Execution Context

Cell Context

Example

    /* Sample C code that reads an 8-byte little-endian value. If in the
       simulated hardware the endpoint stores values in big-endian format then
       macros from <simics/util/swabber.h> can be used for conversion. */

    uint64 value = -1;  // variable to read data into
    exception_type_t ex =
        SIM_issue_read_transaction(mt,
                                   addr,
                                   (buffer_t) {
                                       .data = (uint8 *)&value,
                                       .len = sizeof value,
                                   },
                                   false,  /* inquiry flag */
                                   obj     /* initiator */);

    if (ex == Sim_PE_No_Exception) {
        /* Read was successful: 'value' contains valid data. */
        SIM_LOG_INFO(4, obj, 0, "Read '%#llx' at %#llx", value, addr);
    } else {
        /* Read operation was not successful. There is no valid data
           in 'value'. Put any error handling code here. */
        SIM_LOG_ERROR(obj, 0, "Read at %#llx failed", addr);
    }
    /* Sample C code that writes an 8-byte little-endian value. If in the
       simulated hardware the endpoint stores values in big-endian format then
       macros from <simics/util/swabber.h> can be used for conversion. */

    uint64 write_value = 1;  // Data to write. '1' is written in this example.
    SIM_LOG_INFO(4, obj, 0, "Writing '%#llx' at %#llx", write_value, addr);
    exception_type_t ex =
        SIM_issue_write_transaction(mt,
                                    addr,
                                    (bytes_t) {
                                        .data = (uint8 *)&write_value,
                                        .len = sizeof write_value,
                                    },
                                    false,  /* inquiry flag */
                                    obj     /* initiator */ );

    if (ex == Sim_PE_No_Exception) {
        /* Write was successful. */
    } else {
        /* Write operation was not successful.
           Put any error handling code here. */
        SIM_LOG_ERROR(obj, 0, "Write at %#llx failed", addr);
    }

See Also

exception_type_t, map_target_t, SIM_issue_transaction, transaction_t

SIM_issue_transaction

Name

SIM_issue_transaction — issue transaction

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

exception_type_t
SIM_issue_transaction(const map_target_t *NOTNULL mt,
                      transaction_t *NOTNULL t, uint64 addr);

Python

import simics

simics.SIM_issue_transaction(...)

Description

SIM_issue_transaction issues the transaction t with the address addr to the destination represented by the map target mt. In Python, the mt argument can also be a conf_object_t.

Return Value

The function returns Sim_PE_Deferred if the transaction was deferred for completion at a some later time. The corresponding pseudo exception is returned if the transaction completed directly (normally Sim_PE_No_Exception or Sim_PE_IO_Not_Taken).

See Also

exception_type_t, transaction_t, SIM_new_map_target, SIM_free_map_target, SIM_issue_read_transaction, SIM_issue_write_transaction, SIM_defer_transaction, SIM_complete_transaction, SIM_monitor_transaction, SIM_transaction_wait

Execution Context

Cell Context

SIM_monitor_transaction, SIM_monitor_chained_transaction

Name

SIM_monitor_transaction, SIM_monitor_chained_transaction — monitor a transaction for deferred completion

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

exception_type_t
SIM_monitor_transaction(transaction_t *t, exception_type_t ex);

exception_type_t
SIM_monitor_chained_transaction(transaction_t *t, exception_type_t ex);

Python

import simics

simics.SIM_monitor_transaction(...)
simics.SIM_monitor_chained_transaction(...)

Description

The SIM_monitor_transaction function monitors an asynchronously issued transaction for completion. A transaction is asynchronously issued if it has a completion atom with a callback which is not NULL. The function should be called after the transaction has been issued, and the ex status code should be the return value from function used to issue the transaction, for example the issue method of the transaction interface.

If ex equals Sim_PE_Deferred, then SIM_monitor_transaction will check if the transaction has in fact been completed already, and in that case, immediately invoke the completion callback. If the transaction is still uncompleted, then it will be marked as monitored and a subsequent call to SIM_complete_transaction will immediately complete the transaction by invoking the completion callback.

If ex is not equal to Sim_PE_Deferred, then the transaction has been completed synchronously, and the completion callback is called using ex as the completion status.

Note that it is illegal to call SIM_monitor_transaction for transactions that do not have a valid completion callback.

SIM_monitor_chained_transaction is similar to SIM_monitor_transaction except that when a deferred transaction is completed, its parent transaction will be completed too.

Return Value

Exception code returned by the completion function, or Sim_PE_Deferred if the transaction is monitored for completion at a later time.

See Also

SIM_defer_transaction, SIM_complete_transaction

Execution Context

Cell Context

SIM_poll_transaction

Name

SIM_poll_transaction — check if a transaction has completed

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

exception_type_t
SIM_poll_transaction(transaction_t *t);

Python

import simics

simics.SIM_poll_transaction(...)

Description

The SIM_poll_transaction function checks if the transaction t is marked as completed, in which case the associated status code is returned and the completion status for the transaction is cleared. If the transaction is uncompleted, then Sim_PE_Deferred is returned.

It is illegal to call SIM_poll_transaction on a transaction which is monitored for completion using e.g. the SIM_monitor_transaction function.

See Also

SIM_complete_transaction

Execution Context

Cell Context

SIM_reconnect_transaction

Name

SIM_reconnect_transaction — register that a deferred transaction has been restored

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

void
SIM_reconnect_transaction(transaction_t *t, int64 id);

Python

import simics

simics.SIM_reconnect_transaction(...)

Description

The SIM_reconnect_transaction function is used by objects that checkpoint the transaction state. It should be called when the relevant state has been read from a checkpoint.

Execution Context

Global Context

See Also

SIM_get_transaction_id

SIM_register_python_atom_type

Name

SIM_register_python_atom_type — register an atom type which takes plain Python objects

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

void
SIM_register_python_atom_type(const char *NOTNULL name);

Python

import simics

simics.SIM_register_python_atom_type(...)

Description

Register an atom type named name. The atom type can be used from Python and can hold any Python object.

Execution Context

Global Context

SIM_replace_transaction

Name

SIM_replace_transaction — replace transaction

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

void
SIM_replace_transaction(transaction_t *t_old, transaction_t *t_new);

Python

import simics

simics.SIM_replace_transaction(...)

Description

Replace a transaction t_old with a new transaction t_new.

A transaction which has been issued and is deferred by some downstream device can be replaced with a different transaction by initiator. This is mostly useful when a transaction is allocated on the stack and it turns out that the transaction is not completed synchronously, in which case SIM_replace_transaction can be used to move the transaction to e.g. the heap.

This function ensures that the deferred transaction is properly linked with the t_new transaction. It is the caller’s responsibility to fill in the contents of the new transaction, including the prev pointer.

It is illegal to replace a transaction which has been monitored.

Execution Context

Cell Context

SIM_set_transaction_bytes, SIM_set_transaction_bytes_offs, SIM_set_transaction_value_le, SIM_set_transaction_value_be, SIM_set_transaction_bytes_constant

Name

SIM_set_transaction_bytes, SIM_set_transaction_bytes_offs, SIM_set_transaction_value_le, SIM_set_transaction_value_be, SIM_set_transaction_bytes_constant — set transaction data payload

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

void
SIM_set_transaction_bytes(const transaction_t *t, bytes_t bytes);

void
SIM_set_transaction_bytes_offs(const transaction_t *t, unsigned offs,
                               bytes_t bytes);

void
SIM_set_transaction_value_le(const transaction_t *t, uint64 value);

void
SIM_set_transaction_value_be(const transaction_t *t, uint64 value);

void
SIM_set_transaction_bytes_constant(const transaction_t *t, uint8 value);

Python

import simics

simics.SIM_set_transaction_bytes(...)
simics.SIM_set_transaction_bytes_offs(...)
simics.SIM_set_transaction_value_le(...)
simics.SIM_set_transaction_value_be(...)
simics.SIM_set_transaction_bytes_constant(...)

Description

Set the data payload of a transaction to the contents provided by bytes. The number of provided bytes must match the transaction size exactly.

The SIM_set_transaction_bytes_offs function sets some bytes of the transaction starting at offset offs. The sum of the offset and the number of provided bytes must not exceed the transaction size.

The SIM_set_transaction_value_le function sets the transaction bytes to the little endian representation of value. The size of the transaction must not exceed 8 for this function to be used. Similarly, SIM_set_transaction_value_be sets the transaction bytes to the big endian representation of the provided value. If the transaction is smaller than 8 bytes the functions will truncate the representation of the value.

The SIM_set_transaction_bytes_constant function can be used when an endpoint wants to set all transaction bytes to value.

Execution Context

Cell Context

SIM_transaction_flags, SIM_transaction_is_fetch, SIM_transaction_is_write, SIM_transaction_is_read, SIM_transaction_is_inquiry

Name

SIM_transaction_flags, SIM_transaction_is_fetch, SIM_transaction_is_write, SIM_transaction_is_read, SIM_transaction_is_inquiry — return transaction type

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

transaction_flags_t
SIM_transaction_flags(const transaction_t *NOTNULL t);

bool
SIM_transaction_is_fetch(const transaction_t *NOTNULL t);

bool
SIM_transaction_is_write(const transaction_t *NOTNULL t);

bool
SIM_transaction_is_read(const transaction_t *NOTNULL t);

bool
SIM_transaction_is_inquiry(const transaction_t *NOTNULL t);

Python

import simics

simics.SIM_transaction_flags(...)
simics.SIM_transaction_is_fetch(...)
simics.SIM_transaction_is_write(...)
simics.SIM_transaction_is_read(...)
simics.SIM_transaction_is_inquiry(...)

Description

SIM_transaction_flags returns a transaction_flags_t bitmap describing transaction type. Most of the flags can be queried using specific accessors.

The SIM_transaction_is_fetch function returns true if the transaction is an instruction fetch.

The SIM_transaction_is_read function returns true if the transaction is a read operation.

The SIM_transaction_is_write function returns true if the transaction is a write operation.

The SIM_transaction_is_inquiry function returns true if the transaction is an inquiry operation.

Execution Context

All contexts (including Threaded Context)

SIM_transaction_initiator

Name

SIM_transaction_initiator — return transaction initiator

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

conf_object_t *
SIM_transaction_initiator(const transaction_t *t);

Python

import simics

simics.SIM_transaction_initiator(...)

Description

Return the initiator of the transaction.

Execution Context

All contexts (including Threaded Context)

SIM_transaction_is_deferrable

Name

SIM_transaction_is_deferrable — check if a transaction can be deferred for later completion

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

bool
SIM_transaction_is_deferrable(const transaction_t *NOTNULL t);

Python

import simics

simics.SIM_transaction_is_deferrable(...)

Description

The function allows to check whether a transaction can be deferred (with the SIM_defer_transaction or SIM_defer_owned_transaction function) for later completion which is done with a call to SIM_complete_transaction.

Usually, this function is not needed since SIM_defer_transaction and SIM_defer_owned_transaction return NULL for transactions that cannot be deferred.

Return Value

false if the transaction was issued synchronously and cannot be deferred. Otherwise, true. When a transaction cannot be deferred, endpoint’s issue method of the transaction interface may choose to return the error status Sim_PE_Async_Required.

Execution Context

Cell Context

SIM_transaction_size

Name

SIM_transaction_size — return transaction size

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

unsigned
SIM_transaction_size(const transaction_t *NOTNULL t);

Python

import simics

simics.SIM_transaction_size(...)

Description

Return the size of the transaction, in bytes.

Execution Context

All contexts (including Threaded Context)

SIM_transaction_wait

Name

SIM_transaction_wait — wait for transaction completion

Synopsis

C and DML

#include <simics/device-api.h> // in C
// always available in DML

exception_type_t
SIM_transaction_wait(transaction_t *t, exception_type_t ex);

Python

import simics

simics.SIM_transaction_wait(...)

Description

SIM_transaction_wait waits until an issued transaction has completed.

The function may only be invoked for transactions which have a completion atom containing a NULL pointer. The NULL pointer means that the initiator will wait for transaction completion using this function. Moreover, SIM_transaction_wait must always be called after a transaction has been issued with a NULL completion callback.

The ex argument should be the return value of the function or method used to issue the transaction.

SIM_transaction_wait will not return until the transaction has completed. While waiting, a different user-level thread will be activated, which allows simulated time to advance.

Note that the simulator cannot create a checkpoint while a call to the SIM_transaction_wait is in progress. See transaction-wait-all-completed for more information related to checkpointing and SIM_transaction_wait.

Transaction wait is not supported from all contexts. When unsupported, the transaction will appear to be issued synchronously.

Return Value

Completion status of the transaction

Execution Context

Cell Context

Logging Memory Transactions