ucb-bar/riscv-isa-sim — pull request #9 by martinmaas (2014-11-17 01:55:49+00:00)
Title: Adding support for evaluating arbitrary C expressions to Spike.

This uses picoc (https://code.google.com/p/picoc/) as C interpreter. No existing functionality is changed and the following commands have been added in interactive mode:

untilc/whilec: Equivalent to until/while, but with arbitrary C expression
evalc: Evaluate an arbitrary C expression
alwaysc: During untilc/whilec, this expression will be executed every cycle

The following callback functions are available from C:

pc(p), reg(p,r), mem(addr)

Additional macros that are available include:

px(x), pd(x): Output a value in hex or decimal
wf(fn): Open file fn for writing
fx(x), fd(x): Write x to the opened file
cwf(): Close the open file

To build with picoc support, add --enable-picoc to your configure call.