LFSR wrongly coded for K42 and K83 processors

Beta Testing discussion on mikroC PRO for PIC.
Post Reply
Author
Message
janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

LFSR wrongly coded for K42 and K83 processors

#1 Post by janni » 04 Mar 2021 14:17

Not sure it makes much sense to post here while PRO compilers apparently reached end of life :( but, as some other poor soul may stumble on it, I'm doing it anyway.

The LFSR instruction is wrongly coded for K42 and K83 processors (same will go for Qxx families if, by some miracle, they'll be implemented) as for these processors the address field is 14, not 12-bits wide.

Code: Select all

asm LFSR 0,0x800;   // FSR0 points to 0x2000 in K42 and K83 processors

       0xF000EE08          LFSR        0, 2048
Properly coded, it should be

Code: Select all

       0xF000EE02          LFSR        0, 2048
As the LFSR instruction replaces 4 needed to load FSRx in an alternate way (additionally involving W register), it's quite useful in code optimization.

It's probably not worth mentioning that the ADDFSR, SUBFSR and CALLW instructions were never implemented :( .

BTW, there's also an old quirk that prevents using constants in the LFSR instruction - compiler looses higher address byte in such case:

Code: Select all

const addr=0x800;

main(){
 asm LFSR 0,_addr;// higher byte of addr is lost

	0xF000EE00  	LFSR        0, 0

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: LFSR wrongly coded for K42 and K83 processors

#2 Post by filip » 05 Mar 2021 08:45

Hi,

I apologize for the inconvenience caused by this.

Thank you for reporting the issue, I have notified our development team.

Regards,
Filip.

Post Reply

Return to “mikroC PRO for PIC Beta Testing”