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- animate_combined(mem_addr_start: int = 0, mem_addr_end: int = 31, filename: str | None = None, interval: int = 200, fps: int = 30, fontsize=9, cmap='inferno', plot_every: int = 1)[source]¶
Animate SREG bits, registers (R0..R31), and a memory range as three stacked subplots.
- Args:
mem_addr_start: Start memory address for memory subplot (default 0). mem_addr_end: End memory address for memory subplot (default 31). filename: Optional output filename for saving an animation (GIF). If
not provided, show the plot interactively.
interval: Milliseconds between frames in the animation. fps: Frames per second for saving output. fontsize: Font size for labels and ticks. cmap: Matplotlib colormap name for the heatmaps. plot_every: Plot every N cycles (downsampling of frames).
- Notes:
Requires numpy and matplotlib. If Matplotlib’s animation or ffmpeg is not available, the method will attempt to show a static figure.