X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=2_isa%2Fgentex.pl;h=967bd7a99b1101dae2a073c05295664b202fe62d;hb=60851688b35e13c41b92518d7f5657499666080d;hp=bee4292f355ed91e0a58702924b999888fc58aba;hpb=595a5016d75b5e975435564698b89c0fb08cb715;p=calu.git diff --git a/2_isa/gentex.pl b/2_isa/gentex.pl index bee4292..967bd7a 100755 --- a/2_isa/gentex.pl +++ b/2_isa/gentex.pl @@ -1,6 +1,10 @@ #!/usr/bin/perl use strict; +sub plaintext { + print $_[0]; +} + sub ins { my $bits = $_[0]; my $bline; @@ -17,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) { @@ -70,7 +77,7 @@ sub ins { $count = $bits-1; - $tabular = "\\subsubsection{".$_[1]."}\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--) { @@ -157,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 .= "Alias & ".$_[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) {