progs: bench tools bei deepjit.s geadded
[calu.git] / 2_isa / gentex.pl
index 4b0d8ee82bd3e2baf5c4e2604589a34e087bba38..967bd7a99b1101dae2a073c05295664b202fe62d 100755 (executable)
@@ -21,8 +21,11 @@ sub ins {
        my $x;
        my @fieldnames;
        my @flagnames = ('SF', 'CF', 'OF', 'ZF');
+       my $section = "\\subsubsection";
 
-
+       if($_[9]) {
+               $section = "\\item ";
+       }
 
        @fields = split(/\|/, $_[3]);
        foreach my $field (@fields) {
@@ -74,7 +77,7 @@ sub ins {
 
        $count = $bits-1;
 
-       $tabular = "\\subsubsection{\\texttt{".$_[1]."} -- ".$_[2]."}\n";
+       $tabular = $section."{\\texttt{".$_[1]."} -- ".$_[2]."}\n";
        $tabular .= "\\begin{center} \n \\resizebox{\\textwidth}{!}{\n";
        $tabular .= "\\begin{tabular}{|l|";
        for($i = $bits-1; $i >= 0; $i--) {
@@ -161,22 +164,42 @@ sub ins {
                $tabular .= "\\paragraph{Example:}~\\\\ \n \\begin{lstlisting} \n ".$_[7]. " \\end{lstlisting}\n";
        }
 
+       print $tabular;
+
        if($_[8]) {
-               $tabular .= "\\paragraph{Aliases to this Instruction:}~\\\\\ \n";
+               print "\\paragraph{Aliases to this Instruction:} \n";
                my @aliases = split(/\|/, $_[8]);
 
-               $tabular .= "\\begin{table}[!h] \n \\centering \n \\begin{tabular}{|c|c|} \\hline \n";
-               $tabular .= "\\textbf{Alias }& \\textbf{".$_[1]." equivalent}\\\\ \\hline \n";
+               print "\\begin{list}{\\labelitemi}{\\leftmargin=0em \\itemindent=1em}";
+
+
                foreach my $alias (@aliases) {
-                       my $equv;
-                       my $from;
-                       ($from, $equv) = split(/-/, $alias);
-                       $tabular .= $from . " & ".$equv." \\\\ \\hline \n";
+                       my $long;
+                       my $sub;
+                       my @params;
+                       my $namelist = $_[4];
+
+                       @params = split(/-/, $alias);
+                       $sub = @params[0];
+                       $long = @params[1];
+                       shift(@params); shift(@params);
+
+                       foreach my $vals (@params) {
+                               my $field;
+                               my $val;
+                               ($field, $val) = split(/\//, $vals);
+
+                               my @fieldnames = split(/\|/, $namelist);
+
+                               $fieldnames[$field] = $fieldnames[$field]."(".$val.")";
+                               $namelist = join("|",@fieldnames);
+                       }
+
+                       ins($_[0], $sub, $long,$_[3], $namelist, '', '', '', '',1);
                }
-               $tabular .= "\\end{tabular} \n \\caption{Aliases to the instruction ".$_[1]."} \n \\end{table}";
+               print "\\end{list}";
        }
 
-       print $tabular;
 }
 
 if($#ARGV != 0) {