Home > User Support > CoverageMaster winAMS FAQ

CoverageMaster winAMS FAQ

CoverageMaster General Specific Issues

A02_03: What are the data types built into the CoverageMaster General core? How is it different from the actual MPU?

Question:

I want to use CoverageMaster General, but I want to understand the difference with the actual MPU. What are the data types built into the CoverageMaster General core? How is it different from the actual MPU?

Answer:

The MPU simulator built into CoverageMaster General has the structure of a 32-bit RISC MPU. The number of bits of the MPU cannot be changed or specified.

You can select little endian or big endian for byte order, but you cannot change other processing system-dependent specifications.

Therefore, especially when testing the code of MPU with different data widths, such as 16-bit and 8-bit, it is necessary to understand the difference in data types resulting from the difference in MPU structure.

If there is an "int" type in the source code, the bit width of that variable differs depending on the MPU. For a 32-bit MPU, int = 32-bit (long type) and for a 16-bit microcomputer, int = 16-bit (short type). For example, when testing 16-bit MPU code, int type variables must be defined in advance as short type variables to specify 16-bits.

General language specifications (specification of the built-in compiler when generating executable code) is described in the help manual.

Windows Start Menu -> WinAMS -> CoverageMaster General Manual

 

Excerpt from the Manual

Language Specifications

Effective number of characters for identifiers

The effective length for identifiers is 250 characters.
Identifiers that exceed 250 characters can build, but these identifiers cannot be referenced by CoverageMaster winAMS when using C++ language. In such cases, create a test driver to assign the value and reference the identifier.

Data Type

Variable Type

Size

Minimum Value

Maximum Value

char
unsigned char

8bit
8bit

-128
0

+127
+255

short
unsigned short
short int
unsigned short int

16bit
16bit
16bit
16bit

-32768
0
-32768
0

+32767
+65535
+32767
+65535

int
unsigned int
long
unsigned long

32bit
32bit
32bit
32bit

-2147483648
0
-2147483648
0

+2147483647
+4294967295
+2147483647
+4294967295

long long
unsigned long long

64bit
64bit

-9223372036854775808
0

+9223372036854775807
+18446744073709551615

float
double
long double

32bit
64bit
64bit

-1e37
-1e306
-1e306

+1e37
+1e306
+1e306

signed bit field
unsigned bit field

1 ~ 32bit

-2^(W-1)
0

2^(W-1) - 1
2^(W) - 1

enum
Pointer

32bit
32bit

---
0

---
0xFFFFFFFF

Note W (width) indicates the width of the specified bit.

Additional Information:
bool is treated the same as int.
Bit fields are assigned a 32 bit boundary.
_Bool (C99) is treated the same as char.
When General is used, the int size is fixed at 32 bits during MISRA-C analysis.
When "long = long long" is specified, the long type is interpreted as the long long type and the unsigned long type is interpreted as the unsigned long long type, and the long type and unsigned long type become 64 bits. The int type and unsigned int type still remain as 32 bits.

Bit Field

Bit fields cannot be defined beyond the assigned 32 bit boundary.
Therefore, the maximum width of bit field members is 32 bits.
Furthermore, members that exceed the 32 bit boundary are integrated into the next 32 bit boundary.

Bit fields are allocated according to MSB definition order, but empty bits are taken from the MSB side because they are filled by LSB.
The example below shows a structure defined with 4 members and its bit field allocation image.

Bit Field Definition Example

struct bit {
     int a:4;
     int b:5;
     int c:30;
     int d:8;
};

Bit Field Allocation Image Example

Floating Point Numbers

The internal format of floating point numbers used in General is conforms to the IEEE754 standard.
Furthermore, extended double precision (80 bit) floating point numbers are not supported by winAMS General.

Alignment (Boundary Adjustment)

Alignment Adjustment Value List

Variable Declaration Location

Variable Type

Alignment Adjustment Value

Static Storage Class
Global Storage Class

char
short
int
long
float
long long
double
Pointer
Structure/ Union
Array

1
2
4
4
4
4
4
4
4
type dependent

Auto Storage class, argument

All types

4

Structure member

char
short
int
long
float
long long
double
Pointer
Structure/ Union
Array

1
2
4
4
4
4
4
4
4
type dependent

The #pragma pack(n), the GNU "packed" attribute and the "aligned(n)" attribute are ignored during General code generation. For this reason, sizeof() is calculated assuming these items are not specified.

Predefined macros

The predefined macros used in General are shown below.

Predefined macro list

 __LINE__
 __FILE__
 __TIME__
 __DATA__
 WINAMS_STUB
 mpu32
 reverse
 HAVE_INT64
 __LONG_EQ_LONGLONG__

__LONG_EQ_LONGLONG__ is enabled when "long = long long" is specified.

 

Related Technical Tips Search

Other technical tips in GAIO's web site can be searched for using the links below.

Search key word link: General | Data types
Technical Tips Google Search


Information Links