Memory Similarity Calculator Skill
Guidance for working with MemorySimilarityCalculator in the lib-electronic-components library.
For metadata-driven similarity architecture, see /similarity-metadata:
- SpecImportance levels (CRITICAL, HIGH, MEDIUM, LOW, OPTIONAL)
- ToleranceRule types (exactMatch, percentageTolerance, minimumRequired, etc.)
- SimilarityProfile contexts (DESIGN_PHASE, REPLACEMENT, COST_OPTIMIZATION, etc.)
- Calculator integration patterns and gotchas
Overview
The MemorySimilarityCalculator compares memory ICs based on:
- Equivalent groups - Cross-manufacturer equivalents
- Memory type - EEPROM, Flash, etc.
- Interface - I2C, SPI
- Capacity - Must match for high similarity
- Voltage range - Operating voltage compatibility
Applicable Types
ComponentType.MEMORY
// Any type starting with "MEMORY_"
// Returns true for null to handle unrecognized memory devices
Similarity Thresholds
HIGH_SIMILARITY = 0.9; // Equivalent parts
MEDIUM_SIMILARITY = 0.7; // Same type/interface, close specs
LOW_SIMILARITY = 0.3; // Different capacity or interface
I2C EEPROM Equivalents
| Capacity |
Equivalent Parts |
| 256Kbit |
24LC256, AT24C256, M24C256, CAT24C256 |
| 512Kbit |
24LC512, AT24C512, M24C512, CAT24C512 |
| 1Mbit |
24LC1024, AT24C1024, M24C1024 |
calculator.calculateSimilarity("24LC256", "AT24C256", registry);
// Returns >= 0.7 (equivalent I2C EEPROMs)
SPI EEPROM Equivalents
| Capacity |
Equivalent Parts |
| 256Kbit |
25LC256, 25AA256, AT25256, M95256 |
| 512Kbit |
25LC512, 25AA512, AT25512, M95512 |
SPI Flash Equivalents
| Capacity |
Equivalent Parts |
| 32Mbit |
W25Q32JV, W25Q32FW, MX25L3233F, S25FL032P, IS25LP032 |
| 64Mbit |
W25Q64JV, W25Q64FW, MX25L6433F, S25FL064P, IS25LP064 |
| 128Mbit |
W25Q128JV, W25Q128FW, MX25L12833F, S25FL128, IS25LP128 |
calculator.calculateSimilarity("W25Q32JV", "MX25L3233F", registry);
// Returns >= 0.3 (same capacity SPI Flash)
Interface Rules
I2C and SPI memory have lower similarity due to different interfaces:
calculator.calculateSimilarity("24LC256", "25LC256", registry);
// Returns <= 0.7 (same capacity, different interface)
Capacity Rules
Different capacities return LOW_SIMILARITY:
calculator.calculateSimilarity("W25Q32JV", "W25Q128JV", registry);
// Returns 0.3 (same family, different size)
Package Handling
Package codes don't significantly affect similarity for memory:
- Same memory, different package = HIGH_SIMILARITY (0.9)
- Same memory, compatible package = HIGH_SIMILARITY (0.9)
- Same memory, different package type = ~0.8
Manufacturer Prefixes
| Prefix |
Manufacturer |
Type |
| 24LC |
Microchip |
I2C EEPROM |
| AT24C |
Atmel/Microchip |
I2C EEPROM |
| M24C |
ST |
I2C EEPROM |
| CAT24C |
ON Semi |
I2C EEPROM |
| 25LC/25AA |
Microchip |
SPI EEPROM |
| AT25 |
Atmel/Microchip |
SPI EEPROM |
| M95 |
ST |
SPI EEPROM |
| W25Q |
Winbond |
SPI Flash |
| MX25L |
Macronix |
SPI Flash |
| S25FL |
Spansion/Cypress |
SPI Flash |
| IS25LP |
ISSI |
SPI Flash |
Test Examples
// Same I2C EEPROM
calculator.calculateSimilarity("24LC256", "24LC256", registry);
// Returns 1.0
// Cross-manufacturer I2C EEPROM
calculator.calculateSimilarity("24LC256", "AT24C256", registry);
// Returns >= 0.7
// Same Flash, different manufacturer
calculator.calculateSimilarity("W25Q64JV", "MX25L6433F", registry);
// Returns >= 0.3
// Different capacity
calculator.calculateSimilarity("24LC256", "24LC512", registry);
// Returns 0.3
Metadata-Driven Implementation (January 2026)
Status: ✅ Converted (PR #117)
The MemorySimilarityCalculator now uses a metadata-driven approach with spec-based comparison.
Specs Compared
| Spec |
Importance |
Tolerance Rule |
Description |
| memoryType |
CRITICAL |
exactMatch |
EEPROM, Flash, SRAM, etc. |
| capacity |
CRITICAL |
exactMatch |
256Kbit, 512Kbit, 1Mbit, etc. |
| interface |
HIGH |
exactMatch |
I2C, SPI, Parallel |
| package |
LOW |
exactMatch |
SOIC, DIP, TSSOP, etc. |
Implementation Pattern
// Short-circuit check for CRITICAL incompatibility
if (!memoryType1.isEmpty() && !memoryType2.isEmpty() && !memoryType1.equals(memoryType2)) {
return LOW_SIMILARITY;
}
if (!capacity1.isEmpty() && !capacity2.isEmpty() && !capacity1.equals(capacity2)) {
return LOW_SIMILARITY;
}
// Weighted spec scoring
// memoryType: CRITICAL (1.0 weight)
// capacity: CRITICAL (1.0 weight)
// interface: HIGH (0.7 weight)
// package: LOW (0.2 weight)
Behavior Changes
| Comparison |
Legacy Result |
Metadata Result |
Notes |
| 24LC256 vs 24LC256 |
1.0 |
1.0 |
Identical |
| 24LC256 vs AT24C256 |
0.7+ |
0.85 |
Equivalent I2C EEPROM |
| W25Q32JV vs MX25L3233F |
0.3+ |
0.61 |
Same capacity Flash |
| 24LC256 vs 24LC512 |
0.3 |
0.3 |
Short-circuit on capacity |
| W25Q32JVSSIQ vs W25Q32JVSFIQ |
0.7+ |
0.93 |
Same Flash, different package |
Why more accurate: Metadata approach prioritizes capacity and type matching, with interface as secondary concern.
Learnings & Quirks
Part Number Patterns
24xx = I2C interface, 25xx = SPI interface
C often indicates CMOS
- Capacity in Kbits: 256 = 32KB, 512 = 64KB, 1024 = 128KB
Revision Suffixes
JV, FW, JW on Winbond = package/voltage variants
A, B, C suffixes = revisions (usually compatible)
Voltage Compatibility
- Standard: 2.7V-5.5V
- Low voltage: 1.7V-3.6V (check compatibility)
1---2name: similarity-memory3description: Use when working with memory IC similarity calculations - comparing EEPROM/Flash MPNs, understanding I2C/SPI interface matching, equivalent groups across manufacturers, or memory-specific similarity logic.4---5
6# Memory Similarity Calculator Skill
7
8Guidance for working with `MemorySimilarityCalculator` in the lib-electronic-components library.
9
10---
11
12**For metadata-driven similarity architecture**, see `/similarity-metadata`:
13- SpecImportance levels (CRITICAL, HIGH, MEDIUM, LOW, OPTIONAL)
14- ToleranceRule types (exactMatch, percentageTolerance, minimumRequired, etc.)
15- SimilarityProfile contexts (DESIGN_PHASE, REPLACEMENT, COST_OPTIMIZATION, etc.)
16- Calculator integration patterns and gotchas
17
18---
19
20## Overview
21
22The `MemorySimilarityCalculator` compares memory ICs based on:
23- **Equivalent groups** - Cross-manufacturer equivalents
24- **Memory type** - EEPROM, Flash, etc.
25- **Interface** - I2C, SPI
26- **Capacity** - Must match for high similarity
27- **Voltage range** - Operating voltage compatibility
28
29## Applicable Types
30
31```java
32ComponentType.MEMORY
33// Any type starting with "MEMORY_"
34// Returns true for null to handle unrecognized memory devices
35```
36
37## Similarity Thresholds
38
39```java
40HIGH_SIMILARITY = 0.9; // Equivalent parts
41MEDIUM_SIMILARITY = 0.7; // Same type/interface, close specs
42LOW_SIMILARITY = 0.3; // Different capacity or interface
43```
44
45## I2C EEPROM Equivalents
46
47| Capacity | Equivalent Parts |
48|----------|------------------|
49| 256Kbit | 24LC256, AT24C256, M24C256, CAT24C256 |
50| 512Kbit | 24LC512, AT24C512, M24C512, CAT24C512 |
51| 1Mbit | 24LC1024, AT24C1024, M24C1024 |
52
53```java
54calculator.calculateSimilarity("24LC256", "AT24C256", registry);
55// Returns >= 0.7 (equivalent I2C EEPROMs)
56```
57
58## SPI EEPROM Equivalents
59
60| Capacity | Equivalent Parts |
61|----------|------------------|
62| 256Kbit | 25LC256, 25AA256, AT25256, M95256 |
63| 512Kbit | 25LC512, 25AA512, AT25512, M95512 |
64
65## SPI Flash Equivalents
66
67| Capacity | Equivalent Parts |
68|----------|------------------|
69| 32Mbit | W25Q32JV, W25Q32FW, MX25L3233F, S25FL032P, IS25LP032 |
70| 64Mbit | W25Q64JV, W25Q64FW, MX25L6433F, S25FL064P, IS25LP064 |
71| 128Mbit | W25Q128JV, W25Q128FW, MX25L12833F, S25FL128, IS25LP128 |
72
73```java
74calculator.calculateSimilarity("W25Q32JV", "MX25L3233F", registry);
75// Returns >= 0.3 (same capacity SPI Flash)
76```
77
78## Interface Rules
79
80**I2C and SPI memory have lower similarity due to different interfaces:**
81
82```java
83calculator.calculateSimilarity("24LC256", "25LC256", registry);
84// Returns <= 0.7 (same capacity, different interface)
85```
86
87## Capacity Rules
88
89**Different capacities return LOW_SIMILARITY:**
90
91```java
92calculator.calculateSimilarity("W25Q32JV", "W25Q128JV", registry);
93// Returns 0.3 (same family, different size)
94```
95
96## Package Handling
97
98Package codes don't significantly affect similarity for memory:
99- Same memory, different package = HIGH_SIMILARITY (0.9)
100- Same memory, compatible package = HIGH_SIMILARITY (0.9)
101- Same memory, different package type = ~0.8
102
103## Manufacturer Prefixes
104
105| Prefix | Manufacturer | Type |
106|--------|--------------|------|
107| 24LC | Microchip | I2C EEPROM |
108| AT24C | Atmel/Microchip | I2C EEPROM |
109| M24C | ST | I2C EEPROM |
110| CAT24C | ON Semi | I2C EEPROM |
111| 25LC/25AA | Microchip | SPI EEPROM |
112| AT25 | Atmel/Microchip | SPI EEPROM |
113| M95 | ST | SPI EEPROM |
114| W25Q | Winbond | SPI Flash |
115| MX25L | Macronix | SPI Flash |
116| S25FL | Spansion/Cypress | SPI Flash |
117| IS25LP | ISSI | SPI Flash |
118
119## Test Examples
120
121```java
122// Same I2C EEPROM
123calculator.calculateSimilarity("24LC256", "24LC256", registry);
124// Returns 1.0
125
126// Cross-manufacturer I2C EEPROM
127calculator.calculateSimilarity("24LC256", "AT24C256", registry);
128// Returns >= 0.7
129
130// Same Flash, different manufacturer
131calculator.calculateSimilarity("W25Q64JV", "MX25L6433F", registry);
132// Returns >= 0.3
133
134// Different capacity
135calculator.calculateSimilarity("24LC256", "24LC512", registry);
136// Returns 0.3
137```
138
139---
140
141## Metadata-Driven Implementation (January 2026)
142
143**Status**: ✅ Converted (PR #117)
144
145The `MemorySimilarityCalculator` now uses a **metadata-driven approach** with spec-based comparison.
146
147### Specs Compared
148
149| Spec | Importance | Tolerance Rule | Description |
150|------|-----------|----------------|-------------|
151| **memoryType** | CRITICAL | exactMatch | EEPROM, Flash, SRAM, etc. |
152| **capacity** | CRITICAL | exactMatch | 256Kbit, 512Kbit, 1Mbit, etc. |
153| **interface** | HIGH | exactMatch | I2C, SPI, Parallel |
154| **package** | LOW | exactMatch | SOIC, DIP, TSSOP, etc. |
155
156### Implementation Pattern
157
158```java
159// Short-circuit check for CRITICAL incompatibility
160if (!memoryType1.isEmpty() && !memoryType2.isEmpty() && !memoryType1.equals(memoryType2)) {
161 return LOW_SIMILARITY;
162}
163if (!capacity1.isEmpty() && !capacity2.isEmpty() && !capacity1.equals(capacity2)) {
164 return LOW_SIMILARITY;
165}
166
167// Weighted spec scoring
168// memoryType: CRITICAL (1.0 weight)
169// capacity: CRITICAL (1.0 weight)
170// interface: HIGH (0.7 weight)
171// package: LOW (0.2 weight)
172```
173
174### Behavior Changes
175
176| Comparison | Legacy Result | Metadata Result | Notes |
177|-----------|--------------|-----------------|-------|
178| 24LC256 vs 24LC256 | 1.0 | 1.0 | Identical |
179| 24LC256 vs AT24C256 | 0.7+ | 0.85 | Equivalent I2C EEPROM |
180| W25Q32JV vs MX25L3233F | 0.3+ | 0.61 | Same capacity Flash |
181| 24LC256 vs 24LC512 | 0.3 | 0.3 | Short-circuit on capacity |
182| W25Q32JVSSIQ vs W25Q32JVSFIQ | 0.7+ | 0.93 | Same Flash, different package |
183
184**Why more accurate**: Metadata approach prioritizes capacity and type matching, with interface as secondary concern.
185
186---
187
188## Learnings & Quirks
189
190### Part Number Patterns
191- `24xx` = I2C interface, `25xx` = SPI interface
192- `C` often indicates CMOS
193- Capacity in Kbits: 256 = 32KB, 512 = 64KB, 1024 = 128KB
194
195### Revision Suffixes
196- `JV`, `FW`, `JW` on Winbond = package/voltage variants
197- `A`, `B`, `C` suffixes = revisions (usually compatible)
198
199### Voltage Compatibility
200- Standard: 2.7V-5.5V
201- Low voltage: 1.7V-3.6V (check compatibility)
202
203<!-- Add new learnings above this line -->