|
From: | panic |
Subject: | [Simulavr-devel] [Bug] VCD trace of PINx register not updated |
Date: | Sun, 11 Jun 2017 15:43:00 +0000 |
Hi list, 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. (There are more bugs in HWPort and related to the PINx register, and I'll create separate bug reports for them. This patch is a prerequesite for the others patches though.) Cheers, panic
0001-update-PINx-tracer-on-portpin-update.patch
Description: Text Data
pinx-not-traced.c
Description: Text Data
pinx-not-traced_fail.png
Description: PNG image
pinx-not-traced_fail.vcd
Description: application/vnd.gtkwave-vcd
pinx-not-traced_pass.png
Description: PNG image
pinx-not-traced_pass.vcd
Description: application/vnd.gtkwave-vcd
tracein.txt
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |