pseudo_inst.cc (8555:6fd8d0432d8d) | pseudo_inst.cc (8580:a32e8ce374d6) |
---|---|
1/* 2 * Copyright (c) 2010 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated 11 * unmodified and in its entirety in all distributions of the software, 12 * modified or unmodified, in source code or in binary form. 13 * | 1/* 2 * Copyright (c) 2010 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated 11 * unmodified and in its entirety in all distributions of the software, 12 * modified or unmodified, in source code or in binary form. 13 * |
14 * Copyright (c) 2011 Advanced Micro Devices, Inc. |
|
14 * Copyright (c) 2003-2006 The Regents of The University of Michigan 15 * All rights reserved. 16 * 17 * Redistribution and use in source and binary forms, with or without 18 * modification, are permitted provided that the following conditions are 19 * met: redistributions of source code must retain the above copyright 20 * notice, this list of conditions and the following disclaimer; 21 * redistributions in binary form must reproduce the above copyright --- 354 unchanged lines hidden (view full) --- 376// what the user specified at the command line, the simulation may exit and/or 377// take a checkpoint when a certain work item begins. 378// 379void 380workbegin(ThreadContext *tc, uint64_t workid, uint64_t threadid) 381{ 382 tc->getCpuPtr()->workItemBegin(); 383 System *sys = tc->getSystemPtr(); | 15 * Copyright (c) 2003-2006 The Regents of The University of Michigan 16 * All rights reserved. 17 * 18 * Redistribution and use in source and binary forms, with or without 19 * modification, are permitted provided that the following conditions are 20 * met: redistributions of source code must retain the above copyright 21 * notice, this list of conditions and the following disclaimer; 22 * redistributions in binary form must reproduce the above copyright --- 354 unchanged lines hidden (view full) --- 377// what the user specified at the command line, the simulation may exit and/or 378// take a checkpoint when a certain work item begins. 379// 380void 381workbegin(ThreadContext *tc, uint64_t workid, uint64_t threadid) 382{ 383 tc->getCpuPtr()->workItemBegin(); 384 System *sys = tc->getSystemPtr(); |
385 const System::Params *params = sys->params(); |
|
384 385 DPRINTF(WorkItems, "Work Begin workid: %d, threadid %d\n", workid, 386 threadid); 387 388 // 389 // If specified, determine if this is the specific work item the user 390 // identified 391 // | 386 387 DPRINTF(WorkItems, "Work Begin workid: %d, threadid %d\n", workid, 388 threadid); 389 390 // 391 // If specified, determine if this is the specific work item the user 392 // identified 393 // |
392 if (sys->params()->work_item_id == -1 || 393 sys->params()->work_item_id == workid) { | 394 if (params->work_item_id == -1 || params->work_item_id == workid) { |
394 395 uint64_t systemWorkBeginCount = sys->incWorkItemsBegin(); 396 int cpuId = tc->getCpuPtr()->cpuId(); 397 | 395 396 uint64_t systemWorkBeginCount = sys->incWorkItemsBegin(); 397 int cpuId = tc->getCpuPtr()->cpuId(); 398 |
398 if (sys->params()->work_cpus_ckpt_count != 0 && 399 sys->markWorkItem(cpuId) >= sys->params()->work_cpus_ckpt_count) { | 399 if (params->work_cpus_ckpt_count != 0 && 400 sys->markWorkItem(cpuId) >= params->work_cpus_ckpt_count) { |
400 // 401 // If active cpus equals checkpoint count, create checkpoint 402 // | 401 // 402 // If active cpus equals checkpoint count, create checkpoint 403 // |
403 Event *event = new SimLoopExitEvent("checkpoint", 0); 404 mainEventQueue.schedule(event, curTick()); | 404 exitSimLoop("checkpoint"); |
405 } 406 | 405 } 406 |
407 if (systemWorkBeginCount == sys->params()->work_begin_ckpt_count) { | 407 if (systemWorkBeginCount == params->work_begin_ckpt_count) { |
408 // 409 // Note: the string specified as the cause of the exit event must 410 // exactly equal "checkpoint" inorder to create a checkpoint 411 // | 408 // 409 // Note: the string specified as the cause of the exit event must 410 // exactly equal "checkpoint" inorder to create a checkpoint 411 // |
412 Event *event = new SimLoopExitEvent("checkpoint", 0); 413 mainEventQueue.schedule(event, curTick()); | 412 exitSimLoop("checkpoint"); |
414 } 415 | 413 } 414 |
416 if (systemWorkBeginCount == sys->params()->work_begin_exit_count) { | 415 if (systemWorkBeginCount == params->work_begin_exit_count) { |
417 // 418 // If a certain number of work items started, exit simulation 419 // | 416 // 417 // If a certain number of work items started, exit simulation 418 // |
420 Event *event = new SimLoopExitEvent("work started count reach", 0); 421 mainEventQueue.schedule(event, curTick()); | 419 exitSimLoop("work started count reach"); |
422 } 423 | 420 } 421 |
424 if (tc->getCpuPtr()->cpuId() == sys->params()->work_begin_cpu_id_exit) { | 422 if (cpuId == params->work_begin_cpu_id_exit) { |
425 // | 423 // |
426 // If work started on the specific cpu id specified, exit simulation | 424 // If work started on the cpu id specified, exit simulation |
427 // | 425 // |
428 Event *event = new SimLoopExitEvent("work started on specific cpu", 429 0); 430 431 mainEventQueue.schedule(event, curTick() + 1); | 426 exitSimLoop("work started on specific cpu"); |
432 } 433 } 434} 435 436// 437// This function is executed when annotated work items end. Depending on 438// what the user specified at the command line, the simulation may exit and/or 439// take a checkpoint when a certain work item ends. 440// 441void 442workend(ThreadContext *tc, uint64_t workid, uint64_t threadid) 443{ 444 tc->getCpuPtr()->workItemEnd(); 445 System *sys = tc->getSystemPtr(); | 427 } 428 } 429} 430 431// 432// This function is executed when annotated work items end. Depending on 433// what the user specified at the command line, the simulation may exit and/or 434// take a checkpoint when a certain work item ends. 435// 436void 437workend(ThreadContext *tc, uint64_t workid, uint64_t threadid) 438{ 439 tc->getCpuPtr()->workItemEnd(); 440 System *sys = tc->getSystemPtr(); |
441 const System::Params *params = sys->params(); |
|
446 447 DPRINTF(WorkItems, "Work End workid: %d, threadid %d\n", workid, threadid); 448 449 // 450 // If specified, determine if this is the specific work item the user 451 // identified 452 // | 442 443 DPRINTF(WorkItems, "Work End workid: %d, threadid %d\n", workid, threadid); 444 445 // 446 // If specified, determine if this is the specific work item the user 447 // identified 448 // |
453 if (sys->params()->work_item_id == -1 || 454 sys->params()->work_item_id == workid) { | 449 if (params->work_item_id == -1 || params->work_item_id == workid) { |
455 456 uint64_t systemWorkEndCount = sys->incWorkItemsEnd(); 457 int cpuId = tc->getCpuPtr()->cpuId(); 458 | 450 451 uint64_t systemWorkEndCount = sys->incWorkItemsEnd(); 452 int cpuId = tc->getCpuPtr()->cpuId(); 453 |
459 if (sys->params()->work_cpus_ckpt_count != 0 && 460 sys->markWorkItem(cpuId) >= sys->params()->work_cpus_ckpt_count) { | 454 if (params->work_cpus_ckpt_count != 0 && 455 sys->markWorkItem(cpuId) >= params->work_cpus_ckpt_count) { |
461 // 462 // If active cpus equals checkpoint count, create checkpoint 463 // | 456 // 457 // If active cpus equals checkpoint count, create checkpoint 458 // |
464 Event *event = new SimLoopExitEvent("checkpoint", 0); 465 mainEventQueue.schedule(event, curTick()); | 459 exitSimLoop("checkpoint"); |
466 } 467 | 460 } 461 |
468 if (sys->params()->work_end_ckpt_count != 0 && 469 systemWorkEndCount == sys->params()->work_end_ckpt_count) { | 462 if (params->work_end_ckpt_count != 0 && 463 systemWorkEndCount == params->work_end_ckpt_count) { |
470 // 471 // If total work items completed equals checkpoint count, create 472 // checkpoint 473 // | 464 // 465 // If total work items completed equals checkpoint count, create 466 // checkpoint 467 // |
474 Event *event = new SimLoopExitEvent("checkpoint", 0); 475 mainEventQueue.schedule(event, curTick()); | 468 exitSimLoop("checkpoint"); |
476 } 477 | 469 } 470 |
478 if (sys->params()->work_end_exit_count != 0 && 479 systemWorkEndCount == sys->params()->work_end_exit_count) { | 471 if (params->work_end_exit_count != 0 && 472 systemWorkEndCount == params->work_end_exit_count) { |
480 // 481 // If total work items completed equals exit count, exit simulation 482 // | 473 // 474 // If total work items completed equals exit count, exit simulation 475 // |
483 Event *event = new SimLoopExitEvent("work items exit count reached", 484 0); 485 486 mainEventQueue.schedule(event, curTick()); | 476 exitSimLoop("work items exit count reached"); |
487 } 488 } 489} 490 491} // namespace PseudoInst | 477 } 478 } 479} 480 481} // namespace PseudoInst |