OpenCores
no use no use 1/1 no use no use
PPX16 core bug report
by Unknown on Dec 6, 2006
Not available!
Hi all,

I was experimenting with the PPX16 core and found a bug. I've also
contacted the author of this core, Daniel Wallner.

The problem I’ve came across has to do with the Carry flag and the
SUBLW command. It seems that the carry flag is not set correctly, i’ll
explain:

The instruction description for SUBLW from the PIC16F84 datasheet
says; When the result is positive or zero the carry flag should be ‘1’.
When the result is negative the carry flag should be ‘0’.

The PPX16 core is doing the opposite; When the result is positive the
carry flag is ‘0’, when the result is negative or zero the carry flag is ‘1’.


Here’s a code snippet to give an example:

MOVLW 6
MOVWF main_w_L0
MOVF main_w_L0, 0
SUBLW 5
BTFSS STATUS, C ; Carry flag is set; not correct

MOVLW 5
MOVWF main_w_L0
MOVF main_w_L0, 0
SUBLW 5
BTFSS STATUS, C ; Carry flag is set; correct

MOVLW 4
MOVWF main_w_L0
MOVF main_w_L0, 0
SUBLW 5
BTFSS STATUS, C ; Carry flag is not set; not correct


I’ve tested this by outputting the current opcode on the seven segment
display and used a switch to manually create the clock for the core so I
could single step through the opcodes.


Workaround: Only use the SUBWF command which works correct.


PPX16 core bug report
by Unknown on Dec 6, 2006
Not available!
Hi all, I was experimenting with the PPX16 core and found a bug. I've also contacted the author of this core, Daniel Wallner. The problem I've came across has to do with the Carry flag and the SUBLW command. It seems that the carry flag is not set correctly, i'll explain: The instruction description for SUBLW from the PIC16F84 datasheet says; When the result is positive or zero the carry flag should be '1';. When the result is negative the carry flag should be '0'. The PPX16 core is doing the opposite; When the result is positive the carry flag is '0', when the result is negative or zero the carry flag is '1'. Here's a code snippet to give an example: MOVLW 6 MOVWF main_w_L0 MOVF main_w_L0, 0 SUBLW 5 BTFSS STATUS, C ; Carry flag is set; not correct MOVLW 5 MOVWF main_w_L0 MOVF main_w_L0, 0 SUBLW 5 BTFSS STATUS, C ; Carry flag is set; correct MOVLW 4 MOVWF main_w_L0 MOVF main_w_L0, 0 SUBLW 5 BTFSS STATUS, C ; Carry flag is not set; not correct I've tested this by outputting the current opcode on the seven segment display and used a switch to manually create the clock for the core so I could single step through the opcodes. Workaround: Only use the SUBWF command which works correct. ----- Original Message ----- From: r.stolker at student.avans.nlr.stolker at s...> To: Date: Wed Dec 6 00:07:31 CET 2006 Subject: [oc] PPX16 core bug report
Hi all,

I was experimenting with the PPX16 core and found a bug. I've also
contacted the author of this core, Daniel Wallner.
The problem I’ve came across has to do with the Carry
flag and the
SUBLW command. It seems that the carry flag is not set correctly,
i’ll
explain:
The instruction description for SUBLW from the PIC16F84 datasheet
says; When the result is positive or zero the carry flag should be
‘1’.
When the result is negative the carry flag should be
‘0’.
The PPX16 core is doing the opposite; When the result is positive
the
carry flag is ‘0’, when the result is negative
or zero the carry flag is ‘1’.
Here’s a code snippet to give an example:
MOVLW 6
MOVWF main_w_L0
MOVF main_w_L0, 0
SUBLW 5
BTFSS STATUS, C ; Carry flag is set; not correct
MOVLW 5
MOVWF main_w_L0
MOVF main_w_L0, 0
SUBLW 5
BTFSS STATUS, C ; Carry flag is set; correct
MOVLW 4
MOVWF main_w_L0
MOVF main_w_L0, 0
SUBLW 5
BTFSS STATUS, C ; Carry flag is not set; not correct
I’ve tested this by outputting the current opcode on the
seven segment
display and used a switch to manually create the clock for the core
so I
could single step through the opcodes.
Workaround: Only use the SUBWF command which works correct.




no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.