[Gems-users] Using SIM_continue in Ruby


Date: Thu, 17 Nov 2005 09:31:23 -0500
From: "Deepa Srinivasan" <dsriniv@xxxxxxxx>
Subject: [Gems-users] Using SIM_continue in Ruby
Hello,

I'm trying to use the SIM_continue API from within Ruby code
(SimicsProcessor class), for more controlled execution (to choose which
processor gets to run) than what is currently enabled by
SIMICS_unstall_proc. I'm trying to use the same mechanism as in Opal's
pstate::simcontinue function. My code is as follows:

void proc_breakpoint_handler( conf_object_t *cpu, void *parameter )
{
    printf("Sim breakpoint called\n");
    SIM_break_simulation( "Breaking simulation" );
    printf("Leaving Sim breakpoint called\n");
}

int SimicsProcessor::run_sim()
{
    int ret = 1;
    conf_object_t     *cpu = NULL;
    sim_exception_t except_code;

    cpu = SIM_proc_no_2_ptr(proc_id);
    SIM_enable_processor(cpu);

    SIM_time_post_cycle( cpu, 1, Sim_Sync_Processor,
                         proc_breakpoint_handler, (void *) this );
    SIM_continue( 0 );

    except_code = SIM_clear_exception();

    printf("Sim continue done\n"); fflush(stdout);
    SIM_disable_processor(cpu);
    return ret;
}

When I run this by using a simics script (I've introduced a new ruby command
called run_sim that eventually gets routed to the above function), I can see
the processor executing instructions (I see makeRequest calls for memory
accesses) and the breakpoint callback also gets invoked. The message
"Leaving Sim breakpoint called" gets displayed, but then, nothing else seems
to happen till I hit Ctrl+C and then return to the simics prompt. On hitting
ctrl+c, I get a "Event queue overflowed" message.

Is there something in Ruby that prevents the above SIM_continue mechanism
from functioning correctly? I've set the SIMICS_RUBY_MULTIPLIER to 1. I also
tried disabling the exception handler for Core_Exception that is setup using
SIMICS_install_exception_callback thinking that somehow the simulation
breakpoint is being handled by this callback. But when I do that, I get: "No
object found" when running the simics script, even before control returns
from ruby0.init.

Thanks for any help,
Deepa


[← Prev in Thread] Current Thread [Next in Thread→]
  • [Gems-users] Using SIM_continue in Ruby, Deepa Srinivasan <=