Ejemplo n.º 1
0
/* start simulation, program loaded, processor precise state initialized */
void
sim_main(void)
{
  fprintf(stderr, "sim: ** starting *pipe* functional simulation **\n");

  /* must have natural byte/word ordering */
  if (sim_swap_bytes || sim_swap_words)
    fatal("sim: *pipe* functional simulation cannot swap bytes or words");

  /* set up initial default next PC */
  regs.regs_NPC = regs.regs_PC + sizeof(md_inst_t);
  /* maintain $r0 semantics */
  regs.regs_R[MD_REG_ZERO] = 0;
  fd.PC = regs.regs_PC - sizeof(md_inst_t);
 
  while (TRUE)
  {
	  //handle the pipeline in reverse so that the instruction could be handled in ascending order
	  sim_num_insn++;
	  do_stall();
	  do_wb();
	  do_mem();
	  do_ex();
	  do_id();
	  do_if();
	  dump_pipeline();
  }
}
Ejemplo n.º 2
0
/* start simulation, program loaded, processor precise state initialized */
void
sim_main(void)
{
  fprintf(stderr, "sim: ** starting *pipe* functional simulation **\n");

  /* must have natural byte/word ordering */
  if (sim_swap_bytes || sim_swap_words)
    fatal("sim: *pipe* functional simulation cannot swap bytes or words");

  /* set up initial default next PC */
  /* maintain $r0 semantics */
  regs.regs_R[MD_REG_ZERO] = 0;
  regs.regs_PC -= sizeof(md_inst_t);
  while (TRUE)
  {
	   do_if();
     do_wb();
     do_id();
     do_ex();
     do_mem();
     print_env();
     write_buf();
     #ifndef NO_INSN_COUNT
           sim_num_insn++;
     #endif /* !NO_INSN_COUNT */
  }
}