# Modeling the Power Consumption of Function-Level Code Relocation for Low-Power Embedded Systems
## 5 Prior Relocation-Scoring Model  
Code profiling using the source code insertion technique demonstrates that function-level code relocation uniquely influences the power consumption according to instruction groups. It also shows that the number of instructions is also affected. In this respect, as the number of instructions that constitutes the target function increases, the impact of the instruction group on function-level code relocation increases; thus, the relationship between the number of instructions and the Power Reduction Efficiency (PRE) should be analyzed. In addition, because the target function consists of a combination of multiple groups of instructions, this analysis should be conducted for all instruction groups. This was achieved by performing regression analysis [21] in which the PRE was set as the dependent variable, the number of instructions were set as independent variables, and by modeling the relationship between these two types of variables. The results are shown in Figure 8.  
Figure 7: Code profiling result according to instruction groups. The dependent variable, PRE, was set as the result of the code profiling in Table 3 and Figure 7 and regression analysis was performed. The slope is the largest in the RLS group and the smallest in the BC group. This is in agreement with the code profiling results. The regression model is considered to be less useful if the coefficient of determination(\(R^{2}\)), which is a measure of the degree to which a model estimated in statistics is appropriate for given data, has a value close to zero. However, as shown in Figure 7, the decision coefficients of all instruction groups have a value greater than zero, indicating that regression analysis is a useful method for analyzing the relationship between the number of instructions and \(PRE\). Based on these results, this study proposes a prior relocation-scoring model using function-level code relocation in the form of Equation (2). \[RS_{f}=\sum_{g\in G}\left(N_{g}\times Slope(g)+Intercept(g)\right)\times R(g)^ {2}\times r_{N_{g}}, \tag{2}\]  
where \(N_{g}\) indicates the number of instructions of each group and \(G\) is the set of ARM instruction sets redefined in Table 2. Further, \(Slope(g)\), \(Intercept(g)\), and \(R(g)\) are the results obtained by regression analysis, as shown in Figure 8, and \(r_{N_{g}}\) is the percentage of instructions in the group. As the equation implies, the number of instructions and the result of regression analysis are the main factors contributing to the Relocatable Score (RS) calculation. Thus, the instruction trace, as explained in Section 3.1, produces an instruction trace description including \(N_{g}\) and \(r_{N_{g}}\). The model calculates \(RS\) for each function. This enables us to determine the PRE value used in the regression analysis of each function by measuring the power experimentally in the Section 3.2 environment. The prior relocation-scoring model detects a function that is supposed to be relocated before others. In other words, the calculated RS enables us to identify the order in which functions need to migrate to the other type of memory. Therefore, a function with a high RS score is preferentially relocated, whereas the relocation of a low RS-scored function is more likely to be less effective compared to other functions in a program. The ultimate goal of relocation is to maximize the relocation efficiency, defined as the PRE in Section 2. As the PRE values can only be determined by conducting real experiments, being able to estimate the order of PREs without actual measurement would be meaningful and the low-power expandability of the system could be predicted. In short, the proposed model assigns a grade to the RS scores to allow the order of the PRE values in a program to be predicted. A unique function intended for earlier relocation is assigned a high RS score for a high PRE value; on the other hand, a function with a low RS score is expected to have a low  
Figure 8: Regression analysis results. PRE value.