API Reference¶
introduction.muxTool.cli¶
introduction.muxTool.apis¶
- class introduction.muxTool.apis.RunRequest(csv=None, json=None, out=None, bits=8, trace=None, in_dir='in', out_dir='out')[source]¶
Bases:
objectImmutable run request for MuxApp.
- Parameters:
csv (str | None)
json (str | None)
out (str | None)
bits (int)
trace (str | None)
in_dir (str)
out_dir (str)
- bits: int = 8¶
- csv: str | None = None¶
- in_dir: str = 'in'¶
- json: str | None = None¶
- out: str | None = None¶
- out_dir: str = 'out'¶
- trace: str | None = None¶
- class introduction.muxTool.apis.RunResult(rows, out_csv=None, out_vcd=None)[source]¶
Bases:
objectResults returned by a run: rows (list of dict), and any file outputs.
- Parameters:
rows (List[Dict[str, Any]])
out_csv (str | None)
out_vcd (str | None)
- out_csv: str | None = None¶
- out_vcd: str | None = None¶
- rows: List[Dict[str, Any]]¶
introduction.muxTool.app¶
introduction.muxTool.core¶
- class introduction.muxTool.core.MuxCore(data_bw=8, *, prefer_pyrtl=True)[source]¶
Bases:
objectCore 4:1 mux simulator.
The runtime implementation prefers PyRTL when it is available, but the module remains importable without PyRTL so Sphinx autodoc and lightweight CI jobs do not fail just because optional simulation dependencies are missing.
The logical behavior is always:
y = d0 when sel == 0 y = d1 when sel == 1 y = d2 when sel == 2 y = d3 when sel == 3
- Parameters:
data_bw (int) – Data-path bit width used to mask
d0throughd3andy.prefer_pyrtl (bool) – If true, use PyRTL when it is installed. If false, always use the pure Python fallback simulator.
- build()[source]¶
Build the PyRTL mux circuit and return its ports.
This method is only needed when PyRTL-backed simulation is desired. It intentionally imports PyRTL lazily so importing this module stays safe for documentation builds.
- Return type:
Dict[str, Any]
- simulate(vectors)[source]¶
Simulate the mux, using PyRTL when available and Python otherwise.
- Parameters:
vectors (List[Dict[str, int]])
- Return type:
List[Dict[str, int]]
introduction.muxTool.design¶
- introduction.muxTool.design.write_vcd(filename, rows, data_bw, timescale='1ns')[source]¶
Minimal VCD writer for signals: sel (2 bits), d0..d3 (data_bw), y (data_bw). One timestamp per cycle (10 ns apart).
- Parameters:
filename (str)
rows (List[Dict[str, int]])
data_bw (int)
timescale (str)
- Return type:
None
introduction.muxTool.io¶
- introduction.muxTool.io.load_rows_from_csv(path)[source]¶
- Parameters:
path (str)
- Return type:
Iterator[Dict[str, int]]
introduction.muxTool.utils¶
- introduction.muxTool.utils.log_call(fn)[source]¶
Lightweight decorator to log entry/exit for testability and debugging.
- Parameters:
fn (Callable[[...], Any])
- Return type:
Callable[[…], Any]