/***************************************************************************** * McPAT * SOFTWARE LICENSE AGREEMENT * Copyright 2012 Hewlett-Packard Development Company, L.P. * All Rights Reserved * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer; * redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution; * neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.” * ***************************************************************************/ #include #include #include "XML_Parse.h" #include "xmlParser.h" using namespace std; void ParseXML::parse(char* filepath) { unsigned int i,j,k,m,n; unsigned int NumofCom_4; unsigned int itmp; //Initialize all structures ParseXML::initialize(); // this open and parse the XML file: XMLNode xMainNode=XMLNode::openFileHelper(filepath,"component"); //the 'component' in the first layer XMLNode xNode2=xMainNode.getChildNode("component"); // the 'component' in the second layer //get all params in the second layer itmp=xNode2.nChildNode("param"); for(i=0; iOrderofComponents_3layer) { //___________________________get all system.core0-n________________________________________________ if (sys.homogeneous_cores==1) OrderofComponents_3layer=0; else OrderofComponents_3layer=sys.number_of_cores-1; for (i=0; i<=OrderofComponents_3layer; i++) { xNode3=xNode2.getChildNode("component",i); if (xNode3.isEmpty()==1) { printf("The value of homogeneous_cores or number_of_cores is not correct!"); exit(0); } else{ if (strstr(xNode3.getAttribute("name"),"core")!=NULL) { { //For cpu0-cpui //Get all params with system.core? itmp=xNode3.nChildNode("param"); for(k=0; k0) OrderofComponents_3layer=OrderofComponents_3layer+1; xNode3=xNode2.getChildNode("component",OrderofComponents_3layer); if (xNode3.isEmpty()==1) { printf("some value(s) of number_of_cores/number_of_L2s/number_of_L3s/number_of_NoCs is/are not correct!"); exit(0); } if (strstr(xNode3.getAttribute("id"),"system.mem")!=NULL) { itmp=xNode3.nChildNode("param"); for(k=0; k0) OrderofComponents_3layer=OrderofComponents_3layer+1; xNode3=xNode2.getChildNode("component",OrderofComponents_3layer); if (xNode3.isEmpty()==1) { printf("some value(s) of number_of_cores/number_of_L2s/number_of_L3s/number_of_NoCs is/are not correct!"); exit(0); } if (strstr(xNode3.getAttribute("id"),"system.mc")!=NULL) { itmp=xNode3.nChildNode("param"); for(k=0; k0) OrderofComponents_3layer=OrderofComponents_3layer+1; xNode3=xNode2.getChildNode("component",OrderofComponents_3layer); if (xNode3.isEmpty()==1) { printf("some value(s) of number_of_cores/number_of_L2s/number_of_L3s/number_of_NoCs is/are not correct!"); exit(0); } if (strstr(xNode3.getAttribute("id"),"system.niu")!=NULL) { itmp=xNode3.nChildNode("param"); for(k=0; k0) OrderofComponents_3layer=OrderofComponents_3layer+1; xNode3=xNode2.getChildNode("component",OrderofComponents_3layer); if (xNode3.isEmpty()==1) { printf("some value(s) of number_of_cores/number_of_L2s/number_of_L3s/number_of_NoCs is/are not correct!"); exit(0); } if (strstr(xNode3.getAttribute("id"),"system.pcie")!=NULL) { itmp=xNode3.nChildNode("param"); for(k=0; k0) OrderofComponents_3layer=OrderofComponents_3layer+1; xNode3=xNode2.getChildNode("component",OrderofComponents_3layer); if (xNode3.isEmpty()==1) { printf("some value(s) of number_of_cores/number_of_L2s/number_of_L3s/number_of_NoCs is/are not correct!"); exit(0); } if (strstr(xNode3.getAttribute("id"),"system.flashc")!=NULL) { itmp=xNode3.nChildNode("param"); for(k=0; k