Archive for May, 2007

a2ps

Posted in Programming on May 22, 2007 by aghoras

To print code in color
a2ps –pro=color [files]

To generate a color PDF of code
a2ps –pro=color -Ppdf [files]

When using a2ps use the following to fix the cropped margins on a Deskjet printer:
a2ps -M letterdj counter_test.vh

In Cygwin, to convert things to a PDF
a2ps -r -M letterdj -o - Parity_Gen.vhd | ps2pdf - foo.pdf

 Another good way to print a bunch of files

a2ps  –toc -l 120 -r -M letterdj -o -  *.vhd |ps2pdf -  foo.pdf

Bash Notes

Posted in Programming on May 22, 2007 by aghoras

Loops

for i in *.pdf ;
        do echo $i
done

or

for (( i=0; i< 4; i++)); do echo $i;done

Bash functions:

function PrintDo(){
        #print the first parameter
        echo $1
}

Sizing unsigned to bit vectors

Posted in vhdl on May 10, 2007 by aghoras

To size a number and store it in a std_logic_vector use the following:

assuming:

signal DataOut : std_logic_vector(0 to 31) ;

use:

DataOut <= std_logic_vector(to_unsigned(0,DataOut'length));

Planning a Trip from COS to New Orleans

Posted in Flying on May 1, 2007 by aghoras

The ID for the airport near Belle Chasse, LA is 65LA. The trip from KCOS to KNEW is 895nm long direct. A good place to stop is Paul’s Valley Municipal (KPVJ) which is at the halfway point (KCOS->KPVJ: 423nm, KPVJ->KNEW: 460nm)

RegEx Examples in Perl

Posted in Programming on May 1, 2007 by aghoras

Perl RegEx examples:

#!/usr/bin/perl -w
#
# Playing with RegEx
#
#

#Use grouping to put colons around capital letters
$Test = “Lord Whopper of Fibbing”;
$Test =~ s/([A-Z])/:$1:/g;
print “$Test\n”;

#Straight Forward Substistution
$Test = “Lord Whopper of Fibbing”;
$Test =~ s/L/l/;
print “$Test\n”;

#Use grouping to swap the first and last letters
$Test = “Lord Whopper of Fibbing”;
$Test =~ s/^(.)(.*)(.)$/$3$2$1/;
print “$Test\n”;

#checking values using regex
$sentence = “Best winkles in Sunderland”;
if ($sentence =~ /under/)
{
print “We’re talking about rugby\n”;
}

#checking values using regex ignoring case
$sentence = “Best winkles in Sunderland”;
if ($sentence =~ /Under/i)
{
print “We’re talking about rugby\n”;
print $sentence, “\n”;
}

#checking values using regex ignoring case
# This one has an extra m
$sentence = “Best winkles in Sunderland”;
if ($sentence =~ m/Under/i)
{
print “We’re talking about rugby\n”;
print $sentence, “\n”;
}

#
# Using split
#
$CDV=”Apple,Orange,Banana,Grapes,Pear”;
@fruits=split(/,/,$CDV);
foreach $fruit ( @fruits ){
print $fruit,”\n”;
}