CommandAnalysis.h (10428:0caf62b57dfd) CommandAnalysis.h (11555:2efa95cf8504)
1/*
2 * Copyright (c) 2012-2014, TU Delft
3 * Copyright (c) 2012-2014, TU Eindhoven
4 * Copyright (c) 2012-2014, TU Kaiserslautern
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are

--- 44 unchanged lines hidden (view full) ---

53class CommandAnalysis {
54 public:
55 // Power-Down and Self-refresh related memory states
56 enum memstate {
57 MS_PDN_F_ACT = 10, MS_PDN_S_ACT = 11, MS_PDN_F_PRE = 12,
58 MS_PDN_S_PRE = 13, MS_SREF = 14
59 };
60
1/*
2 * Copyright (c) 2012-2014, TU Delft
3 * Copyright (c) 2012-2014, TU Eindhoven
4 * Copyright (c) 2012-2014, TU Kaiserslautern
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are

--- 44 unchanged lines hidden (view full) ---

53class CommandAnalysis {
54 public:
55 // Power-Down and Self-refresh related memory states
56 enum memstate {
57 MS_PDN_F_ACT = 10, MS_PDN_S_ACT = 11, MS_PDN_F_PRE = 12,
58 MS_PDN_S_PRE = 13, MS_SREF = 14
59 };
60
61 CommandAnalysis();
62
63 // Returns number of reads, writes, acts, pres and refs in the trace
61 // Returns number of reads, writes, acts, pres and refs in the trace
64 CommandAnalysis(const int nbrofBanks);
62 CommandAnalysis(const int64_t nbrofBanks);
65
66 // Number of activate commands
67 int64_t numberofacts;
68 // Number of precharge commands
69 int64_t numberofpres;
70 // Number of reads commands
71 int64_t numberofreads;
72 // Number of writes commands

--- 39 unchanged lines hidden (view full) ---

112 int64_t sref_ref_act_cycles;
113 // Number of precharged auto-refresh cycles in self-refresh mode
114 int64_t sref_ref_pre_cycles;
115 // Number of active auto-refresh cycles during self-refresh exit
116 int64_t spup_ref_act_cycles;
117 // Number of precharged auto-refresh cycles during self-refresh exit
118 int64_t spup_ref_pre_cycles;
119
63
64 // Number of activate commands
65 int64_t numberofacts;
66 // Number of precharge commands
67 int64_t numberofpres;
68 // Number of reads commands
69 int64_t numberofreads;
70 // Number of writes commands

--- 39 unchanged lines hidden (view full) ---

110 int64_t sref_ref_act_cycles;
111 // Number of precharged auto-refresh cycles in self-refresh mode
112 int64_t sref_ref_pre_cycles;
113 // Number of active auto-refresh cycles during self-refresh exit
114 int64_t spup_ref_act_cycles;
115 // Number of precharged auto-refresh cycles during self-refresh exit
116 int64_t spup_ref_pre_cycles;
117
118 // function for clearing counters
119 void clearStats(const int64_t timestamp);
120
120 // function for clearing arrays
121 void clear();
122
123 // To identify auto-precharges
124 void getCommands(const MemorySpecification& memSpec,
121 // function for clearing arrays
122 void clear();
123
124 // To identify auto-precharges
125 void getCommands(const MemorySpecification& memSpec,
125 const int
126 nbrofBanks,
127 std::vector<MemCommand>& list,
128 bool lastupdate);
129
130 private:
126 std::vector<MemCommand>& list,
127 bool lastupdate);
128
129 private:
131 unsigned init;
132 int64_t zero;
130 int64_t zero;
133 unsigned pop;
134 // Cached last read command from the file
135 std::vector<MemCommand> cached_cmd;
136
137 // Stores the memory commands for analysis
138 std::vector<MemCommand> cmd_list;
139
131 // Cached last read command from the file
132 std::vector<MemCommand> cached_cmd;
133
134 // Stores the memory commands for analysis
135 std::vector<MemCommand> cmd_list;
136
140 // Stores all memory commands for analysis
141 std::vector<MemCommand> full_cmd_list;
142
143 // To save states of the different banks, before entering active
144 // power-down mode (slow/fast-exit).
145 std::vector<int> last_states;
146 // Bank state vector
147 std::vector<int> bankstate;
148
149 std::vector<int64_t> activation_cycle;
150 // To keep track of the last ACT cycle

--- 15 unchanged lines hidden (view full) ---

166 // Clock cycle when self-refresh was issued
167 int64_t sref_cycle;
168
169 // Clock cycle when the latest power-down was issued
170 int64_t pdn_cycle;
171
172 // Memory State
173 unsigned mem_state;
137 // To save states of the different banks, before entering active
138 // power-down mode (slow/fast-exit).
139 std::vector<int> last_states;
140 // Bank state vector
141 std::vector<int> bankstate;
142
143 std::vector<int64_t> activation_cycle;
144 // To keep track of the last ACT cycle

--- 15 unchanged lines hidden (view full) ---

160 // Clock cycle when self-refresh was issued
161 int64_t sref_cycle;
162
163 // Clock cycle when the latest power-down was issued
164 int64_t pdn_cycle;
165
166 // Memory State
167 unsigned mem_state;
168 unsigned num_active_banks;
174
175 // Clock cycle of first activate command when memory state changes to ACT
176 int64_t first_act_cycle;
177
178 // Clock cycle of last precharge command when memory state changes to PRE
179 int64_t last_pre_cycle;
169
170 // Clock cycle of first activate command when memory state changes to ACT
171 int64_t first_act_cycle;
172
173 // Clock cycle of last precharge command when memory state changes to PRE
174 int64_t last_pre_cycle;
180 // To collect and analyse all commands including auto-precharges
181 void analyse_commands(const int nbrofBanks,
182 Data::MemorySpecification
183 memSpec,
184 int64_t nCommands,
185 int64_t nCached,
186 bool lastupdate);
175
187 // To perform timing analysis of a given set of commands and update command counters
188 void evaluate(const MemorySpecification& memSpec,
176 // To perform timing analysis of a given set of commands and update command counters
177 void evaluate(const MemorySpecification& memSpec,
189 std::vector<MemCommand>& cmd_list,
190 int nbrofBanks);
178 std::vector<MemCommand>& cmd_list);
191
192 // To calculate time of completion of any issued command
179
180 // To calculate time of completion of any issued command
193 int timeToCompletion(const MemorySpecification& memSpec,
181 int64_t timeToCompletion(const MemorySpecification& memSpec,
194 MemCommand::cmds type);
195
196 // To update idle period information whenever active cycles may be idle
197 void idle_act_update(const MemorySpecification& memSpec,
198 int64_t latest_read_cycle,
199 int64_t latest_write_cycle,
200 int64_t latest_act_cycle,
201 int64_t timestamp);
202
203 // To update idle period information whenever precharged cycles may be idle
204 void idle_pre_update(const MemorySpecification& memSpec,
205 int64_t timestamp,
206 int64_t latest_pre_cycle);
207
208 void printWarningIfActive(const std::string& warning, int type, int64_t timestamp, int bank);
209 void printWarningIfNotActive(const std::string& warning, int type, int64_t timestamp, int bank);
182 MemCommand::cmds type);
183
184 // To update idle period information whenever active cycles may be idle
185 void idle_act_update(const MemorySpecification& memSpec,
186 int64_t latest_read_cycle,
187 int64_t latest_write_cycle,
188 int64_t latest_act_cycle,
189 int64_t timestamp);
190
191 // To update idle period information whenever precharged cycles may be idle
192 void idle_pre_update(const MemorySpecification& memSpec,
193 int64_t timestamp,
194 int64_t latest_pre_cycle);
195
196 void printWarningIfActive(const std::string& warning, int type, int64_t timestamp, int bank);
197 void printWarningIfNotActive(const std::string& warning, int type, int64_t timestamp, int bank);
198 void printWarningIfPoweredDown(const std::string& warning, int type, int64_t timestamp, int bank);
210 void printWarning(const std::string& warning, int type, int64_t timestamp, int bank);
211};
212}
213#endif // ifndef COMMAND_TIMINGS_H
199 void printWarning(const std::string& warning, int type, int64_t timestamp, int bank);
200};
201}
202#endif // ifndef COMMAND_TIMINGS_H