Upload graph Match

This commit is contained in:
PKU-ZLR 2019-12-07 12:57:48 +08:00 committed by GitHub
parent 5ba9936da3
commit e138645b4e
2 changed files with 17 additions and 9 deletions

View File

@ -1,4 +1,5 @@
#include "Circuit.h"
#include "Match.h"
vector<string> split(string str, string separator) { // split a string by the separator
vector<string> dest;
@ -173,12 +174,17 @@ void Circuit::abc_lut_map(string lib) {
getline(fin, s);
vector<string> names = split(s, " ");
++abc_lut[names.size() - 2];
// for (int i = 0; i < names.size(); i++)
// cout << names[i] << endl;
}
fin.close();
for (int i = 0; i < 10; ++i) {
abc_lut_area += abc_lut[i] * area[i];
}
cout << "ABC Area1: " << abc_lut_area << endl;
Match *mt = new Match();
cout << "ABC Area2: " << abc_lut_area - mt->getMatch(benchmark + "_lut.blif")<< endl;
}
void Circuit::write_dot() {
@ -191,7 +197,9 @@ void Circuit::write_dot() {
fout << "digraph G {\nsize = \"7.5,10\";\ncenter = true;" << endl;
for (pair<string, Var*> p : graph) {
fout << p.first;
//for (int i = 0; i < p.first.length(); i++)
// if (p.first[i] != '[' && p.first[i] != ']')
fout << p.first;
if (p.second->is_in) {
fout << "[shape = invtriangle, color = coral, fillcolor = coral];" << endl;
} else if (p.second->is_out) {

View File

@ -190,14 +190,14 @@ int main(int argc, char *argv[]) {
vector<string> benchmark;
queue<string> Q;
map<string, int> ind;
unsigned int C = 15; // record the most C Cuts
string dir = "benchmark/ISCAS85";
string outdir = "result/ISCAS85";
unsigned int C = 8; // record the most C Cuts
string dir = "benchmark/EPFL";
string outdir = "result/EPFL";
get_file_name(dir, benchmark);
for (string str : benchmark) {
cout << str << endl;
//string str = "cir1.v"; {
for (string str : benchmark) {
cout << str << endl;
//string str = "arbiter.blif"; {
double total_time;
clock_t start = clock();
@ -288,7 +288,7 @@ int main(int argc, char *argv[]) {
}
}
for (int k = 1; k <= Luts; k++) {
sort(Cuts[k].begin(), Cuts[k].end(), cmp_Depth2);
sort(Cuts[k].begin(), Cuts[k].end(), cmp_Depth);
c.graph[now]->cuts[k].clear();
unsigned int len = Cuts[k].size();
//cout << "now:" << now << endl;
@ -299,7 +299,7 @@ int main(int argc, char *argv[]) {
}
//if (c.graph[now]->pre.size() != 1)
c.graph[now]->cuts[1].insert(set<string> { now });
sort(Ct.begin(), Ct.end(), cmp_Depth2);
sort(Ct.begin(), Ct.end(), cmp_Depth);
int Depth = Ct[0].mindep;
c.graph[now]->mindep = Ct[0].mindep;
c.graph[now]->AreaFlow = Ct[0].AreaFlow;