110234Syasuko.eckert@amd.com/*****************************************************************************
210234Syasuko.eckert@amd.com *                                McPAT
310234Syasuko.eckert@amd.com *                      SOFTWARE LICENSE AGREEMENT
410234Syasuko.eckert@amd.com *            Copyright (c) 2010-2013 Advanced Micro Devices, Inc.
510234Syasuko.eckert@amd.com *                          All Rights Reserved
610234Syasuko.eckert@amd.com *
710234Syasuko.eckert@amd.com * Redistribution and use in source and binary forms, with or without
810234Syasuko.eckert@amd.com * modification, are permitted provided that the following conditions are
910234Syasuko.eckert@amd.com * met: redistributions of source code must retain the above copyright
1010234Syasuko.eckert@amd.com * notice, this list of conditions and the following disclaimer;
1110234Syasuko.eckert@amd.com * redistributions in binary form must reproduce the above copyright
1210234Syasuko.eckert@amd.com * notice, this list of conditions and the following disclaimer in the
1310234Syasuko.eckert@amd.com * documentation and/or other materials provided with the distribution;
1410234Syasuko.eckert@amd.com * neither the name of the copyright holders nor the names of its
1510234Syasuko.eckert@amd.com * contributors may be used to endorse or promote products derived from
1610234Syasuko.eckert@amd.com * this software without specific prior written permission.
1710234Syasuko.eckert@amd.com
1810234Syasuko.eckert@amd.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1910234Syasuko.eckert@amd.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2010234Syasuko.eckert@amd.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2110234Syasuko.eckert@amd.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2210234Syasuko.eckert@amd.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2310234Syasuko.eckert@amd.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2410234Syasuko.eckert@amd.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2510234Syasuko.eckert@amd.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2610234Syasuko.eckert@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2710234Syasuko.eckert@amd.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2810234Syasuko.eckert@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2910234Syasuko.eckert@amd.com *
3010234Syasuko.eckert@amd.com * Author: Yasuko Eckert
3110234Syasuko.eckert@amd.com *
3210234Syasuko.eckert@amd.com ***************************************************************************/
3310234Syasuko.eckert@amd.com
3410234Syasuko.eckert@amd.com#ifndef __COMMON_H__
3510234Syasuko.eckert@amd.com#define __COMMON_H__
3610234Syasuko.eckert@amd.com
3710234Syasuko.eckert@amd.com#include <string>
3810234Syasuko.eckert@amd.com
3910234Syasuko.eckert@amd.com#include "xmlParser.h"
4010234Syasuko.eckert@amd.com
4110234Syasuko.eckert@amd.com// Macro definitions to do string comparson to specific parameter/stat.
4210234Syasuko.eckert@amd.com// Note: These macros assume node_name and value variables of type XMLCSTR
4310234Syasuko.eckert@amd.com//       to exist already.
4410234Syasuko.eckert@amd.com#define STRCMP(var, str) else if (strcmp(var, str) == 0)
4510234Syasuko.eckert@amd.com
4610234Syasuko.eckert@amd.com#define ASSIGN_INT_IF(str, lhs) STRCMP(node_name, str) \
4710234Syasuko.eckert@amd.comlhs = atoi(value)
4810234Syasuko.eckert@amd.com
4910234Syasuko.eckert@amd.com#define ASSIGN_FP_IF(str, lhs) STRCMP(node_name, str) \
5010234Syasuko.eckert@amd.comlhs = atof(value)
5110234Syasuko.eckert@amd.com
5210234Syasuko.eckert@amd.com#define ASSIGN_STR_IF(str, lhs) STRCMP(node_name, str) \
5310234Syasuko.eckert@amd.comlhs = string(value)
5410234Syasuko.eckert@amd.com
5510234Syasuko.eckert@amd.com#define ASSIGN_ENUM_IF(str, lhs, etype) STRCMP(node_name, str) \
5610234Syasuko.eckert@amd.comlhs = (etype)atoi(value)
5710234Syasuko.eckert@amd.com
5810234Syasuko.eckert@amd.com
5910234Syasuko.eckert@amd.com// Constants shared across many system components
6010234Syasuko.eckert@amd.com#define BITS_PER_BYTE 8.0
6110234Syasuko.eckert@amd.com#define MIN_BUFFER_SIZE 64
6210234Syasuko.eckert@amd.com// CAM structures do not have any associativity
6310234Syasuko.eckert@amd.com#define CAM_ASSOC 0
6410234Syasuko.eckert@amd.com
6510234Syasuko.eckert@amd.com#endif // __COMMON_H__
66