Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Getting Started with AI for VLSI Engineers5
  • Just Enough AI: Models and Context15
  • Prompting13
  • Trust and Verification14
  • Using AI for Engineering Work17
  • Engineering Walkthroughs7
  • Practical Foundations for AI Workflows4
  • Engineering Data5
    • Files, CSV, and JSON
    • Tables and IDs
    • Basic SQL for Engineering Questions
    • Regression Database Lab
    • Queries Versus Search
  • Retrieval-Augmented Generation6
  • Agents and Tool Use18
  • Agent Design8
  • MCP and Skills6
  • Multi-Agent Design6
  • Practical Capstone6
  • Tokens, Cost and Latency12
  • Agentic Workflows for Chip Teams18
  • Interview and Judgment10
  • AI Skills: Full Course Index
  • Working with AI Glossary
  • Working with AI Cheatsheet
Loading lesson

‹Engineering Data
  1. Topics
  2. AI Skills for VLSI Engineers
  3. Engineering Data
  4. Files, CSV, and JSON

Engineering Data · Beginner

Files, CSV, and JSON

Parse engineering exports while preserving meaning and provenance.

On this page

    Problem: a report is not yet a dataset

    A DV engineer receives a regression summary, an STA engineer receives a timing report, and a PD engineer receives a congestion export. Each looks like rows of numbers, but the layout alone does not define the meaning. Before asking AI to summarize them, identify the producing tool, report revision, extraction rule, units, and scope. An RTL build label without a source revision may refer to several different designs. A timing value without its corner and mode can invite a misleading comparison.

    CSV is useful for a flat list with consistent columns. JSON is useful when a run has nested configuration, multiple results, or optional metadata. Neither format guarantees correct engineering meaning. Choose a stable schema, a documented agreement about field names and their types, before collecting many exports. Keep the original approved export available so a reviewer can trace a normalized value back to its source.

    Worked synthetic example

    CSV and JSON feed a parser that validates fields, creates one row per run attempt, and supports an exact failure-count query.
    File format describes the export; row meaning and validation make the count interpretable.
    plaintext
    1
    2
    3
    4
    5
    6
    7
    8
    Synthetic CSV: one row is one completed run attempt.
    run_id,test_name,seed,status,duration_s,note
    R101,reset_smoke,11,PASS,12.5,"reset, then traffic"
    R102,fifo_stress,22,FAIL,18.0,"timeout"
    
    Equivalent JSON record for the first row:
    {"run_id":"R101","test_name":"reset_smoke","seed":11,
     "status":"PASS","duration_s":12.5,"note":"reset, then traffic"}

    The comma inside the quoted note is part of one field. Splitting each line on commas would silently create an extra column. A normal CSV reader handles the quoting. CSV fields usually arrive as strings, so convert the seed and duration deliberately. In JSON, numbers and strings differ: the string "11" is not the integer 11. Keep identifiers as strings even when an export happens to use only digits; converting an identifier such as 0007 to an integer loses information.

    example.py
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    import csv
    import io
    import json
    
    source = 'run_id,seed,status,duration_s\nR101,11,PASS,12.5\n'
    records = []
    for raw in csv.DictReader(io.StringIO(source)):
        if raw["status"] not in {"PASS", "FAIL", "ERROR"}:
            raise ValueError("Unknown status")
        records.append({
            "run_id": raw["run_id"], "seed": int(raw["seed"]),
            "status": raw["status"], "duration_s": float(raw["duration_s"]),
        })
    expected = [{"run_id": "R101", "seed": 11, "status": "PASS", "duration_s": 12.5}]
    assert records == expected
    assert type(records[0]["seed"]) is int
    assert type(records[0]["duration_s"]) is float
    encoded = json.dumps(records, sort_keys=True)
    assert json.loads(encoded) == expected
    print(encoded)
    print("PASS: synthetic CSV conversion and JSON round trip")

    This independent, complete snippet parses an embedded synthetic string and prints JSON. It does not open files. When adapting a reader to an approved file, specify its encoding and use the CSV module's documented newline handling. Decide whether an empty numeric field means missing, invalid, or unavailable before conversion. Never convert a missing slack measurement to zero: zero slack and no measurement describe different states.

    Exercise and acceptance checks

    Check yourself A row contains run_id=0007, duration_s empty, and status=SKIPPED. How should an importer handle it?

    Preserve 0007 as a string. Represent missing duration explicitly, for example as None and then JSON null, under a documented policy. Reject or quarantine SKIPPED until the allowed status vocabulary is updated; do not silently map it to PASS or FAIL. Record the rejected row's source location.

    Review the row count before and after conversion and account for each rejected row. Check that a note containing a comma remains one field. Add a schema version to the surrounding export manifest so a renamed duration column is detected instead of becoming a column of missing values. An AI-generated parser is a draft until these behaviors have been inspected against representative exports.

    Limits and source

    Parsing validates shape, not whether the simulator actually completed or whether an STA report used the intended constraints. Local examples do not grant permission to upload reports: obtain approval for the source data and destination first, and keep production access read-only. Reference: Python 3.12 CSV and JSON library documentation.

    Related topics

    • Up: Engineering Data

    • Next: Tables and IDs

    Previous

    76 / 173

    Next: Tables and IDs

    Up next

    Up nextTables and IDs

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Basic SQL for Engineering Questions
    • Regression Database Lab
    • Queries Versus Search