LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cores > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: r.stolker at student.avans.nl<r.stolker@s...>
    Date: Wed Dec 6 01:35:58 CET 2006
    Subject: [oc] PPX16 core bug report
    Top
    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.nl<r.stolker@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&#8217;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&#8217;ll
    > explain:
    > The instruction description for SUBLW from the PIC16F84 datasheet
    > says; When the result is positive or zero the carry flag should be
    > &#8216;1&#8217;.
    > When the result is negative the carry flag should be
    > &#8216;0&#8217;.
    > The PPX16 core is doing the opposite; When the result is positive
    > the
    > carry flag is &#8216;0&#8217;, when the result is negative
    > or zero the carry flag is &#8216;1&#8217;.
    > Here&#8217;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&#8217;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.
    >
    >

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.