Simulator Bug with SBRC and fesh changed register ?

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used the simulator from Atmel Studio 7 for an Mega48 Assembler program. 

 

Here the code, a short loop to wait for a comparator status.

Label1:

    in R16,ACSR                  ; get comparator status
    SBRC R16,ACO              ; skip if comparator bit cleared
    rjmp Label1

   

The simulator shows an odd behavior: 

If the register value for R16 is changes just before the SBRC instruction is executed from normal single stepping (step into via F11 key), the old R16 value seems to be used. 

However if the SBRC instruction is manually (even if already there) set as the next statement the changed value is accepted.

 

Such changes did work in older AVR Studio versions, like in January.

Especially for simulating such hardware dependent parts this is rather inconvenient.

Additionally use "set next statement (Ctrl-shift-F10)" is a workaround, but odd.

 

Is this a bug, or is there some reason to this ?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to confirm I see the same - it always skips whether bit 5 is set or not. It's not an assembly error as the opcode is 0xFD05 which is correct for R16,5 so it does seem to be a simulation problem. I simply used:

	NOP
	NOP
Label1:
    in R16,ACSR                  ; get comparator status
    SBRC R16,ACO              ; skip if comparator bit cleared
    rjmp Label1
	NOP
	NOP

as test code and kept setting next statement back to the start then trying either state of AC0 followed by then stepping through the entire sequence. Regardless of ACSR it skipped.