API Reference¶
introduction.dacTool.cli¶
Command-line interface for introduction.dacTool.
The CLI supports the original DAC simulation workflows and a deploy-safe
sphinx-skel helper used by GitHub Pages / Sphinx documentation builds.
- introduction.dacTool.cli.add_common(ap)[source]¶
Add arguments shared by R-2R and weighted-resistor DAC workflows.
- Parameters:
ap (ArgumentParser)
- Return type:
None
introduction.dacTool.apis¶
- class introduction.dacTool.apis.Row(meta: 'Dict[str, Any]' = <factory>)[source]¶
Bases:
object- Parameters:
meta (Dict[str, Any])
- meta: Dict[str, Any]¶
- class introduction.dacTool.apis.RunRequest(dac_type, nbits=10, vref=3.3, R_ohm=10000.0, sigma_r_pct=0.0, sigma_2r_pct=0.0, ro_over_r=1.0, res_sigma_pct=0.0, gain_err=0.0, vo_offset=0.0, csv=None, jspec=None, tupd=1e-06, in_dir='in', out_dir='out', out_csv=None, out_vcd=None, out_vcd_all=None, include_ideal_in_vcd=False, radix='dec')[source]¶
Bases:
objectUser-facing API for a single DAC simulation run.
You pick the dac_type (‘r2r’ or ‘weighted’) and pass common knobs plus paths. All relative paths are resolved against in_dir/out_dir by the CLI/app.
- Parameters:
dac_type (str)
nbits (int)
vref (float)
R_ohm (float)
sigma_r_pct (float)
sigma_2r_pct (float)
ro_over_r (float)
res_sigma_pct (float)
gain_err (float)
vo_offset (float)
csv (str | None)
jspec (str | None)
tupd (float)
in_dir (str)
out_dir (str)
out_csv (str | None)
out_vcd (str | None)
out_vcd_all (str | None)
include_ideal_in_vcd (bool)
radix (str)
- R_ohm: float = 10000.0¶
- csv: str | None = None¶
- dac_type: str¶
- gain_err: float = 0.0¶
- in_dir: str = 'in'¶
- include_ideal_in_vcd: bool = False¶
- jspec: str | None = None¶
- nbits: int = 10¶
- out_csv: str | None = None¶
- out_dir: str = 'out'¶
- out_vcd: str | None = None¶
- out_vcd_all: str | None = None¶
- radix: str = 'dec'¶
- res_sigma_pct: float = 0.0¶
- ro_over_r: float = 1.0¶
- sigma_2r_pct: float = 0.0¶
- sigma_r_pct: float = 0.0¶
- tupd: float = 1e-06¶
- vo_offset: float = 0.0¶
- vref: float = 3.3¶
introduction.dacTool.app¶
- introduction.dacTool.app.run(req)[source]¶
- Parameters:
req (RunRequest)
- Return type:
introduction.dacTool.core¶
- class introduction.dacTool.core.R2RDAC(nbits, vref, R_ohm, sigma_r_pct=0.0, sigma_2r_pct=0.0, seed=None, gain_err=0.0, vo_offset=0.0)[source]¶
Bases:
objectVoltage-mode R-2R ladder DAC with nodal analysis and mismatch per resistor group.
- Parameters:
nbits (int)
vref (float)
R_ohm (float)
sigma_r_pct (float)
sigma_2r_pct (float)
seed (int | None)
gain_err (float)
vo_offset (float)
- class introduction.dacTool.core.WeightedDAC(nbits, vref, ro_over_r, gain_err=0.0, vo_offset=0.0, res_sigma_pct=0.0, seed=None)[source]¶
Bases:
objectBinary weighted-resistor DAC (summation DAC) ideal + simple mismatch model.
- Parameters:
nbits (int)
vref (float)
ro_over_r (float)
gain_err (float)
vo_offset (float)
res_sigma_pct (float)
seed (int | None)
introduction.dacTool.design¶
- introduction.dacTool.design.write_results_csv(path, rows)[source]¶
- Parameters:
path (str)
rows (List[Dict[str, Any]])
- Return type:
None
- introduction.dacTool.design.write_vcd(path, nbits, updates, tupd, start_time_ns=0, all_mode=False, include_ideal=False)[source]¶
Generic VCD writer used by both engines; values in microvolts.
- Parameters:
path (str)
nbits (int)
updates (List[Update])
tupd (float)
start_time_ns (int)
all_mode (bool)
include_ideal (bool)
- Return type:
int
introduction.dacTool.io¶
- introduction.dacTool.io.bits_from_int(code, nbits)[source]¶
- Parameters:
code (int)
nbits (int)
- Return type:
List[int]
- introduction.dacTool.io.int_from_bits(bits_lsb_first)[source]¶
- Parameters:
bits_lsb_first (List[int])
- Return type:
int
introduction.dacTool.utils¶
- introduction.dacTool.utils.bin_zero_padded(v, w, group=4)[source]¶
- Parameters:
v (int)
w (int)
group (int)
- Return type:
str
- introduction.dacTool.utils.resolve_input_path(p, in_dir)[source]¶
- Parameters:
p (str | None)
in_dir (str)
- Return type:
str | None