-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetCircuitStats.cpp
More file actions
33 lines (26 loc) · 934 Bytes
/
getCircuitStats.cpp
File metadata and controls
33 lines (26 loc) · 934 Bytes
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
#include "Circuit.h"
#include <fstream>
#include <string>
#include <filesystem>
int main(int argc, char* argv[]) {
if (argc < 2) {
std::cerr << "Usage: " << argv[0] << " <VerilogFileName> [<generations> <parameter>]" << std::endl;
return 1;
}
if (!std::filesystem::exists(argv[1])) {
std::cerr << "File does not exist: " << argv[1] << std::endl;
return 1;
}
std::string path = argv[1];
size_t lastSlashPos = path.find_last_of('/');
std::string bench_name = path.substr(lastSlashPos + 1);
bench_name = bench_name.substr(0, bench_name.size() - 2); // Removing ".v"
Circuit circuit;
circuit.loadFromVerilog(argv[1],2);
circuit.update();
std::cout << bench_name << ", "
<< circuit.parameters[SIZE] << ", "
<< circuit.parameters[ENTROPY] << ", "
<< circuit.parameters[DEPTH] << std::endl;
return 0;
}