API Reference

introduction.vcdTool.cli

introduction.vcdTool.cli.build_parser()[source]

Build the command-line parser.

Return type:

ArgumentParser

introduction.vcdTool.cli.main(argv=None)[source]

Run the vcdTool command-line interface.

Parameters:

argv (list[str] | None)

Return type:

int

introduction.vcdTool.cli.parse_decode_list(s)[source]

Parse a comma-separated decode list such as code:10,bus:8.

Parameters:

s (str | None)

Return type:

list[tuple[str, int]]

introduction.vcdTool.apis

class introduction.vcdTool.apis.RunRequest(vcd: 'str', signals: 'List[str] | None' = None, units: 'str' = 'us', backend: 'str' = 'mpl', overlay: 'bool' = False, out_csv: 'Optional[str]' = None, csv_units: 'str' = 's', png: 'Optional[str]' = None, html: 'Optional[str]' = None, decode: 'List[Tuple[str, int]]' = <factory>, in_dir: 'str' = 'in', out_dir: 'str' = 'out')[source]

Bases: object

Parameters:
  • vcd (str)

  • signals (List[str] | None)

  • units (str)

  • backend (str)

  • overlay (bool)

  • out_csv (str | None)

  • csv_units (str)

  • png (str | None)

  • html (str | None)

  • decode (List[Tuple[str, int]])

  • in_dir (str)

  • out_dir (str)

backend: str = 'mpl'
csv_units: str = 's'
decode: List[Tuple[str, int]]
html: str | None = None
in_dir: str = 'in'
out_csv: str | None = None
out_dir: str = 'out'
overlay: bool = False
png: str | None = None
signals: List[str] | None = None
units: str = 'us'
validate()[source]
Return type:

None

vcd: str

introduction.vcdTool.app

class introduction.vcdTool.app.VCDApp[source]

Bases: object

Top-level orchestration for VCD plotting pipeline.

run(req)[source]
Parameters:

req (RunRequest)

Return type:

dict

introduction.vcdTool.core

class introduction.vcdTool.core.Decoder[source]

Bases: object

apply(series, rawbits, widths, decodes)[source]
Parameters:

decodes (List[Tuple[str, int]])

class introduction.vcdTool.core.VCDData(timescale_factor: 'float', vars_by_id: 'Dict[str, Var]', events: 'List[Tuple[int, List[Tuple[str, str]]]]')[source]

Bases: object

Parameters:
  • timescale_factor (float)

  • vars_by_id (Dict[str, Var])

  • events (List[Tuple[int, List[Tuple[str, str]]]])

events: List[Tuple[int, List[Tuple[str, str]]]]
timescale_factor: float
vars_by_id: Dict[str, Var]
class introduction.vcdTool.core.VCDParser[source]

Bases: object

parse(path)[source]
Parameters:

path (str)

Return type:

VCDData

class introduction.vcdTool.core.Var(id, name, width)

Bases: tuple

id

Alias for field number 0

name

Alias for field number 1

width

Alias for field number 2

class introduction.vcdTool.core.WaveformBuilder[source]

Bases: object

build(vcd, wanted_names)[source]
Parameters:
  • vcd (VCDData)

  • wanted_names (List[str])

introduction.vcdTool.design

introduction.vcdTool.design.plot_mpl(png_path, times_sec, series, widths, xunits, title)[source]
Parameters:
  • png_path (str | None)

  • times_sec (List[float])

  • series (Dict[str, List[float]])

  • widths (Dict[str, int])

  • xunits (str)

  • title (str)

Return type:

None

introduction.vcdTool.design.plot_plotly(html_path, times_sec, series, widths, xunits, title, overlay=False)[source]
Parameters:
  • html_path (str | None)

  • times_sec (List[float])

  • series (Dict[str, List[float]])

  • widths (Dict[str, int])

  • xunits (str)

  • title (str)

Return type:

None

introduction.vcdTool.io

introduction.vcdTool.io.export_csv(csv_path, times_sec, series, csv_units)[source]
Parameters:
  • csv_path (str)

  • times_sec (List[float])

  • series (Dict[str, List[float]])

  • csv_units (str)

Return type:

None

introduction.vcdTool.io.resolve_input_path(p, in_dir)[source]
Parameters:
  • p (str)

  • in_dir (str)

Return type:

str

introduction.vcdTool.io.resolve_output_path(p, out_dir)[source]

Policy: - Absolute paths: return as-is (ensure parent dir exists). - Relative paths (even with a subdirectory like ‘sub/out.csv’): join with out_dir.

Parameters:
  • p (str | None)

  • out_dir (str)

Return type:

str | None

introduction.vcdTool.io.timescale_map()[source]
Return type:

Dict[str, float]

introduction.vcdTool.io.unit_scale_map()[source]
Return type:

Dict[str, float]

introduction.vcdTool.utils

introduction.vcdTool.utils.ensure_dir_for_file(path)[source]
Parameters:

path (str | None)

Return type:

None

introduction.vcdTool.utils.timed(fn)[source]
Parameters:

fn (Callable[[...], Any])

Return type:

Callable[[…], Any]