bugSimulavr: an AVR simulator - Bugs: bug #51222, VCD trace of PINx register not...


bug #51222: VCD trace of PINx register not updated

Submitted by:  None
Submitted on:  Sun 11 Jun 2017 04:29:16 PM UTC  
Category:  Simulation Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  Thomas K. <tomk>
Originator Email:  -email is unavailable- Open/Closed:  Closed
Component Version:  simulavrxx

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 04 Dec 2019 03:36:37 PM UTC, comment #1: 

Solved with upcoming release.

Thomas K. <tomk>
Project AdministratorIn charge of this item.
Sun 11 Jun 2017 04:29:16 PM UTC, original submission:  

The PINx (e.g. PINB, PIND, ...) register holds the input state of the port pins. This is independent of the DDRx settings.
The register itself is simulated/updated, but not so the VCD trace.

See the attached example that toggles PB1. Compile with

> avr-gcc -g -mmcu=atmega644 -std=gnu11 -O2 -Wall -Wextra -Werror -o pinx-not-traced.elf pinx-not-traced.c

and run simulavr like so

> simulavr --device atmega644 --file pinx-not-traced.elf --terminate exit -c vcd:tracein.txt:pinx-not-traced.vcd

For convenience, I've attached GTKWave screenshots with the bug ("fail") and with the fix ("pass"). (Other pins being read as '1' is fine because they are floating/output stage is in tristate, which is converted to '1' after the simulated/implied Schmitt-trigger)

The fix is a one line change updating the tracer of the PINx register, see the attached patch file.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #40906:  tracein.txt added by None (40B - text/plain)
file #40898:  pinx-not-traced.c added by None (151B - text/x-csrc)
file #40899:  pinx-not-traced_fail.png added by None (6KiB - image/png)
file #40900:  pinx-not-traced_pass.png added by None (6KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by tomk (Posted a comment)

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

    Only logged-in users can vote.




    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-04 tomk StatusNone => Fixed
        Assigned toNone => tomk
        Open/ClosedOpen => Closed
    2017-06-11 None Attached File- => Added tracein.txt, #40906
    2017-06-11 None Attached File- => Added 0001-update-PINx-tracer-on-portpin-update.patch, #40897
        Attached File- => Added pinx-not-traced.c, #40898
        Attached File- => Added pinx-not-traced_fail.png, #40899
        Attached File- => Added pinx-not-traced_pass.png, #40900

    Back to the top

    Powered by Savane 3.5