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++
12606 Discussions

How to use the niosii custom instructiont?

Altera_Forum
Honored Contributor II
967 Views

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ph34r.gif hello, 

 

I did a niosii custom instructiont mode,and input it into my system via SOPC,but I ran  

 

into troublesome when I oprate the custom instructiont mode in NIOSII IDE. 

According to the Example B(p2-1,Bit-Swap Custom Instruction) of Software Interface of  

 

"Nios II Custom Istrucrion User Guide" ,the custom instruction used in applacation code  

 

should be as follows the form: 

 

1.#include "system.h" 

2int main(void) 

int a = 0x12345678; 

int a_swap =0; 

a_swap= ALT_CT_BSWAP(a); 

 

return 0; 

 

According to this kind of form,my custom instructiont mode in applacation code do not  

 

work ! 

 

I fined the Another example of User Guid is different from this form. 

... 

alt_u8 zeros_hardware[NUM_SAMPLES]; 

alt_u32 numbers[NUM_SAMPLES]; 

... 

void hardware_leading_zeros(void); 

compare_leading_zeros(void); 

...# ifdef ALT_CT_LEADING_ZERO_DETECTOR 

hardware_leading_zeros(void); 

compare_leading_zeros(void);# endif ALT_CT_LEADING_ZERO_DETECTOR 

...# ifdef ALT_CT_LEADING_ZERO_DETECTOR 

zeros_hardware = alt_ct_leading_zero_detector(numbers);# endif ALT_CT_LEADING_ZERO_DETECTOR 

... 

 

When I put my custom instructiont mode into the leading-zeros-detector example running  

 

well ,my custom instructiont mode can work well! but when I put my custom instructiont  

 

mode into my system without sysid,it can not work again. 

 

why ?! 

whether the custom instructiont mode in applacation code want a limited_times sysid or  

 

other condition? 

 

thank you. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/rolleyes.gif  

 

sbgxg123_zhb@21cn.net 

zhgxg@163.net
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
286 Views

I don&#39;t see any reason why the SysID peripheral would have anything to do with it (I suggest you keep it in your design to make sure you are using the correct hardware). One thing to make sure of is that you have the correct name of the custom instruction (in your case " ALT_CT_BSWAP(a)"). If the C compile occured with no errors then this wouldn&#39;t be the cause. 

 

Can you describe further what you are seeing and how you set up the custom instruction?
0 Kudos
Reply