Assignments

Assignments are used to assign a new value to an I/O register. The operators are listed in Table 1.

Table 1. Stimuli assignments operators

Statement

Description

target = value

Direct assignment; set target equal to value.

target |= value

Bitwise OR assignment; bits that are '1' in value will be set in target, remaining bits unchanged.

target &= value

Bitwise AND assignment; bits that are '0' in value will be cleared in target, remaining bits unchanged.

target ^= value

Bitwise XOR assignment; bits that are '1' in value will be toggled (inverted) in target, remaining bits unchanged.

Target can be the numerical memory address of an I/O register in the I/O map. For simple devices with flat I/O structure such as tinyAVR® and megaAVR®, the register name as found in the data sheet can also be used.

For devices with complex I/O structure (XMEGA®, UC3, SAM) it is for now recommended to use addresses. The easiest way to determine the address is to bring up the I/O view and select the desired register. The address can be copied from the I/O view (select the desired register, right-click, and select "Copy Address").

Value can be either a numerical constant specified in decimal, octal, or hex according to C syntax, or it can have the form *source. Using this syntax source is the name or memory address of an I/O register. The current interpreter does not support expressions.

GPIOR0 = *GPIOR1 + 1 // Not allowed!