<commit_before>/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/chips/p9/common/include/p9_const_common.H $        */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2012,2019                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */


/*! \brief These are macros used for the scom_addresses.H
 *
 *  Provides macro defintions for defining scom constants
 *  for assembly and C
 *
 */

// - HWP metadata

///
/// @file const_common.H
/// @brief These are macros used for the scom_addresses.H
///
// *HWP HWP Owner: <NAME> <<EMAIL>>
// *HWP FW Owner: ? <?>
// *HWP Team: SoA
// *HWP Level: 1
// *HWP Consumed by: XX:XX


#ifndef __CONST_COMMON_H
#define __CONST_COMMON_H

#if defined __ASSEMBLER__

//This probably won't work :(
//  Not sure you can do .set for the same name.
//  If so, it probably takes the last one, which would be the incorrect one
//#define FIXREG8(name, expr, unit, meth, newexpr) .set name, (newexpr)
//#define FIXREG32(name, expr, unit, meth, newexpr) .set name, (newexpr)
//#define FIXREG64(name, expr, unit, meth, newexpr) .set name, (newexpr)
//
//#define CONST_UINT8_T(name, expr, unit, meth) .set name, (expr)
//#define CONST_UINT32_T(name, expr, unit, meth) .set name, (expr)
//#define CONST_UINT64_T(name, expr, unit, meth) .set name, (expr)

#define RULL(x) x

#elif defined __cplusplus

#include <stdint.h>

template <typename T, uint64_t UNIT, uint64_t METH, T REG >
struct has_fixup
{
    static const T value = T(0);
};

template <typename T, uint64_t UNIT, uint64_t METH, T REG, uint64_t FLD >
struct has_fixfld
{
    static const uint8_t value = 255;
};


#define FIXREG8(name, expr, unit, meth, newexpr) template<> struct has_fixup<uint8_t,unit,meth,expr> { static const uint8_t value = newexpr; };
#define FIXREG32(name, expr, unit, meth, newexpr) template<> struct has_fixup<uint32_t,unit,meth,expr> { static const uint32_t value = newexpr; };
#define FIXREG64(name, expr, unit, meth, newexpr) template<> struct has_fixup<uint64_t,unit,meth,expr> { static const uint64_t value = newexpr; };

#define REG8(name, expr, unit, meth) static const uint8_t name = has_fixup<uint8_t,unit,meth,expr>::value ? has_fixup<uint8_t,unit,meth,expr>::value : expr;
#define REG32(name, expr, unit, meth) static const uint32_t name = has_fixup<uint32_t,unit,meth,expr>::value ? has_fixup<uint32_t,unit,meth,expr>::value : expr;
#define REG64(name, expr, unit, meth) static const uint64_t name = has_fixup<uint64_t,unit,meth,expr>::value ? has_fixup<uint64_t,unit,meth,expr>::value : expr;

#define FIXREG8_FLD(name, expr, unit, meth, fld, newexpr) template<> struct has_fixfld<uint8_t,unit,meth,expr,fld> { static const uint8_t value = newexpr; };
#define FIXREG32_FLD(name, expr, unit, meth, fld, newexpr) template<> struct has_fixfld<uint32_t,unit,meth,expr,fld> { static const uint32_t value = newexpr; };
#define FIXREG64_FLD(name, expr, unit, meth, fld, newexpr) template<> struct has_fixfld<uint64_t,unit,meth,expr,fld> { static const uint64_t value = newexpr; };

#define REG8_FLD(name, expr, unit, meth, fld) static const uint8_t name = has_fixfld<uint8_t,unit,meth,expr,fld>::value != 255 ? has_fixfld<uint8_t,unit,meth,expr,fld>::value : expr;
#define REG32_FLD(name, expr, unit, meth, fld) static const uint8_t name = has_fixfld<uint32_t,unit,meth,expr,fld>::value != 255 ? has_fixfld<uint32_t,unit,meth,expr,fld>::value : expr;
#define REG64_FLD(name, expr, unit, meth, fld) static const uint8_t name = has_fixfld<uint64_t,unit,meth,expr,fld>::value != 255 ? has_fixfld<uint64_t,unit,meth,expr,fld>::value : expr;

#define RULL(x) x##ull

#else // C code

// CONST_UINT[8,3,64]_T() can't be used in C code/headers; Use
//
//     #define <symbol> <value> [ or ULL(<value>) for 64-bit constants

#define RULL(x) x##ull

#endif  // __ASSEMBLER__

#endif  // __CONST_COMMON_H
<commit_msg>New scom addresses const headers for chip 9031<commit_after>/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/chips/p9/common/include/p9_const_common.H $        */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2012,2019                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */


/*! \brief These are macros used for the scom_addresses.H
 *
 *  Provides macro defintions for defining scom constants
 *  for assembly and C
 *
 */

// - HWP metadata

///
/// @file const_common.H
/// @brief These are macros used for the scom_addresses.H
///
// *HWP HWP Owner: <NAME> <<EMAIL>>
// *HWP FW Owner: ? <?>
// *HWP Team: SoA
// *HWP Level: 1
// *HWP Consumed by: XX:XX


#ifndef __CONST_COMMON_H
#define __CONST_COMMON_H

#if defined __ASSEMBLER__

//This probably won't work :(
//  Not sure you can do .set for the same name.
//  If so, it probably takes the last one, which would be the incorrect one
//#define FIXREG8(name, expr, unit, meth, newexpr) .set name, (newexpr)
//#define FIXREG32(name, expr, unit, meth, newexpr) .set name, (newexpr)
//#define FIXREG64(name, expr, unit, meth, newexpr) .set name, (newexpr)
//
//#define CONST_UINT8_T(name, expr, unit, meth) .set name, (expr)
//#define CONST_UINT32_T(name, expr, unit, meth) .set name, (expr)
//#define CONST_UINT64_T(name, expr, unit, meth) .set name, (expr)

#define RULL(x) x

#elif defined __cplusplus

#include <stdint.h>

template <typename T, uint64_t UNIT, uint64_t METH, T REG >
struct has_fixup
{
    static const T value = T(0);
};

template <typename T, uint64_t UNIT, uint64_t METH, T REG, uint64_t FLD >
struct has_fixfld
{
    static const uint8_t value = 255;
};


#define FIXREG8(name, expr, unit, meth, newexpr) template<> struct has_fixup<uint8_t,unit,meth,expr> { static const uint8_t value = newexpr; };
#define FIXREG32(name, expr, unit, meth, newexpr) template<> struct has_fixup<uint32_t,unit,meth,expr> { static const uint32_t value = newexpr; };
#define FIXREG64(name, expr, unit, meth, newexpr) template<> struct has_fixup<uint64_t,unit,meth,expr> { static const uint64_t value = newexpr; };

#define REG8(name, expr, unit, meth) static const uint8_t name = has_fixup<uint8_t,unit,meth,expr>::value ? has_fixup<uint8_t,unit,meth,expr>::value : expr;
#define REG32(name, expr, unit, meth) static const uint32_t name = has_fixup<uint32_t,unit,meth,expr>::value ? has_fixup<uint32_t,unit,meth,expr>::value : expr;
#define REG64(name, expr, unit, meth) static const uint64_t name = has_fixup<uint64_t,unit,meth,expr>::value ? has_fixup<uint64_t,unit,meth,expr>::value : expr;

#define FIXREG8_FLD(name, expr, unit, meth, fld, newexpr) template<> struct has_fixfld<uint8_t,unit,meth,expr,fld> { static const uint8_t value = newexpr; };
#define FIXREG32_FLD(name, expr, unit, meth, fld, newexpr) template<> struct has_fixfld<uint32_t,unit,meth,expr,fld> { static const uint32_t value = newexpr; };
#define FIXREG64_FLD(name, expr, unit, meth, fld, newexpr) template<> struct has_fixfld<uint64_t,unit,meth,expr,fld> { static const uint64_t value = newexpr; };

#define REG8_FLD(name, expr, unit, meth, fld) static const uint8_t name = has_fixfld<uint8_t,unit,meth,expr,fld>::value != 255 ? has_fixfld<uint8_t,unit,meth,expr,fld>::value : expr;
#define REG32_FLD(name, expr, unit, meth, fld) static const uint8_t name = has_fixfld<uint32_t,unit,meth,expr,fld>::value != 255 ? has_fixfld<uint32_t,unit,meth,expr,fld>::value : expr;
#define REG64_FLD(name, expr, unit, meth, fld) static const uint8_t name = has_fixfld<uint64_t,unit,meth,expr,fld>::value != 255 ? has_fixfld<uint64_t,unit,meth,expr,fld>::value : expr;

#define RULL(x) x##ull

//Remove the chiplet id from any register so that it can
//be used with pu.perv target type
#define FORCE_PERV(val) (RULL(0xFFFFFFFF00FFFFFF) & val)

#else // C code

// CONST_UINT[8,3,64]_T() can't be used in C code/headers; Use
//
//     #define <symbol> <value> [ or ULL(<value>) for 64-bit constants

#define RULL(x) x##ull

#endif  // __ASSEMBLER__

#endif  // __CONST_COMMON_H

{'fraction_non_alphanumeric': 0.11833197942052531, 'fraction_numerical': 0.022835996028522428, 'mean_word_length': 2.2023121387283235, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 62, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '367645', 'n_tokens_mistral': 3528, 'n_tokens_neox': 3388, 'n_words': 972}