// T is P
777 | # Current Strategy:
778 | # - convert SV class to C++ Class
779 | # - convert SV Parameterized class to C++ template class
780 | #
781 | s/\btype REQ=int,RSP=int/typename REQ=int, typename RSP=int/; # HACK: support for OVM weirdness
782 |
783 | # Apparently a space between the class name and the parameterized list is not required - so let's add one - since that's what the rest of this filter expects
784 | s/(\w)(<)/$1 $2/;
785 |
786 | if (/\bclass(\s+)(\S+)/) { # was /class(\s+)(\w+)/ -- but need to support class definition in macros
787 | $class_start = 1;
788 | $classname = $2;
789 | # C++ does not declare abstract classes (C++ abstract class just has pure methods declared)
790 | if (/\bvirtual\b/) {
791 | s/virtual\s+class/class/;
792 | }
793 | # forward reference
794 | # in SV a forward reference looks like: typedef class myclass;
795 | # in C++ it looks like: class myclass;
796 | if (/typedef/) {
797 | s/typedef\s+class(.*;)/class $1/;
798 | $class_start = 0;
799 | }
800 | }
801 | if ($class_start) {
802 | s/\btype /typename /g; # 'typename' and 'class' are equivalent
803 | if (s/;/ { public: /) { # SV defaults to public; C++ defaults to private
804 | $class = 1; # we're in a class body
805 | $class_start = 0;
806 | $access_specifier = "public";
807 | }
808 | if (/class(\s+)(\S+)(\s*)) {
809 | $template_class = 1;
810 | s/class(\s+)(\S+)/template /;
811 | }
812 | elsif ($infile[$infile_line] =~ /^(\s*?)) { # template starts on next line
813 | $template_class = 1;
814 | s/class(\s+)(\S+)/template /;
815 | }
816 |
817 | if ($template_class == 1 && $template_brackets == 0 && $template_class_drop == 0) {
818 | #print STDERR "Found ".$classname." at line $infile_line\n";
819 | if (s/(.*)>\s+extends\s+(.*)$/$1> class $classname extends $2/) {
820 | $template_class_drop = 1; # dropped class name
821 | }
822 | elsif (s/(.*)>(.*)$/$1> class $classname $2/) {
823 | #print STDERR "Current Line: >".$_."\n";
824 | $template_class_drop = 1; #dropped class name
825 | #print (STDERR "Dropped\n");
826 | }
827 | elsif ($infile[$infile_line] =~ /^(\s*?)) { # template starts on next line
828 | $template_class = 1;
829 | }
830 | else {
831 | $template_class = 0;
832 | }
833 | }
834 | }
835 |
836 | if (/\bendclass\b/) {
837 | $class_start = 0;
838 | $derived_class = 0;
839 | $template_class = 0;
840 | $template_class_drop = 0;
841 | $template_brackets = 0;
842 | $class = 0; # we're not in a class body
843 | }
844 |
845 | # Class Access Specifier
846 | # In C++ the access specifier defaults to private
847 | # In SV the access specifier defaults to public
848 | # In C++ the access specifier is sticky
849 | # In SV the access specifier is per member
850 | # Looking for:
851 | # local protected public
852 | # Current Strategy:
853 | # - if we're in a class body restick the public marker after SV changes to local or protected
854 | # - to keep the line number references correct we need to put the public on the same line
855 | # - if we're not in the body of a method then we can mark public
856 | # - if the line is a # macro then skip the print
857 | if ($class == 1 && $enum_start == 0 && $function_start == 0 && $ml_assign_start == 0 && !(/^\s*\#/)) {
858 | if (/\blocal\s+\b/) {
859 | s/\blocal\b//;
860 | if ($access_specifier ne "private") {
861 | print "private: ";
862 | $access_specifier = "private";
863 | }
864 | }
865 | elsif (/\bprotected\s+\b/) {
866 | s/\bprotected\b//;
867 | if ($access_specifier ne "protected") {
868 | print "protected: ";
869 | $access_specifier = "protected";
870 | }
871 | }
872 | elsif (/\bpublic\s+\b/) {
873 | s/\bpublic\b//;
874 | if ($access_specifier ne "public") {
875 | print "public: ";
876 | $access_specifier = "public";
877 | }
878 | }
879 | elsif ($function == 0 && $enum == 0 && $ml_assign == 0) {
880 | if ($access_specifier ne "public") {
881 | print "public: ";
882 | $access_specifier = "public";
883 | }
884 | }
885 | }
886 | if (/^\s*\#endif/) {
887 | # if we just exited an if(n)def/endif block we don't know the current state of public/protected/private
888 | $access_specifier = "unknown";
889 | }
890 |
891 |
892 | #-----------------------------------------------------------------------------
893 | #
894 | # Change Begin / End markers to { / } braces
895 | # NOTE: we don't do this earlier b/c the SV begin / end markers are much
896 | # easier to parse (search for) than trying to keep track of nested
897 | # braces.
898 | #
899 | #-----------------------------------------------------------------------------
900 |
901 | # Tasks and Functions
902 | # SV Tasks and Functions declaration opens with ;
903 | # C++ functions open with { (unless functions are extern or pure)
904 | # SV Methods do not have to have parens function foo; is same as function foo();
905 | # Looking for:
906 | # ... function or task
907 | # Current Strategy:
908 | # - if extern do nothing
909 | # - if pure virtual remove pure keyword and change semicolon to '= 0;'
910 | # - change semicolon to open curly
911 | if ($class && (/pure\s+virtual/)) {
912 | s/pure\s+//;
913 | $ispure = 1;
914 | }
915 | elsif ($class && (/\bextern\b/)) {
916 | s/extern\s+//;
917 | $isextern = 1;
918 | }
919 |
920 | if (/\b(task|function)\b/) {
921 | $function_start = 1;
922 | $function = 0;
923 | }
924 |
925 | if ($function_start == 1) {
926 | # put in the parens if they're missing
927 | if (!/\)\s*;/) {
928 | s/;/();/;
929 | }
930 | if ($ispure) {
931 | if(s/;\s*$/ = 0;\n/) {
932 | $ispure = 0;
933 | $function_start = 0;
934 | }
935 | }
936 | elsif ($isextern) {
937 | if (/;\s*$/) {
938 | $isextern = 0;
939 | $function_start = 0;
940 | }
941 | }
942 | elsif ($isdpi) {
943 | if (s/;\s*$/ {}\n/) {
944 | $isdpi = 0;
945 | $function_start = 0;
946 | }
947 | }
948 | elsif (s/;/ {/) {
949 | $function = 1; # in a method body
950 | $function_start = 0;
951 | }
952 | }
953 | if (/end(task|function)/) {
954 | $function = 0;
955 | }
956 |
957 | # Enumerated Typedef
958 | # SV Enumerated Typedef looks exactly like C++ enum
959 | # Except that C++ enums are always of type int
960 | # SV: typedef enum [type] {...} enumtypename
961 | # C++: typedef enum [optional enumtypename] [: type] {...} enumtypename
962 | # Current Strategy:
963 | # - get rid of any optional type information
964 | # - note when in an enum body
965 | if (/typedef enum/) {
966 | if (/\benum\b\s+{/) {}
967 | else {
968 | s/\benum\b(.*?){/enum {/;
969 | }
970 | }
971 | else {
972 | if (/\benum\b\s+{/) {}
973 | else {
974 | s/\benum\b(.*?){/enum {/;
975 | }
976 | }
977 |
978 | # Enumerated Type
979 | # SV Enumerated Typedef looks similar to C++ enum - but name is swapped
980 | # Except that C++ enums are always of type int
981 | # SV: enum [optional type with optional bit width] {...} enumname
982 | # C++: enum enumname {...}
983 | # Current Strategy:
984 | # - get rid of any optional type information
985 | # - note when in an enum body
986 | if ($enum_start == 1) {
987 | $enum = 1;
988 | $enum_start = 0;
989 | }
990 |
991 | if (/\benum\b/) {
992 | $enum_start = 1;
993 | }
994 | if ($enum_start) {
995 | if (/\}/) {
996 | $enum = 0;
997 | $enum_start = 0;
998 | }
999 | }
1000 | if ($enum == 1) {
1001 | if (/\}/) {
1002 | $enum = 0;
1003 | $enum_start = 0;
1004 | }
1005 | }
1006 |
1007 |
1008 | # Multiline Assignment
1009 | # Need to know if an assignment is multiline to catch local/protected inline initilizations
1010 | # Current Strategy:
1011 | # - flag inline assignments to end of statement semicolon that are in a class
1012 |
1013 | if ($ml_assign_start == 1) {
1014 | $ml_assign = 1;
1015 | $ml_assign_start = 0;
1016 | }
1017 |
1018 | # Look for multiline only when:
1019 | # - in a class
1020 | # - not in an enum
1021 | # - not in a function
1022 | # - not a line that starts a macro
1023 | # - current line not empty
1024 | # - current line not empty macro line
1025 | if ($class == 1 && $enum_start == 0 && $function_start == 0 && !(/^\s*\#/) && /^\s*\S+/ && !(/^\s*\/\/\s*$/)) {
1026 | if (/=/ && !/==/) { #assignment
1027 | if (!/;/) {
1028 | $ml_assign_start = 1;
1029 | #print STDERR "mlstart: ".$_;
1030 | }
1031 | }
1032 | if (!/;/) {
1033 | if ($infile[$infile_line] =~ /=/) { # assignment starts on next line
1034 | if ($infile[$infile_line] =~ /==/) {}
1035 | else {
1036 | $ml_assign_start = 1;
1037 | #print STDERR "Yo! ".$infile[$infile_line];
1038 | }
1039 | }
1040 | }
1041 |
1042 | if ($ml_assign_start) {
1043 | if (/;/) {
1044 | $ml_assign = 0;
1045 | $ml_assign_start = 0;
1046 | }
1047 | }
1048 | if ($ml_assign == 1) {
1049 | if (/;/) {
1050 | $ml_assign = 0;
1051 | $ml_assign_start = 0;
1052 | }
1053 | }
1054 | }
1055 | if ($ml_assign) {
1056 | #print STDERR "ml: ".$_;
1057 | }
1058 |
1059 | # Named Begin Block
1060 | # Looking for:
1061 | # ... begin : name ...
1062 | # Current Strategy:
1063 | # - change begin to open curly and remove the name
1064 | s/\bbegin\s*:\s*\S+/{/;
1065 |
1066 | # UnNamed Begin Block
1067 | # Looking for:
1068 | # ... begin ...
1069 | # Current Strategy:
1070 | # - change begin to open curly
1071 | s/\bbegin\b/{/;
1072 |
1073 | # Named End Blocks
1074 | # Looking for:
1075 | # ... end* : name ...
1076 | # Current Strategy:
1077 | # - change end to close curly and remove the name
1078 | s/\bendclass\s*:\s*\S+/};/;
1079 | s/\bendprogram\s*:\s*\S+/}/;
1080 | s/\bendmodule\s*:\s*\S+/}/;
1081 | s/\bendinterface\s*:\s*\S+/}/;
1082 | s/\bendcase\s*:\s*\S+/}/;
1083 | s/\bendfunction\s*:\s*\S+/}/;
1084 | s/\bendtask\s*:\s*\S+/}/;
1085 | #s/\bendclocking\s*:\s*\S+/}/;
1086 | s/\bendgroup\s*:\s*\S+/}/;
1087 | s/\bend\s*:\s*\S+/}/;
1088 |
1089 | # UnNamed End Blocks
1090 | # Looking for:
1091 | # ... end* ...
1092 | # Current Strategy:
1093 | # - change end to close curly
1094 | s/\bendclass\b/};/;
1095 | s/\bendprogram\b/}/;
1096 | s/\bendmodule\b/}/;
1097 | s/\bendinterface\b/}/;
1098 | s/\bendcase\b/}/;
1099 | s/\bendfunction\b/}/;
1100 | s/\bendtask\b/}/;
1101 | #s/\bendclocking\b/}/;
1102 | s/\bendgroup\b/}/;
1103 | s/\bend\b/}/;
1104 |
1105 | # Function
1106 | # C++ function looks exactly like SV function except C++ doesn't have the word "function"
1107 | # Looking for:
1108 | # - function functionscope::functionname ( ...
1109 | # Current Strategy:
1110 | # - remove word function from the line
1111 | s/\bfunction\b//;
1112 |
1113 | # Task
1114 | # C++ function looks exactly like SV task except C++ doesn't have the word "task"
1115 | # AND an SV task doesn't have a return type
1116 | # Looking for:
1117 | # - task taskscope::taskname ( ...
1118 | # Current Strategy:
1119 | # - remove word task from the line
1120 | # - add return type of 'task'
1121 | #s/\btask\b/void/; # originally I changed the word task to void - to show the task as a void function
1122 |
1123 | # Derived Class (and the access specifier)
1124 | # SV Derived Class inherits base class members without affecting the access permissions
1125 | # to a user of the class
1126 | # SV: class myderivedclass extends mybaseclass; ...
1127 | # C++: class myderivedclass : public mybaseclass { ...
1128 | # Current Strategy:
1129 | # - change extends keyword to public access specifier
1130 | s/\bextends\b/: public/;
1131 |
1132 | # Detect and Skip Full Anything in a String
1133 | # Don't want to convert keywords that are in the body of a string
1134 | # Looking for:
1135 | # " ... "
1136 | # Current Strategy:
1137 | # - return what was removed from the inside of double quotes
1138 | if ($str_back ne "") {
1139 | s/""/"$str_back"/;
1140 | $str_back = "";
1141 | }
1142 | if ($str_line_continue) {
1143 | #print STDERR "still in string\n";
1144 | #print STDERR $_;
1145 | if (s/"lcstart\\/"$str_back_lc_start\\/) {
1146 | #print STDERR "start!".$str_back_lc_start."\n";
1147 | $str_back_lc_start = "";
1148 | }
1149 | elsif (s/lcmiddle\\/$str_back_lc_mid\\/) {
1150 | #print STDERR "mid!".$str_back_lc_mid."\n";
1151 | $str_back_lc_mid = "";
1152 | }
1153 | elsif (s/lcend"/$str_back_lc_end"/) {
1154 | #print STDERR "END!".$str_back_lc_end."\n";
1155 | $str_back_lc_end = "";
1156 | $str_line_continue = 0;
1157 | }
1158 | else {
1159 | die "FATAL: string line continue at file line ".$infile_line;
1160 | }
1161 | }
1162 |
1163 | # Return the Inline Comment to the End of the Line
1164 | # NOTE: doxygen cannot handle an inline comment in a macro -- SV specifies that those comments should be ignored
1165 | if ($inline_comment ne "") {
1166 | #print STDERR "still - inline comment found at line $infile_line\n";
1167 | if ($macro_start || $multiline_macro) {
1168 | #print STDERR "Macro with inline comment found at line $infile_line\n";
1169 | s/\/\/\\/\/\*$inline_comment\*\/ \\/; # in macro - convert inline comment to inline block comment
1170 | }
1171 | else {
1172 | s/\/\//\/\/$inline_comment/;
1173 | }
1174 | $inline_comment = "";
1175 | }
1176 | if ($inline_block_comment ne "") {
1177 | s/\/\*\*\//\/\*$inline_block_comment\*\//;
1178 | $inline_block_comment = "";
1179 | }
1180 |
1181 | print;
1182 | }
1183 |
1184 | # Define Doxygen Modules
1185 | if ($moduleinterface) {
1186 | print "/** \@defgroup SVinterface Interfaces */\n";
1187 | }
1188 | if ($moduleprogram) {
1189 | print "/** \@defgroup SVprogram Programs */\n";
1190 | }
1191 | if ($modulemodule) {
1192 | print "/** \@defgroup SVmodule Modules */\n";
1193 | }
1194 |
1195 |
--------------------------------------------------------------------------------
/html/idv_dox_footer.html:
--------------------------------------------------------------------------------
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 |
44 |
45 |
46 | ![]() 47 | Intelligent Design Verification 48 | Project: $projectname, Revision: $projectnumber 49 | 50 | |
51 |
52 |
53 | Copyright (c) 2008-2010 Intelligent Design Verification. 54 | Permission is granted to copy, distribute and/or modify this document 55 | under the terms of the GNU Free Documentation License, Version 1.2 56 | or any later version published by the Free Software Foundation; 57 | with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. 58 | A copy of the license is included here: 59 | http://www.intelligentdv.com/licenses/fdl.txt 60 | 61 | |
62 |
63 |
64 | ![]() 65 | Doxygen Version: $doxygenversion 66 | IDV SV Filter Version: 2.6.3 67 | $datetime 68 | |
69 |