![]() (I fully realize the negative implications of this and will explain.) The new bit comes out of the carry, the looping point is at PRNG not PRNG_int. If I can get it to work with about the same number of instructions as above it will be a really good building block for PIC PRNGs. ![]() I know the fix is going to be something really stupid too, I just think I've been looking at it to long or something. Which is the point of implementing a Galois LFSR. I'm doing nByte + 1bit LFSRs because (in theory) it conveniently allows one to do most things with byte oriented instructions while almost entirely avoiding single bit manipulations. I use two RRCFs to pass bits through CARRY, which should make it effectively a 17 bit LFSR. Maybe I'm not following the algo correctly? The bit mask above is for a 17 bit Galois LFSR as laid out on the wiki article. I have tried all sorts of different combinations I could think of with all different lengths for the shift register. I'm not getting maximum sequence length out of the register no matter what bit mask I use for the polynomial/taps. ![]() XORWF LFSR_B_H, F store in LFSR high byte. MOVLW b'10010000' XOR bits 17 and 14 if bit 0 is set RRCF LFSR_B_L, F (Shifts through the CARRY bit) PRNG RRCF LFSR_B_H, F Shift the 16+1 bit register ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |