Conversation
Introduce LibDatabase class and writeToDB() integration to persist Liberty LUT entries into a SQLite database via 'parse --db' options. - LibDatabase: RAII wrapper with prepared INSERT statement, float32 BLOB conversion, and WAL journal mode - LibFile::writeToDB(): iterate cells->pins->timing_arcs->arc_types, write each LUT as a row in lut_entries with full hierarchy context - CLI: add --db, --pvt-corner, --aged-year, --lib-json flags to 'parse' - CMake: link SQLiteCpp to main target - Tests: 8 GoogleTest cases covering write, read, UNIQUE constraint, BLOB round-trip, idempotent write, and NULL scenario_id invariant
- Rename --pvt-corner to --pvt (generic, not aging-specific) - Make --aged-year optional (default 0.0, suitable for non-aging libs) - Remove --lib-json: DB mode no longer writes JSON, JSON and DB output are now orthogonal (parse=JSON, parse --db=DB only) - Clarify process parameter doc: stores raw .lib integer, not mapped to SS/FF/TT (caller's responsibility via --pvt)
…dup data loss
The `when` attribute (boolean condition distinguishing timing arcs sharing
the same related_pin) was not extracted, not stored in the DB, and not part
of the UNIQUE constraint. This caused INSERT OR IGNORE to silently discard
77.7% of timing LUT entries on a production PDK dataset (counter reported
35560, DB stored only 7936).
Changes:
- DDL: add "when" TEXT column (between timing_type and arc_type), include
in UNIQUE(file_path, pvt_corner, aged_year, cell_name, output_pin,
related_pin, "when", arc_type)
- INSERT/bind: sync column with placeholder; bind empty when as "" not NULL
(SQLite NULL-in-UNIQUE would let unconditional arcs bypass idempotent
re-writes and cause data duplication)
- Extraction: LibFile::writeToDB reads arc.value("when", "") from JSON
- TDD: 3 new tests (DifferentWhenSameKeyBothPersisted in libdb layer,
WhenConditionPreserved and MultipleWhenArcsAllPersisted in integration
layer); 3 existing tests updated for when column
- Docs: doc/sqlite_dedup_analysis.md (new analysis), doc/ChangeLog.md
(2026-06-23 entry), README.md (SQLiteCpp dependency)
- Version: bump 1.1.3 -> 1.2.0
Verified on a production PDK (531 cells, 6943 when conditions):
- DB entries recovered from 7936 to 35536 (99.9% recovery)
- Conditional arcs: 27772 all preserved
- Idempotent re-write: count unchanged
Co-Authored-By: Claude <noreply@anthropic.com>
The parse subcommand description in main.cpp was outdated — it omitted the --db SQLite output mode that was added earlier. Updated both the CLI string and the README help section to match. - src/main.cpp: update parse description to mention --db SQLite mode - README.md: sync help output with actual ./zlibvalidation -h - Version: bump 1.2.0 -> 1.2.1 Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Merge
dev→masterfor the v1.2.1 release. Combines two rounds of changes:v1.2.0 — SQLite
whenUNIQUE fixThe
whenattribute (boolean condition distinguishing timing arcs sharing the samerelated_pin) was not extracted, not stored in the DB, and not part of the UNIQUE constraint. This causedINSERT OR IGNOREto silently discard 77.7% of timing LUT entries on a production PDK dataset.Key changes:
"when"TEXT column, include in UNIQUE constraintwhenas""not NULL (avoid SQLite NULL-in-UNIQUE dedup trap)arc.value("when", "")from JSONdoc/sqlite_dedup_analysis.mdv1.2.1 — CLI help text sync
src/main.cpp: parse subcommand description updated to mention--dbSQLite modeREADME.md: help section synced with actual./zlibvalidation -houtputFiles changed
CMakeLists.txt,README.md,doc/ChangeLog.md,doc/sqlite_dedup_analysis.md,include/LibDatabase.hpp,include/version.h,src/LibDatabase.cpp,src/LibFile.cpp,src/main.cpp,test/test_libdb.cpp,test/test_libfile_db.cpp