coder.HardwareImplementation class

Package: coder

codegen configuration object that specifies hardware implementation parameters for code generation

Description

A coder.HardwareImplementation object contains hardware-specific configuration parameters. The codegen function uses these parameters to generate standalone C/C++ libraries and executables for specific target hardware. To use this object, refer to it from the related coder.CodeConfig or coder.EmbeddedCodeConfig object that codegen is using.

Construction

hw_cfg = coder.HardwareImplementation creates a coder.HardwareImplementation object.

Properties

Description

Description of hardware implementation object.

character vector, 'class HardwareImplementation: Hardware implementation specifications.' , Maximum Length: 78 characters

Name

Name of hardware implementation object.

character vector, 'HardwareImplementation' , Maximum Length: 22 characters

ProdBitPerChar

Describe length in bits of the C char data type that the deployment hardware supports.

Value must be a multiple of 8 between 8 and 32.

Dependencies:

  • Specifying a device using the ProdHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 8

ProdBitPerDouble

Describe the bit length of C double data type that the deployment hardware supports (read only).

double, 64

ProdBitPerFloat

Describe the bit length of C floating-point data type that the deployment hardware supports (read only).

double, 32

ProdBitPerInt

Describe length in bits of the C int data type that the deployment hardware supports.

Value must be a multiple of 8 between 8 and 32.

Dependencies:

  • Specifying a device using the ProdHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 32

ProdBitPerLong

Describe length in bits of the C long data type that the deployment hardware supports.

Value must be a multiple of 8 between 32 and 128.

Dependencies:

  • Specifying a device using the ProdHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 32

ProdBitPerLongLong

Describe length in bits of the C long long data type that the deployment hardware supports.

Tips:

  • Use the C long long data type only if your C compiler supports long long.

  • You can change the value of this parameter only for custom targets. For custom targets, values must be a multiple of 8 and between 64 and 128.

Dependencies:

  • ProdLongLongMode enables use of this parameter.

  • The value of this parameter must be greater than or equal to the value of ProdBitPerLong.

  • Selecting a device using the ProdHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 64

ProdBitPerPointer

Describe the bit-length of pointer data for the deployment hardware (read only).

integer, 64

ProdBitPerSizeT

Describe the bit-length of size_t data for the deployment hardware.

If ProdEqTarget is true, Embedded Coder® processor-in-the-loop (PIL) execution checks this setting with reference to the target hardware. If ProdEqTarget is false, the PIL execution checks the TargetBitPerSizeT setting with reference to the target hardware..

Value must be 8, 16, 24, 32, 40, 64, or 128 and greater or equal to the value of int.

Dependencies:

  • Selecting a device using the Device vendor and Device type parameters sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

ProdBitPerPtrDiffT

Describe the bit-length of ptrdiff_t data for the deployment hardware.

If ProdEqTarget is true, Embedded Coder processor-in-the-loop (PIL) execution checks this setting with reference to the target hardware. If ProdEqTarget is false, the PIL execution checks the TargetBitPerPtrDiffT setting with reference to the target hardware.

Value must be 8, 16, 24, 32, 40, 64, or 128 and greater or equal to the value of int.

Dependencies:

  • Selecting a device using the Device vendor and Device type parameters sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

ProdBitPerShort

Describe length in bits of the C short data type that the deployment hardware supports.

Value must be a multiple of 8 between 8 and 32.

Dependencies:

  • Selecting a device using the ProdHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 16

ProdEndianess

Describe significance of the first byte of a data word for the deployment hardware.

character vector, 'Unspecified', 'LittleEndian', 'BigEndian'

ProdEqTarget

Specify whether the test hardware differs from the deployment hardware.

Dependencies:

  • Setting this parameter to true disables the target properties.

  • Setting this parameter to false enables the target properties that specify the test hardware properties.

true, false

ProdHWDeviceType: [1x29 char]

Specify manufacturer and type of hardware that you use to implement the production version of the system.

Because codegen cannot generate code for ASICs or FPGAs, if ProdHWDeviceType is set to ASIC/FPGA, TestHWDeviceType is automatically set to 'Generic->MATLAB Host Computer'.

character vector, 'Generic->MATLAB Host Computer'

ProdIntDivRoundTo

Describe how your compiler rounds the result of dividing one signed integer by another to produce a signed integer quotient.

character vector, 'Undefined', 'Zero', 'Floor'

ProdLargestAtomicFloat

Specify the largest floating-point data type that can be atomically loaded and stored on the deployment hardware.

Dependencies:

  • Specifying a device using the ProdHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

character vector, 'None'

ProdLargestAtomicInteger

Specify the largest integer data type that can be atomically loaded and stored on the deployment hardware.

Dependencies:

  • Specifying a device using the ProdHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

  • You can set this parameter to long long only if the deployment hardware supports the C long long data type and you have set the ProdLongLongMode parameter to true.

character vector, 'Char'

ProdLongLongMode

Specify that your C compiler supports the C long long data type. Most C99 compilers support long long. Set to true to enable use of the C long long data type for code generation for the deployment hardware. Set to false to disable the use of C long long data type for code generation for the deployment hardware.

Tips:

  • This parameter is enabled only if the specified deployment hardware supports the C long long data type.

  • If your compiler does not support C long long, do not select this parameter.

Dependency:

  • This parameter enables use of ProdBitPerLongLong.

true, false

ProdShiftRightIntArith

Describe whether your compiler implements a signed integer right shift as an arithmetic right shift.

true, false

ProdWordSize

Describe microprocessor native word size for the deployment hardware.

Value must be a multiple of 8 between 8 and 64.

Dependencies:

  • Selecting a device using the ProdHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 64

TargetBitPerChar

Describe length in bits of the C char data type that the test hardware supports.

Value must be a multiple of 8 between 8 and 32.

Dependencies:

  • Specifying a device using the TargetHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 8

TargetBitPerDouble

Describe the bit length of C double data type that the test hardware supports (read only).

integer, 64

TargetBitPerFloat

Describe the bit length of C floating-point data type that the test hardware supports (read only).

integer, 32

TargetBitPerInt

Describe length in bits of the C int data type that the test hardware supports.

Value must be a multiple of 8 between 8 and 32.

Dependencies:

  • Specifying a device using the TargetHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 32

TargetBitPerLong

Describe length in bits of the C long data type that the test hardware supports.

Value must be a multiple of 8 between 32 and 128.

Dependencies:

  • Specifying a device using the TargetHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 32

TargetBitPerLongLong

Describe length in bits of the C long long data type that the test hardware supports.

Dependencies:

  • TargetLongLongMode enables use of this parameter.

  • The value of this parameter must be greater than or equal to the value of TargetBitPerLong.

Tips:

  • Use the C long long data type only if your C compiler supports long long.

  • Change the value of this parameter for custom targets only. For custom targets, values must be a multiple of 8 and between 64 and 128.

integer, 64

TargetBitPerPointer

Describe the bit-length of pointer data for the test hardware (read only).

integer, 64

TargetBitPerSizeT

Describe the bit-length of size_t data for the test hardware.

If ProdEqTarget is false, Embedded Coder processor-in-the-loop (PIL) execution checks this setting with reference to the target hardware. If ProdEqTarget is true, the PIL execution checks the ProdBitPerSizeT setting with reference to the target hardware..

Value must be 8, 16, 24, 32, 40, 64, or 128 and greater or equal to the value of int.

Dependencies:

  • Selecting a device using the Device vendor and Device type parameters sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

TargetBitPerPtrDiffT

Describe the bit-length of ptrdiff_t data for the test hardware.

If ProdEqTarget is false, Embedded Coder processor-in-the-loop (PIL) execution checks this setting with reference to the target hardware. If ProdEqTarget is true, the PIL execution checks the ProdBitPerPtrDiffT setting with reference to the target hardware.

Value must be 8, 16, 24, 32, 40, 64, or 128 and greater or equal to the value of int.

Dependencies:

  • Selecting a device using the Device vendor and Device type parameters sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

TargetBitPerShort

Describe length in bits of the C short data type that the test hardware supports.

Value must be a multiple of 8 between 8 and 32 .

Dependencies:

  • Selecting a device using the TargetHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 16

TargetEndianess

Describe significance of the first byte of a data word for the test hardware.

character vector, 'Unspecified', 'LittleEndian', 'BigEndian'

TargetHWDeviceType: [1x29 char]

Specify manufacturer and type of the hardware that you use to test the generated code.

Because codegen cannot generate code for ASICs or FPGAs, if ProdHWDeviceType is set to ASIC/FPGA, TestHWDeviceType is automatically set to 'Generic->MATLAB Host Computer'.

character vector, 'Generic->MATLAB Host Computer'

TargetIntDivRoundTo

Describe how your compiler rounds the result of two signed integers for the test hardware.

character vector, 'Undefined', 'Zero', 'Floor'

TargetLargestAtomicFloat

Specify the largest floating-point data type that can be atomically loaded and stored on the test hardware.

Dependencies:

  • Specifying a device using the TargetHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

character vector, , 'None'

TargetLargestAtomicInteger

Specify the largest integer data type that can be atomically loaded and stored on the test hardware.

Dependencies:

  • Specifying a device using the TargetHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

  • You can set this parameter to long long only if the test hardware supports the C long long data type and you have set the TargetLongLongMode parameter to true.

character vector, , 'Char'

TargetLongLongMode

Specify that your C compiler supports the C long long data type. Most C99 compilers support long long. Set to true to enable use of the C long long data type for code generation for the test hardware. Set to false to disable use of the C long long data type for code generation for the test hardware.

Tips:

  • This parameter is enabled only if the specified test hardware supports the C long long data type.

  • If your compiler does not support C long long, do not select this parameter.

Dependency:

This parameter enables use of TargetBitPerLongLong.

true, false

TargetShiftRightIntArith

Describe whether your compiler implements a signed integer right shift as an arithmetic right shift.

true, false

TargetWordSize

Describe microprocessor native word size for the test hardware.

Value must be a multiple of 8 between 8 and 64.

Dependencies:

  • Selecting a device using theTargetHWDeviceType parameter sets a device-specific value for this parameter.

  • This parameter is enabled only if you can modify it for the specified device.

integer, 64

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects in the MATLAB® documentation.

Examples

Create a hardware implementation configuration object. Use the object to generate a C static library.

  1. Create a hardware implementation configuration object.

    hw_cfg = coder.HardwareImplementation;
  2. Create a code generation configuration object to generate a C static library.

    cfg = coder.config('lib');
  3. Associate the hardware implementation object with the code generation configuration object.

    cfg.HardwareImplementation = hw_cfg;
  4. Generate a C library for a MATLAB function foo that has no input parameters. Specify the configuration object using the -config option:

    codegen -config cfg foo

Alternatives

Use the coder function to create a MATLAB Coder™ project. The project provides a user interface that facilitates adding MATLAB files, defining input parameters, and specifying build parameters.

Was this topic helpful?