diff options
author | Pavel V. Shatov (Meister) <meisterpaul1@yandex.ru> | 2020-09-23 15:02:28 +0300 |
---|---|---|
committer | Pavel V. Shatov (Meister) <meisterpaul1@yandex.ru> | 2020-09-23 15:02:28 +0300 |
commit | 6010cb79da1b58fc5a71806273bb789840dc106b (patch) | |
tree | 6b48c856b4142542a9241131be55bcd0f7fd7908 /helper/convert-artix7.py | |
parent | 1144e0d0f546c6d76d58d7b2ae75bf27374272d7 (diff) |
Turns out multi-part components were not fully converted and were not
recognized properly during forward annotation. Had to do a couple of
experiments to figure out how KiCAD handles this and then write some quick and
dirty scripts to repair the multi-part symbols (STM32, Artix-7 and the 74_244
logic buffer were affected).
Diffstat (limited to 'helper/convert-artix7.py')
-rw-r--r-- | helper/convert-artix7.py | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/helper/convert-artix7.py b/helper/convert-artix7.py new file mode 100644 index 0000000..5a4871a --- /dev/null +++ b/helper/convert-artix7.py @@ -0,0 +1,71 @@ +print('DEF XC7A200TFBG484 IC 0 40 Y Y 17 F N') +print('F0 "U" -410 -910 60 H V L BNN') +print('F1 "" 0 0 60 H V C CNN') +print('F2 "" 0 0 60 H V C CNN') +print('F3 "" 0 0 60 H V C CNN') +print('DRAW') + +def print_rec(r): + for i in range(len(r)): + ri = r[i] + if i > 0: print(' ', end='') + print(ri, end='') + + print("\n", end='') + +SKIP_REC_TYPES = ['#', 'F0', 'F1', 'F2', 'F3', 'DRAW', 'ENDDRAW', 'ENDDEF'] + +with open('artix7.old', 'r') as f_rd: + f_rd_lines = f_rd.readlines() + + for f_rd_line in f_rd_lines: + rd_line = f_rd_line.strip() + + #if rd_line.startswith('#'): continue + #if rd_line.startswith('DEF '): continue + #if rd_line.startswith('ENDDEF'): continue + #if rd_line.startswith('DRAW'): continue + #if rd_line.startswith('ENDDRAW'): continue + + rec = rd_line.split(' ') + rec_type = rec[0] + + # + # DEF + # + if rec_type == "DEF": + unit = rec[1].split('_')[1] + continue + + # + # T + # + if rec_type == "T": + rec[6] = unit + print_rec(rec) + continue + + # + # P + # + if rec_type == "P": + rec[2] = unit + print_rec(rec) + continue + + # + # X + # + if rec_type == "X": + rec[-3] = unit + print_rec(rec) + continue + + if rec_type in SKIP_REC_TYPES: continue + else: raise RuntimeError("rec_type == '%s'" % rec_type) + + print(rd_line) + + +print('ENDDRAW') +print('ENDDEF') |