-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircuit.h
80 lines (58 loc) · 2.01 KB
/
circuit.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef __CIRCUIT_H__
#define __CIRCUIT_H__
#include <stdlib.h>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <assert.h>
#include <stack>
#include <queue>
using namespace std;
#include "node.h"
typedef map<string,Node*>::iterator mapIter;
class Circuit
{
private:
map<string,Node*> nodeMap;
string name;
public:
// constructors
Circuit() {};
Circuit(const string &filename)
{ if (readBLIF(filename)) cout << "error in reading " << filename << endl; }
// destructor
~Circuit();
// get number of nodes in the circuit
unsigned getNumNodes() { return nodeMap.size(); }
// get and set the name of the circuit
string getName() { return name; }
int setName(const string &modelName) { name = modelName; return 0; }
// get primary inputs and outputs
vector<Node*> getPIs();
vector<Node*> getPOs();
// sets the node of <string> as primary input and output
int setPI(const string &input);
int setPO(const string &output);
// set (assign) nodes in specific format as primary inputs and outputs from [startBit,endBit)
// for a given string <string> and numBits, format is <string>[startBit] ... <string[endBit-1]
int setPIs(const string &input, unsigned int startBit, unsigned int endBit);
int setPOs(const string &output, unsigned int startBit, unsigned int endBit);
// check to see if a node is there
Node* findNode(const string &nodeName);
// create an empty node - will return NULL if node already exists
Node* createNode(const string &nodeName);
// prints out the contents of the circuit
int print();
// reads in circuit from BLIF format
int readBLIF(const string &filename);
// writes circuit in BLIF format
int writeBLIF(const string &filename);
// erases the contents of the entire circuit
int clear();
void printTopo();
void simOutputs(string inputFile);
};
#endif