SystemC 3.0.0
Accellera SystemC proof-of-concept library
sc_machine.h
Go to the documentation of this file.
1/*****************************************************************************
2
3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4 more contributor license agreements. See the NOTICE file distributed
5 with this work for additional information regarding copyright ownership.
6 Accellera licenses this file to you under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with the
8 License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 implied. See the License for the specific language governing
16 permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22 sc_machine.h -- Machine-dependent Environment Settings
23
24 Original Author: Andy Goodrich, Forte Design Systems, Inc.
25
26 CHANGE LOG AT END OF FILE
27 *****************************************************************************/
28
29
30#ifndef SC_MACHINE_H
31#define SC_MACHINE_H
32
33#include <climits>
34
35// ----------------------------------------------------------------------------
36// Little or big endian machine?
37// ----------------------------------------------------------------------------
38
39#if defined(_MSC_VER) && !defined(__BYTE_ORDER__)
40// Quoting from https://learn.microsoft.com/en-us/cpp/standard-library/bit-enum?view=msvc-170#remarks
41// All native scalar types are little-endian for the platforms that
42// Microsoft Visual C++ targets (x86, x64, ARM, ARM64).
43# define SC_LITTLE_ENDIAN
44#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
45# define SC_LITTLE_ENDIAN
46#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
47# define SC_BIG_ENDIAN
48#else
49# error "Could not detect the endianness of the CPU."
50#endif
51
52// ----------------------------------------------------------------------------
53// Are long data types 32-bit or 64-bit?
54// ----------------------------------------------------------------------------
55
56#if ULONG_MAX > 0xffffffffUL
57# define SC_LONG_64
58#endif
59
60// $Log: sc_machine.h,v $
61// Revision 1.5 2011/08/26 22:58:23 acg
62// Torsten Maehne: changes for endian detection.
63//
64// Revision 1.4 2011/08/26 20:46:18 acg
65// Andy Goodrich: moved the modification log to the end of the file to
66// eliminate source line number skew when check-ins are done.
67//
68// Revision 1.3 2011/02/18 20:38:44 acg
69// Andy Goodrich: Updated Copyright notice.
70//
71// Revision 1.2 2010/09/06 16:35:09 acg
72// Andy Goodrich: changed i386 to __i386__ in ifdef.
73//
74// Revision 1.1.1.1 2006/12/15 20:20:06 acg
75// SystemC 2.3
76//
77// Revision 1.3 2006/01/13 18:53:10 acg
78// Andy Goodrich: Added $Log command so that CVS comments are reproduced in
79// the source.
80//
81
82#endif // !defined(SC_MACHINE_H)