main.cc revision 10152:52c552138ba1
1/***************************************************************************** 2 * McPAT/CACTI 3 * SOFTWARE LICENSE AGREEMENT 4 * Copyright 2012 Hewlett-Packard Development Company, L.P. 5 * All Rights Reserved 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are 9 * met: redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer; 11 * redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution; 14 * neither the name of the copyright holders nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.” 29 * 30 ***************************************************************************/ 31 32#include <iostream> 33 34#include "io.h" 35 36using namespace std; 37 38 39int main(int argc,char *argv[]) 40{ 41 42 uca_org_t result; 43 if (argc != 53 && argc != 55) 44 { 45 bool infile_specified = false; 46 string infile_name(""); 47 48 for (int32_t i = 0; i < argc; i++) 49 { 50 if (argv[i] == string("-infile")) 51 { 52 infile_specified = true; 53 i++; 54 infile_name = argv[i]; 55 } 56 } 57 58 if (infile_specified == false) 59 { 60 cerr << " Invalid arguments -- how to use CACTI:" << endl; 61 cerr << " 1) cacti -infile <input file name>" << endl; 62 cerr << " 2) cacti arg1 ... arg52 -- please refer to the README file" << endl; 63 cerr << " No. of arguments input - " << argc << endl; 64 exit(1); 65 } 66 else 67 { 68 result = cacti_interface(infile_name); 69 } 70 } 71 else if (argc == 53) 72 { 73 result = cacti_interface(atoi(argv[ 1]), 74 atoi(argv[ 2]), 75 atoi(argv[ 3]), 76 atoi(argv[ 4]), 77 atoi(argv[ 5]), 78 atoi(argv[ 6]), 79 atoi(argv[ 7]), 80 atoi(argv[ 8]), 81 atoi(argv[ 9]), 82 atof(argv[10]), 83 atoi(argv[11]), 84 atoi(argv[12]), 85 atoi(argv[13]), 86 atoi(argv[14]), 87 atoi(argv[15]), 88 atoi(argv[16]), 89 atoi(argv[17]), 90 atoi(argv[18]), 91 atoi(argv[19]), 92 atoi(argv[20]), 93 atoi(argv[21]), 94 atoi(argv[22]), 95 atoi(argv[23]), 96 atoi(argv[24]), 97 atoi(argv[25]), 98 atoi(argv[26]), 99 atoi(argv[27]), 100 atoi(argv[28]), 101 atoi(argv[29]), 102 atoi(argv[30]), 103 atoi(argv[31]), 104 atoi(argv[32]), 105 atoi(argv[33]), 106 atoi(argv[34]), 107 atoi(argv[35]), 108 atoi(argv[36]), 109 atoi(argv[37]), 110 atoi(argv[38]), 111 atoi(argv[39]), 112 atoi(argv[40]), 113 atoi(argv[41]), 114 atoi(argv[42]), 115 atoi(argv[43]), 116 atoi(argv[44]), 117 atoi(argv[45]), 118 atoi(argv[46]), 119 atoi(argv[47]), 120 atoi(argv[48]), 121 atoi(argv[49]), 122 atoi(argv[50]), 123 atoi(argv[51]), 124 atoi(argv[52])); 125 } 126 else 127 { 128 result = cacti_interface(atoi(argv[ 1]), 129 atoi(argv[ 2]), 130 atoi(argv[ 3]), 131 atoi(argv[ 4]), 132 atoi(argv[ 5]), 133 atoi(argv[ 6]), 134 atoi(argv[ 7]), 135 atoi(argv[ 8]), 136 atof(argv[ 9]), 137 atoi(argv[10]), 138 atoi(argv[11]), 139 atoi(argv[12]), 140 atoi(argv[13]), 141 atoi(argv[14]), 142 atoi(argv[15]), 143 atoi(argv[16]), 144 atoi(argv[17]), 145 atoi(argv[18]), 146 atoi(argv[19]), 147 atoi(argv[20]), 148 atoi(argv[21]), 149 atoi(argv[22]), 150 atoi(argv[23]), 151 atoi(argv[24]), 152 atoi(argv[25]), 153 atoi(argv[26]), 154 atoi(argv[27]), 155 atoi(argv[28]), 156 atoi(argv[29]), 157 atoi(argv[30]), 158 atoi(argv[31]), 159 atoi(argv[32]), 160 atoi(argv[33]), 161 atoi(argv[34]), 162 atoi(argv[35]), 163 atoi(argv[36]), 164 atoi(argv[37]), 165 atoi(argv[38]), 166 atoi(argv[39]), 167 atoi(argv[40]), 168 atoi(argv[41]), 169 atoi(argv[42]), 170 atoi(argv[43]), 171 atoi(argv[44]), 172 atoi(argv[45]), 173 atoi(argv[46]), 174 atoi(argv[47]), 175 atoi(argv[48]), 176 atoi(argv[49]), 177 atoi(argv[50]), 178 atoi(argv[51]), 179 atoi(argv[52]), 180 atoi(argv[53]), 181 atoi(argv[54])); 182 } 183 184 result.cleanup(); 185// delete result.data_array2; 186// if (result.tag_array2!=NULL) 187// delete result.tag_array2; 188 189 return 0; 190} 191 192