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 // Returns number of reads, writes, acts, pres and refs in the trace |
62 CommandAnalysis(const int64_t nbrofBanks); |
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 |
121 // function for clearing arrays 122 void clear(); 123 124 // To identify auto-precharges 125 void getCommands(const MemorySpecification& memSpec, |
126 std::vector<MemCommand>& list, 127 bool lastupdate); 128 129 private: |
130 int64_t zero; |
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 |
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; |
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; |
175 |
176 // To perform timing analysis of a given set of commands and update command counters 177 void evaluate(const MemorySpecification& memSpec, |
178 std::vector<MemCommand>& cmd_list); |
179 180 // To calculate time of completion of any issued command |
181 int64_t timeToCompletion(const MemorySpecification& memSpec, |
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); |
199 void printWarning(const std::string& warning, int type, int64_t timestamp, int bank); 200}; 201} 202#endif // ifndef COMMAND_TIMINGS_H |