Skip to content

Commit

Permalink
fixed makefile, add target depth option to simplemapper
Browse files Browse the repository at this point in the history
  • Loading branch information
kheyse committed Feb 26, 2014
1 parent 60a2101 commit 2cce958
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 21 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ ABC_VERSION = 810ba683c042
RAPIDSMITH_VERSION = 0.5.1-linux64
HESSIAN_VERSION = 4.0.6
JAVABDD_VERSION = 1.0b2
JOPT_SIMPLE_VERSION = 4.5

javaClasses = java/src/be/ugent/elis/recomp/mapping/tmapSimple/TMapSimple.java java/src/be/ugent/elis/recomp/aig/MergeAag.java java/src/be/ugent/elis/recomp/mapping/simple/SimpleMapper.java java/src/be/ugent/elis/recomp/aig/MakeCEvaluator.java java/src/be/ugent/elis/recomp/aig/MakeCEvaluator.java java/src/be/ugent/elis/recomp/util/ExtractInfo.java


.PHONY : java third_party all aigtoaig abc javabdd source
.PHONY : java third_party all aigtoaig abc javabdd jopt_simple source
.SUFFIXES: .java .class

all : java source third_party
Expand All @@ -18,25 +19,26 @@ java : $(javaClasses:.java=.class)
$(javaClasses:.java=.class) : rapidSmith
.java.class :
mkdir -p java/bin
javac -d java/bin -classpath java/src:third_party/rapidSmith:third_party/rapidSmith/jars/hessian-${HESSIAN_VERSION}.jar:third_party/JavaBDD/javabdd-1.0b2.jar $<

javac -d java/bin -classpath java/src:third_party/rapidSmith:third_party/rapidSmith/jars/hessian-${HESSIAN_VERSION}.jar:third_party/JavaBDD/javabdd-1.0b2.jar:third_party/jopt-simple-${JOPT_SIMPLE_VERSION}.jar $<


source :
echo "export PATH=${PWD}/python/src:${PWD}/third_party/bin:"'$${PATH}' > source
echo "export CLASSPATH=${PWD}/java/bin:${PWD}/third_party/rapidSmith/jars/hessian-${HESSIAN_VERSION}.jar:"'$${CLASSPATH:-}' >> source
echo "export CLASSPATH=${PWD}/third_party/JavaBDD/javabdd-1.0b2.jar:"'$${CLASSPATH:-}' >> source
echo "export CLASSPATH=${PWD}/third_party/jopt-simple-${JOPT_SIMPLE_VERSION}.jar"'$${CLASSPATH:-}' >> source
echo "export PYTHONPATH=${PWD}/python/src:"'$${PYTHONPATH:-}' >> source
echo "export RAPIDSMITH_PATH=${PWD}/third_party/rapidSmith" >> source
echo "export TLUTFLOW_PATH=${PWD}" >> source



third_party : aigtoaig abc rapidSmith javabdd
third_party : aigtoaig abc rapidSmith javabdd jopt_simple
aigtoaig : third_party/aiger-${AIGER_VERSION}/aigtoaig third_party/bin/aigtoaig
abc : third_party/abc_${ABC_VERSION}/abc third_party/bin/abc third_party/etc/abc.rc
rapidSmith : third_party/rapidSmith
javabdd : third_party/JavaBDD/javabdd-${JAVABDD_VERSION}.jar
jopt_simple : third_party/jopt-simple-${JOPT_SIMPLE_VERSION}.jar

third_party/bin/aigtoaig :
mkdir -p third_party/bin
Expand Down Expand Up @@ -92,3 +94,6 @@ third_party/javabdd_${JAVABDD_VERSION}.tar.gz :
third_party/JavaBDD/javabdd-${JAVABDD_VERSION}.jar : third_party/javabdd_${JAVABDD_VERSION}.tar.gz
tar -xzf third_party/javabdd_${JAVABDD_VERSION}.tar.gz -C third_party
touch third_party/JavaBDD/javabdd-${JAVABDD_VERSION}.jar

third_party/jopt-simple-${JOPT_SIMPLE_VERSION}.jar :
cd third_party && curl -O http://central.maven.org/maven2/net/sf/jopt-simple/jopt-simple/${JOPT_SIMPLE_VERSION}/jopt-simple-${JOPT_SIMPLE_VERSION}.jar
42 changes: 29 additions & 13 deletions java/src/be/ugent/elis/recomp/mapping/simple/SimpleMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ e. before Licensee sends such Adaptation to any other people or entities, Licens

import javax.print.attribute.standard.PrinterName;

import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;

import be.ugent.elis.recomp.mapping.tmapSimple.ParameterMarker;
import be.ugent.elis.recomp.mapping.utils.MappingAIG;
import be.ugent.elis.recomp.synthesis.BDDFactorySingleton;
Expand All @@ -90,40 +94,52 @@ public class SimpleMapper {
*/
public static void main(String[] args) throws FileNotFoundException {
BDDFactorySingleton.get(1000, 1000);

OptionParser parser = new OptionParser();
OptionSpec<String> files_option = parser.nonOptions().ofType( String.class );
OptionSpec<Integer> depth_option =
parser.accepts("depth").withRequiredArg().ofType( Integer.class ).defaultsTo(-1);
OptionSet options = parser.parse(args);

// Usage:
// <0> : input file with aag
// <1> : integer/number of inputs per LUT
// <2> : output file with mapped blif
//
// -d<int> : optional target depth

String[] arguments = options.valuesOf(files_option).toArray(new String[1]);
int target_depth = depth_option.value(options);

// Read AIG file
MappingAIG a = new MappingAIG(arguments[0]);

// Read AIG file
MappingAIG a = new MappingAIG(args[0]);
int K = Integer.parseInt(arguments[1]);

int K = Integer.parseInt(args[1]);
// a.visitAll(new ParameterMarker(new FileInputStream(args[1])));

// Mapping
System.out.println("Cone Enumeration:");
ConeEnumeration enumerator = new ConeEnumeration(K);

a.visitAll(enumerator);
System.out.println("Cone Ranking:");
a.visitAll(new ConeRanking(new DepthOrientedConeComparator()));
a.visitAllInverse(new ConeSelection());

double depthBeforeAreaRecovery = a.getDepth();
a.visitAllInverse(new HeightCalculator());
a.visitAllInverse(new HeightCalculator(target_depth));
a.visitAll(new ConeRanking(new AreaflowOrientedConeComparator(),true,false));
a.visitAllInverse(new ConeSelection());
a.visitAllInverse(new HeightCalculator());
a.visitAllInverse(new HeightCalculator(target_depth));
a.visitAll(new ConeRanking(new AreaOrientedConeComparator(),false,true));
if(depthBeforeAreaRecovery != a.getDepth()) {
System.err.println("Depth increased during area recovery: from "+depthBeforeAreaRecovery+" to "+a.getDepth());
System.exit(1);
}

// a.visitAllInverse(new PrintNameVisitor());


System.out.println("Cone Selection:");
a.visitAllInverse(new ConeSelection());

System.out.println(a.numLuts() +"\t"+ a.getDepth() +"\t"+ enumerator.getNmbrCones() +"\t"+ enumerator.getNmbrKCones() +"\t"+ enumerator.getNmbrDominatedCones());

// Writing a blif
a.printLutStructureBlif(new PrintStream(new BufferedOutputStream(new FileOutputStream(args[2]))), K);
a.printLutStructureBlif(new PrintStream(new BufferedOutputStream(new FileOutputStream(args[2]))), K);
}
}
17 changes: 13 additions & 4 deletions java/src/be/ugent/elis/recomp/mapping/tmapSimple/TMapSimple.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ public class TMapSimple {
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// Find the base name of the aag file
//String baseName = args[0].substring(0,args[0].lastIndexOf('.'));
BDDFactorySingleton.get(1000, 1000);

//Usage:
// <0> : input file with aig
Expand All @@ -110,8 +109,18 @@ public static void main(String[] args) throws IOException {
// <5> : input VHDL file (used to copy VHDL header)
// <6> : output VHDL file with (T)LUT structure
// <7> : output file with VHDL names of TLUT instances

BDDFactorySingleton.get(1000, 1000);
//
// -d<int> : optional target depth

OptionParser parser = new OptionParser();
OptionSpec<String> files_option = parser.nonOptions().ofType( String.class );
OptionSpec<Integer> depth_option =
parser.accepts("depth").withRequiredArg().ofType( Integer.class ).defaultsTo(-1);
OptionSet options = parser.parse(args);

String[] arguments = options.valuesOf(files_option).toArray(new String[1]);
int target_depth = depth_option.value(options);


// Read AIG file
MappingAIG a = new MappingAIG(args[0]);
Expand Down

0 comments on commit 2cce958

Please sign in to comment.