-
Notifications
You must be signed in to change notification settings - Fork 1
/
define.hpp
79 lines (65 loc) · 1.94 KB
/
define.hpp
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 __DEFINE_HPP
#define __DEFINE_HPP
//#define NDEBUG
#include <assert.h>
/** runtime info **/
#define PE_ARRAY_STATE_FILE_PATH "./output/PEArrayState.txt"
#define REFORMED_PE_ARRAY_STATE_FILE_PATH "./output/RePEArrayState.txt"
#define PRINT_RUNTIME_INFO_TO_STD
#define PRINT_RUNTIME_INFO_TO_FILE
/** output file path **/
#define PRINT_INFO_TO_STD
#define PRINT_INFO_TO_FILE
#define PRINT_ERROR_TO_STD
#define PRINT_ERROR_TO_FILE
#define PRINT_WARNING_TO_STD
#define PRINT_WARNING_TO_FILE
#define INFO_FILE_PATH "./output/info.txt"
#define INFO_ERROR_PATH "./output/error.txt"
#define INFO_WARNING_PATH "./output/warning.txt"
/** some assumption of the hardware behaviours **/
#define REG_WRITE_THE_SAME_VALUE_NOT_CONSUME_POWER
/** i.e. when writing the same value to register
* as it contained, it won't add to writing time
**/
#define COMBI_LOGIC_HOLD_THE_SAME_VALUE_NOT_CONSUME_POWER
#define MAX_PARAM_SIZE 16/// temporary solution in case of the copy of vector
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
class String{
private:
public:
static inline std::string NumToString(int num){
std::stringstream ss;
ss<<num;
return ss.str();
}
static inline std::string NumToString(float num){
std::stringstream ss;
ss<<num;
return ss.str();
}
static inline std::string NumToString(uint64_t num){
std::stringstream ss;
ss<<num;
return ss.str();
}
static inline std::string NumToString(uint32_t num){
std::stringstream ss;
ss<<num;
return ss.str();
}
static inline bool isNum(std::string& str){
std::stringstream sin(str);
double d;
char c;
if(!(sin >> d))
return false;
if (sin >> c)
return false;
return true;
}
};
#endif // __DEFINE_HPP