Hi, I am working on a circular buffer which is for the fir delay line. In the linear asm code, I have set the AMR to '00000001010000000001000000000000', which is setting BK0 to 2^11 bytes and set B6 for circular addressing mode. But some whenever there is *B6++ in the code, the pointer in B6 doesn't seems to be increasing. The only way to increase the pointer is ADD B6, 4, B6. But through this method, the buffer no longer behave as circular buffer, as it will not return to the starting address when the pointer exceeded the end address. What is the root cause of the problem, is it cause by hardware bug or did I set something wrong?
Below is my asm code, where I have actually mapped the B6 to pL2_addr.
.global _fir_filter
_fir_filter .cproc x_addr, h_addr, y_addr, pL2_addr, Nh, Ny
.reg h_value1:h_value2, x_value2:x_value1, xValue1, xValue2, x_value3
.reg sum1, sum2, sum_1, sum_2, prod1, prod2, prod_1, prod_2, x1:x0
.reg pL2_addr_rst, h_addr_rst
.reg pL2_wr, nh, ny, XbuffN
.reg temp, count
.reg AMRreg
.map pL2_addr / B6
MV h_addr, h_addr_rst
MV Nh, nh
MV Ny, ny
MV pL2_addr, pL2_addr_rst
MVK 0xA, XbuffN ;setup circular addressing mode for delay line buffer
MVC AMR, AMRreg ;selected BK0, size: 2^(1 + 0xA) Bytes, pointer at B6
zero temp
OR temp, XbuffN, temp
SHL temp, 9, temp
OR temp, 0x1, temp
SHL temp, 12, temp
MVC temp, AMR
MV nh, count
ADD count, 2, count
L2loop: .trip 3 ;preload data into delay line buffer
LDDW *x_addr++, x1:x0
STW x0, *pL2_addr++
STW x1, *pL2_addr++
[count]SUB count, 2, count
[count]B L2loop
MV pL2_addr, pL2_wr
MV pL2_addr_rst,pL2_addr
oloop: .trip 9960
zero sum1
zero sum2
zero sum_1
zero sum_2
iloop: .trip 3
LDDW *pL2_addr++ ,x_value2:x_value1
ADD pL2_addr, 8, pL2_addr
LDDW *h_addr--, h_value1:h_value2
MPYSP x_value1, h_value1, prod1
MPYSP x_value2, h_value2, prod2
ADDSP sum1, prod1, sum1
ADDSP sum2, prod2, sum2
LDW *pL2_addr, x_value3
MPYSP x_value2, h_value1, prod_1
MPYSP x_value3, h_value2, prod_2
ADDSP sum_1, prod_1, sum_1
ADDSP sum_2, prod_2, sum_2
[nh] SUB nh, 2, nh
[nh] B iloop
ADDSP sum1, sum2, sum1
ADDSP sum_1, sum_2, sum_1
STW sum1, *y_addr++
STW sum_1, *y_addr++
MV pL2_wr, pL2_addr
LDDW *x_addr++, x1:x0
STW x0, *pL2_addr++
STW x1, *pL2_addr++
MV pL2_addr, pL2_wr
[ny] MV pL2_addr_rst,pL2_addr
[ny] ADD pL2_addr, 8, pL2_addr
[ny] MV pL2_addr, pL2_addr_rst
[ny] SUB ny, 2, ny
[ny] MV h_addr_rst, h_addr
[ny] MV Nh, nh
[ny] B oloop
end:
MVC AMRreg, AMR
.endproc