tiny8.visualizer module

Visualization helpers using Matplotlib to plot register/memory changes.

This module provides a simple Visualizer class that can create an animated visualization of the CPU step trace showing SREG bits, registers and a memory range.

class tiny8.visualizer.Visualizer(cpu)[source]

Bases: object

__init__(cpu)[source]
animate_execution(mem_addr_start=96, mem_addr_end=127, filename=None, interval=200, fps=30, fontsize=9, cmap='inferno', plot_every=1)[source]

Animate SREG bits, registers (R0..R31), and a memory range as three stacked subplots.

Parameters:
  • mem_addr_start (int) – Start memory address for memory subplot.

  • mem_addr_end (int) – End memory address for memory subplot.

  • filename (str | None) – Optional output filename for saving animation.

  • interval (int) – Milliseconds between frames.

  • fps (int) – Frames per second for saving output.

  • fontsize – Font size for labels and ticks.

  • cmap – Matplotlib colormap name for the heatmaps.

  • plot_every (int) – Plot every N steps (downsampling).

show_register_history(registers=None, figsize=(14, 8))[source]

Plot timeline of register value changes over execution.

Parameters:
  • registers (list[int]) – List of register indices to plot (default: R0-R7).

  • figsize – Figure size as (width, height).

show_memory_access(mem_addr_start=0, mem_addr_end=255, figsize=(12, 8))[source]

Plot a heatmap showing memory access patterns over time.

Parameters:
  • mem_addr_start (int) – Start memory address.

  • mem_addr_end (int) – End memory address.

  • figsize – Figure size as (width, height).

show_flag_history(figsize=(14, 6))[source]

Plot SREG flag changes over execution time.

Parameters:

figsize – Figure size as (width, height).

show_statistics(top_n=10)[source]

Plot execution summary statistics.

Parameters:

top_n (int) – Number of top memory addresses to show in access frequency.