pseudo_inst.cc (7823:dac01f14f20f) | pseudo_inst.cc (7914:eee5bb0fb8ea) |
---|---|
1/* 2 * Copyright (c) 2003-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 314 unchanged lines hidden (view full) --- 323} 324 325void 326switchcpu(ThreadContext *tc) 327{ 328 exitSimLoop("switchcpu"); 329} 330 | 1/* 2 * Copyright (c) 2003-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 314 unchanged lines hidden (view full) --- 323} 324 325void 326switchcpu(ThreadContext *tc) 327{ 328 exitSimLoop("switchcpu"); 329} 330 |
331// 332// This function is executed when annotated work items begin. Depending on 333// what the user specified at the command line, the simulation may exit and/or 334// take a checkpoint when a certain work item begins. 335// 336void 337workbegin(ThreadContext *tc, uint64_t workid, uint64_t threadid) 338{ 339 tc->getCpuPtr()->workItemBegin(); 340 System *sys = tc->getSystemPtr(); 341 342 DPRINTF(WorkItems, "Work Begin workid: %d, threadid %d\n", workid, 343 threadid); 344 345 // 346 // If specified, determine if this is the specific work item the user 347 // identified 348 // 349 if (sys->params()->work_item_id == -1 || 350 sys->params()->work_item_id == workid) { 351 352 uint64_t systemWorkBeginCount = sys->incWorkItemsBegin(); 353 int cpuId = tc->getCpuPtr()->cpuId(); 354 355 if (sys->params()->work_cpus_ckpt_count != 0 && 356 sys->markWorkItem(cpuId) >= sys->params()->work_cpus_ckpt_count) { 357 // 358 // If active cpus equals checkpoint count, create checkpoint 359 // 360 Event *event = new SimLoopExitEvent("checkpoint", 0); 361 mainEventQueue.schedule(event, curTick()); 362 } 363 364 if (systemWorkBeginCount == sys->params()->work_begin_ckpt_count) { 365 // 366 // Note: the string specified as the cause of the exit event must 367 // exactly equal "checkpoint" inorder to create a checkpoint 368 // 369 Event *event = new SimLoopExitEvent("checkpoint", 0); 370 mainEventQueue.schedule(event, curTick()); 371 } 372 373 if (systemWorkBeginCount == sys->params()->work_begin_exit_count) { 374 // 375 // If a certain number of work items started, exit simulation 376 // 377 Event *event = new SimLoopExitEvent("work started count reach", 0); 378 mainEventQueue.schedule(event, curTick()); 379 } 380 381 if (tc->getCpuPtr()->cpuId() == sys->params()->work_begin_cpu_id_exit) { 382 // 383 // If work started on the specific cpu id specified, exit simulation 384 // 385 Event *event = new SimLoopExitEvent("work started on specific cpu", 386 0); 387 388 mainEventQueue.schedule(event, curTick() + 1); 389 } 390 } 391} 392 393// 394// This function is executed when annotated work items end. Depending on 395// what the user specified at the command line, the simulation may exit and/or 396// take a checkpoint when a certain work item ends. 397// 398void 399workend(ThreadContext *tc, uint64_t workid, uint64_t threadid) 400{ 401 tc->getCpuPtr()->workItemEnd(); 402 System *sys = tc->getSystemPtr(); 403 404 DPRINTF(WorkItems, "Work End workid: %d, threadid %d\n", workid, threadid); 405 406 // 407 // If specified, determine if this is the specific work item the user 408 // identified 409 // 410 if (sys->params()->work_item_id == -1 || 411 sys->params()->work_item_id == workid) { 412 413 uint64_t systemWorkEndCount = sys->incWorkItemsEnd(); 414 int cpuId = tc->getCpuPtr()->cpuId(); 415 416 if (sys->params()->work_cpus_ckpt_count != 0 && 417 sys->markWorkItem(cpuId) >= sys->params()->work_cpus_ckpt_count) { 418 // 419 // If active cpus equals checkpoint count, create checkpoint 420 // 421 Event *event = new SimLoopExitEvent("checkpoint", 0); 422 mainEventQueue.schedule(event, curTick()); 423 } 424 425 if (sys->params()->work_end_ckpt_count != 0 && 426 systemWorkEndCount == sys->params()->work_end_ckpt_count) { 427 // 428 // If total work items completed equals checkpoint count, create 429 // checkpoint 430 // 431 Event *event = new SimLoopExitEvent("checkpoint", 0); 432 mainEventQueue.schedule(event, curTick()); 433 } 434 435 if (sys->params()->work_end_exit_count != 0 && 436 systemWorkEndCount == sys->params()->work_end_exit_count) { 437 // 438 // If total work items completed equals exit count, exit simulation 439 // 440 Event *event = new SimLoopExitEvent("work items exit count reached", 441 0); 442 443 mainEventQueue.schedule(event, curTick()); 444 } 445 } 446} 447 |
|
331} // namespace PseudoInst | 448} // namespace PseudoInst |