common.h revision 10234
1/***************************************************************************** 2 * McPAT 3 * SOFTWARE LICENSE AGREEMENT 4 * Copyright (c) 2010-2013 Advanced Micro Devices, Inc. 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 * Author: Yasuko Eckert 31 * 32 ***************************************************************************/ 33 34#ifndef __COMMON_H__ 35#define __COMMON_H__ 36 37#include <string> 38 39#include "xmlParser.h" 40 41// Macro definitions to do string comparson to specific parameter/stat. 42// Note: These macros assume node_name and value variables of type XMLCSTR 43// to exist already. 44#define STRCMP(var, str) else if (strcmp(var, str) == 0) 45 46#define ASSIGN_INT_IF(str, lhs) STRCMP(node_name, str) \ 47lhs = atoi(value) 48 49#define ASSIGN_FP_IF(str, lhs) STRCMP(node_name, str) \ 50lhs = atof(value) 51 52#define ASSIGN_STR_IF(str, lhs) STRCMP(node_name, str) \ 53lhs = string(value) 54 55#define ASSIGN_ENUM_IF(str, lhs, etype) STRCMP(node_name, str) \ 56lhs = (etype)atoi(value) 57 58 59// Constants shared across many system components 60#define BITS_PER_BYTE 8.0 61#define MIN_BUFFER_SIZE 64 62// CAM structures do not have any associativity 63#define CAM_ASSOC 0 64 65#endif // __COMMON_H__ 66