-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEDml2TikZ.il
1984 lines (1723 loc) · 59.6 KB
/
EDml2TikZ.il
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*=============================================================================*
*
* EDml2TikZ
*
* Purpose: maskLayout to tikzpicture converter
*
* Author: Matthias Schweikardt
* Email: [email protected]
*
* Lint: IQ score is 100 (best is 100)
* {sklint ?file "EDml2TikZ.il"}
*
* Globals:
* - Symbols:
* o EDml2TikZ
* - Forms and Fields:
* o EDml2TikZLayoutForm
* - Functions:
* o EDml2TikZ
*
* Revision: 2019-03-29 Created
* 2019-04-16 Added GUI
* 2019-06-05 Added margin
* 2019-12-24 refractured/output dir by user/bBox
* 2022-08-06 Use advanced boolean engine
* 2022-09-25 Add layout menu items to separate file
* 2023-03-26 Improved comments
* 2023-06-11 Bugfix seperate layers
*
* Copyright 2023, Reutlingen University, Electronics & Drives
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*=============================================================================*/
;FUNCTION
; EDml2TikZ
;
;Description: see README.md
;
(defun
EDml2TikZ
(
@key
(oCellView (geGetWindowCellView))
(sOutDir "./")
(sLayersLatexFile nil)
(sLatexCompiler "pdflatex")
(nGridSize 1.0)
(bDebug nil)
(bAbe t)
(xParallelABEruns 1)
(xShapesPerFile 1000)
(xLevels 32)
(bSplitLayers nil)
(bBox nil)
(bMake t)
(nMargin 0)
(bGraphicalMode nil)
)
(let (dpl)
xParallelABEruns ; for lint
(unless (dplp EDml2TikZ.dpl)
(putpropq (quote EDml2TikZ) (list nil) dpl)
);unless
; The whole data of the tool is stored in the disembodied property list dpl.
; This dpl is stored in the property list of the symbol 'EDml2TikZ'.
; The dpl can be retrieved by'EDml2TikZ.dpl'.
; The structure of the dpl is shown below:
;
; dpl
; |
; +view fields and forms are described below
; | |
; | +forms
; | | |
; | | +outDirFileSelectorField (1.1)
; | | |
; | | +latexFileFileSelectorField (1.2)
; | | |
; | | +levelsIntField (1.3)
; | | |
; | | +gridSizeFloatForm (1.4)
; | | |
; | | +marginFloatForm (1.5)
; | | |
; | | +latexCompilerStringField (1.6)
; | | |
; | | +abeBooleanButton (1.7)
; | | |
; | | +parallelABEruns (1.8)
; | | |
; | | +shapesPerFileIntField (1.9)
; | | |
; | | +openWithStringField (1.10)
; | | |
; | | +splitLayerBooleanButton (1.11)
; | | |
; | | +makeBooleanButton (1.12)
; | | |
; | | +debugBooleanButton (1.13)
; | | |
; | | +EDml2TikZFormLayout (1)
; | |
; | +callbacks
; | |
; | +fExecuteMl2TikZ
; |
; +temp
; | |
; | +sStartTime string, time stamp when the tool os started
; |
; +model
; | |
; | +cv db-obj, cellview database object of the
; | | layout to be exported
; | |
; | +sLayersLatexFile string, path to the LaTeX file where all
; | | layers are defined
; | |
; | +sOutDir string, path to the output directory
; | |
; | +bAbe bool, indicated if the Advanced Boolean
; | | Engine (ABE) is used
; | |
; | +xParallelABEruns int, number of parallel ABE runs
; | |
; | +xLevels int, number of levels of hierarchy through
; | | which the layout is exported
; | |
; | +xShapesPerFile int, max- number of shapes that are
; | | exported to a *.tex* file
; | |
; | +sLatexCompiler string, name of the LaTeX compiler
; | |
; | +bMake bool, execute *make* after export
; | |
; | +bDebug bool, enable debug mode, i.e., the
; | | intermediate cellviews are not
; | | deleted after export
; | |
; | +nGridSize float, grid size in cm in the *.tex* file
; | |
; | +bSplitLayers bool, split the layers in different *.tex*
; | | files
; | |
; | +nMargin float, margin between the layout and the
; | | border of the resulting PDF
; | |
; | +bBox list, bounding box of the layout to be exported
; | |
; | +oFlattenCellView db-obj, cellview database object of the
; | | flattened layout
; | |
; | +oCombinedCellView db-obj, cellview database object of the
; | | combined layout
; | |
; | +lLayers list, list of layers to be exported
; | |
; | +xNumOfShapes int, shape counter
; | |
; | |
; | | lambda functions are explained below
; | +fCheckInout
; | |
; | +fWriteTikZwithABE
; | |
; | +fWriteTikZ
; | |
; | +fReadInLayersLatexFile
(setq dpl EDml2TikZ.dpl)
(unless dpl->model
dpl->model = (list nil)
;LAMBDA FUNCTION
; fReadInLayersLatexFile
;
;Description:
; Read all layers to be exported from a *.tex* file
;
;Parameters:
; dpl dpl, disembodied property list of the tool
;
;Return:
; lLayers list, list of layers
;
(putpropq
dpl->model
(lambda (dpl)
(let (s pPort)
dpl->model->lLayers = nil
(when
(and
(stringp dpl->model->sLayersLatexFile)
(isFile dpl->model->sLayersLatexFile)
(isReadable dpl->model->sLayersLatexFile)
);and
(putpropq
dpl->model
(car (last (parseString dpl->model->sLayersLatexFile "/")))
sLayersLatexFileName
);putpropq
(setq pPort (infile dpl->model->sLayersLatexFile))
(while (gets s pPort)
(rexCompile "[ ]*\\tikzstyle{[ ]*\\([\\|a-zA-Z_0-9]*\\)[ ]*}.*")
(when
(and
(rexExecute s)
(equal (length (parseString (rexSubstitute "\\1") "|")) 2)
);and
(putpropq
dpl->model
(cons
(parseString (rexSubstitute "\\1") "|")
dpl->model->lLayers
);cons
lLayers
);putpropq
);when
);while
(putpropq
dpl->model
(reverse dpl->model->lLayers)
lLayers
);putpropq
);when
dpl->model->lLayers
);let
);lambda
fReadInLayersLatexFile
);putpropq
;LAMBDA FUNCTION
; fWriteTikZ
;
;Description:
; Export the layout as TikZ
;
;Parameters:
; dpl dpl, disembodied property list of the tool
;
;Return:
; sOutDir string, path to output directory
;
(putpropq
dpl->model
(lambda (dpl)
(let
( ;local parameters
sStartPhrase
sEndPhrase
sBoundingBox
lShapes
(port nil)
tikzFileName
(i 0)
(shapeCount 0)
(filesToCompile nil)
(filesPerLayer nil)
(filesForToplevel nil)
(numOfChar 0)
(maxNumOfCharPerLine 72)
str
)
;oFlattenCellView
(putpropq
dpl->model
(dbOpenCellViewByType
dpl->model->cv~>libName
dpl->model->cv~>cellName
(strcat
dpl->model->cv~>viewName
"_flatten_"
dpl->temp->sStartTime
);strcat
"maskLayout"
"w"
);dbOpenCellViewByType
oFlattenCellView
);putpropq
;oCombinedCellView
(putpropq
dpl->model
(dbOpenCellViewByType
dpl->model->cv~>libName
dpl->model->cv~>cellName
(strcat
dpl->model->cv~>viewName
"_combined_"
dpl->temp->sStartTime
);strcat
"maskLayout"
"w"
);dbOpenCellViewByType
oCombinedCellView
);putpropq
(leFlattenInst
(dbCreateInst
dpl->model->oFlattenCellView
dpl->model->cv
"I0"
0:0
"R0"
);dbCreateInst
/* x_levels */ dpl->model->xLevels
/* g_flattenPCells */ t
/* g_preservePins */ nil
/* g_preserveRODobjs */ nil
/* g_delDetachedBlockages */ nil
/* g_preservePinFigs */ t
/* g_flattenVias */ t
);leFlattenInst
(foreach lLayer dpl->model->lLayers
(dbLayerOr
dpl->model->oCombinedCellView
lLayer
(setof
x
dpl->model->oFlattenCellView~>shapes
(and
(equal x~>lpp lLayer)
(nequal x~>objType "ellipse")
);and
);setof
);dbLayerOr
);foreach
(foreach lLayer dpl->model->lLayers
(foreach
ellipse
(setof
x
dpl->model->oFlattenCellView~>shapes
(and
(equal x~>lpp lLayer)
(equal x~>objType "ellipse")
);and
);setof
(dbCopyShape ellipse dpl->model->oCombinedCellView)
);foreach
);foreach
dpl->model->xNumOfShapes = 0
(foreach lLayer dpl->model->lLayers
(putpropq
dpl->model
(plus
dpl->model->xNumOfShapes
(length
(setof
x
dpl->model->oFlattenCellView~>shapes
(equal x~>lpp lLayer)
);setof
);length
);plus
xNumOfShapes
);putpropq
);foreach
(when
(and
(greaterp
dpl->model->xNumOfShapes
dpl->model->xShapesPerFile
);greaterp
(not dpl->model->bSplitLayers)
);and
(putpropq
dpl->model
(ceiling
(quotient
dpl->model->xNumOfShapes
(ceiling
(times
1.0
(quotient
dpl->model->xNumOfShapes
dpl->model->xShapesPerFile
);quotient
);times
);ceiling
);quotient
);ceiling
xShapesPerFile
);putpropq
);when
(dbSave dpl->model->oFlattenCellView)
(dbSave dpl->model->oCombinedCellView)
(createDir dpl->model->sOutDir)
(shell
(strcat
"cp "
dpl->model->sLayersLatexFile
" "
dpl->model->sOutDir
dpl->model->sLayersLatexFileName
);strcat
);shell
(setq
sStartPhrase
(strcat
"\\documentclass{standalone}\n"
"\\usepackage{tikz}\n"
"\\usepackage{graphicx}\n"
"\\input{" dpl->model->sLayersLatexFileName "}\n"
"\\begin{document}\n"
"\\begin{tikzpicture}[x="
(lsprintf "%L" dpl->model->nGridSize)
"cm,y="
(lsprintf "%L" dpl->model->nGridSize)
"cm]\n"
);strcat
);setq
(setq
sBoundingBox
(lsprintf
"\\useasboundingbox (%L,%L) rectangle (%L,%L);\n"
(if dpl->model->bBox
(xCoord (lowerLeft dpl->model->bBox))
(difference
(xCoord (lowerLeft dpl->model->oCombinedCellView~>bBox))
(plus dpl->model->nMargin 0.01)
);difference
);if
(if dpl->model->bBox
(yCoord (lowerLeft dpl->model->bBox))
(difference
(yCoord (lowerLeft dpl->model->oCombinedCellView~>bBox))
(plus dpl->model->nMargin 0.01)
);difference
);if
(if dpl->model->bBox
(xCoord (upperRight dpl->model->bBox))
(plus
(xCoord (upperRight dpl->model->oCombinedCellView~>bBox))
(plus dpl->model->nMargin 0.01)
);plus
);if
(if dpl->model->bBox
(yCoord (upperRight dpl->model->bBox))
(plus
(yCoord (upperRight dpl->model->oCombinedCellView~>bBox))
(plus dpl->model->nMargin 0.01)
);plus
);if
);lsprintf
);setq
(setq sEndPhrase "\\end{tikzpicture}\n\\end{document}")
(foreach lLayer dpl->model->lLayers
(setq
lShapes
(setof
x
dpl->model->oCombinedCellView~>shapes
(equal x~>lpp lLayer)
);setof
);setq
(if dpl->model->bSplitLayers then
(if
(geqp
dpl->model->xShapesPerFile
(length lShapes)
);geqp
then
(setq
tikzFileName
(lsprintf "layout_%s_%s" (car lLayer) (cadr lLayer))
);setq
(setq i -1)
(setq
filesForToplevel
(cons tikzFileName filesForToplevel)
);setq
(setq
filesToCompile
(cons
tikzFileName
filesToCompile
);cons
);setq
else
(setq
tikzFileName
(lsprintf "%s_%s_0" (car lLayer) (cadr lLayer))
);setq
(setq i 0)
(setq
filesPerLayer
(cons tikzFileName filesPerLayer)
);setq
);if
(setq
port
(outfile (strcat dpl->model->sOutDir tikzFileName ".tex"))
);setq
(fprintf port "%s%s" sStartPhrase sBoundingBox)
else
(unless (portp port)
(if
(leqp
dpl->model->xNumOfShapes
dpl->model->xShapesPerFile
);leqp
then
(setq
tikzFileName
(lsprintf
"%s_%s_%s"
dpl->model->cv~>libName
dpl->model->cv~>cellName
dpl->model->cv~>viewName
);lsprintf
);setq
else
(setq tikzFileName "0")
(setq
filesForToplevel
(cons tikzFileName filesForToplevel)
);setq
);if
(setq filesToCompile (cons tikzFileName filesToCompile))
(setq
port
(outfile (strcat dpl->model->sOutDir tikzFileName ".tex"))
);setq
(fprintf port "%s%s" sStartPhrase sBoundingBox)
);unless
);if
(foreach shape lShapes
(when (equal shape~>objType "rect")
(fprintf
port
"\\draw[%s|%s] (%L,%L) rectangle (%L,%L);\n"
(car lLayer)
(cadr lLayer)
(xCoord (lowerLeft shape~>bBox))
(yCoord (lowerLeft shape~>bBox))
(xCoord (upperRight shape~>bBox))
(yCoord (upperRight shape~>bBox))
);fprintf
);when
(when (equal shape~>objType "polygon")
(setq
str
(lsprintf
"\\draw[%s|%s] (%L,%L)"
(car lLayer)
(cadr lLayer)
(xCoord (car shape~>points))
(yCoord (car shape~>points))
);lsprintf
);setq
(setq numOfChar (strlen str))
(fprintf port str)
(foreach lPoint (cdr shape~>points)
(setq
str
(lsprintf
" -- (%L,%L)"
(xCoord lPoint)
(yCoord lPoint)
);lsprintf
);setq
(setq numOfChar (plus numOfChar (strlen str)))
(when (greaterp numOfChar maxNumOfCharPerLine)
(fprintf port "\n\t")
(setq numOfChar (plus 2 (strlen str)))
);when
(fprintf port str)
);foreach
(fprintf port " -- cycle;\n")
);when
(when (equal shape~>objType "ellipse")
(fprintf
port
"\\draw[%s|%s] (%L,%L) circle [x radius=%L, y radius=%L];\n"
(car lLayer)
(cadr lLayer)
(xCoord (centerBox shape~>bBox))
(yCoord (centerBox shape~>bBox))
(quotient
(difference
(rightEdge shape~>bBox)
(leftEdge shape~>bBox)
);difference
2.0
);quotient
(quotient
(difference
(topEdge shape~>bBox)
(bottomEdge shape~>bBox)
);difference
2.0
);quotient
);fprintf
);when
(preincrement shapeCount)
(when (geqp shapeCount dpl->model->xShapesPerFile)
(fprintf port "%s" sEndPhrase)
(close port)
(if dpl->model->bSplitLayers then
(setq
tikzFileName
(lsprintf
"%s_%s_%L"
(car lLayer)
(cadr lLayer)
(preincrement i)
);lsprintf
);setq
(setq filesPerLayer (cons tikzFileName filesPerLayer))
else
(setq tikzFileName (lsprintf "%L" (preincrement i)))
(setq
filesForToplevel
(cons tikzFileName filesForToplevel)
);setq
(setq filesToCompile (cons tikzFileName filesToCompile))
);if
(setq
port
(outfile (strcat dpl->model->sOutDir tikzFileName ".tex"))
);setq
(fprintf port "%s%s" sStartPhrase sBoundingBox)
(setq shapeCount 0)
);when
);foreach
(when dpl->model->bSplitLayers
(fprintf port "%s" sEndPhrase)
(close port)
(when (geqp i 0)
(setq
tikzFileName
(lsprintf "layout_%s_%s" (car lLayer) (cadr lLayer))
);setq
(setq
port
(outfile (strcat dpl->model->sOutDir tikzFileName ".tex"))
);setq
(fprintf port "%s" sStartPhrase)
(setq
filesToCompile
(cons
(append
(list tikzFileName)
(reverse filesPerLayer)
);append
filesToCompile
);cons
);setq
(foreach fileName (reverse filesPerLayer)
(fprintf
port
"\\node at (0,0) {\\includegraphics{%s.pdf}};\n"
fileName
);fprintf
);foreach
(fprintf port "%s" sEndPhrase)
(close port)
(setq
filesForToplevel
(cons tikzFileName filesForToplevel)
);setq
(setq filesPerLayer nil)
(setq i 0)
(setq shapeCount 0)
);when
);when
);foreach
(unless dpl->model->bSplitLayers
(fprintf port "%s" sEndPhrase)
(close port)
);unless
(when filesForToplevel
(setq
tikzFileName
(lsprintf
"%s_%s_%s"
dpl->model->cv~>libName
dpl->model->cv~>cellName
dpl->model->cv~>viewName
);lsprintf
);setq
(setq
port
(outfile (strcat dpl->model->sOutDir tikzFileName ".tex"))
);setq
(fprintf port "%s" sStartPhrase)
(setq filesToCompile (cons tikzFileName filesToCompile))
(foreach sFileName (reverse filesForToplevel)
(fprintf
port
"\\node at (0,0) {\\includegraphics{%s.pdf}};\n"
sFileName
);fprintf
);foreach
(fprintf port "%s" sEndPhrase)
(close port)
);when
(setq port (outfile (strcat dpl->model->sOutDir "Makefile")))
(fprintf port "LATEXCOMPILER=%s\n" dpl->model->sLatexCompiler)
(fprintf port "\n")
(fprintf port "\nall:")
(foreach file (reverse (cdr filesToCompile))
(if (listp file)
(fprintf port " %s.pdf" (car file))
(fprintf port " %s.pdf" file)
);if
);foreach
(fprintf port "\n\t${LATEXCOMPILER} %s.tex\n" (car filesToCompile))
(foreach file (reverse (cdr filesToCompile))
(if (listp file) then
(fprintf port "\n%s.pdf:" (car file))
(foreach item (cdr file)
(fprintf port " %s.pdf" item)
);foreach
(fprintf port "\n\t${LATEXCOMPILER} %s.tex" (car file))
(fprintf port "\n")
(foreach item (cdr file)
(fprintf port "\n%s.pdf:" item)
(fprintf port "\n\t${LATEXCOMPILER} %s.tex" item)
(fprintf port "\n")
);foreach
else
(fprintf port "\n%s.pdf:" file)
(fprintf port "\n\t${LATEXCOMPILER} %s.tex" file)
(fprintf port "\n")
);if
);foreach
(close port)
(when dpl->model->bMake
(shell (strcat "cd " dpl->model->sOutDir "\n" "make"))
);when
(let (dFlattenCellView dCombinedCellView)
(setq
dFlattenCellView
(ddGetObj
dpl->model->oFlattenCellView~>libName
dpl->model->oFlattenCellView~>cellName
dpl->model->oFlattenCellView~>viewName
);ddGetObj
);setq
(setq
dCombinedCellView
(ddGetObj
dpl->model->oCombinedCellView~>libName
dpl->model->oCombinedCellView~>cellName
dpl->model->oCombinedCellView~>viewName
);ddGetObj
);setq
(dbClose dpl->model->oFlattenCellView)
(dbClose dpl->model->oCombinedCellView)
(unless dpl->model->bDebug
(ddDeleteObj dFlattenCellView)
(ddDeleteObj dCombinedCellView)
);unless
);let
dpl->model->sOutDir
);let
);lambda
fWriteTikZ
);putpropq
;LAMBDA FUNCTION
; fWriteTikZwithABE
;
;Description:
; Export the layout as TikZ using ABE
;
;Parameters:
; dpl dpl, disembodied property list of the tool
;
;Return:
; sOutDir string, path to output directory
;
(putpropq
dpl->model
(lambda (dpl)
(let
( ;local parameters
sStartPhrase
sEndPhrase
sBoundingBox
(port nil)
tikzFileName
(i 0)
(shapeCount 0)
(filesToCompile nil)
(filesPerLayer nil)
(filesForToplevel nil)
(numOfChar 0)
(maxNumOfCharPerLine 72)
str
tileIter
abeLayers
shape
)
(abeInit
dpl->model->cv
?doInterrupts t
?threads dpl->model->xParallelABEruns
);abeInit
(setq
abeLayers
(foreach mapcar layer dpl->model->lLayers
(list
layer
(abeLayerMergeTiles
(abeLayerFromCellView
(car layer)
?purpose (cadr layer)
?startLevel 0
?stopLevel dpl->model->xLevels
);abeLayerFromCellView
"horizontal"
?queue t
);abeLayerMergeTiles
);list
);foreach
);setq
(abeRunQueue)
;count all shapes
(putpropq
dpl->model
(apply
(quote plus)
(foreach mapcar abeLayer abeLayers
(getq (cadr abeLayer) numTiles)
);foreach
);apply
xNumOfShapes
);putpropq
;calculate shapes per file
(when
(and
(greaterp
dpl->model->xNumOfShapes
dpl->model->xShapesPerFile
);greaterp
(not dpl->model->bSplitLayers)
);and
(putpropq
dpl->model
(ceiling
(quotient
dpl->model->xNumOfShapes
(ceiling
(times
1.0
(quotient
dpl->model->xNumOfShapes
dpl->model->xShapesPerFile
);quotient
);times
);ceiling
);quotient
);ceiling
xShapesPerFile
);putpropq
);when
(createDir dpl->model->sOutDir)
(shell
(strcat