Altera_Forum
Honored Contributor
21 years agoHow to use the niosii custom instructiont?
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