Download fulltext - DiVA Portal
Transcript
52 CHAPTER 4 value of the register r9. Because the r1 is usually used as a stack pointer, this line actually pushes r9 into the stack with an offset of 128. l.sw 128(r1), r91 When writing with higher level languages like C or C++, the compiler will manage the usages of the GPRs. In this case the GPRs are transparent to the programmers. A funny fact is that, although the registers are called “general purpose” they are assigned with special roles by the compiler. It happens not only in OR1200 but many other CPUs as well. Table 4.1 is partly copied from the OpenRISC 1000 Architectural Manual [9] page 334. It lists the usages of some GPRs. The value of r0 is always fixed to 0. r1 and r2 are the stack pointer (SP) and the frame pointer (FP) which point to the top and bottom of the stack. r3 to r8 are used to pass the parameters during the function calls. If a function has more than 6 parameters, the extra parameters have to be stored in the stack. r9 is the return address and r11 stores the returned data. Table 4.1: OR1200 GPRs (part) All OR1200 SPRs are listed in Section 4.3 of the Architectural Manual [9]. All of them use 16-bit addresses in the format showed in Figure 4.3. The bit 15–11 are the group index, and the bit 10–0 are the register address. 1 OpenRISC 1000 instructions are described in Chapter 5 of the OpenRISC 1000 Architectural Manual [9].