Compare commits
	
		
			2 Commits
		
	
	
		
			9de0aed84d
			...
			ec1b820c18
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ec1b820c18 | |||
| 64329cf0f6 | 
| @@ -278,7 +278,7 @@ public: | ||||
|  | ||||
|     void disass_output(uint64_t pc, const std::string instr) override { | ||||
|         NSCLOG(INFO, LOGCAT) << fmt::format("0x{:016x}    {:40} [s:0x{:x};c:{}]", pc, instr, (reg_t)state.mstatus, | ||||
|                                             this->reg.icount + cycle_offset); | ||||
|                                             this->reg.cycle + cycle_offset); | ||||
|     }; | ||||
|  | ||||
|     iss::instrumentation_if* get_instrumentation_if() override { return &instr_if; } | ||||
| @@ -311,7 +311,7 @@ protected: | ||||
|  | ||||
|         uint64_t get_pendig_traps() override { return arch.reg.trap_state; } | ||||
|  | ||||
|         uint64_t get_total_cycles() override { return arch.reg.icount + arch.cycle_offset; } | ||||
|         uint64_t get_total_cycles() override { return arch.reg.cycle + arch.cycle_offset; } | ||||
|  | ||||
|         void update_last_instr_cycles(unsigned cycles) override { arch.cycle_offset += cycles - 1; } | ||||
|  | ||||
| @@ -908,7 +908,7 @@ iss::status riscv_hart_m_p<BASE, FEAT, LOGCAT>::write_plain(unsigned addr, reg_t | ||||
|  | ||||
| template <typename BASE, features_e FEAT, typename LOGCAT> | ||||
| iss::status riscv_hart_m_p<BASE, FEAT, LOGCAT>::read_cycle(unsigned addr, reg_t& val) { | ||||
|     auto cycle_val = this->reg.icount + cycle_offset; | ||||
|     auto cycle_val = this->reg.cycle + cycle_offset; | ||||
|     if(addr == mcycle) { | ||||
|         val = static_cast<reg_t>(cycle_val); | ||||
|     } else if(addr == mcycleh) { | ||||
| @@ -928,7 +928,7 @@ iss::status riscv_hart_m_p<BASE, FEAT, LOGCAT>::write_cycle(unsigned addr, reg_t | ||||
|             mcycle_csr = (static_cast<uint64_t>(val) << 32) + (mcycle_csr & 0xffffffff); | ||||
|         } | ||||
|     } | ||||
|     cycle_offset = mcycle_csr - this->reg.icount; // TODO: relying on wrap-around | ||||
|     cycle_offset = mcycle_csr - this->reg.cycle; // TODO: relying on wrap-around | ||||
|     return iss::Ok; | ||||
| } | ||||
|  | ||||
| @@ -959,7 +959,7 @@ iss::status riscv_hart_m_p<BASE, FEAT, LOGCAT>::write_instret(unsigned addr, reg | ||||
|  | ||||
| template <typename BASE, features_e FEAT, typename LOGCAT> | ||||
| iss::status riscv_hart_m_p<BASE, FEAT, LOGCAT>::read_time(unsigned addr, reg_t& val) { | ||||
|     uint64_t time_val = this->reg.icount / (100000000 / 32768 - 1); //-> ~3052; | ||||
|     uint64_t time_val = this->reg.cycle / (100000000 / 32768 - 1); //-> ~3052; | ||||
|     if(addr == time) { | ||||
|         val = static_cast<reg_t>(time_val); | ||||
|     } else if(addr == timeh) { | ||||
|   | ||||
| @@ -328,7 +328,7 @@ public: | ||||
|  | ||||
|     void disass_output(uint64_t pc, const std::string instr) override { | ||||
|         CLOG(INFO, disass) << fmt::format("0x{:016x}    {:40} [p:{};s:0x{:x};c:{}]", pc, instr, lvl[this->reg.PRIV], (reg_t)state.mstatus, | ||||
|                                           this->reg.icount + cycle_offset); | ||||
|                                           this->reg.cycle + cycle_offset); | ||||
|     }; | ||||
|  | ||||
|     iss::instrumentation_if* get_instrumentation_if() override { return &instr_if; } | ||||
| @@ -361,7 +361,7 @@ protected: | ||||
|  | ||||
|         uint64_t get_pendig_traps() override { return arch.reg.trap_state; } | ||||
|  | ||||
|         uint64_t get_total_cycles() override { return arch.reg.icount + arch.cycle_offset; } | ||||
|         uint64_t get_total_cycles() override { return arch.reg.cycle + arch.cycle_offset; } | ||||
|  | ||||
|         void update_last_instr_cycles(unsigned cycles) override { arch.cycle_offset += cycles - 1; } | ||||
|  | ||||
| @@ -895,7 +895,7 @@ template <typename BASE> iss::status riscv_hart_msu_vp<BASE>::write_reg(unsigned | ||||
| } | ||||
|  | ||||
| template <typename BASE> iss::status riscv_hart_msu_vp<BASE>::read_cycle(unsigned addr, reg_t& val) { | ||||
|     auto cycle_val = this->reg.icount + cycle_offset; | ||||
|     auto cycle_val = this->reg.cycle + cycle_offset; | ||||
|     if(addr == mcycle) { | ||||
|         val = static_cast<reg_t>(cycle_val); | ||||
|     } else if(addr == mcycleh) { | ||||
| @@ -916,7 +916,7 @@ template <typename BASE> iss::status riscv_hart_msu_vp<BASE>::write_cycle(unsign | ||||
|             mcycle_csr = (static_cast<uint64_t>(val) << 32) + (mcycle_csr & 0xffffffff); | ||||
|         } | ||||
|     } | ||||
|     cycle_offset = mcycle_csr - this->reg.icount; // TODO: relying on wrap-around | ||||
|     cycle_offset = mcycle_csr - this->reg.cycle; // TODO: relying on wrap-around | ||||
|     return iss::Ok; | ||||
| } | ||||
|  | ||||
| @@ -944,7 +944,7 @@ template <typename BASE> iss::status riscv_hart_msu_vp<BASE>::write_instret(unsi | ||||
| } | ||||
|  | ||||
| template <typename BASE> iss::status riscv_hart_msu_vp<BASE>::read_time(unsigned addr, reg_t& val) { | ||||
|     uint64_t time_val = this->reg.icount / (100000000 / 32768 - 1); //-> ~3052; | ||||
|     uint64_t time_val = this->reg.cycle / (100000000 / 32768 - 1); //-> ~3052; | ||||
|     if(addr == time) { | ||||
|         val = static_cast<reg_t>(time_val); | ||||
|     } else if(addr == timeh) { | ||||
|   | ||||
| @@ -305,7 +305,7 @@ public: | ||||
|  | ||||
|     void disass_output(uint64_t pc, const std::string instr) override { | ||||
|         NSCLOG(INFO, LOGCAT) << fmt::format("0x{:016x}    {:40} [p:{};s:0x{:x};c:{}]", pc, instr, lvl[this->reg.PRIV], (reg_t)state.mstatus, | ||||
|                                             this->reg.icount + cycle_offset); | ||||
|                                             this->reg.cycle + cycle_offset); | ||||
|     }; | ||||
|  | ||||
|     iss::instrumentation_if* get_instrumentation_if() override { return &instr_if; } | ||||
| @@ -338,7 +338,7 @@ protected: | ||||
|  | ||||
|         uint64_t get_pendig_traps() override { return arch.reg.trap_state; } | ||||
|  | ||||
|         uint64_t get_total_cycles() override { return arch.reg.icount + arch.cycle_offset; } | ||||
|         uint64_t get_total_cycles() override { return arch.reg.cycle + arch.cycle_offset; } | ||||
|  | ||||
|         void update_last_instr_cycles(unsigned cycles) override { arch.cycle_offset += cycles - 1; } | ||||
|  | ||||
| @@ -1105,7 +1105,7 @@ iss::status riscv_hart_mu_p<BASE, FEAT, LOGCAT>::write_plain(unsigned addr, reg_ | ||||
|  | ||||
| template <typename BASE, features_e FEAT, typename LOGCAT> | ||||
| iss::status riscv_hart_mu_p<BASE, FEAT, LOGCAT>::read_cycle(unsigned addr, reg_t& val) { | ||||
|     auto cycle_val = this->reg.icount + cycle_offset; | ||||
|     auto cycle_val = this->reg.cycle + cycle_offset; | ||||
|     if(addr == mcycle) { | ||||
|         val = static_cast<reg_t>(cycle_val); | ||||
|     } else if(addr == mcycleh) { | ||||
| @@ -1125,7 +1125,7 @@ iss::status riscv_hart_mu_p<BASE, FEAT, LOGCAT>::write_cycle(unsigned addr, reg_ | ||||
|             mcycle_csr = (static_cast<uint64_t>(val) << 32) + (mcycle_csr & 0xffffffff); | ||||
|         } | ||||
|     } | ||||
|     cycle_offset = mcycle_csr - this->reg.icount; // TODO: relying on wrap-around | ||||
|     cycle_offset = mcycle_csr - this->reg.cycle; // TODO: relying on wrap-around | ||||
|     return iss::Ok; | ||||
| } | ||||
|  | ||||
| @@ -1156,7 +1156,7 @@ iss::status riscv_hart_mu_p<BASE, FEAT, LOGCAT>::write_instret(unsigned addr, re | ||||
|  | ||||
| template <typename BASE, features_e FEAT, typename LOGCAT> | ||||
| iss::status riscv_hart_mu_p<BASE, FEAT, LOGCAT>::read_time(unsigned addr, reg_t& val) { | ||||
|     uint64_t time_val = this->reg.icount / (100000000 / 32768 - 1); //-> ~3052; | ||||
|     uint64_t time_val = this->reg.cycle / (100000000 / 32768 - 1); //-> ~3052; | ||||
|     if(addr == time) { | ||||
|         val = static_cast<reg_t>(time_val); | ||||
|     } else if(addr == timeh) { | ||||
|   | ||||
| @@ -428,6 +428,7 @@ template <typename ARCH> status riscv_target_adapter<ARCH>::target_xml_query(std | ||||
|         } | ||||
|         oss << "  </feature>\n"; | ||||
|         oss << "</target>\n"; | ||||
|         csr_xml = oss.str(); | ||||
|     } | ||||
|     out_buf = csr_xml; | ||||
|     return Ok; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user