Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12686 Discussions

some questions about registers in nios2

Altera_Forum
Honored Contributor II
979 Views

i have some questions about registers in nios2  

1: the GP(r26)' function like PC as in X86 architecture ?  

 

2: (r15-r8) is named Caller-Saved registers ,their function ? 

 

3:(r16_r23),their function ? 

 

4: when call a function, the rule of saving registers is what? between r2 to 

r25 ,which should be saved ? 

 

5: when an interrupt happen or call function , the differences between the saving registers and restore register action.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
293 Views

Hi wkongwkong, 

 

Please see the "Nios II Processor Reference Handbook": 

 

http://www.altera.com/literature/lit-nio2.jsp (http://www.altera.com/literature/lit-nio2.jsp

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
293 Views

 

--- Quote Start ---  

originally posted by wkongwkong@Jun 22 2006, 11:15 PM 

i have some questions about registers in nios2  

1: the gp(r26)' function like  pc as in x86 architecture ?  

 

2: (r15-r8) is named  caller-saved  registers ,their function ? 

 

3:(r16_r23),their function ? 

 

4: when call a function, the rule of saving registers is what? between r2 to 

    r25 ,which should be saved ? 

 

5: when an interrupt  happen or call function ,  the differences between  the saving registers  and restore register  action. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16354) 

--- quote end ---  

 

--- Quote End ---  

 

1. I&#39;m rusty on my x86 so I&#39;m not sure of the answer to this. 

2. Caller saved registers have to be saved by the calling function. So if you&#39;re writing in assembler you don&#39;t have to bother saving them. 

3. They&#39;re just registers that you can do with what you will 

4. When calling a function if doing it from assembler you should save the caller saved registers. If you do the call from C the compiler looks after this for you. 

5. If you want to know which registers are saved for an IRQ look in the file alt_exception_entry.S in the nios2 component
0 Kudos
Reply