File: programmers.tex

package info (click to toggle)
savant 1.02.1-1
  • links: PTS
  • area: main
  • in suites: potato, woody
  • size: 9,076 kB
  • ctags: 8,973
  • sloc: cpp: 70,113; sh: 1,792; makefile: 157
file content (2377 lines) | stat: -rw-r--r-- 61,799 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377

\documentclass[11pt]{report}

\usepackage{alltt,color,fullpage,psfig}

\newcommand{\version}{1.0}

\begin{document}

\title{
\textbf{SAVANT Programmer's Manual} \\
(Documentation for version \version)}

\author{
\emph{Dale E. Martin} and \emph{Philip A. Wilsey} \\
Computer Architecture Design Laboratory \\
Dept of ECECS, PO Box 210030 \\
Cincinnati, OH  45221--0030 \\
\texttt{savant@ececs.uc.edu}
}

\date{}

\maketitle

\vspace*{6in}

\noindent
Copyright \copyright 1995-1999 The University of Cincinnati.  All
rights reserved. 

\bigskip

\noindent
Published by the University of Cincinnati \\
Dept of ECECS, PO Box 210030 \\
Cincinnati, OH  45221--0030 USA 

\bigskip

\noindent
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.

\medskip
\noindent
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.

\medskip
\noindent
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions.

\newpage

\tableofcontents

\chapter{Introduction}

SCRAM is a VHDL analyzer and extensible environment for CAD tool
backend development.  VHDL descriptions are analyzed and stored in the
SAVANT intermediate form (IF), which is comptaible with the Advanced
Intermediate Representation with Extensibility (AIRE).  Provisions to
support the insertion of backend CAD tools have been provided.  More
precisely, a technique for structuring and instantiating the nodes of
the IF built by SCRAM has been developed that allows the CAD tool
builder to easily insert additional capabilities into the IF
structure.  The specific technique is described in the following
section.  The effect is the construction of an extensible class
structure for the SAVANT IF as outlined in the SAVANT Overview
document.

The SCRAM parser is constructed as an LL(2) grammar using the Purdue
Compiler Construction Tool Set (PCCTS) parser generator (many thanks
to Terence Parr, Hank Dietz, Will Cohen, and to Tom Moog who has
continued improving PCCTS 1.33).  PCCTS is available at
{\tt http://www.polhode.com/pccts133mr.html}.  SCRAM has been developed
in C++ using GNU's EGCS 1.1.1 compiler.  Effort has been made to
maintain compatibility with GNU's g++ 2.7.2 for the 1.0 release of
SAVANT - future versions of SAVANT most likely will use features found
only the the newer versions of the the GNU EGCS compilers, such as
exceptions and/or namespaces.

\chapter{Introduction}

\section{Introduction to SAVANT}

\begin{description}
  
\item[SAVANT?]  Standard Analyzer of VHDL Applications for Next-generation
  Technology.
  
\item[Who?]  MTL Systems and the University of Cincinnati.  Funding by
  Wright Labs, SBIR Phase II.
  
\item[What?]  Create a freely available, extensible VHDL Analyzer.
  Provided value added benefit and market.
  
\item[Why?]  Stimulate integration of VHDL technology into the CAD
  research community.

\end{description}

\newcommand{\Cpp}{C$^{_{++}}$}

\section{The Software Components of SAVANT}

\begin{description}
\item[SCRAM:] a VHDL analyzer
\item[Extensible classes:] to build intermediate forms for
    \begin{itemize}
    \item IIR from the AIRE spec

    \item FIR from the AIRE spec \footnote{FIR support has been
    suspended and the existing code removed from SAVANT due to an
    incomplete specification at the time that the implementation was
    being done.  FIR support could occur in the future if resources
    become available.  Patches of the existing FIR implentation which
    are no longer being maintained could be made to interested parties
    on request.}

    \end{itemize}
\item[Extension classes:] \
    \begin{itemize}
    \item transmute: eliminating redundant structures in the IIR
    \item publisher: outputting VHDL and \Cpp\footnotemark
    \item archiver: extensions to read/write FIR files to/from IIR trees
    \end{itemize}
\end{description}


\footnotetext{The development of the \Cpp output is sponsored by DARPA.}

\section{Software Availability}

\begin{itemize}
\item Copyrighted by the University of Cincinnati
\item Freely Redistributable under the terms of the GNU Public Library License. (LGPL)
\end{itemize}

\section{The Intermediate Forms}

\noindent
\textbf{AIRE:} Advanced Intermediate Representation with Extensibility

\begin{enumerate}
\item Formats:
    \begin{description} \item[IIR:] in-memory intermediate
    representation \item[FIR:] file intermediate representation
    \end{description}

\item
Jointly developed by:
\begin{small}
\begin{itemize}
\item University of Adelaide (Australia)
\item DA Solutions Ltd (UK)
\item FTL Systems, Inc. (USA)
\item MTL Systems, Inc. (USA)
\item University of Cincinnati (USA)
\end{itemize}
\end{small}

\end{enumerate}

\newpage

\noindent

\begin{minipage}{6in}
\psfig{file=uc-projects.ps,angle=270,width=6in,silent=}
\noindent
\begin{scriptsize}
\copyright 1995-1999 The University of Cincinnati.  Reprinted with permission.
\end{scriptsize}
\end{minipage}

\section{AIRE: Current Status}

\begin{itemize}
\item IIR:
    \begin{itemize}
    \item Draft design complete
    \item Implementations by UC, FTL, and other parties
    \item Extensible object-oriented design
    \end{itemize}
\item FIR:
    \begin{itemize}
    \item Draft design in progress
    \item Implementations under-development
    \item Extensible object-oriented design
    \end{itemize}
\item EIA standardization in progress
\end{itemize}


\section{SCRAM: Current Status}

\begin{itemize}
\item LL(2) grammar
\item Flex lexer, ANTLR (from PCCTS) parser generator
\item Parsing: complete language coverage
\item IIR node construction: complete
\item Type checking: implemented, tested and validated
\item Overloaded name resolution implemented
\end{itemize}


\section{SAVANT Implementation of AIRE: Current Status}

\begin{itemize}
\item IIR implementation complete
\item FIR implementation suspended
\end{itemize}


\section{Extensibility in SAVANT}

\begin{itemize}
\item Achieved by user added derived classes to IIR/FIR
\item Allow addition of data and methods to all AIRE classes
\item Provide user full benefits of object-oriented programming
\end{itemize}


\section{Class Relationships Supporting Extensibility}

\psfig{file=savant-if.ps,angle=270,width=6.5in,silent=}


\section{Transmute: Current Status}

\begin{itemize}
\item Base rewriting are all implemented 
\item Operational on a node-by-node basis (integrated with publish)
\item Available for use by extension classes
\end{itemize}


\section{Record/Playback: Current Status}

\begin{itemize}
\item Initial implementation of FIR class nodes completed in 1998
\item Implementation suspended due to incomplete specification
\item Specification is reported to be complete, and if resources become available
it's possible that FIR support could be reintegrated
\item Library support in SAVANT currently accomplished through VHDL publishing and reparsing
\end{itemize}


\section{Publish: Current Status}

\begin{itemize}
\item VHDL regeneration complete
\item C++ for TyVIS operational and complete
\end{itemize}

\section{Auxiliary Support Tools}

\begin{itemize}
\item Flex: lexer generator
\item PCCTS: parser-generator
\item C++ compiler
\item Assorted unix tools, e.g., make
\end{itemize}


\section{Project Web Sites}

\begin{itemize}
\item {\tt http://www.ececs.uc.edu/}\verb+~+{\tt paw/savant/}
\end{itemize}


\section{Related Web Sites}

\begin{itemize}
\item {\tt http://www.ececs.uc.edu/}\verb+~+{\tt paw/aire/}
\item {\tt http://www.ececs.uc.edu/}\verb+~+{\tt paw/quest/}
\item {\tt http://www.ececs.uc.edu/}\verb+~+{\tt paw/tyvis/}
\item {\tt http://www.ececs.uc.edu/}\verb+~+{\tt paw/warped/}
\item {\tt http://www.ececs.uc.edu/}\verb+~+{\tt paw/rassp/}
\end{itemize}


\chapter{SAVANT INSTALLATION}

\section{Installation}

\begin{itemize}
\item Requirements
    \begin{itemize} \item Resources \item Tools \end{itemize}
\item Where to get it
\item Installation Procedure
\item Updating Your Distribution
    \begin{itemize}
    \item Via patches
    \item CVS import
    \end{itemize}
\end{itemize}


\section{Resource Requirements}

\begin{description}

\item \textbf{Approximate Disk Space Requirements} (for Linux and Solaris,
varies with OS and compiler)

    \begin{itemize} 
	\item 10M of Disk space for distributed source code or binaries 
	\item 70M of Disk space for compilation 
	\item 18M of Disk space for executable (with debug information) 
	\item 3M of Disk space for executable (without debug information)
    \end{itemize}

\item \textbf{Virtual Memory} 

    \begin{itemize}
    \item At least 40M of virtual memory (for compilation).
    \end{itemize}

\end{description}


\section{Tool Requirements}

\begin{description}
\item[tar] Gnu tar version 1.2 is known to work
\item[gunzip] Gnu gunzip version 1.2.4 is known to work
\item[Make] Gnu make version 3.77 is known to work
\item[Lexer] Flex version 2.5.4 is known to work
\item[Parser Generator] PCCTS version 1.33MR12b is known to work
\item[C++ compiler] A full featured C++ compiler is required.  Known to
work: 
    \begin{itemize}
    \item g++ version 2.7.2 (and later)
    \item EGCS g++ version 1.1.1
    \item Sunpro C++ version 4.1
    \item Digital Unix cxx C++ compiler
    \end{itemize}
\item[Operating System Environment] Unix.  Known to work:
    \begin{itemize}
    \item Linux versions 2.0 and 2.2
    \item Solaris 2.6
    \item Digital Unix
    \end{itemize}
\end{description}


\section{Where to get it}

\begin{description}
\item[SAVANT:] \
    \begin{itemize}
    \item Source code, Debian Linux packages, and Solaris 2.6 packages\\ {\tt ftp://ftp.ececs.uc.edu/pub/users/dmartin/}
    \item Debian Linux packages - {\tt ftp://ftp.debian.org}
    \end{itemize}
\item[GNU Tools:] Make, Flex, g++, gnu tar, gunzip, and cvs
    \begin{itemize}
    \item {\tt ftp://prep.ai.mit.edu/pub/gnu/}
    \item {\tt ftp://gatekeeper.dec.com:/pub/GNU/}
    \end{itemize}
\item[PCCTS:] \
    \begin{itemize}
    \item {\tt http://www.polhode.com/pccts133mr.html}
    \end{itemize}
\item[Linux:] \
    \begin{itemize}
    \item {\tt http://sunsite.unc.edu/pub/Linux/distributions/} or
    \item {\tt ftp://ftp.yggdrasil.com/mirrors/sunsite/INDEX.html} or
    \item {\tt ftp://ftp.debian.org/pub/debian}
    \end{itemize}
\end{description}


\section{Downloading/unpacking Tips}

\begin{itemize}
\item Always use \textbf{binary mode} when downloading files with ftp.

\item SAVANT is distributed in a \textbf{gzip}'ed \textbf{tar}file.

\item
To uncompress the gzip'ed file {\tt foo.gz}, type:
    \begin{description}
    \item {\tt gunzip foo.gz}
    \end{description}

\item 
To unarchive a tar'ed file {\tt foo.tar}, type:
    \begin{description}
    \item {\tt tar -xf foo.tar}
    \end{description}

\item 
To unarchive a gzip'ed tar file {\tt foo.tgz}, type:
    \begin{description}
    \item {\tt tar -xzf foo.tgz}
    \end{description}

\item 
Suffixes can be cumulative: a gzip'ed tar file may be named: \\
{\tt foo.tar.gz}, which is unpacked by
    \begin{description}
    \item {\tt gunzip foo.tar.gz}
    \item {\tt tar -xf foo.tar}
    \end{description}

\end{itemize}


\section{Unix Environment Variables}

\begin{itemize}

\item
Environment variables exist in the shell to pass information to
application programs.  

\item
SAVANT uses two environment variables ({\tt PCCTSROOT} and
{\tt SAVANTROOT}) to determine the location of header files and
libraries.  

\item
Depending on the shell you use, there are different methods for setting
environment variables.  See your shell documentation for details.

\end{itemize}


\section{Setting Environment Variables \\
\textrm{(For the shells: {\tt bash} and {\tt sh})}}

\begin{alltt}
set FOO=/home/john-doe
export FOO
\end{alltt}


\section{Setting Environment Variables \\
\textrm{(For the shells: {\tt csh} and {\tt tcsh})}}

\begin{alltt}
setenv FOO /home/john-doe
\end{alltt}


\section{SAVANT Environment Variables}

\begin{description}

\item[PCCTSROOT:] This variable specifies the location of the header
files included with {\tt pccts}.  Needed to compile SAVANT.

\item[SAVANTROOT:] This variable specifies the the top level directory
of the SAVANT distribution.  Needed to compile SAVANT.  Need for the
execution of SCRAM if not installed in a ``standard'' subdirectory,
such as {\tt /usr} or {\tt /usr/local}.

\end{description}


\section{Preparing SAVANT for compilation}

\begin{enumerate}

\item
Set the environment variables {\tt PCCTSROOT} and {\tt SAVANTROOT}.

\item
The SAVANT distribution is shipped with a configuration script to
generate a Makefile for your environment.  This script is named
{\tt configure} and is in the directory {\tt savant/src}.  To
configure the system, execute the following commands:

\begin{alltt}
cd savant/src
./configure
\end{alltt}

\end{enumerate}


\section{The {\tt configure} script}

\begin{itemize}

\item
The {\tt configure} script will generate two Makefiles -
{\tt Makefile} in the {\tt savant/src} directory and {\tt Makefile.common}
in the {\tt savant/lib} directory, from the files
{\tt Makefile.in} and {\tt Makefile.common.in} respectively.

\item
The script searches for a C++ compiler on your system.  If the
compiler you want to use is not in the list the script knows about, or
if it locates a compiler other than the one you want to use, you can
explicitly name a compiler in the environment variable
{\tt CXX}.  This variable only needs to be defined while the script
is running; it can be unset after the script has finished.

\end{itemize}


\section{Building Dependencies}
\noindent
To build the SAVANT system, the {\tt make} utility is used.
{\tt make} requires a list of dependencies to be generated into the file 
{\tt .depend}. To generate these dependencies, issue the following commands:

\begin{alltt}
cd savant/src
make depend
\end{alltt}

If only life was so simple.  The generation of dependencies has been
the main problem that users of SAVANT have asked the developers about.
Initially SAVANT's Makefiles were written to call {\tt makedepend}
which is actually part of the X Window system.  Eventually, the large
number of files in the intermediate caused the ``stock''
{\tt makedepend} to fail.  One solution to this problem is to
recompile {\tt makedepend} with some {\tt \#define}s increased -
see the file {\tt INSTALL} for details.  This isn't that simple to
do since the program includes many files from the X Windows source - a
full X source distribution is required.  The developers responded to
this problem by shipping binaries for the expanded {\tt makedepend}
for some common platforms with the source archive.  This solution
works if you're using a supported platform.  

Another approach is to use {\tt g++} to generate dependencies.  The
configure script looks for {\tt g++} specifically for this purpose
(even if you've specified another compiler in the {\tt CXX}
environment variable).  However, the developers have experienced
problems with this method - it appears that either {\tt make} or
{\tt g++} has a bug in it.

The file {\tt savant/lib/Makefile.common\{.in\}} defines a variable
{\tt MAKEDEPEND}.  The configure script sets it one of two ways:

\begin{itemize}

\item  {\tt MAKEDEPEND=-rm -f .depend; g++ -MM -MG \$(MDFLAGS) \$(CPPFLAGS)
\$(MAKEDEP\_SRCS) \\
> .depend } 

or

\item {\tt MAKEDEPEND=-rm -f .depend; ../bin/makedepend.\$host\_os -f- --
\$(MDFLAGS) \\ 
\$(CPPFLAGS) -- \$(MAKEDEP\_SRCS) > .depend }

\end{itemize}

In the second example shown above, {\tt \$host\_os} will be replaced
with the OS portion of the output from {\tt config.guess}.  For a
most Linux machines, for example, the full binary name would be
{\tt makedepend.linux-gnu}.  These examples are provided to allow
the reader to determine the best solution for dependency generation
available to them, and to provide them with the capability to insert
their own solution into the Makefile.

\section{Notes about Building Dependencies}

\begin{enumerate}

\item 
it's a good idea to build dependencies any time you run the {\tt
configure} script for the first time.

\item
anytime there is a change made to a source file in the SAVANT system
involving a {\tt \#include}, this procedure needs to be performed.

\end{enumerate}

\section{Compiling the system}

\noindent
To compile the system, issue the commands:

\begin{alltt}
cd savant/src
make
\end{alltt}

\chapter{CVS and SAVANT Updates}

\section{Source Code Control}

\noindent
Code control systems have many benefits for software developers.  CVS
is one example of such a system. Its features include:

\begin{itemize}
\item Support for Concurrent Software Development
\item A common Central Repository of the Software
\item Version Tags, Revision numbers, and Timestamps
\item Support for off-site Importing and Exporting of revised versions
\item Automatic Inclusion of Log Messages
\end{itemize}

\noindent
The SAVANT software developers use cvs in a very concurrent and
complex setting.  It works very well for them, and they'd recommend it
to anyone doing any type of software development, large or small.

\section{Coordinating with SAVANT Distributions}

\begin{itemize}
\item cvs supports the {\tt import}ing of revised versions from a
    remote site
\item \textbf{Recommendation:} users of SAVANT will benefit from using cvs
    to manage their software for integration (by cvs {\tt import}) with
    revisions to the SAVANT software
\item Alternatives to cvs do exist, but will not be explained here or in
    the SAVANT distributed software.
\end{itemize}


\section{Creating a CVS Archive} 

\noindent
If this is the first CVS archive you have ever set up, first you will need
to set up an archive directory.  The archive directory can be specified by
the environment variable {\tt CVSROOT}.  Assume that
{\tt my\_cvs\_archive} is to be the name of the the archive directory.
Then it's creation is achieved (in csh) by issuing the following commands:

\begin{alltt}
cd
mkdir my\_cvs\_archive
mkdir my\_cvs\_archive/CVSROOT
setenv CVSROOT my\_cvs\_archive
\end{alltt}



\section{Importing New Code into an Archive} 

\noindent
Importing your code for the first time.  For this example, our project
name is {\tt my\_project} and the initial revision of the code is in the
subdirectory {\tt work/src}.  We'll call our organization
{\tt savant\_geeks} and make this revision {\tt 1\_2}.

\begin{alltt}
cd work/src
cvs import my\_project savant\_geeks 1\_2
\end{alltt}

\begin{itemize}
\item cvs will invoke your default editor for entry of a log message
\item edit the buffer with the desired log message
\item save the buffer
\item exit the editor and the log message will be applied
\end{itemize}


\section{Explanation of the {\tt import} Command}

\noindent
The syntax for {\tt cvs import} is:

\begin{description}
\item {\tt cvs import [repository] [vendor-tag] [release-tags]}
\item where
    \begin{description}
    \item[repository] This is the name you want to give the project.
    There may be more than one repository per CVS archive, so they must be
    uniquely named.  Furthermore, when checking code out of the archive,
    it is placed in a directory with the same name as the repository.
    \item[vendor-tag] This simply names the authoring ``vendor''.
    \item[release-tags] This names any tags you would like to give the
    initial check-in.  Tags can be used later to retrieve specific revision
    of files.
    \end{description}
\end{description}



\section{Checking out a CVS module}

\noindent
After checking in the initial revision of your application, it is
important to check out a working copy from the archive.  This is done by
using the command 

\begin{description}
\item {\tt cvs checkout [module]}
\end{description}

\noindent
CVS will create a subdirectory with the same name as the module in the
current directory.  This is your working directory, and changes made to
the files in this directory do not affect the archive until they are
explicitly committed.

\section{Committing Changes to the Archive}

\noindent
Changes are committed to the archive using the command:

\begin{description}
\item {\tt cvs commit}
\end{description}

\noindent
The names of the files to commit may optionally follow the command.  If no
file names are given, CVS will recurse through all subdirectories, and
commit all files that have been modified since they were checked out of
the archive.

\noindent
\textbf{Notes:} 

\begin{enumerate}

\item
Each time files are committed to the archive your editor will be invoked
for a log message. 

\item
cvs commands operate implicitly on files in your current directory.

\end{enumerate}


\section{Adding Files to the Archive}

\noindent
New files to be added to the CVS archive must be explicitly added using
the {\tt cvs add} command.  For example, addition of the file
{\tt foo} 
using
the 

\begin{description}
\item {\tt cvs add foo}
\end{description}

\noindent
\textbf{Notes:} 

\begin{enumerate}

\item 
{\tt foo} can be a list of files.

\item
Each time file(s) are added to the archive your editor will be invoked
for a log message. 

\item
cvs commands operate implicitly on files in your current directory.

\end{enumerate}


\section{Removing Files from the Archive}

\noindent
To remove a file (\emph{e.g.,} {\tt foo}) from the archive:

\begin{enumerate}
\item remove the {\tt foo} from the working directory
\item issue the command: {\tt cvs remove foo}
\end{enumerate}

\noindent
\textbf{Notes:}

\begin{enumerate}

\item
CVS keeps deleted files available in case requests to checkout old
versions of the software are issued.

\item
CVS will refuse to delete a file that still exists in the working
directory.

\end{enumerate}


\section{Importing new SAVANT Releases into Your Archive}

\begin{itemize}

\item
If you are developing software using the SAVANT system, and a new
SAVANT release becomes available, the following steps can be used to
import the new release into your archive.

\item
For example to import a newly released version of savant (0.2.99d in this
example), into the CVS archived named {\tt testing} you would type:

\begin{alltt}
tar -xvf savant-v0.2.99d.tar
cd savant
cvs import testing dale v0\_2\_99d
[ type in log message when prompted ]
\end{alltt}

\item 
Syntax: \\
{\tt cvs import [repository] [vendor-tag] [release-tags]}

\end{itemize}


\section{Output Generated from CVS Commands}

\noindent
CVS will report file modifications as they occur, in the following format:

\begin{alltt}
U testing/src/aire/IIRBase/IIRBase\_ContextClause.hh
U testing/src/aire/IIRBase/IIRBase\_LibraryDeclaration.cc
M testing/src/aire/IIRBase/IIRBase\_LibraryDeclaration.hh
C testing/src/aire/IIRBase/IIRBase\_ComponentDeclaration.hh
\end{alltt}

\section{Meaning of the Output Generated by CVS}

\begin{description}
\item[U] This file was updated by the import.
\item[M] This file was modified by you.
\item[C] Both you and the off-site developers modified this file, and
    CVS was unable to automatically resolve the conflict. (the differences
    will be saved in the file and surrounded by 
    \begin{description}
    \item {\tt <<<<<<< working-filename}
    \item {\tt =======}
    \item {\tt >>>>>>> version-number}
    \end{description}

\end{description}

\chapter{The AIRE Standard}

\section{Introduction to the AIRE specification}

\begin{description}
\item[Who?] \ \\
Initiated by Wright Labs, FTL Systems, and the University of Cincinnati.

\item[What?] \ \\
Create a specification for a freely available, highly portable, extensible
VHDL intermediate form. 

\item[Why?] \ \\
To allow easy tool interoperability.

\end{description}


\section{AIRE Objectives}

\begin{itemize}

\item
Develop portable, memory-based and file-based representation of HDL
designs

\item
Permit free redistribution tools complying with the specification

\item
Permit free implementation of tools complying with the specification

\item
Permit interoperability and exchange of
    \begin{itemize}
    \item VHDL backend analysis tools
    \item VHDL libraries access utilities
    \item VHDL libraries
    \end{itemize}

\end{itemize}


\section{AIRE Fundamentals}

\noindent
Fundamental aspects of AIRE:

\begin{description}
\item[Object-Oriented] \ \\
The AIRE specification is presented as a class hierarchy.  \\
Each class has methods defined that implement its functionality.

\item[Portable Across Languages] \ \\
Allows implementation in variety of OO languages \\
Does not preclude implementations in non-OO language, \emph{e.g.,} C or
Ada 

\end{description}


\section{AIRE Overview}

\begin{enumerate}
\item Formats:
    \begin{description}
    \item[IIR:] in-memory intermediate representation
    \item[FIR:] file intermediate representation
    \end{description}

\item
AIRE is a working group under EIA.

\item
Scope: IEEE Std 1076--87 (VHDL 87), 1076-93 (VHDL 93) 1076.1 (Mixed
Signal), 1364 (Verilog as VHDL).

\item
Jointly developed by:
\begin{small}
\begin{itemize}
\item University of Adelaide (Australia)
\item DA Solutions Ltd (UK)
\item FTL Systems, Inc. (USA)
\item MTL Systems, Inc. (USA)
\item University of Cincinnati (USA)
\end{itemize}
\end{small}

\end{enumerate}


\section{AIRE Documents}

\begin{itemize}

\item Available in both HTML and postscript forms.
\item HTML version fully hyper-linked and X-referenced
\item Primary viewing sites:
    \begin{itemize}
    \item {\tt http://www.vhdl.org/vi/aire/}
    \item {\tt http://www.ftlsystems.com/aire/Index.htm}
    \item {\tt http://www.ececs.uc.edu/}\verb+~+{\tt paw/aire/}
    \item {\tt http://www.cs.adelaide.edu.au/users/vide/aire/}
    \end{itemize}

\end{itemize}


\section{AIRE Fundamental Data Types}

\begin{description}

\item[IR\_Boolean:]
an enumeration type defining values {\tt TRUE} and {\tt FALSE}.

\item[IR\_Character:]
the domain of values covering the ISO 8859-1 standard.

\item[IR\_Int32:]
a domain of discrete values covering the range \\
-2,147,483,647 to +2,147,483,647. 

\item[IR\_Int64:]
a domain of discrete values covering the range \\
-4,611,686,014,132,420,609 to +4,611,686,014,132,420,609. 

\item[IR\_FP32:]
representing the 32-bit floating point type in IEEE Std. 754.

\item[IR\_FP64:]
representing the 64-bit floating point type in IEEE Std. 754.

\item [IR\_Kind:] 
an enumeration uniquely qualifying each class.

\end{description}


\section{IIR Overview}

\begin{itemize}
\item Object-oriented, extensible data structure
\item No public data in base definition
\item Only public interface is by method invocation
\item Approximately 227 class definitions
\item Quasi-stable, current version: 4
\item Two implementations under development 
    \begin{itemize}
    \item Auriga: FTL Systems, Inc
    \item SAVANT: UC/MTL Systems, Inc
    \end{itemize}
\item Singlely rooted (at {\tt class IIR})
\end{itemize}


\section{Chief Design Requirements for IIR}

\begin{itemize}
\item Language Scope (coverage of 1976-87/93, 1976.1, 1364, Trial
  Implementation Draft of 1/24/97  Including Digital VHDL \& VHDL-AMS support)
\item Supportive of Multi-backend analysis tools
\item Portable
\item Extensibility
\item Efficiency
\item Support integration and product exchange
\item Security (offer support for IP)
\item Availability (non-proprietary, free or nearly free)
\end{itemize}


\section{Real Object-Oriented Definition}

\begin{itemize}
\item Other intermediates defined as OO, but in practice were not really OO
\item IIR is defined as an OO structure
\item IIR supports use as an OO structure
\end{itemize}


\section{Example of the Derivation Hierarchy}

\begin{description}
\item \
\begin{itemize}
\item IIR
    \begin{itemize}
    \item IIR\_DesignFile
    \item IIR\_Comment
    \item . . . 
    \item IIR\_SequentialStatement
        \begin{itemize}
        \item IIR\_AssertionStatement
        \item IIR\_BreakStatement
        \item . . .
        \end{itemize}
    \item IIR\_ConcurrentStatement
    \end{itemize}
\end{itemize}
\end{description}


\section{Constructors/Destructors}

\begin{itemize}
\item All constructors must have no arguments
\item No constraints on destructors
\end{itemize}


\section{Interior Classes}

\begin{itemize}
\item Some intermediate classes not directly instantiatable
\item \emph{e.g.,} IIR\_SequentialStatement
\item Interior classes are indirectly instantiated by instantiation of
    children
\end{itemize}


\section{The IIR Class Hierarchy}

\psfig{file=iir-extensible.ps,height=6in,silent=}


\section{Extensibility}

\begin{itemize}

\item Each IIR class is really a collection of 2 or more classes

    \begin{itemize}
    \item \textbf{IIRBase\_X}: root class containing all predefined public
    methods 
    \item \textbf{IIRUser\_X}: user class, void in base IIR definition
    \item \textbf{IIR\_X}: leaf class for this class (possible internal leaf)
    where \textbf{X} is a qualifier for a class in IIR
    \end{itemize}

\item Only leaf classes of non-interior classes are instantiatable \\
    (the derivation chain instantiates the respective parents)

\end{itemize}



\section{Example from the HTML definition of IIR}

\psfig{file=iir-seqStatement.ps,angle=270,width=6in,silent=}


\section{FIR Overview}

\begin{itemize}
\item Object-oriented, extensible data structure
\item Platform independent data formats to facilitate FIR library data exchange
\item Design in progress, current version: 3.0
\item Two implementations under development 
    \begin{itemize}
    \item Auriga: FTL Systems, Inc
    \item SAVANT: University of Cincinnati
    \end{itemize}
\item Singlely rooted (at {\tt class FIR})
\end{itemize}


\section{Chief Design Requirements for IIR}

\begin{itemize}
\item Language Scope (coverage of 1976-87/93, 1976.1, 1364)
\item Supportive of Multi-backend analysis tools
\item Portable
\item Extensibility
\item Efficiency
\item Support integration and product exchange
\item Security (offer support for IP)
\item Availability (non-proprietary, free or nearly free)
\end{itemize}


\section{Real Object-Oriented Definition}

\begin{itemize}
\item FIR is defined as an OO structure
\item FIR supports use as an OO structure
\item Design structure mirrors the class IIR definition
\item Unlike IIR, FIR's public interface is a data structure definition
\end{itemize}


\section{Example of the Derivation Hierarchy}

\begin{description}
\item \
\begin{itemize}
\item FIR
    \begin{itemize}
    \item FIR\_DesignFile
    \item FIR\_Comment
    \item . . . 
    \item FIR\_SequentialStatement
        \begin{itemize}
        \item FIR\_AssertionStatement
        \item FIR\_BreakStatement
        \item . . .
        \end{itemize}
    \item FIR\_ConcurrentStatement
    \end{itemize}
\end{itemize}
\end{description}


\section{The FIR Class Hierarchy}

\psfig{file=fir-extensible.ps,height=5.15in,silent=}


\section{Example from the FIR HTML definition}

\psfig{file=fir-seqStatement.ps,height=7in,silent=}


\chapter{The SAVANT Implementation of AIRE}

\section{Goals for the SAVANT Implementation of AIRE}

\begin{itemize}
\item Strictly adhere to the standard
\item Attempt to enforce the intended usage
    \begin{itemize}
    \item making non-final classes abstract to prevent their
        instantiation 
    \item using strong typing to enforce interfaces
    \end{itemize}
\item Encapsulate all core AIRE functionality
\item Support user extensibility
\end{itemize}


\section{Organization of the SAVANT Distribution}

\begin{small}
\begin{alltt}
~/savant> ls
COMPONENTS              CVS/                    INSTALL
INSTALL-FOR-SIMULATION  LGPL                    LICENSE
README                  RELEASENOTES            bin/
doc/                    lib/                    src/
~/savant> 
\end{alltt}
\end{small}


\section{savant/doc}

\begin{small}
\begin{alltt}
~>ls savant/doc/
README             libraryManager/    programmers/   simulationManual/

~>
\end{alltt}
\end{small}

\begin{itemize}
\item overview.texi: overview of the {\tt IIRScram} classes
\item programmers.texi: programmer's guide
\end{itemize}


\section{savant/src}

\begin{small}
\begin{alltt}
~>ls savant/src/
total 945
 920 Makefile         1 TODO             2 savant.hh        2 version.hh
   6 Makefile.bak     1 aire/            1 scram/
   6 Makefile.in      5 main.cc          1 util/
~>
\end{alltt}
\end{small}

\begin{itemize}
\item location of main makefile
\item {\tt main.cc}: driver code for scram
\item {\tt version.hh}: specifies version/release date of distribution
\end{itemize}



\section{savant/src/aire}

\begin{small}
\begin{alltt}
~>ls savant/src/aire/
total 55
   9 IIR/                     7 IIRKind.hh
  18 IIRBase/                18 IIRScram/
   2 IIRBasicDataTypes.hh    
~>
\end{alltt}
\end{small}

\begin{itemize}
\item IIR/FIR common headers located here
\item IIRBase: location of public AIRE/IIR methods
\item IIRScram: location of scram specific data/methods
\item IIR: leaf nodes for instantiation and derivation
\end{itemize}


\section{IIRBase Contains}

\begin{itemize}
\item Public interface described in the AIRE spec 
\item Protected/Private data/methods to support public interface
\end{itemize}


\section{IIRScram Contains}

\begin{itemize}
\item Methods for general use
    \begin{itemize}
    \item {\tt transmute()} 
    \item {\tt publish\_vhdl()}
    \item {\tt publish\_cc()}
    \end{itemize}
\item Methods not for general use
    \begin{itemize}
    \item type checking routines for SCRAM
    \item symbol table management functions for SCRAM
    \end{itemize}
\end{itemize}


\section{IIR Contains}

\begin{itemize}
\item empty constructor/destructors
\item no other private/protected/public functions or data
\end{itemize}


\section{savant/src/scram}

\begin{small}
\begin{alltt}
~>ls savant/src/scram/
total 259
   6 FlexLexer.h              9 scram.cc
   2 README                   2 scram.hh
   2 RIGHTS                   2 scram.man
  22 VHDLLexer.flex           3 scram_func.hh
   3 VHDLLexer.hh             6 symbol_lookup.cc
   3 VHDLToken.hh             5 symbol_lookup.hh
   2 Xdefaults               10 symbol_table.cc
   2 bool.hh                  6 symbol_table.hh
   2 config.hh              160 vhdl.gg
   3 declaration_chain.hh     9 vhdl.hh
~>
\end{alltt}
\end{small}


\section{savant/src/util}

\begin{small}
\begin{alltt}
~>ls savant/src/util/
total 71
   4 arg_parser.cc          4 error_func.cc          8 set.hh
   5 arg_parser.hh          4 error_func.hh          3 switch_file.cc
   2 container.hh           4 hash_table.hh          3 switch_file.hh
   7 dl_list.hh            20 resolution_func.cc
   2 elaborate_info.hh      5 resolution_func.hh
~>
\end{alltt}
\end{small}

\begin{itemize}
\item {\tt arg\_parser.\{hh,cc\}} parses command line arguments
    (discussed more fully tomorrow)
\end{itemize}


\section{Programming Practices in SAVANT Development}

\begin{itemize}
\item All SAVANT/AIRE class names directly correspond to the AIRE spec
\item All AIRE specific data/methods reside in {\tt IIRBase\_}
\item All SCRAM specific data/methods reside in {\tt IIRScram\_}
\item Names of all extension methods have a leading underscore
\item All {\tt IIR\_} classes are empty
\item All C++ headers separate from bodies
\item Fully descriptive names used whenever possible
\end{itemize}


\chapter{Extensibility in SAVANT}

%%\section{``Macro'' Derivation of AIRE}

%%\psfig{file=extensible-if.ps,angle=270,height=5in,silent=}


%%\section{``Micro'' Derivation of AIRE}

%%\centerline{\psfig{file=savant-if.ps,angle=270,height=5in,silent=}}


\section{``Actual'' Derivation of AIRE}

\bigskip
\bigskip
\bigskip

\psfig{file=actual-if.ps,angle=270,width=6.5in,silent=}


\section{Compare with the AIRE Spec}

\psfig{file=iir-extensible.ps,height=7in,silent=}



\section{All AIRE Classes Occur as 3 SAVANT Class Definitions}

\bigskip
\bigskip
\psfig{file=node-implementation.ps,height=4in,silent=}


\section{Class Derivations Limited To....}

\begin{itemize}
\item Abstract and concrete classes in {\tt IIR}
\end{itemize}


\section{Why this Structure?}

\begin{itemize}
\item SCRAM instantiates objects
\item Instantiation causes invocation of parent constructors
\item Virtual function tables are completed
\item Enables extensibility w/o forcing modifications to code in the parser
\end{itemize}



\section{Huh?}

\begin{itemize}
\item SCRAM instantiates concrete classes in {\tt IIR}
\item The IIR tree is built by the SCRAM parser
\item User defined extensions must then be inserted below the concrete,
    instantiatable nodes.
\end{itemize}


\section{Extending {\tt IIR\_Declaration}}

\noindent
\begin{minipage}{2.25in}
Classes can be added to the ``micro'' hierarchy to extend the
functionality of the system without modifying the parser.
\end{minipage} \hfill \begin{minipage}{3in}
\psfig{file=extended-declaration.ps,height=5in,silent=}
\end{minipage}


\section{Code Changes for Extension}

\begin{itemize}
\item build directory containing extension classes
\item modify the makefile accordingly (tomorrow's lecture)
\item change the derivation tree for the relevant classes in {\tt IIR}
    \begin{itemize}
    \item all the classes that are to be extended
    \end{itemize}
\end{itemize}

\chapter{Review of SAVANT IIR Classes}

\section{Example Studied}

\noindent
In the remainder of this time period, we will trace the complete
derivation tree from the root {\tt class IIRBase} to {\tt class
IIR\_SignalDeclaration}. 


\section{From IIRBase to IIR\_SignalDedclaration: \\
  Exploring the SAVANT Class Hierarchy} 

\subsection{IIRBase.hh}

\begin{alltt}
\begin{small}
#ifndef IIRBASE\_HH  // All header files are wrapped in this manner.
#define IIRBASE\_HH  // Only shown here...

// standard copyright notice, warranty disclaimer, author identification, and

//---------------------------------------------------------------------------
// 
// $Id: programmers.tex,v 1.6 1999/03/19 20:53:36 ramanan Exp $
// 
//---------------------------------------------------------------------------

#include "IIRBasicDataTypes.hh"

class IIRBase \{

public:

  virtual IIR\_Kind get\_kind() = 0;
  virtual IIR\_Char *get\_kind\_text() = 0;

  void set\_file\_name(IIR\_Identifier *file\_name) \{ . . . \}
  void set\_sheet\_name(IIR\_Identifier *sheet\_name) \{ . . . \}
  void set\_line\_number(IIR\_Int32 line\_number);
  void set\_column\_offset(IIR\_Int32 column\_offset);
  void set\_character\_offset(IIR\_Int32 character\_offset);
  void set\_x\_coordinate(IIR\_Int32 x\_coordinate);
  void set\_y\_coordinate(IIR\_Int32 y\_coordinate);

  IIR\_Identifier *get\_file\_name()  \{return iir\_file\_name;\}
  IIR\_Identifier *get\_sheet\_name() \{return iir\_sheet\_name;\}

  IIR\_Int32 get\_line\_number()      \{return iir\_line\_number;\}
  IIR\_Int32 get\_column\_offset()    \{return iir\_column\_offset;\}
  IIR\_Int32 get\_character\_offset() \{return iir\_character\_offset;\}
  IIR\_Int32 get\_x\_coordinate()     \{return iir\_x\_coordinate;\}
  IIR\_Int32 get\_y\_coordinate()     \{return iir\_y\_coordinate;\}

protected:
  
  IIRBase();
  virtual ~IIRBase() = 0;
    
private:
  
  IIR\_Identifier *iir\_file\_name;
  IIR\_Identifier *iir\_sheet\_name;

  IIR\_Int32  iir\_line\_number;
  IIR\_Int32  iir\_column\_offset;
  IIR\_Int32  iir\_character\_offset;
  IIR\_Int32  iir\_x\_coordinate;
  IIR\_Int32  iir\_y\_coordinate;
\};
\end{small}
\end{alltt}


\subsection{IIRScram.hh}

\begin{alltt}
\begin{small}
#ifndef DEVELOPER\_ASSERTIONS
#include <assert.h>
#endif

extern switch\_file \_vhdl\_out;  //file for vhdl output
extern switch\_file \_cc\_out;    //file for c++ output

class IIRScram : public IIRBase \{

public:

  virtual void \_publish\_vhdl();
  virtual void \_publish\_cc();
  virtual IIR\_Boolean \_is\_declaration();
  virtual IIR\_Boolean \_is\_ascending\_range();
  virtual IIR\_Boolean \_is\_name();
  virtual IIR\_Boolean \_is\_signal();
  virtual IIR\_Boolean \_is\_variable();
  virtual IIR\_Boolean \_is\_text\_literal();
  virtual IIR\_Boolean \_is\_discrete\_type();

  virtual IIR  *\_transmute();

  //The following function is used for code generation that does runtime 
  //elaboration
  virtual void \_publish\_cc\_elaborate();

  void \_report\_undefined\_scram\_fn(char *);

  // These methods have to do with semantic checks and such.
  virtual set<IIR\_Declaration> *\_symbol\_lookup();
  virtual set<IIR\_Declaration> *\_symbol\_lookup( IIR\_Declaration *);

  virtual set<IIR\_TypeDefinition> *\_get\_lval\_set();
  virtual set<IIR\_TypeDefinition> *\_get\_rval\_set();
  
  virtual void \_type\_check( set<IIR\_TypeDefinition> * );
  virtual void \_type\_check( IIR\_TypeDefinition * );

  virtual ostream &\_print( ostream & );

  static void \_set\_symbol\_table( symbol\_table *s\_t );
  static symbol\_table *\_get\_symbol\_table( );

protected:

  IIRScram();
  virtual ~IIRScram() = 0;
  static symbol\_table *sym\_tab;
    
private:

\};

inline ostream &
operator<<(ostream &os, IIRScram &is )\{
  return is.\_print( os );
\}
\end{small}
\end{alltt}


\subsection{IIR.hh}

\begin{alltt}
\begin{small}
class IIR : public IIRScram \{

public:

  virtual ~IIR() = 0;

protected:

  IIR();
    
private:
\};
\end{small}
\end{alltt}

\noindent
\textbf{Note:} this is an abstract class


\subsection{IIRBase\_Declaration.hh}

\begin{alltt}
\begin{small}
class IIRBase\_Declaration : public IIR \{

public:

  IIR\_Kind get\_kind() \{
    return IIR\_DECLARATION;
  \}

  IIR\_Char *get\_kind\_text() \{
    return "IIR\_Declaration";
  \}

  void set\_declarator( IIR\_TextLiteral *declarator );
  IIR\_TextLiteral *get\_declarator();

protected:
  
  IIRBase\_Declaration();
  virtual ~IIRBase\_Declaration() = 0;
    
private:
  
  IIR\_TextLiteral *declarator;
\};
\end{small}
\end{alltt}


\subsection{IIRScram\_Declaration.hh}

\begin{alltt}
\begin{small}
class IIRScram\_Declaration : public IIRBase\_Declaration \{

public:

  virtual void \_publish\_vhdl();

  // Methods for C++ code generation

  virtual IIR\_Boolean \_is\_type() \{ return FALSE; \}
  virtual IIR\_Boolean \_is\_access\_type() \{ return FALSE; \}
  virtual IIR\_Boolean \_is\_read\_file() \{ return FALSE; \}
  virtual IIR\_Boolean \_is\_write\_file() \{ return FALSE; \}
  virtual IIR\_Boolean \_is\_object\_decl() \{ return FALSE; \}
  virtual IIR\_Boolean \_is\_signal() \{ return FALSE; \}
  virtual IIR\_PortList *\_get\_port\_map()\{ return NULL; \}
  virtual IIR\_GenericList *\_get\_generic\_map()\{ return NULL; \}

  virtual IIR\_Declaration *\_find\_symbol( IIR\_Name *look\_for )\{
    \_report\_undefined\_scram\_fn("\_find\_symbol( IIR\_Name *)");
    return NULL;
  \}

  virtual char * \_get\_type\_string()\{
    return "(unknown)";
  \}
  enum declaration\_type \{ ERROR = 0, UNDEFINED, VARIABLE, SHARED\_VARIABLE,
                          TYPE, SUBTYPE, SIGNAL, PROCEDURE, INTERFACE,
                          FUNCTION, S\_FILE, ENTITY, CONSTANT, CONFIGURATION,
                          COMPONENT, ATTRIBUTE, ALIAS, ARCHITECTURE, PACKAGE,
                          PACKAGE\_BODY, INTERFACE\_VARIABLE, 
                          INTERFACE\_SIGNAL, INTERFACE\_CONSTANT,
                          INTERFACE\_FILE, LABEL, LITERAL, UNITS, GROUP,
                          LIBRARY, LAST\_DECLARATION\_TYPE \};

  virtual declaration\_type \_get\_type();

  void \_set\_scope( IIR\_Int32 );
  IIR\_Int32 \_get\_scope();
  virtual IIR\_TypeDefinition *\_get\_lval();
  virtual IIR\_TypeDefinition *\_get\_rval();

  virtual bool \_check\_param( IIR\_TypeDefinition *decl, int arg\_num );
  virtual bool \_is\_implicit\_declaration();

  IIR\_Attribute *\_get\_attribute\_name();
  void \_set\_attribute\_name( IIR\_Attribute * );

  IIR\_DeclarationList implicit\_declarations;
  IIR\_Declaration *\_find\_in\_implicit\_list( char * );

  virtual IIR\_TypeDefinition *\_get\_type\_of\_element( int );
  virtual IIR\_Int32 \_get\_num\_indexes();

  virtual ostream & \_print( ostream & );

protected:

  IIRScram\_Declaration();
  virtual ~IIRScram\_Declaration() = 0;
    
private:

  IIR\_Int32 scope;
  IIR\_Attribute *attribute\_name;
\};
\end{small}
\end{alltt}


\subsection{IIRScram\_Declaration.hh}

\begin{alltt}
\begin{small}
class IIR\_Declaration : public IIRScram\_Declaration \{

public:

protected:
  
  IIR\_Declaration() \{\};
  virtual ~IIR\_Declaration() = 0;
  
private:
  
\};
\end{small}
\end{alltt}


\subsection{IIRBase\_ObjectDeclaration.hh}

\begin{alltt}
\begin{small}
class IIRBase\_ObjectDeclaration : public IIR\_Declaration \{

public:

  IIR\_Kind get\_kind() \{ return IIR\_OBJECT\_DECLARATION; \}
  IIR\_Char *get\_kind\_text() \{ return "IIR\_ObjectDeclaration"; \}

  void set\_subtype(IIR\_TypeDefinition* subtype);
  IIR\_TypeDefinition* get\_subtype();

  IIR\_AttributeSpecificationList attributes;

protected:

  IIRBase\_ObjectDeclaration();
  virtual ~IIRBase\_ObjectDeclaration() = 0;
    
private:
  IIR\_TypeDefinition* subtype;
\};
\end{small}
\end{alltt}


\subsection{IIRScram\_ObjectDeclaration.hh}

\begin{alltt}
\begin{small}
class IIRScram\_ObjectDeclaration : public IIRBase\_ObjectDeclaration \{

public:

  IIR\_TypeDefinition *\_get\_lval();
  IIR\_TypeDefinition *\_get\_rval();
  set<IIR\_TypeDefinition> *\_get\_rval\_set();

  IIR\_Boolean \_is\_object\_decl();

  IIR\_Int32 \_get\_num\_indexes();
  IIR\_TypeDefinition *\_get\_type\_of\_element( int index );

protected:

  IIRScram\_ObjectDeclaration() \{\}
  virtual ~IIRScram\_ObjectDeclaration() = 0;
    
private:
\};
\end{small}
\end{alltt}


\subsection{IIR\_ObjectDeclaration.hh}

\begin{alltt}
\begin{small}
class IIR\_ObjectDeclaration : public IIRScram\_ObjectDeclaration \{

public:

protected:

  IIR\_ObjectDeclaration() \{\};
  virtual ~IIR\_ObjectDeclaration() = 0;
  
private:
  
\};
\end{small}
\end{alltt}


\subsection{IIRBase\_SignalDeclaration.hh}

\begin{alltt}
\begin{small}
class IIRBase\_SignalDeclaration : public IIR\_ObjectDeclaration \{

public:

  IIR\_Kind get\_kind() \{return IIR\_SIGNAL\_DECLARATION;\}
  IIR\_Char *get\_kind\_text() \{return "IIR\_SignalDeclaration";\}

  void set\_value(IIR* value);
  IIR* get\_value();
  void set\_signal\_kind(IIR\_SignalKind signal\_kind);
  IIR\_SignalKind get\_signal\_kind();

protected:
  
  IIRBase\_SignalDeclaration();
  virtual ~IIRBase\_SignalDeclaration() = 0;
    
private:
  
  IIR* value;
  IIR\_SignalKind signal\_kind;

\};
\end{small}
\end{alltt}


\subsection{IIRScram\_SignalDeclaration.hh}

\begin{alltt}
\begin{small}
class IIRScram\_SignalDeclaration : public IIRBase\_SignalDeclaration \{

public:

  void \_publish\_cc();
  IIR\_Boolean \_is\_signal()\{ return TRUE; \}

  declaration\_type \_get\_type();

protected:

  IIRScram\_SignalDeclaration() \{\}
  virtual ~IIRScram\_SignalDeclaration() = 0;
\};
\end{small}
\end{alltt}


\subsection{IIR\_SignalDeclaration.hh}

\begin{alltt}
\begin{small}
class IIR\_SignalDeclaration : public IIRScram\_SignalDeclaration \{

public:

  IIR\_SignalDeclaration() \{\};
  virtual ~IIR\_SignalDeclaration();
  
protected:
  
private:
  
\};
\end{small}
\end{alltt}

\chapter{Programming Exercise 1}

\section{Problem Statement}

\begin{enumerate}
\item Build a mechanism to profile the static structure of a VHDL model
\item Modify the of SAVANT classes in {\tt IIRScram\_}
    \begin{enumerate}
    \item Add the static variable {\tt count} of type to the class
    \item Modify the constructor to increment {\tt count}
    \item Modify the destructor to decrement {\tt count}
    \end{enumerate}
\item Begin with {\tt IIRScram\_SignalDeclaration.hh}
\item Recompile scram
\item Run with supplied test file
\item Print the result
\item Compare the results to the original test file.  Is the count correct?
\item Continue with additional VHDL constructs of your choice.
\end{enumerate}


\section{Detailed Programming Changes}

\subsection{Edit the file {\tt IIRScram\_SignalDeclaration.hh}}

  \begin{enumerate}
  \item In the {\tt private:} section, add: \\
    {\tt static IIR\_Int32 count;}
  \item In the {\tt public:} section, add: \\
    {\tt static IIR\_Int32 get\_count()\{ return count; \};}
  \item In the {\tt protected:} section, change the line: \\
    {\tt IIRScram\_SignalDeclaration()\{\}} \\
    to \\
    {\tt IIRScram\_SignalDeclaration()\{count++;\}}
  \item Save the file.
  \end{enumerate}

\subsection{Edit the file {\tt IIRScram\_SignalDeclaration.cc}}

  \begin{enumerate}
  \item Add the following line somewhere in the file: \\
    {\tt IIR\_Int32 IIRScram\_SignalDeclaration::count;}
  \item Change the line: \\
    {\small {\tt IIRScram\_SignalDeclaration::}\verb+~+{\tt IIRScram\_SignalDeclaration()\{\}}} \\
    to \\
    {\small {\tt IIRScram\_SignalDeclaration::}\verb+~+{\tt IIRScram\_SignalDeclaration()\{count--;\}}}
  \end{enumerate}
  

\section{Recompile}

\begin{enumerate}
\item move to the {\tt savant/src/} directory
\item type: {\tt make aire/IIRScram/IIRScram\_SignalDeclaration.o}
\item Re-edit  {\tt IIRScram\_SignalDeclaration.hh} and/or \\
    {\tt IIRScram\_SignalDeclaration.cc} until it compiles error free
    (ask an instructor for help if necessary).
\end{enumerate}


\section{Reporting the Results of the Static Counting}

\begin{enumerate}
\item Edit the file {\tt main.cc}
\item Just before the last \}, add the lines: \\
    {\small {\tt \#include "IIR\_SignalDeclaration.hh"}} \\
    {\small {\tt cout << "Signal count: " << IIR\_SignalDeclaration::get\_count() << endl;}}
\item Recompile
    \begin{enumerate}
    \item cd to the {\tt savant/src/} directory
    \item type {\tt make}
    \item If problems arise, contact an instructor for help.
    \end{enumerate}
\end{enumerate}


\section{Interesting results}

\begin{enumerate}


\item
Now that we have a modified {\tt scram} binary, we can test it on some
vhdl files.  After running the new {\tt scram} on some simple files,
count the number of signal declarations in the VHDL versus the number you
program reports.

\item
If the number the program reports is greater than the number you count,
then count the number of signal valued attributes, and add that number to
the number reported.  As required by AIRE, {\tt scram} internally
creates declarations for various attributes to augment code generation in
the back end. 

\end{enumerate}

\chapter{Advanced Savant Programming}

\section{Recall the ``Micro'' Derivation of AIRE}

\psfig{file=savant-if.ps,angle=270,width=6.5in,silent=}


\section{Recall the ``Actual'' Derivation of AIRE}

\bigskip
\bigskip
\bigskip

\psfig{file=actual-if.ps,angle=270,width=6.5in,silent=}


\section{User Modifications}

\begin{itemize}
\item Define a new class that shadows an existing method
\item Add a new virtual function to the IIR root class ({\tt IIR}) with
    a default action that is selectively shadow'ed on a class by class
    basis 

\bigskip
\item \textbf{Note:} code changes near the root of the IIR tree can
    trigger numerous dependency relations and create a situation where
    seemingly small changes cause recompilation of virtually the entire
    source tree.
\end{itemize}


\section{Inserting a User Defined Class into the Hierarchy (Part I)}

\begin{minipage}{2in}
  As previously discussed, the default hierarchy of the SAVANT/AIRE
nodes looks like:
\end{minipage} \hfill \begin{minipage}{3in}
\psfig{file=node-implementation.ps,silent=}
\end{minipage}


\section{Inserting a User Defined Class into the Hierarchy (Part II)}

\begin{minipage}{2.5in}
When inserting a user defined class into the hierarchy, the default
derivation is ``broken'' to look like:
\end{minipage} \hfill \begin{minipage}{3in}
\psfig{file=broken-derivation.ps,width=3in,silent=}
\end{minipage}


\section{Inserting a User Defined Class into the Hierarchy (Part III)}

\noindent
Essentially, the user-defined class must be derived from the IIR level
just ``underneath'' the IIR level, in this case, IIRScram.  In
addition, the derivation of the IIR level must be modified such that
it inherits directly from the user defined class.


\section{Preparations outside the AIRE Classes}

\begin{itemize}
\item Updating the Makefile
\item Modifying {\tt main()} to invoke new methods
\item Defining and Parsing new command line arguments
\end{itemize}


\section{Editing {\tt Makefile.in} for Inclusion of New Classes}

\noindent
When new classes are added to the SAVANT/AIRE hierarchy, the new classes
must be compiled and included into the libraries.  The file
{\tt Makefile.in} that comes with the distribution has a simple
mechanism for adding classes to {\tt libaire.a}.  To include the
classes in the subdirectory {\tt IIRSavantGeeks} into
{\tt libaire.a}, find the following lines in
{\tt Makefile.in}:

\noindent
\begin{small}
\begin{alltt}
# If you are extending the AIRE classes with your own, put your subdirectory
# in this list and it will automatically get compiled into libaire.
AIRE_SUBDIRS = $(AIRE) $(AIRE)/IIRBase $(AIRE)/IIRScram $(AIRE)/IIR
\end{alltt}
\end{small}


\section{Editing {\tt Makefile.in} (Part II)}

\noindent
Adding a subdirectory to this list has the following consequences:
\begin{itemize}
\item
All ``.cc'' files are compiled into ``.o'' files.
\item
All of the ``.o'' files generated get written into {\tt libaire.a}.
\item
The named directory is added to the list searched for C++ header files.
\item
{\tt make clean} will remove the ``.o'' files in this directory.
\end{itemize}

\noindent
\textbf{Note:} after editing {\tt Makefile.in}, {\tt configure} or
{\tt config.status} needs to be re-run (to generate {\tt Makefile}),
and dependencies need to be rebuilt with {\tt make depend}.


\section{Modifying ``main''}

\noindent
The procedure {\tt main} in {\tt savant/src/main.cc}
instantiates SAVANT's parser class, {\tt scram}.  {\tt scram}
essentially has one public method, {\tt parse\_files}.  This method
takes the following arguments:

\begin{description}
\item[int argc] This variable tells the parser how many filenames are
listed in the next argument.
\item[char **argv] This is an array of strings, holding the filenames
to parse.
\item[symbol\_table *] This is the symbol table you want to use for parsing.
\end{description}

\noindent
The method {\tt parse\_files} returns a {\tt dl\_list<IIR\_DesignFile>
*}.  Once this list is generated, the rest of the code in main my do
whatever it likes with it.  This is where methods in extension classes
are normally invoked.


\section{Adding Command Line Arguments to Scram} 

\begin{itemize}

\item
When extending the SAVANT system with new capabilities, it will often
be desirable to add command line options to scram to control them.

\item
In the {\tt savant/src/util} subdirectory there is a class that
implements an argument parser (in files {\tt arg\_parser.hh} and
{\tt arg\_parser.cc}).  This class is used by scram to process 
the command line, and can easily be extended to support additional
options.

\end{itemize}


\section{Argument Parser Initialization}

In the file {\tt savant/src/main.cc}, the following lines
initialize the array of {\tt arg\_record}s passed to the arg\_parser:

\begin{footnotesize}
\begin{alltt}
static arg\_parser::arg\_record arg\_list[] = \{
  \{"-publish-vhdl","publish VHDL", &publish\_vhdl, arg\_parser::ARG\_BOOLEAN\},
  \{"-publish-cc","publish c++", &publish\_cc, arg\_parser::ARG\_BOOLEAN\},
  \{"-no-file-output", "send publish\_cc output to stdout instead of compilable files",  
    &no\_file\_output, arg\_parser::ARG\_BOOLEAN\},
  \{"-warranty-info", "print information about (lack of) warranty",
    &print\_warranty, arg\_parser::ARG\_BOOLEAN \},
  \{NULL, NULL\}
\};
\end{alltt}
\end{footnotesize}


\section{Syntax of arg\_records (Part I)}

\noindent
Each arg\_record consists of the following fields:

\begin{description}
\item[char *arg\_text] This is the text of the argument itself, like
{\tt --help}.
\item[char *arg\_help] This is the description of the argument's
function that is printed with usage messages.
\item[void *storage] This is a pointer to whatever type of storage
this type of argument needs (as determined by the next parameter).
\item[arg\_type type] This enumeration what type of argument this is -
a boolean flag, or a string, for instance.  See inline documentation
for current options.
\end{description}


\section{Syntax of arg\_records (Part I)}

\noindent
To add a new argument to {\tt scram}:

\begin{description}
\item[Modify arg\_list] Described above.
\item[Declare new variable] That the argument will effect.  Don't
forget to initialize the variable as well.
\end{description}


\chapter{Programming Exercise 2}

\section{Problem Statement}

\begin{description}
\item \
\begin{enumerate}
\item Build a mechanism to obfuscate identifiers in VHDL models
\item Make a {\tt IIRTraining} directory in {\tt savant/src/aire/iir}
\item Build the class: \\
    {\tt IIRTraining\_Identifier} derived from: \\
    {\tt IIRScram\_Identifier} that shadows the method: \\
    {\tt void \_publish\_vhdl()} in {\tt IIRScram\_Identifier} 
\item Obscure the printed identifier output by {\tt \_publish\_vhdl()}
\item In the directory savant/src/aire/iir/IIR:
    \begin{enumerate}
        \item Modify the file {\tt IIR\_Identifier.hh} to include
            {\tt IIRTraining\_Identifier.hh} instead of
            {\tt IIRScram\_Identifier.hh} 
        \item Derive the class {\tt IIR\_Identifer} from
            {\tt IIRTraining\_Identifier} instead of \\
            {\tt IIRScram\_Identifier} 
    \end{enumerate}
\item Recompile scram
\item Run against a VHDL file that contains an object of some type from
    package standard
\item What prints in the data type declarator?
\item How can this be fixed?
\item Continue with additional obfuscations of your choice.
\end{enumerate}
\end{description}




\section{Detailed Programming changes}

\begin{enumerate}
\item
  Make a new directory for extension classes:\\
  \\*
  {\tt savant/src/aire/iir/IIRTraining}
\item
  Create new class: \\
  \\*g
  {\tt IIRTraining\_Identifier}.
\end{enumerate}

\section{{\tt IIRTraining\_Identifier.hh}}

\begin{small}
\begin{alltt}
#ifndef IIRTRAINING\_IDENTIFIER\_HH
#define IIRTRAINING\_IDENTIFIER\_HH

#include ``IIRScram\_Identifier.hh''

class IIRTraining\_Identifier : public IIRScram\_Identifier \{

public:
  \_publish\_vhdl();  // This is defined as virtual in base classes.  
                      // This definition overrides.

protected:
  IIRTraining\_Identifier() \{\};
  ~IIRTraining\_Identifier() = 0;
\}
#endif
\end{alltt}
\end{small}


\section{{\tt IIRTraining\_Identifier.cc}}

\begin{small}
\begin{alltt}
#include "IIRTraining\_Identifier.hh"
#include "switch\_file.hh"
#include <ctype.h>

IIRTraining\_Identifier::~IIRTraining\_Identifier() \{\}

void 
IIRTraining\_Identifier::\_publish\_vhdl()\{
  int i;
  for( i = 0; i < length; i++ )\{
    if( isalpha((text[i] + 1)) )\{
      \_vhdl\_out << (char)(text[i] + 1);
    \}
    else\{
      \_vhdl\_out << (char)text[i];
    \}
  \}
\}
\end{alltt}
\end{small}



\section{Modify {\tt IIR\_Identifier.hh} in savant/src/aire/iir/IIR}

\begin{small}
\begin{alltt}
#ifndef IIR\_IDENTIFIER\_HH
#define IIR\_IDENTIFIER\_HH

#include "IIRTraining\_Identifier.hh"

class IIR\_Identifier : public IIRTraining\_Identifier \{

public:
  
  IIR\_Identifier() \{\};
  ~IIR\_Identifier() \{\};
  
protected:  private:
  
\};

#endif
\end{alltt}
\end{small}


\section{Add {\tt IIRTraining} to Makefile}

\begin{enumerate}

\item
Modify {\tt Makefile.in} to include the files from
{\tt IIRTraining} into {\tt libaire.a}.  Look for the following
lines in {\tt Makefile.in}:

\begin{footnotesize}
\begin{alltt}
# If you are extending the AIRE classes with your own, put your subdirectory
# in this list and it will automatically get compiled into libaire.
AIRE_SUBDIRS = $(AIRE) $(IIR)/IIRBase $(IIR)/IIRScram $(IIR)/IIR
\end{alltt}
\end{footnotesize}

\item
Change it to read:

\begin{footnotesize}
\begin{alltt}
# If you are extending the AIRE classes with your own, put your subdirectory
# in this list and it will automatically get compiled into libaire.
AIRE_SUBDIRS = $(AIRE) $(IIR)/IIRBase $(IIR)/IIRScram $(IIR)/IIR $(IIR)/IIRTraining 
\end{alltt}
\end{footnotesize} 

\end{enumerate}

%%$ to fix emacs fontlock coloring

\section{Build new {\tt Makefile} and Compile} 

\begin{enumerate}

\item
Build a new Makefile from Makefile.in by re-running the script\\
{\tt savant/configure/configure}.

\item
Build dependencies in the new {\tt Makefile} using the command
{\tt make depend}.

\item
Build {\tt scram} by issuing the command {\tt make}.

\end{enumerate}

\begin{small}
\noindent
\textbf{NOTE:} You can make sure that your new class compiles before
rebuilding the entire system by:

\indent
{\tt make aire/iir/IIRTraining/IIRTraining\_Identifier.o}

\noindent
Additionally, you can build {\tt libaire.a} to see if you modified the
{\tt Makefile} correctly:

\indent
{\tt make ../lib/libaire.a}

\end{small}

\chapter*{Acknowledgments}

This research has been conducted with the participation of many
investigators.  While not an complete list, the following individuals
have made notable direct and/or indirect contributions to this effort
(in alphabetical order):
Jeff Carter,
Harold Carter,
Praveen Chawla,
John Hines,
Herb Hirsch,
Timothy J. McBrayer,
Greg Peterson,
Al Scarpelli,
Mike Shellhause and
John Willis.
We wish to express our sincerest gratitude for the time that you spent
reviewing and commenting on our designs.

This research was supported in part by MTL Systems, Inc and the Wright
Laboratory at Wright-Patterson AFB.  Thank you for your support.

\end{document}