{
  "slug": "flip-n-write",
  "term": "Flip-N-Write",
  "aliases": [
    "FNW",
    "Flip N Write"
  ],
  "definition": "Flip-N-Write reduces changed bits in phase-change memory by choosing a word's normal or complemented encoding and recording an inversion bit.",
  "note": "A read-before-write comparison identifies changed cells; an inversion bit lets reads recover the logical word. Only changed cells are programmed. This is a proposed PCM encoding, not a NAND erase-block policy. [power]\n\nFor even n data bits and one inversion bit, let d be the Hamming distance between the old logical word and the new word. Keeping the current inversion state costs d updates; changing it costs n-d+1, including the flag. Selecting the cheaper encoding bounds the total by n/2. The accounting assumes independently writable binary cells and a stable flag location. [example]\n\nIn an eight-bit example, 16 alternating writes of 255 and 0 change only the inversion bit: 16 updates instead of 128 for plain differential writes. Yet the busiest cell still changes 16 times in either design. Fewer total updates alone therefore do not prove a longer lifetime. [example]\n\nRead latency, peripheral circuitry, SET/RESET costs and power scheduling still matter when translating bit counts into performance or energy. [power]",
  "status": "research",
  "advantages": [],
  "limitations": [
    {
      "text": "The example does not model ECC, flag protection, wear leveling, interrupted writes or cell-to-cell endurance variation.",
      "citationIds": [
        "example"
      ]
    }
  ],
  "related": [
    "phase-change-memory",
    "hamming-distance",
    "wear-leveling"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-29",
  "citations": [
    {
      "id": "power",
      "title": "Hay et al. Preventing PCM Banks from Seizing Too Much Power. MICRO 2011, sections 2-3 and 4.4.",
      "url": "https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/MICRO44-final.pdf",
      "accessed": "2026-11-29"
    },
    {
      "id": "fnw",
      "title": "Cho and Lee. Flip-N-Write: a simple deterministic technique to improve PRAM write performance, energy and endurance. MICRO 2009.",
      "url": "https://doi.org/10.1145/1669112.1669157",
      "accessed": "2026-11-29"
    },
    {
      "id": "example",
      "title": "Hesela: exact binary-cell accounting, flag concentration example and runnable tests.",
      "url": "https://hesela.dev/research/flip-n-write/README.md",
      "accessed": "2026-11-29"
    }
  ],
  "provenance": [
    "Mechanism reviewed in the full MICRO 2011 paper, which evaluates Flip-N-Write as a baseline and cites Cho and Lee (2009). The 2009 full text was unavailable in this review.",
    "The bound and alternating-write example are independently derived arithmetic, not a reproduction of either paper's performance or endurance experiments."
  ]
}
