When multiple control registers are updated continuously by a store instruction of the RH850, the order in which the control registers are updated may not match the order in which they were written to the source file. Synchronization processing needs to be inserted in order to control the order in which the control registers are updated.
In CC-RH, continuous writing to control registers can be detected and information of the writing process can be displayed or a fixed synchronization processing can be inserted.
Specify the address range and group information of control registers with #pragma register_group.
Specify #pragma register_group in the following format.
Specify the start address and end address with unsigned integers. An octal, decimal, or hexadecimal integer can be used. |
The end address is treated as its address belongs to the group.
The usable characters for the group-ID are only alphabetic characters (a-z or A-Z; case-sensitive), numbers (0-9), and underscore (_).
The length of the group-ID is not limited.
To specify the same group which is not continuous in the address space, the same group-ID can be specified in more than one #pragma register_group directive. |
The group-ID can be omitted. If omitted, writing to that area is treated as an operation that is not continuous with any other write operations. |
When the address ranges specified in multiple #pragma register_group directives overlap with each other |
If the above example is compiled with the -store_reg=list option specified, write operations are determined as shown below and a message indicating that writing was performed is output to the standard error output. |
Since REG1 and REG2 belong to the same group, synchronization processing does not need to be applied to writing to REG1. |
Since REG2 and REG_Z belong to different groups, synchronization processing needs to be applied to writing to REG2. |
Since whether there is writing to the same group after writing to REG_Z is not clear, synchronization processing needs to be applied to writing to REG_Z. |
src.c(10):M0536001:control register is written.(id=CPU, 0xfedf0001) src.c(11):M0536001:control register is written.(id=0, 0xfee00000) |
If the same example is compiled with the -store_reg=list_all option specified, a message is output for writing to all of the control registers specified by #pragma register_group without determining whether continuous writing to the same group is performed. |
If the same example is compiled with the -store_reg=sync option specified, write operations are determined in the same manner as (a) and synchronization processing is inserted in the output code instead of a message being output. In synchronization processing, a combination of loading from the same control register and syncp instruction is output. |
When #pragma register_group is used with the -Xmerge_file option at the same time, even though a #pragma register_group directive that is incompatible between source files is specified, an error will not occur and the result may be unintended. It is recommended to include #pragma register_group in the include file and share it between source files. |