Hello,
After making some research, I learnt that i can run C54x code on C55xx simulator. Simply, I would like to run FIR filter code on C5416 device. According to instruction that i got, I first tried C5509 code and run it which is seen on code window 1.
---------------------------------------------------------------------------------------------------------------------
CODE FOR C5509
.mmregs .global _c_int00 STK_LEN .set 100 TEST_LEN .set 50 COEFF_LEN .set 22 stack .usect "stack", STK_LEN coeff .usect "coeff", COEFF_LEN y0 .usect "output", TEST_LEN y1 .usect "output", TEST_LEN y2 .usect "output", TEST_LEN .data table .int 0xFF66, 0x00AD, 0x01DF, 0x01F5, 0xFF89 .int 0xFB7E, 0xF99F, 0xFE4D, 0x0A9D, 0x1A27 .int 0x2502, 0x2502, 0x1A27, 0x0A9D, 0xFE4D .int 0xF99F, 0xFB7E, 0xFF89, 0x01F5, 0x01DF .int 0x00AD, 0xFF66 .space 16*TEST_LEN x0 .int 0x7FFF .space 16*TEST_LEN x1 .int 0x0000, 0x12CF, 0x1E6F, 0x1E6F, 0x12CF .int 0x0000, 0xED31, 0xE191, 0xE191, 0xED31 .int 0x0000, 0x12CF, 0x1E6F, 0x1E6F, 0x12CF .int 0x0000, 0xED31, 0xE191, 0xE191, 0xED31 .int 0x0000, 0x12CF, 0x1E6F, 0x1E6F, 0x12CF .int 0x0000, 0xED31, 0xE191, 0xE191, 0xED31 .int 0x0000, 0x12CF, 0x1E6F, 0x1E6F, 0x12CF .int 0x0000, 0xED31, 0xE191, 0xE191, 0xED31 .int 0x0000, 0x12CF, 0x1E6F, 0x1E6F, 0x12CF .int 0x0000, 0xED31, 0xE191, 0xE191, 0xED31 .int 0x0000 .space 16*TEST_LEN x2 .int 0x0000, 0x1E6F, 0x12CF, 0xED31, 0xE191 .int 0x0000, 0x1E6F, 0x12CF, 0xED31, 0xE191 .int 0x0000, 0x1E6F, 0x12CF, 0xED31, 0xE191 .int 0x0000, 0x1E6F, 0x12CF, 0xED31, 0xE191 .int 0x0000, 0x1E6F, 0x12CF, 0xED31, 0xE191 .int 0x0000, 0x1E6F, 0x12CF, 0xED31, 0xE191 .int 0x0000, 0x1E6F, 0x12CF, 0xED31, 0xE191 .int 0x0000, 0x1E6F, 0x12CF, 0xED31, 0xE191 .int 0x0000, 0x1E6F, 0x12CF, 0xED31, 0xE191 .int 0x0000, 0x1E6F, 0x12CF, 0xED31, 0xE191 .int 0x0000 .space 16*TEST_LEN .text _c_int00: BSET C54CM BSET FRCT ; Fractional Mode BSET SXMD ; Sign Extension BSET M40 ; Overflow Mode AMOV #stack+STK_LEN, XSP ; Setup stack pointer CALL init AMOV #x0, XAR0 AMOV #(x0+1), XAR1 AMOV #y0, XAR2 CALL fir AMOV #x1, XAR0 AMOV #(x1+1), XAR1 AMOV #y1, XAR2 CALL fir AMOV #x2, XAR0 AMOV #(x2+1), XAR1 AMOV #y2, XAR2 CALL fir end: B end ; Initialise coefficients init: AMOV #coeff, XAR1 RPT #COEFF_LEN MVPD #table, *AR1+ AMOV #coeff, XCDP RET ; FIR subroutine does TEST_LEN iterations fir: MOV #(TEST_LEN/2) - 1, BRC0 RPTB fir_end-1 MOV #0, AC0 MOV #0, AC1 RPT #COEFF_LEN-1 MAC *AR0-, *CDP+, AC0 :: MAC *AR1-, *CDP+, AC1 MACR *AR0, *CDP, AC0 :: MACR *AR1, *CDP, AC1 MOV HI(AC0), *AR2+ MOV HI(AC1), *AR2+ MOV #coeff, CDP MAR *+AR0(COEFF_LEN+2) MAR *+AR1(COEFF_LEN+2) fir_end: RET
------------------------------------------------------------------------------------------------------------------------------
After I converted the above code to implement into c5416. Even though I built up successfully, I cannot get any output y0, y1 and y2 result according to below code. I saw an instruction that I need to use accumulator A by writing AB and already set BSET C54CM. I cannot figure out where the mistake is.
----------------------------------------------------------------------------------------------------------------------------------------------------
CODE for C5416 by choosing C55xx Rev 3.0 CPU cycle accurate simulator
.mmregs
.global _c_int00
STK_LEN .set 100
TEST_LEN .set 50
COEFF_LEN .set 22
stack .usect "stack", STK_LEN
coeff .usect "coeff", COEFF_LEN
y0 .usect "output", TEST_LEN
y1 .usect "output", TEST_LEN
y2 .usect "output", TEST_LEN
.data
table .int 0xFF66, 0x00AD, 0x01DF, 0x01F5,0xFF89
.int 0xFB7E, 0xF99F, 0xFE4D, 0x0A9D,0x1A27
.int 0x2502, 0x2502, 0x1A27, 0x0A9D,0xFE4D
.int 0xF99F, 0xFB7E, 0xFF89, 0x01F5,0x01DF
.int 0x00AD, 0xFF66
.space 16*TEST_LEN
x0 .int 0x7FFF
.space 16*TEST_LEN
x1 .int 0x0000, 0x12CF, 0x1E6F, 0x1E6F,0x12CF
.int 0x0000, 0xED31, 0xE191, 0xE191,0xED31
.int 0x0000, 0x12CF, 0x1E6F, 0x1E6F,0x12CF
.int 0x0000, 0xED31, 0xE191, 0xE191,0xED31
.int 0x0000, 0x12CF, 0x1E6F, 0x1E6F,0x12CF
.int 0x0000, 0xED31, 0xE191, 0xE191,0xED31
.int 0x0000, 0x12CF, 0x1E7F, 0x1E7F,0x12CF
.int 0x0000, 0xED31, 0xE191, 0xE191,0xED31
.int 0x0000, 0x12CF, 0x1E6F, 0x1E6F,0x12CF
.int 0x0000, 0xED31, 0xE191, 0xE191,0xED31
.int 0x0000
.space 16*TEST_LEN
x2 .int 0x0000, 0x1E6F, 0x12CF, 0xED31,0xE191
.int 0x0000, 0x1E6F, 0x12CF, 0xED31,0xE191
.int 0x0000, 0x1E6F, 0x12CF, 0xED31,0xE191
.int 0x0000, 0x1E6F, 0x12CF, 0xED31,0xE191
.int 0x0000, 0x1E6F, 0x12CF, 0xED31,0xE191
.int 0x0000, 0x1E6F, 0x12CF, 0xED31,0xE191
.int 0x0000, 0x1E6F, 0x12CF, 0xED31,0xE191
.int 0x0000, 0x1E6F, 0x12CF, 0xED31,0xE191
.int 0x0000, 0x1E6F, 0x12CF, 0xED31,0xE191
.int 0x0000, 0x1E6F, 0x12CF, 0xED31,0xE191
.int 0x0000
.space 16*TEST_LEN
.text
_c_int00: BSET C54CM
SSBX FRCT ; Fractional Mode
SSBX SXMD ; Sign Extension Mode
SSBX OVM ; Overflow Mode
STM #stack+STK_LEN, SP ; Setup stack pointer
CALL init
STM #x0, AR3
STM #y0, AR4
CALL fir
STM #x1, AR3
STM #y1, AR4
CALL fir
STM #x2, AR3
STM #y2, AR4
CALL fir
end: B end
; Initialize coefficients
init: STM #coeff, AR1
RPT #COEFF_LEN
MVPD #coeff, *AR1+
STM #coeff, AR2
RET
; FIR subroutine does TEST_LEN iterations
fir: STM #TEST_LEN-1, BRC
RPTB fir_end-1
; Single Mac Code
MPY *AR2+, *AR3-, A
RPT #COEFF_LEN-2
MAC *AR2+, *AR3-, A
MACR *AR2, *AR3, A
STH A, *AR4+
STM #coeff, AR2
MAR *+AR3(COEFF_LEN+1)
fir_end: RET
---------------------------------------------------------------------------------------------------------------------------------------
Additionally, I am using ccs v5.5 and for the linker command file for C5509 and C5416 are shown below. As I said, as C5509 works, C5416 is not working.
C5509 LINKER COMMAND FILE
MEMORY
{
IPROG: origin = 100h, len = 500h
IDATA: origin = 600h, len = 500h
IVARS: origin = 1100h, len = 2000h
}
SECTIONS
{
.text: { } > IPROG
.data: { } > IDATA
output: { } > IVARS
stack: { } > IVARS
coeff: { } > IVARS
}
C5416 LINKER COMMAND FILE
MEMORY
{
PAGE 0:
IPROG: origin = 0x1000, len = 0x3000
PAGE 1:
IDATA: origin = 0x400, len = 0x1000
IVARS: origin = 0x1400, len = 0x1000
}
SECTIONS
{
.text: > IPROG PAGE 0
.data: > IDATA PAGE 1
output: > IVARS PAGE 1
stack: > IVARS PAGE 1
coeff: > IVARS PAGE 1
}
Regards,
Samet