# comparesdc

> Compare two SDC constraint files and report every added, removed or changed constraint and argument -- for reviewing timing-constraint changes between design versions.

- Catalog id: `Comparesdc`; bundle: `comparesdc`; latest version 20261018
- Documentation page: https://edautils.com/DownloadLinks.html
- Keywords: SDC compare, SDC diff, timing constraints comparison, constraint review
- Terms: as stated on edautils.com, EDAUtils tools are free for commercial and academic use, with no license server. The bundle's own metadata says: "Free to evaluate with the bundled licence; commercial licences from help@edautils.com". Licence prerequisites per tool are under "How an agent runs it".
- This file: https://edautils.com/capabilities/comparesdc.md

## Downloads

- EDAUtils download site: https://edautils.ai/download/Comparesdc (latest file `comparesdc-20261018.tar.gz`)
- SourceForge: https://sourceforge.net/projects/edautils-free-utilities/files/comparesdc/
- GitHub Releases: https://github.com/edautils/releases/releases/download/RELEASE_20261018/comparesdc-20261018.tar.gz (release `RELEASE_20261018`; all releases: https://github.com/edautils/releases/releases)

## How an agent runs it

The following is the AGENTS.md shipped at the root of the bundle.

Compares two SDC (Synopsys Design Constraints) files. Each file is sourced into an embedded
Tcl interpreter running the sdc-shell command layer, which builds an SDC data model; the two
models are saved as temporary XMI files and compared with EMF Compare. Output is a numbered
difference list written to a text file (default `diff.txt`) and echoed to the log.
Main class: `com.eu.miscedautils.sdcparser.comparesdc` (jar `lib/designplayer.jar`).

### Where it ships

Its own bundle, `comparesdc.tar.gz` (flow `comparesdc`; release tree
`release_scripts/comparesdc/1.0`), and as a point tool in the **sdc-shell** and
**designplayer-shell** bundles (`bin/comparesdc` running the shell's jar; this guide as
`tools/comparesdc/AGENTS.md`, examples under `tools/comparesdc/examples/`).

### Prerequisites

- Java on `PATH` (the launcher runs plain `java`). Use Java 11 or newer (Java 21 recommended: the
  release is built and regression-tested with OpenJDK 21); the bundled JAXB and Eclipse libraries
  are class-file version 55, so a Java 8 runtime fails with `UnsupportedClassVersionError`.
- `EDAUTILS_ROOT` = the unpacked bundle directory (must contain `bin/` and `lib/`). The
  launcher exits 1 with "Environment variable EDAUTILS_ROOT is not set" otherwise.
  `source setup_env.sh` (or `setup_env.csh`) from the bundle root sets `EDAUTILS_ROOT`,
  `EDAUTILS_LICENSE_FILE=$EDAUTILS_ROOT/edautils.lic`, `CLASSPATH` and prepends `bin/` to `PATH`.
- Protected Tcl layer: `$EDAUTILS_ROOT/bin/tcl/*.tcl.encrypted` plus the signed
  `edautils.manifest` (copied in from designplayer-shell by the release build). At start-up
  they are verified and decrypted into a private temp folder under `java.io.tmpdir`; the SDC
  commands come from `init.sdc.tcl`. A missing/invalid signature or a failed decryption is a
  Fatal Error and exit status 11. Do not add, remove or edit files in `bin/tcl`.
- Licence feature `SDCCOMPARE`. The licence file is searched in this order:
  `$EDAUTILS_LICENSE_FILE`, `./edautils.lic` (run directory), `$HOME/edautils.lic`,
  `$EDAUTILS_ROOT/edautils.lic`. No licence for the feature: exit status 10.
- Optional environment: `JAVA_FLAGS` (passed to the JVM, e.g. `-Xmx8g`; with no heap option in it the launcher adds `-Xmx` sized to the machine (`bin/eu_heap.sh`: the largest of 64/32/16/12/8/4 GB within 3/4 of physical or cgroup memory, else 2 GB; `EDAUTILS_MAX_HEAP_GB` caps it)),
  `EDAUTILS_LOG_FILE` / `EDAUTILS_APPEND_LOG_FILE` (log file name; the second appends),
  `EDAUTILS_DISABLE_USAGE_TRACKING=true`, `EDAUTILS_PRINT_STACK_TRACE` (stack traces on
  internal exceptions), `EDAUTILS_ENABLE_DEBUG_ENVIRONMENT=1` (debug messages).
- No external tools needed (the Tcl interpreter is inside the jar).

### Invocation

```
comparesdc -golden <file.sdc> -revised <file.sdc> [-outfile <file>] [-user <email>]
```

| Option | Meaning |
|---|---|
| `-golden <file>` | Golden SDC file (mandatory) |
| `-revised <file>` | Revised SDC file (mandatory) |
| `-outfile <file>` | Difference report (default `diff.txt`) |
| `-origin <file>` | Accepted and recorded, but never used (3-way compare is not implemented) |
| `-user <email>` | User id for usage registration |

There is no `-help`, `-nobanner` or `-quiet`: any unknown word (including `-help`) gives
Error "Unrecognized option : <opt>", the usage, and exit 1. Missing `-golden`/`-revised`:
Error "Missing mandatory input(s) ...", the usage, exit 1. The banner is always printed.
The usage text says "UPF file" for the two inputs (copied from compareupf); they are SDC files.
Any file extension works (the regression suite uses both `.tcl` and `.sdc`).

### Inputs / Outputs

- Reads: the two SDC files (executed as Tcl through the SDC command layer, one
  `Executing command : ...` note per command).
- Writes: the `-outfile` report, always (empty when there are no differences). Each line reads
  `[  n] Attribute change : <attribute> : <revised value> -> <golden value>` (the revised
  model is the left side of the comparison). Temporary `revised-*.xmi` / `golden-*.xmi` and
  the decrypted Tcl go under `java.io.tmpdir` (or `.`) and are deleted at JVM exit.
- Log: `comparesdc.log` in the current directory (override with `EDAUTILS_LOG_FILE`).
  The differences are echoed between `******************Differences ***` markers.

### Exit status and messages

- 0 on a normal finish (also after in-run errors such as an unreadable SDC file, which are
  reported but not fatal). 1 = unrecognised option, missing mandatory input, or an internal
  exception. 10 = licence checkout failed. 11 = protected Tcl content failed its signature
  check or decryption. 1 also = `EDAUTILS_ROOT` missing/invalid (launcher).
- Message format: `comparesdc: <Severity>: <id>: <text>`, severity one of `Error`,
  `Fatal Error`, `Warning`, `Note`, `Programming Error`; `<id>` is a 5-digit message number.
  Key notes: `Found total differences : N`, `Written differences into file : <f>`.
- The run ends with `comparesdc: Note: <id>: Found N error(s) and M warning(s) ...`.

### Examples

Shipped: `examples/trivial_constraints/` (`runme.csh`, `simple_constraint.tcl`,
`simple_constraint.modified.tcl`):

```
cd $EDAUTILS_ROOT/examples/trivial_constraints
comparesdc -revised simple_constraint.modified.tcl -golden simple_constraint.tcl -outfile Diff.rpt
```

From the regression suite (reference:
`tests.edautilscommandline/tests/comparesdc/simple_constraint_2/runme.csh`):

```
comparesdc -revised simple_constraint.modified.sdc -golden simple_constraint.sdc -outfile Diff.rpt
```

### Integration notes

- Non-interactive; does not read stdin. Run with `</dev/null`.
- Writes the log and the default report into the current directory: give each parallel run
  its own working directory (or distinct `-outfile` and `EDAUTILS_LOG_FILE`). Temp files use
  unique names, so parallel runs do not collide in `java.io.tmpdir`.
- Set `EDAUTILS_DISABLE_USAGE_TRACKING=true` to stop usage registration.
- Success test: exit status 0 **and** the log contains `Found 0 error(s)` **and** the report
  exists. `Found total differences : 0` (empty report) means equivalent; the exit status never
  signals "files differ".

### See also

compareupf, parsesdc, sdc-shell.
