SID Simulator Component Developer's Guide | ||
---|---|---|
<<< Previous | API Reference | Next >>> |
status read (host_int_4 addr, little_int_1& data); status read (host_int_4 addr, little_int_2& data); status read (host_int_4 addr, little_int_4& data); status read (host_int_4 addr, little_int_8& data); status read (host_int_4 addr, big_int_1& data); status read (host_int_4 addr, big_int_2& data); status read (host_int_4 addr, big_int_4& data); status read (host_int_4 addr, big_int_8& data); |
To read from a bus, the bus master calls the overloaded function read with an address to read from, and a reference to a data word. Addresses are conventionally interpreted as byte addresses. If the read is successful, the data word will contain the word read; otherwise it will be unchanged.
status write (host_int_4 addr, little_int_1 data); status write (host_int_4 addr, little_int_2 data); status write (host_int_4 addr, little_int_4 data); status write (host_int_4 addr, little_int_8 data); status write (host_int_4 addr, big_int_1 data); status write (host_int_4 addr, big_int_2 data); status write (host_int_4 addr, big_int_4 data); status write (host_int_4 addr, big_int_8 data); |
To write to a bus, the bus master calls the overloaded function write with an address to write to, and a data word. Addresses are conventionally interpreted as byte addresses. The result of a write indicates whether the write was considered, by the bus slave, to be successful. Note however that the slave is not in any way required to reflect the contents of a successful write in terms of any future reads from the same address.
All bus transactions are initiated by a bus master, and respond with a status code object. Such an object has the following fields:
a value from the sid::bus::status_t enumeration: either ok, misaligned, unmapped, or unpermitted.
a scalar quantity, in unspecified units, describing the latency of the bus transaction.
The sid::bus::status class has simple zero-, one- and two-argument constructors, indicating general zero-latency success, success status alone (with zero latency) or status and latency of the bus transaction. For example, one can return from a bus transaction with any of the following statements:
return status (); // status = ok, latency = 0 return status (unmapped); // status = unmapped, latency = 0 return status (ok, 5); // status = ok, latency = 5 |
<<< Previous | Home | Next >>> |
the sid::component interface | Up | the sid::pin interface |