1/* 2 * Copyright (c) 2014, TU Delft, TU Eindhoven and TU Kaiserslautern 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: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * 3. Neither the name of the copyright holder nor the names of its 17 * contributors may be used to endorse or promote products derived from 18 * this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 23 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 26 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * 32 * Authors: Matthias Jung, Omar Naji 33 * 34 */ 35 36#include <string> 37#include "libdrampower/LibDRAMPower.h" 38 39#if USE_XERCES 40 #include "xmlparser/MemSpecParser.h" 41#endif 42 43using namespace std; 44using namespace Data; 45 46int main(int argc, char* argv[]) 47{ 48 assert(argc == 2); 49 //Setup of DRAMPower for your simulation 50 string filename; 51 //type path to memspec file 52 filename = argv[1]; 53 //Parsing the Memspec specification of found in memspec folder 54 #if USE_XERCES 55 MemorySpecification memSpec(MemSpecParser::getMemSpecFromXML(filename)); 56 #else 57 MemorySpecification memSpec; 58 #endif 59 libDRAMPower test = libDRAMPower(memSpec, 0); 60 // During the simulation you can report activity 61 // to DRAMPower with the doCommand(...) function: 62 test.doCommand(MemCommand::ACT,0,35); 63 test.doCommand(MemCommand::RDA,0,50); 64 test.doCommand(MemCommand::ACT,4,51); 65 test.doCommand(MemCommand::RDA,4,66); 66 test.doCommand(MemCommand::ACT,0,86); 67 test.doCommand(MemCommand::RDA,0,101); 68 test.doCommand(MemCommand::ACT,2,102); 69 //This functionality is still not implemented. 70 test.updateCounters(false); 71 test.doCommand(MemCommand::RDA,2,117); 72 test.doCommand(MemCommand::ACT,5,119); 73 test.doCommand(MemCommand::RDA,5,134); 74 test.doCommand(MemCommand::ACT,0,137); 75 test.doCommand(MemCommand::RDA,0,152); 76 test.doCommand(MemCommand::ACT,3,159); 77 test.doCommand(MemCommand::RDA,3,174); 78 test.doCommand(MemCommand::ACT,0,195); 79 test.doCommand(MemCommand::RDA,0,210); 80 test.doCommand(MemCommand::ACT,4,232); 81 test.doCommand(MemCommand::WRA,4,247);
|