Altera_Forum
Honored Contributor
10 years agoHow to pad or extend the most significant bit (bit 23) into bits 24 through 31
Hi,
As suggested by forumer kflynn (http://www.alteraforum.com/forum/member.php?u=86819) in this link (http://www.alteraforum.com/forum/showthread.php?t=48398), the below issue can be resolved by padding or extending the most significant bit (bit 23) into bits 24 through 31. I want to know, how could I extend the most significant bit (bit 23) into bits 24 through 31? How could I do that in C code? I am using C code to program Nios II. I was thinking of using bit shifting operation but not knowing in details how by using bit shifting operation, the above could be achieved, any link or resource is much appreciated. Thank you in advance. HI, I have a very simple question but I have no idea what went wrong. Basically I have a 24-bit signed signal from VHDL block fed into Nios II system. I use C code for NIos II system. This is my code:Code:value =IORD_ALTERA_AVALON_PIO_DATA(base); to read the 24-bit signed signal. I define it asCode: alt_32 value=0; The problem is it always give me positive value every time read from this line even though I am sure it is negative value from VHDL code.Code: printf("\n value= %d \n", value); Any idea what went wrong??? sorry for the simple question... Thank you in advance