Skip to content

v3.0.1 - PSpice overflow-block fix

Choose a tag to compare

@jtsylve jtsylve released this 05 Jun 01:22
· 3 commits to main since this release

Changes since v3.0.0

Bug fixes

  • Fix PSpice overflow-block line reconstruction (#8). PSpice packs each source line into 64-byte blocks 62 payload bytes at a time, marking non-final blocks with a $+ overflow marker in bytes 62–63 and padding the final block with the $jbs$ sentinel. The old decoder treated bytes 62–63 as unused, searched only bytes 0–61 for the sentinel, and merged any line beginning with + into the previous line — producing inconsistent line breaks and leaking sentinel fragments ( $jbs, $jb, …) into the output for models with overflow blocks. The new _split_block decoder classifies each block as final or overflow by examining all 64 bytes, handling the intact sentinel, a carriage-return terminator (including when it lands in bytes 62–63), a sentinel truncated at the payload boundary, and the $+ marker; a leading + is now preserved verbatim as ordinary SPICE continuation syntax.

Specifications

  • SPECIFICATIONS/pspice.md updated to v1.1.0, documenting the real 64-byte block structure: bytes 62–63 are not unused, the distinction between overflow and final blocks, sentinel straddling of the payload boundary, and the two independent (block-level and source-level) line-continuation mechanisms.

Testing

  • Added byte-level and round-trip continuation tests for PSpice overflow blocks.

Dependencies

  • Bump pytest from 9.0.2 to 9.0.3
  • Bump pygments from 2.19.2 to 2.20.0

SpiceCrypt now decrypts QSPICE® .prot protected sub-circuit blocks, the third SPICE encryption family it supports. Combined with existing LTspice and PSpice coverage, SpiceCrypt is now a universal decryption tool spanning the three most widely used SPICE simulators.

QSPICE protects sub-circuit bodies with a .prot.unprot block whose payload is a randomized base-16 text encoding keyed by a 32-bit seed stored in the clear. SpiceCrypt decodes the encoding, runs the seed-keyed dual stream cipher (a Mersenne Twister stream plus an additive walk over a fixed 9973-byte table), inflates the DEFLATE payload, and detokenizes the Windows-1252 netlist body. Because the seed is the only key material and travels alongside the ciphertext, the scheme provides obfuscation rather than cryptographic protection.

New features

  • QSPICE .prot/.unprot protected-block decryption with automatic format detection
  • Streaming QSpiceFileParser wired into decrypt_stream() / decrypt(), extending auto-detection to Binary File → PSpice → QSPICE → LTspice
  • Public API exports QSpiceFileParser and QSpiceCipher
  • Protected blocks that fail to decode are passed through unchanged with a warning rather than aborting the stream
  • decrypt_stream() returns (block_count, 0) for QSPICE input — the number of protected blocks decrypted

Breaking changes

  • Remove the v2-deprecated backward-compat shim modules des.py, binary_file.py, and crypto_state.py (which have emitted DeprecationWarning since v2.0.0); import from spice_crypt.ltspice.* directly

Architecture

  • New spice_crypt/qspice/ subpackage: QSpiceCipher primitives (base-16 decode, dual keystream, zlib inflate, Windows-1252 detokenize) and the streaming QSpiceFileParser
  • decrypt.py switches the reader to CP1252 when a .prot block is detected so high-bit passthrough characters decode correctly, and rewrites the micro sign µ to the ASCII u other tools expect

Specifications

  • New SPECIFICATIONS/qspice.md: full documentation of the .prot base-16 encoding, seed-keyed dual stream cipher, DEFLATE compression, and Windows-1252 keyword tokenization

Testing & CI

  • QSPICE decryption test suite with .lib fixtures (basic, comments, multi-block, passthrough, tokens)
  • scripts/gen_qspice_testdata.py test-data generator

Infrastructure

  • README, trademark, and keyword updates for QSPICE® (a registered trademark of Qorvo US, Inc.)