Updates
This commit is contained in:
@@ -21,7 +21,10 @@ from dotenv import load_dotenv
|
||||
|
||||
load_dotenv(Path(__file__).parent / ".env")
|
||||
|
||||
from csv_preprocessor import analyze_file, analyze_lp_file, group_captures, ChannelMetrics, LPMetrics
|
||||
from csv_preprocessor import (
|
||||
analyze_file, analyze_lp_file, analyze_1v8_file,
|
||||
group_captures, ChannelMetrics, LPMetrics, V1V8Metrics,
|
||||
)
|
||||
|
||||
DATA_DIR = Path(__file__).parent / "data"
|
||||
REPORTS_DIR = Path(__file__).parent / "reports"
|
||||
@@ -30,9 +33,12 @@ CLAUDE_MODEL = "claude-opus-4-6"
|
||||
SYSTEM_PROMPT = (
|
||||
"You are an expert in MIPI D-PHY signal integrity analysis. "
|
||||
"You will be given compact pre-processed summaries of oscilloscope captures "
|
||||
"from a MIPI CLK and DAT0 differential pair. "
|
||||
"Each capture has three passes: sig (high-res HS quality), proto (long-window HS stats), "
|
||||
"and lp (single-ended, shows LP-11/LP-00/HS burst structure including the SoT sequence). "
|
||||
"from a MIPI CLK and DAT0 differential pair, plus 1.8 V supply rail measurements. "
|
||||
"The MIPI PHY (NXP i.MX 8M Mini) drives LP states from the 1.8 V VDDIO. "
|
||||
"Each capture has up to four data sets: "
|
||||
"sig (high-res HS quality), proto (long-window HS stats), "
|
||||
"lp (single-ended LP-11/LP-00/HS burst including SoT sequence), "
|
||||
"and pwr (1.8 V supply captured during the LP→HS transition). "
|
||||
"Analyse the data for trends, degradation, anomalies, or consistent spec concerns "
|
||||
"across captures. Be concise and actionable."
|
||||
)
|
||||
@@ -56,13 +62,18 @@ def process_capture(
|
||||
lines = [f"=== Capture {num:04d} {ts} ==="]
|
||||
metrics_list: list[ChannelMetrics | LPMetrics] = []
|
||||
|
||||
for key in ("proto_clk", "proto_dat", "sig_clk", "sig_dat", "lp_clk", "lp_dat"):
|
||||
for key in ("proto_clk", "proto_dat", "sig_clk", "sig_dat", "lp_clk", "lp_dat", "pwr_1v8"):
|
||||
if key not in files:
|
||||
lines.append(f" [{key}] MISSING")
|
||||
if key == "pwr_1v8":
|
||||
lines.append(f" [{key}] NOT CAPTURED (Rigol not connected or no droop)")
|
||||
else:
|
||||
lines.append(f" [{key}] MISSING")
|
||||
continue
|
||||
try:
|
||||
if key.startswith("lp_"):
|
||||
m = analyze_lp_file(files[key])
|
||||
elif key == "pwr_1v8":
|
||||
m = analyze_1v8_file(files[key])
|
||||
else:
|
||||
m = analyze_file(files[key])
|
||||
lines.append(m.summary())
|
||||
@@ -82,16 +93,20 @@ def build_prompt(all_summaries: list[str]) -> str:
|
||||
"Each capture has three passes per lane (CLK and DAT0):\n"
|
||||
" sig — high-res HS differential (rise/fall times)\n"
|
||||
" proto — long-window HS differential (jitter, clock freq, amplitude)\n"
|
||||
" lp — single-ended LP state capture (LP-11 voltage, SoT sequence, HS bursts)\n\n"
|
||||
" lp — single-ended LP state capture (LP-11 voltage, SoT sequence, HS bursts)\n"
|
||||
" pwr — 1.8 V supply rail captured during LP→HS transition (droop, ripple, spec)\n\n"
|
||||
f"{body}\n\n"
|
||||
"Please:\n"
|
||||
"1. Identify any consistent spec concerns (HS voltage, LP-11 voltage, LP-low timing).\n"
|
||||
"2. Highlight any trends over captures (amplitude drift, jitter, LP-11 voltage, etc.).\n"
|
||||
"2. Highlight any trends over captures (amplitude drift, jitter, LP-11 voltage, 1.8 V droop, etc.).\n"
|
||||
"3. Flag anomalies — missing LP transitions, short LP-low, unexpected burst counts.\n"
|
||||
"4. For any ERROR or WARNING lines in the summaries, explain the most likely cause "
|
||||
" (e.g. missing file, bad trigger, signal absent, probe issue) and what to check.\n"
|
||||
"5. Provide specific, actionable recommendations to address all identified issues and anomalies.\n"
|
||||
"6. Summarise overall signal health in 2–3 sentences."
|
||||
"4. Correlate 1.8 V supply droop/ripple with MIPI LP anomalies — does droop depth or ripple "
|
||||
" correlate with SoT timing violations, short LP-low plateaux, or LP-11 voltage drops? "
|
||||
" If pwr data is absent, note that supply correlation could not be assessed.\n"
|
||||
"5. For any ERROR or WARNING lines in the summaries, explain the most likely cause "
|
||||
" (e.g. missing file, bad trigger, signal absent, probe issue, supply marginal) and what to check.\n"
|
||||
"6. Provide specific, actionable recommendations to address all identified issues and anomalies.\n"
|
||||
"7. Summarise overall signal health in 2–3 sentences."
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user