Services and Modeling for Embedded Software Development
Embecosm divider strip
Prev  Next

8.3.1.  Adding Clock Rate and Timing Functions to the Or1ksim Library

Three additional functions are needed in the Or1ksim library to support synchronized timing. The UART will need to know the clock rate of the model (to work out the baud rate from the value of the divisor latch). The Or1ksimSyncSC class itself will need a pair of functions, one to set a timing point in the ISS the second to return the amount of time since the last timing point. This the amount of time the underlying ISS has used when synchronizing with SystemC.

The three additional functions are simple additions. The clock rate is a configuration parameter, while a run time count of instructions executed is already maintained. An extra record in the run-time structure allows a time to be recorded (in seconds through dividing the count by the clock rate), which can be compared in subsequent calls to give the ISS time used since the last time point[6].

These functions are a standard part of the Or1ksim 0.3.0 and Or1ksim 0.4.0 libraries.



[6] This is a loosely timed model. The timing from the ISS is approximate—it does not model the microarchitecture in detail. Cycle estimates will not be exact—that requires a fully cycle accurate model.

Embecosm divider strip