patchSimulavr: an AVR simulator - Patches: patch #7079, Trace fixes and better memory...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

patch #7079: Trace fixes and better memory access

Submitted by:  Petr Hluzin <petrh>
Submitted on:  Sun 31 Jan 2010 10:13:47 PM UTC  
 
Category: bug fixPriority: 5 - Normal
Status: DonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Component Version: simulavrxx

Sat 19 Nov 2011 12:11:59 AM UTC, comment #2:

The patch is almost completely already incorporated in the current code. (Who did that? Me? When? I am weak with git.) I do not recall committing it.

The only remaining thing had been the removal of redundant HWStackSram::mem - which has just been committed: http://git.savannah.gnu.org/cgit/simulavr.git/commit/?id=4a6450910a752898a1bdb080e5f21f26b844fe7b

Petr Hluzin <petrh>
Project Member
Sun 07 Feb 2010 07:20:47 PM UTC, comment #1:

Submitting version 2 of the patch.

Some incorrect assertions were removed. (It turned out to be legal to access registers and IO by a STD instruction.)

(file #19641)

Petr Hluzin <petrh>
Project Member
Sun 31 Jan 2010 10:13:47 PM UTC, original submission:

avr_op_ADIW::Trace( ) - did print register and the constant swapped (see ctor)
avr_op_BRBS::Trace( ) - printed bogus value as a destination (BRBS is 2B instruction)
avr_op_BSET::Trace( ) - printed using bogus index (get_reg_bit vs get_sreg_bit in ctor)
avr_op_CALL::Trace( ) - printed uninitialized value as address
avr_op_DEC::Trace( ) - printed bogus second argument
avr_op_LPM_Z::Trace() - did not print the written-to register

(Remaining changes are not user-visible.)

These were found while adjusting the code for different handling of memory access: reading/writing (after this patch) goes through device first. (I have to tinker with it and RWMemoryWithOwnMemory would be ugly.)

pros:

  • nicer ctors
  • easier peeking into simulavr while debugging
  • smaller DecodedInstruction instances (by ~3*4B)
  • reduced cache pressure
  • allows more efficient (cache friendly) storage of data memory (not yet in this patch)
  • less chance for wrong *::Trace() code or wrong X,Y,Z read

cons:

  • uglier *::operator()
  • 1 more hot field in AvrDevice
  • unaligned access to fields in instructions

HWStack::HWStack() has one less argument, all devices have to be trivially adjusted.

Some instructions still have HWSreg* status - we can get rid of that. (I do not need that though.)

The DecodedInstruction ctor still accepts the extra arguments after this patch.
I would remove them but one my diff tool gets confused by that many changes (yours may too).
I can prepare another patch that just removes the extra arguments if you like.

Petr Hluzin <petrh>
Project Member

 

Attached Files
file #19641:  memory-access-v2.patch added by petrh (105kB - text/x-diff)
file #19586:  memory-access.patch added by petrh (105kB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by petrh (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 19 Nov 2011 12:11:59 AM UTCpetrhStatusNone=>Done
    Sun 07 Feb 2010 07:20:45 PM UTCpetrhAttached File-=>Added memory-access-v2.patch, #19641
    Sun 31 Jan 2010 10:13:47 PM UTCpetrhAttached File-=>Added memory-access.patch, #19586

    Back to the top


    Powered by Savane 3.1-cleanup