OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable_0_2_0/] [or1ksim/] [sim-cmd.c] - Diff between revs 1557 and 1580

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 1557 Rev 1580
Line 21... Line 21...
#define _GNU_SOURCE /* For isblank() */
#define _GNU_SOURCE /* For isblank() */
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <ctype.h>
#include <ctype.h>
#include <unistd.h>
#include <unistd.h>
 
#include <limits.h>
 
 
#include "config.h"
#include "config.h"
 
 
#ifdef HAVE_LIBREADLINE
#ifdef HAVE_LIBREADLINE
#include <readline/readline.h>
#include <readline/readline.h>
Line 388... Line 389...
 * to_insn_num */
 * to_insn_num */
void check_insn_exec(void *dat)
void check_insn_exec(void *dat)
{
{
  if(runtime.cpu.instructions < to_insn_num) {
  if(runtime.cpu.instructions < to_insn_num) {
    /* Instruction count has not yet been reached, reschedule */
    /* Instruction count has not yet been reached, reschedule */
    SCHED_ADD(check_insn_exec, NULL, to_insn_num - runtime.cpu.instructions);
    long long int  delta = to_insn_num - runtime.cpu.instructions;
 
    SCHED_ADD(check_insn_exec, NULL, (delta > INT_MAX) ? INT_MAX : delta);
    return;
    return;
  }
  }
  handle_sim_command();
  handle_sim_command();
}
}
 
 
Line 414... Line 416...
    if(!strcmp(argv[2], "hush"))
    if(!strcmp(argv[2], "hush"))
      runtime.sim.hush = 1;
      runtime.sim.hush = 1;
  }
  }
 
 
  if(argc >= 2) {
  if(argc >= 2) {
    if((to_insn_num = strtol(argv[1], NULL, 0)) != -1) {
    if((to_insn_num = strtoll(argv[1], NULL, 0)) != -1) {
      if(runtime.sim.hush) {
      if(runtime.sim.hush) {
        /* Schedule a job to run in to_insn_num cycles time since an instruction
        /* Schedule a job to run in to_insn_num cycles time since an instruction
         * may execute in only 1 cycle.  check_insn_exec will check if the right
         * may execute in only 1 cycle.  check_insn_exec will check if the right
         * number of instructions have been executed.  If not it will
         * number of instructions have been executed.  If not it will
         * reschedule.  */
         * reschedule.  */
        SCHED_ADD(check_insn_exec, NULL, to_insn_num);
        SCHED_ADD(check_insn_exec, NULL, (to_insn_num > INT_MAX) ? INT_MAX : to_insn_num);
      } else {
      } else {
        /* The user wants to see the execution dumps.  Schedule a task to show
        /* The user wants to see the execution dumps.  Schedule a task to show
         * it to him after each cycle */
         * it to him after each cycle */
        sched_next_insn(print_insn_exec, NULL);
        sched_next_insn(print_insn_exec, NULL);
      }
      }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.