File size: 1,135 Bytes
27be9c5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | /*
Copyright (c) 2017, The University of Bristol, Senate House, Tyndall Avenue, Bristol, BS8 1TH, United Kingdom.
Copyright (c) 2021, COSIC-KU Leuven, Kasteelpark Arenberg 10, bus 2452, B-3001 Leuven-Heverlee, Belgium.
All rights reserved
*/
#include "GC/SimplifyCircuit.h"
#include <fstream>
#include <iostream>
#include <string.h>
using namespace std;
int main(int argc, const char *argv[])
{
if (argc != 2)
{
cout << "Call using\n\tmake-mad.x file\nto convert \n\tBristol/file.txt\nto include MADD gates\n";
exit(1);
}
string input_file_name= argv[1], output_file_name= argv[1];
input_file_name= "Bristol/" + input_file_name + ".txt";
output_file_name= "MAND-Circuits/" + output_file_name + ".txt";
cout << "Input : " << input_file_name << endl;
cout << "Output : " << output_file_name << endl;
Circuit C;
ifstream inpf(input_file_name.c_str());
if (inpf.fail())
{
throw file_error(input_file_name);
}
inpf >> C;
inpf.close();
C.merge_AND_gates();
ofstream outf(output_file_name.c_str());
outf << C << endl;
outf.close();
cout << "All done" << endl;
}
|