Guest User

render.py

a guest
Jan 21st, 2025
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.25 KB | None | 0 0
  1. # imaging technique:
  2. # ion beam voltage contrast charges the word lines, causing vias to programmed bit
  3. # cells to light up (word line shorted to bit line via blown portion of split gate)
  4. #
  5. # note that two bit cells share a contact (via, aka bit line), so we are actually
  6. # seeing the OR combination of two adjacent bits on the same bit line
  7. # they are activated by their separate word lines. for example:
  8. # one row of bits in a bit plane:
  9. # 'o' represents contact visible in SEM images
  10. # '=' represents two word lines running on either side of each contact
  11. #                                      central spine -> ||
  12. # BL -> 28 29 30 31 27 26 25 24 20 21 22 23 19 18 17 16 || 12 13 14 15 11 10 09 08 04 05 06 07 03 02 01 00
  13. # WL0,1 =o==o==o==o==o==o==o==o==o==o==o==o==o==o==o==o || o==o==o==o==o==o==o==o==o==o==o==o==o==o==o==o=
  14. # so each contact represents the 'OR' combination of these bits:
  15. # OR:   28 29 30 31 27 26 25 24 20 21 22 23 19 18 17 16    12 13 14 15 11 10 09 08 04 05 06 07 03 02 01 00
  16. # OR:   61 62 63 64 60 59 58 57 52 53 54 55 51 50 49 48    44 45 46 47 43 42 41 40 36 37 38 39 35 34 33 32
  17. from operator import indexOf
  18.  
  19.  
  20. # logically 4096 rows across 24 bit planes
  21. # pages are 64 bits - corresponds to 1 row in a bitplane, 2 word lines
  22. #                                (see pvc-test8-annotated-mirrors.png)
  23. # each bitplane is 128 rows x 32 columns
  24. # column == bit line
  25.  
  26.  
  27. # map to physical layout and display
  28. def render(title, otp_words, wordline_seq, bitplane_seq, bitline_seq, ored=False):
  29.     on  = 'o'
  30.     off = '.'
  31.     #on  = '⬢'
  32.     #off = '⬡'
  33.     center_spine_gap = ' ' * 33
  34.     bitplane_gap = ' ' * 4
  35.     if ored:
  36.         print(f"{title} (adjacent wordlines OR'd together):")
  37.         wordline_seq = [(wordline_seq[i],wordline_seq[i+1]) for i in range(0,len(wordline_seq),2)]
  38.     else:
  39.         print(f"{title}:")
  40.  
  41.     # generate header with bitplane numbers
  42.     print('   bp: ', end='')
  43.     for BP in bitplane_seq:
  44.         if BP == ' ':
  45.             print(center_spine_gap, end='')
  46.             continue
  47.         print(str(BP).center(33), end=bitplane_gap)
  48.     print()
  49.  
  50.     # generate header with bitline numbers
  51.     bl_hex_h = ''
  52.     bl_hex_l = ''
  53.     for BP in bitplane_seq:
  54.         if BP == ' ':
  55.             bl_hex_h += center_spine_gap
  56.             bl_hex_l += center_spine_gap
  57.             continue
  58.         for BL in bitline_seq[BP]:
  59.             if BL == ' ':
  60.                 bl_hex_h += ' '
  61.                 bl_hex_l += ' '
  62.                 continue
  63.             bl_hex = f'{BL:02x}'
  64.             bl_hex_h += bl_hex[0]
  65.             bl_hex_l += bl_hex[1]
  66.         bl_hex_h += bitplane_gap
  67.         bl_hex_l += bitplane_gap
  68.     print(f'bl(h): {bl_hex_h}')
  69.     print(f'bl(l): {bl_hex_l}')
  70.  
  71.     # generate the array
  72.     for WL in wordline_seq:
  73.         if ored:
  74.             print(f'{WL[0]:02x}|{WL[1]:02x}: ', end='')
  75.         else:
  76.             print(f'   {WL:02x}: ', end='')
  77.         for BP in bitplane_seq:
  78.             if BP == ' ':
  79.                 print(center_spine_gap, end='')
  80.                 continue
  81.             for BL in bitline_seq[BP]:
  82.                 if BL == ' ':
  83.                     print(' ', end='')
  84.                     continue
  85.                 if ored:
  86.                     bv = 0
  87.                     for _WL in WL:
  88.                         WL_offset = _WL * 32
  89.                         bv |= otp_words[BP][WL_offset + BL]
  90.                 else:
  91.                     WL_offset = WL * 32
  92.                     bv = otp_words[BP][WL_offset + BL]
  93.                 c = on if bv == 1 else off
  94.                 print(c, end='')
  95.             print(bitplane_gap, end='')
  96.         print()
  97.     print()
  98.     print("-" * 16)
  99.     print()
  100.  
  101.  
  102. # hypothesized bit plane ordering from left to right (see fuses-angle-small-hypaddr.jpg):
  103. bitplanes = [16,17,18,19,20,21,22,23, 0, 1, 2, 3,' ', 4, 5, 6, 7, 8, 9,10,11,12,13,14,15]
  104. # hypothesized bit line ordering (relative to the word line offset)
  105. bitlines = [28,29,30,31,27,26,25,24,20,21,22,23,19,18,17,16,' ',12,13,14,15,11,10, 9, 8, 4, 5, 6, 7, 3, 2, 1, 0]
  106. # hypothesized word line ordering (top to bottom):
  107. wordlines = list(range(64,128)) + list(reversed(range(64)))
  108.  
  109. # all the bitlines, indexed by bitplane number
  110. all_bitlines = {}
  111. for i in range(24):
  112.     if bitplanes.index(i) < 12:
  113.         all_bitlines[i] = bitlines
  114.     else:
  115.         all_bitlines[i] = list(reversed(bitlines))
  116.  
  117. words = []
  118. #with open('../../otp_get_after_fuses_blown_justvalues.txt', 'r') as fh:
  119. with open('../../desired_render_words.txt', 'r') as fh:
  120.     for line in fh:
  121.         word = int(line, 16)
  122.         words.append(word)
  123.         #print(bin(word))
  124.  
  125. print(f"Loaded {len(words)} words from file")
  126. assert(len(words) == 4096)
  127.  
  128. otp = []
  129. # fill in the bitplane values as otp[bitplane] = ...bits...
  130. # note these are in logical order
  131. for bitplane in range(24):
  132.     otp.append([])
  133.     for bit in range(4096):
  134.         word = words[bit]
  135.         bit_value = 1 if word & (1 << bitplane) != 0 else 0
  136.         otp[bitplane].append(bit_value)
  137.     #print(otp[bitplane])
  138.  
  139.  
  140. render("even wordlines", otp, wordlines[::2], bitplanes, all_bitlines, ored=False)
  141. render("odd wordlines", otp, wordlines[1::2], bitplanes, all_bitlines, ored=False)
  142. render("full map", otp, wordlines, bitplanes, all_bitlines, ored=True)
  143.  
  144. #eof
  145.  
Advertisement
Add Comment
Please, Sign In to add comment