ADW's clock speed in Options->Configure Debugger->ARMulate->Configure initially defaults to 0.00 for compatibility with armsd's defaults. A clock speed of zero in ADW is equivalent to omitting armsd's '-clock' option on the command-line. i.e. a 'zero' clock frequency really means 'unspecified'. For the ARMulator, having no clock frequency specified is not a problem because ARMulator doesn't need to know what the clock frequency is to be able to 'execute' instructions and count cycles (for $statistics). However, the user's application program may sometimes need to access a clock as part of its program, for example, if it contains calls to the standard C function clock() or the Angel SWI_clock, so ARMulator must always be able to give clock information. It does this in the following way: - If a clock speed has been specified to ADW or armsd, then ARMulator will use that frequency value for its timing.
- If the clock speed is zero (for ADW) or unspecified (for armsd), the real-time clock of the host computer will be used by ARMulator instead of an emulated clock. This is described in the SDT 2.11 User Guide (section 3.7.3) and in ADW's on-line help.
In either case, the clock information is used by ARMulator to calculate the elapsed time since execution of the application program began. This elapsed time can be read by the application program using the C function clock() or the Angel SWI_clock, and is also visible to the user from the debugger as $clock. It is also used internally by ADW and armsd in the calculation of $memstats. Note that the clock speed (whether specified or unspecified) has no effect on actual (real-time) speed of execution under ARMulator - it only affects the simulated elapsed time. $memstats is handled slightly differently because it really does need to have a defined clock freq, so that ARMulator can calculate how many wait states will be needed for the memory speed defined in an armsd.map file. If a (non-zero) clock speed is specified and an armsd.map file is present, then $memstats can give useful information about memory accesses and times. However, if no clock speed is specified (i.e. 0MHz) then, for the purposes of calculating the wait-states, an arbitrary default of 1MHz is used to calculate a core:memory clock ratio, so that $memstats can still give useful memory timings. This is now documented in the SDT 2.50/2.51 User Guide.
|