#! /usr/bin/perl -w # Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. # This file is part of GNU CC. # GNU CC is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # GNU CC is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with GNU CC; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston MA 02111-1307, USA. # This does trivial (and I mean _trivial_) conversion of Texinfo # markup to Perl POD format. It's intended to be used to extract # something suitable for a manpage from a Texinfo document. $output = 0; $skipping = 0; %sects = (); $section = ""; @icstack = (); @endwstack = (); @skstack = (); @instack = (); $shift = ""; %defs = (); $fnno = 1; $inf = ""; $ibase = ""; while ($_ = shift) { if (/^-D(.*)$/) { if ($1 ne "") { $flag = $1; } else { $flag = shift; } $value = ""; ($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/); die "no flag specified for -D\n" unless $flag ne ""; die "flags may only contain letters, digits, hyphens, dashes and underscores\n" unless $flag =~ /^[a-zA-Z0-9_-]+$/; $defs{$flag} = $value; } elsif (/^-/) { usage(); } else { $in = $_, next unless defined $in; $out = $_, next unless defined $out; usage(); } } if (defined $in) { $inf = gensym(); open($inf, "<$in") or die "opening \"$in\": $!\n"; $ibase = $1 if $in =~ m|^(.+)/[^/]+$|; } else { $inf = \*STDIN; } if (defined $out) { open(STDOUT, ">$out") or die "opening \"$out\": $!\n"; } while(defined $inf) { while(<$inf>) { # Certain commands are discarded without further processing. /^\@(?: [a-z]+index # @*index: useful only in complete manual |need # @need: useful only in printed manual |(?:end\s+)?group # @group .. @end group: ditto |page # @page: ditto |node # @node: useful only in .info file |(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents )\b/x and next; chomp; # Look for filename and title markers. /^\@setfilename\s+([^.]+)/ and $fn = $1, next; /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next; # Identify a man title but keep only the one we are interested in. /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do { if (exists $defs{$1}) { $fn = $1; $tl = postprocess($2); } next; }; # Look for blocks surrounded by @c man begin SECTION ... @c man end. # This really oughta be @ifman ... @end ifman and the like, but such # would require rev'ing all other Texinfo translators. /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do { $output = 1 if exists $defs{$2}; $sect = $1; next; }; /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next; /^\@c\s+man\s+end/ and do { $sects{$sect} = "" unless exists $sects{$sect}; $sects{$sect} .= postprocess($section); $section = ""; $output = 0; next; }; # handle variables /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do { $defs{$1} = $2; next; }; /^\@clear\s+([a-zA-Z0-9_-]+)/ and do { de
#!/bin/bash
set -ex
yosys -p '
	read_verilog -formal demo.v
	prep -flatten -nordff -top demo
	write_smt2 -wires demo.smt2
	flatten demo; delete -output
	memory_map; opt -full
	techmap; opt -fast
	abc -fast -g AND; opt_clean
	write_aiger -map demo.aim demo.aig
'
super_prove demo.aig > demo.aiw
yosys-smtbmc --dump-vcd demo.vcd --aig demo demo.smt2
ef\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g; # Turn B blah> into B I B to # match Texinfo semantics of @emph inside @samp. Also handle @r # inside bold. s/<//g; 1 while s/B<((?:[^<>]|I<[^<>]*>)*)R<([^>]*)>/B<$1>${2}B]*)I<([^>]+)>/B<$1>I<$2>B]*)B<([^>]+)>/I<$1>B<$2>I//g; s/([BI])<(\s+)([^>]+)>/$2$1<$3>/g; s/([BI])<([^>]+?)(\s+)>/$1<$2>$3/g; # Extract footnotes. This has to be done after all other # processing because otherwise the regexp will choke on formatting # inside @footnote. while (/\@footnote/g) { s/\@footnote\{([^\}]+)\}/[$fnno]/; add_footnote($1, $fnno); $fnno++; } return $_; } sub unmunge { # Replace escaped symbols with their equivalents. local $_ = $_[0]; s/</E/g; s/>/E/g; s/{/\{/g; s/}/\}/g; s/&at;/\@/g; s/&/&/g; return $_; } sub add_footnote { unless (exists $sects{FOOTNOTES}) { $sects{FOOTNOTES} = "\n=over 4\n\n"; } $sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; $sects{FOOTNOTES} .= $_[0]; $sects{FOOTNOTES} .= "\n\n"; } # stolen from Symbol.pm { my $genseq = 0; sub gensym { my $name = "GEN" . $genseq++; my $ref = \*{$name}; delete $::{$name}; return $ref; } }