Forum Discussion
Altera_Forum
Honored Contributor
21 years agoCompiler
http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/mad.gif movia at,((90057600)/115200) 28: 00400034 movhi at,0 2c: 0840c354 ori at,at,781 movia at,((90000000+57600)/1152...
Altera_Forum
Honored Contributor
21 years agomaybe the compiler bug for the following test code:# test.S# define ALT_CPU_FREQ 90000000# define BAUD_RATE 2400 //1200# define C_DIVISOR ((ALT_CPU_FREQ+BAUD_RATE/2)/BAUD_RATE)
.equ A_DIVISOR , ((ALT_CPU_FREQ+BAUD_RATE/2)/BAUD_RATE) .macro MOVUIK32 _reg,_val .if (\_val >>16) == 0 MOVUI \_reg,%lo(\_val) .elseif (\_val <<16) == 0 MOVHI \_reg,%hi(\_val) .else MOVIA \_reg,\_val .endif .endm .section .text .align 2 .set noat _start: MOVUIK32 r2,C_DIVISOR MOVUIK32 r3,A_DIVISOR .end You may change the valu of ALT_CPU_FREQ and BAUD_RATE macros, and then check the compiling result!