Compare commits
	
		
			12 Commits
		
	
	
		
			ef2a4df925
			...
			feature/re
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 58311b37db | |||
| ad8dc09bee | |||
| 2bba5645c3 | |||
| bf0a5a80de | |||
| b37ef973de | |||
| 4c363f4073 | |||
| b8fa5fbbda | |||
| ac86f14a54 | |||
| 68b5697c8f | |||
| 09b0f0d0c8 | |||
| 98b418ff43 | |||
| 059bd0d371 | 
| @@ -35,12 +35,14 @@ FILE(GLOB TGC_VM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/vm/interp/vm_*.cpp) | ||||
| set(LIB_SOURCES  | ||||
|     src/vm/fp_functions.cpp | ||||
|     src/plugin/instruction_count.cpp | ||||
|     src/plugin/cycle_estimate.cpp | ||||
|     src/plugin/cov.cpp | ||||
|     src/plugin/pctrace.cpp | ||||
|      | ||||
|     ${TGC_SOURCES} | ||||
|     ${TGC_VM_SOURCES} | ||||
| ) | ||||
| if(TARGET RapidJSON) | ||||
|     list(APPEND LIB_SOURCES src/plugin/cycle_estimate.cpp) | ||||
| endif() | ||||
|  | ||||
| if(WITH_LLVM) | ||||
| 	FILE(GLOB TGC_LLVM_SOURCES | ||||
| @@ -82,6 +84,10 @@ elseif(TARGET elfio::elfio) | ||||
| else() | ||||
|     message(FATAL_ERROR "No elfio library found, maybe a find_package() call is missing") | ||||
| endif() | ||||
| if(TARGET RapidJSON) | ||||
|     target_link_libraries(${PROJECT_NAME} PUBLIC RapidJSON) | ||||
| endif() | ||||
|  | ||||
|  | ||||
| set_target_properties(${PROJECT_NAME} PROPERTIES | ||||
|   VERSION ${PROJECT_VERSION} | ||||
|   | ||||
| @@ -169,7 +169,6 @@ struct ${coreDef.name.toLowerCase()}: public arch_if { | ||||
|         }}%> | ||||
|         uint32_t trap_state = 0, pending_trap = 0; | ||||
|         uint64_t icount = 0; | ||||
|         uint64_t cycle = 0; | ||||
|         uint64_t instret = 0; | ||||
|         uint32_t last_branch; | ||||
|     } reg; | ||||
|   | ||||
| @@ -1,9 +1,12 @@ | ||||
| { | ||||
| 	"${coreDef.name}" : [<%instructions.eachWithIndex{instr,index -> %>${index==0?"":","} | ||||
| 		{ | ||||
| 			"name"  : "${instr.name}", | ||||
| 			"size"  : ${instr.length}, | ||||
| 			"delay" : ${instr.isConditional?"[1,1]":"1"} | ||||
| 			"name"  :   "${instr.name}", | ||||
| 			"size"  :   ${instr.length}, | ||||
| 			"encoding": "${instr.encoding}", | ||||
|             "mask":     "${instr.mask}", | ||||
| 			"branch":   ${instr.modifiesPC}, | ||||
| 			"delay" :   ${instr.isConditional?"[1,1]":"1"} | ||||
| 		}<%}%> | ||||
| 	] | ||||
| } | ||||
| @@ -201,7 +201,7 @@ public: | ||||
|  | ||||
|     void disass_output(uint64_t pc, const std::string instr) override { | ||||
|         CLOG(INFO, disass) << fmt::format("0x{:016x}    {:40} [s:0x{:x};c:{}]", | ||||
|                 pc, instr, (reg_t)state.mstatus, this->reg.icount); | ||||
|                 pc, instr, (reg_t)state.mstatus, this->reg.icount + cycle_offset); | ||||
|     }; | ||||
|  | ||||
|     iss::instrumentation_if *get_instrumentation_if() override { return &instr_if; } | ||||
| @@ -237,6 +237,10 @@ protected: | ||||
|  | ||||
|         uint64_t get_next_pc() override { return arch.get_next_pc(); }; | ||||
|  | ||||
|         uint64_t get_instr_count() { return arch.reg.icount; } | ||||
|  | ||||
|         uint64_t get_total_cycles() override { return arch.reg.icount + arch.cycle_offset; } | ||||
|  | ||||
|         void set_curr_instr_cycles(unsigned cycles) override { arch.cycle_offset += cycles - 1; }; | ||||
|  | ||||
|         riscv_hart_m_p<BASE, FEAT> &arch; | ||||
|   | ||||
| @@ -307,7 +307,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.ccount); | ||||
|                 pc, instr, lvl[this->reg.PRIV], (reg_t)state.mstatus, this->reg.ccount + cycle_offset); | ||||
|     }; | ||||
|  | ||||
|     iss::instrumentation_if *get_instrumentation_if() override { return &instr_if; } | ||||
| @@ -340,6 +340,10 @@ protected: | ||||
|  | ||||
|         virtual uint64_t get_next_pc() { return arch.get_next_pc(); }; | ||||
|  | ||||
|         uint64_t get_instr_count() { return arch.reg.icount; } | ||||
|  | ||||
|         uint64_t get_total_cycles() override { return arch.reg.icount + arch.cycle_offset; } | ||||
|  | ||||
|         virtual void set_curr_instr_cycles(unsigned cycles) { arch.cycle_offset += cycles - 1; }; | ||||
|  | ||||
|         riscv_hart_msu_vp<BASE> &arch; | ||||
|   | ||||
| @@ -216,7 +216,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); | ||||
|                 pc, instr, lvl[this->reg.PRIV], (reg_t)state.mstatus, this->reg.icount + cycle_offset); | ||||
|     }; | ||||
|  | ||||
|     iss::instrumentation_if *get_instrumentation_if() override { return &instr_if; } | ||||
| @@ -252,6 +252,10 @@ protected: | ||||
|  | ||||
|         virtual uint64_t get_next_pc() { return arch.get_next_pc(); }; | ||||
|  | ||||
|         uint64_t get_instr_count() { return arch.reg.icount; } | ||||
|  | ||||
|         uint64_t get_total_cycles() override { return arch.reg.icount + arch.cycle_offset; } | ||||
|  | ||||
|         virtual void set_curr_instr_cycles(unsigned cycles) { arch.cycle_offset += cycles - 1; }; | ||||
|  | ||||
|         riscv_hart_mu_p<BASE, FEAT> &arch; | ||||
|   | ||||
| @@ -258,7 +258,6 @@ struct tgc_c: public arch_if { | ||||
|         uint32_t DPC = 0; | ||||
|         uint32_t trap_state = 0, pending_trap = 0; | ||||
|         uint64_t icount = 0; | ||||
|         uint64_t cycle = 0; | ||||
|         uint64_t instret = 0; | ||||
|         uint32_t last_branch; | ||||
|     } reg; | ||||
|   | ||||
| @@ -37,9 +37,9 @@ | ||||
|  | ||||
| #include "iss/instrumentation_if.h" | ||||
| #include "iss/vm_plugin.h" | ||||
| #include <json/json.h> | ||||
| #include <string> | ||||
| #include <unordered_map> | ||||
| #include <vector> | ||||
|  | ||||
| namespace iss { | ||||
|  | ||||
| @@ -49,11 +49,13 @@ class cycle_estimate: public iss::vm_plugin { | ||||
| 	BEGIN_BF_DECL(instr_desc, uint32_t) | ||||
| 		BF_FIELD(taken, 24, 8) | ||||
| 		BF_FIELD(not_taken, 16, 8) | ||||
| 		BF_FIELD(size, 0, 16) | ||||
| 		instr_desc(uint32_t size, uint32_t taken, uint32_t not_taken): instr_desc() { | ||||
|         BF_FIELD(is_branch, 8, 8) | ||||
|         BF_FIELD(size, 0, 8) | ||||
| 		instr_desc(uint32_t size, uint32_t taken, uint32_t not_taken, bool branch): instr_desc() { | ||||
| 			this->size=size; | ||||
| 			this->taken=taken; | ||||
| 			this->not_taken=not_taken; | ||||
| 			this->is_branch=branch; | ||||
| 		} | ||||
| 	END_BF_DECL(); | ||||
|  | ||||
| @@ -64,7 +66,7 @@ public: | ||||
|  | ||||
|     cycle_estimate(const cycle_estimate &&) = delete; | ||||
|  | ||||
|     cycle_estimate(std::string config_file_name); | ||||
|     cycle_estimate(std::string const& config_file_name); | ||||
|  | ||||
|     virtual ~cycle_estimate(); | ||||
|  | ||||
| @@ -88,7 +90,7 @@ private: | ||||
|         } | ||||
|     }; | ||||
|     std::unordered_map<std::pair<uint64_t, uint64_t>, uint64_t, pair_hash> blocks; | ||||
|     Json::Value root; | ||||
|     std::string config_file_name; | ||||
| }; | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -52,6 +52,18 @@ class cov : public iss::vm_plugin { | ||||
|         size_t not_taken_delay; | ||||
|         size_t taken_delay; | ||||
|     }; | ||||
|     BEGIN_BF_DECL(instr_desc, uint32_t) | ||||
|         BF_FIELD(taken, 24, 8) | ||||
|         BF_FIELD(not_taken, 16, 8) | ||||
|         BF_FIELD(is_branch, 8, 8) | ||||
|         BF_FIELD(size, 0, 8) | ||||
|         instr_desc(uint32_t size, uint32_t taken, uint32_t not_taken, bool branch): instr_desc() { | ||||
|             this->size=size; | ||||
|             this->taken=taken; | ||||
|             this->not_taken=not_taken; | ||||
|             this->is_branch=branch; | ||||
|         } | ||||
|     END_BF_DECL(); | ||||
| 
 | ||||
| public: | ||||
| 
 | ||||
| @@ -59,7 +71,7 @@ public: | ||||
| 
 | ||||
|     cov(const cov &&) = delete; | ||||
| 
 | ||||
|     cov(); | ||||
|     cov(std::string const &); | ||||
| 
 | ||||
|     virtual ~cov(); | ||||
| 
 | ||||
| @@ -75,8 +87,11 @@ public: | ||||
| 
 | ||||
| private: | ||||
|     iss::instrumentation_if *instr_if  {nullptr}; | ||||
|     int counter {0}; | ||||
|     std::ofstream output; | ||||
|     std::string filename; | ||||
|     std::vector<instr_desc> delays; | ||||
|     bool jumped, first; | ||||
| 
 | ||||
| }; | ||||
| } | ||||
| } | ||||
							
								
								
									
										11
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/main.cpp
									
									
									
									
									
								
							| @@ -44,6 +44,11 @@ using tgc_c_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_c>; | ||||
| #include "iss/arch/tgc_b.h" | ||||
| using tgc_b_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_b>; | ||||
| #endif | ||||
| #ifdef CORE_TGC_C_XRB_NN | ||||
| #include "iss/arch/riscv_hart_m_p.h" | ||||
| #include "iss/arch/tgc_c_xrb_nn.h" | ||||
| using tgc_c_xrb_nn_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_c_xrb_nn>; | ||||
| #endif | ||||
| #ifdef CORE_TGC_D | ||||
| #include "iss/arch/riscv_hart_mu_p.h" | ||||
| #include "iss/arch/tgc_d.h" | ||||
| @@ -152,6 +157,12 @@ int main(int argc, char *argv[]) { | ||||
|                 iss::create_cpu<tgc_b_plat_type>(clim["backend"].as<std::string>(), clim["gdb-port"].as<unsigned>()); | ||||
|         } else | ||||
| #endif | ||||
| #ifdef CORE_TGC_C_XRB_NN | ||||
|         if (isa_opt == "tgc_c_xrb_nn") { | ||||
|             std::tie(cpu, vm) = | ||||
|                 iss::create_cpu<tgc_c_xrb_nn_plat_type>(clim["backend"].as<std::string>(), clim["gdb-port"].as<unsigned>()); | ||||
|         } else | ||||
| #endif | ||||
| #ifdef CORE_TGC_D | ||||
|         if (isa_opt == "tgc_d") { | ||||
|             std::tie(cpu, vm) = | ||||
|   | ||||
| @@ -1,32 +0,0 @@ | ||||
| #include <iss/plugin/cov.h> | ||||
| #include <iss/arch_if.h> | ||||
| #include <iostream> | ||||
|  | ||||
|  | ||||
| iss::plugin::cov::cov() { | ||||
|     std::cout << "Entering Constructor"<<std::endl; | ||||
|     output.open("output.txt"); | ||||
|  | ||||
| } | ||||
|  | ||||
| iss::plugin::cov::~cov() { | ||||
|     std::cout << "Entering Destructor"<<std::endl; | ||||
|     output.close(); | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
| bool iss::plugin::cov::registration(const char *const version, vm_if& vm) { | ||||
|     instr_if = vm.get_arch()->get_instrumentation_if(); | ||||
|     return true; | ||||
| } | ||||
| void iss::plugin::cov::callback(instr_info_t iinfo, const exec_info&) { | ||||
| //    if((instr_if->get_next_pc() - instr_if->get_pc() != 4) ||( instr_if->get_next_pc() - instr_if->get_pc() != 2)){ | ||||
| //        std::cout << "jump from " << std::hex << instr_if->get_pc() << " to " << instr_if->get_next_pc()<< " after " << std::dec << counter <<" linear instructions" <<std::endl; | ||||
| //        counter = 0; | ||||
| //    }else { | ||||
| //        counter++; | ||||
| //    } | ||||
|  | ||||
|     output<<std::hex << instr_if->get_pc() << std::endl; | ||||
| } | ||||
| @@ -36,58 +36,82 @@ | ||||
|  | ||||
| #include <iss/arch_if.h> | ||||
| #include <util/logging.h> | ||||
| #include <rapidjson/document.h> | ||||
| #include <rapidjson/istreamwrapper.h> | ||||
| #include "rapidjson/writer.h" | ||||
| #include "rapidjson/stringbuffer.h" | ||||
| #include <rapidjson/ostreamwrapper.h> | ||||
| #include <rapidjson/error/en.h> | ||||
| #include <fstream> | ||||
|  | ||||
| iss::plugin::cycle_estimate::cycle_estimate(std::string config_file_name) | ||||
| using namespace rapidjson; | ||||
| using namespace std; | ||||
|  | ||||
| iss::plugin::cycle_estimate::cycle_estimate(string const& config_file_name) | ||||
| : arch_instr(nullptr) | ||||
| , config_file_name(config_file_name) | ||||
| { | ||||
|     if (config_file_name.length() > 0) { | ||||
|         std::ifstream is(config_file_name); | ||||
|         if (is.is_open()) { | ||||
|             try { | ||||
|                 is >> root; | ||||
|             } catch (Json::RuntimeError &e) { | ||||
|                 LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what(); | ||||
|             } | ||||
|         } else { | ||||
|             LOG(ERR) << "Could not open input file " << config_file_name; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| iss::plugin::cycle_estimate::~cycle_estimate() { | ||||
| } | ||||
|  | ||||
| bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if& vm) { | ||||
| 	arch_instr = vm.get_arch()->get_instrumentation_if(); | ||||
| 	if(!arch_instr) return false; | ||||
| 	const std::string  core_name = arch_instr->core_type_name(); | ||||
|     Json::Value &val = root[core_name]; | ||||
|     if(!val.isNull() && val.isArray()){ | ||||
|     	delays.reserve(val.size()); | ||||
|     	for(auto it:val){ | ||||
|     		auto name = it["name"]; | ||||
|     		auto size = it["size"]; | ||||
|     		auto delay = it["delay"]; | ||||
|     		if(!name.isString() || !size.isUInt() || !(delay.isUInt() || delay.isArray())) throw std::runtime_error("JSON parse error"); | ||||
|     		if(delay.isUInt()){ | ||||
| 				delays.push_back(instr_desc{size.asUInt(), delay.asUInt(), 0}); | ||||
|     		} else { | ||||
| 				delays.push_back(instr_desc{size.asUInt(), delay[0].asUInt(), delay[1].asUInt()}); | ||||
|     		} | ||||
|     	} | ||||
|     } else { | ||||
|         LOG(ERR)<<"plugin cycle_estimate: could not find an entry for "<<core_name<<" in JSON file"<<std::endl; | ||||
|     arch_instr = vm.get_arch()->get_instrumentation_if(); | ||||
|     if(!arch_instr) return false; | ||||
|     const string  core_name = arch_instr->core_type_name(); | ||||
|     if (config_file_name.length() > 0) { | ||||
|         ifstream is(config_file_name); | ||||
|         if (is.is_open()) { | ||||
|             try { | ||||
|                 IStreamWrapper isw(is); | ||||
|                 Document d; | ||||
|                 ParseResult ok = d.ParseStream(isw); | ||||
|                 if(ok) { | ||||
|                     Value& val = d[core_name.c_str()]; | ||||
|                     if(val.IsArray()){ | ||||
|                         delays.reserve(val.Size()); | ||||
|                         for (auto it = val.Begin(); it != val.End(); ++it) { | ||||
|                             auto& name = (*it)["name"]; | ||||
|                             auto& size = (*it)["size"]; | ||||
|                             auto& delay = (*it)["delay"]; | ||||
|                             auto& branch = (*it)["branch"]; | ||||
|                             if(delay.IsArray()) { | ||||
|                                 auto dt = delay[0].Get<unsigned>(); | ||||
|                                 auto dnt = delay[1].Get<unsigned>(); | ||||
|                                 delays.push_back(instr_desc{size.Get<unsigned>(), dt, dnt, branch.Get<bool>()}); | ||||
|                             } else if(delay.Is<unsigned>()) { | ||||
|                                 auto d = delay.Get<unsigned>(); | ||||
|                                 delays.push_back(instr_desc{size.Get<unsigned>(), d, d, branch.Get<bool>()}); | ||||
|                             } else | ||||
|                                 throw runtime_error("JSON parse error"); | ||||
|                        } | ||||
|                     } else { | ||||
|                         LOG(ERR)<<"plugin cycle_estimate: could not find an entry for "<<core_name<<" in JSON file"<<endl; | ||||
|                         return false; | ||||
|                    } | ||||
|                 } else { | ||||
|                     LOG(ERR)<<"plugin cycle_estimate: could not parse in JSON file at "<< ok.Offset()<<": "<<GetParseError_En(ok.Code())<<endl; | ||||
|                     return false; | ||||
|                } | ||||
|             } catch (runtime_error &e) { | ||||
|                 LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what(); | ||||
|                 return false; | ||||
|             } | ||||
|         } else { | ||||
|             LOG(ERR) << "Could not open input file " << config_file_name; | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
| 	return true; | ||||
|     return true; | ||||
|  | ||||
| } | ||||
|  | ||||
| void iss::plugin::cycle_estimate::callback(instr_info_t instr_info, exec_info const&) { | ||||
| void iss::plugin::cycle_estimate::callback(instr_info_t instr_info, exec_info const& exc_info) { | ||||
|     assert(arch_instr && "No instrumentation interface available but callback executed"); | ||||
| 	auto entry = delays[instr_info.instr_id]; | ||||
| 	bool taken = (arch_instr->get_next_pc()-arch_instr->get_pc()) != (entry.size/8); | ||||
|     if (taken && entry.taken > 1) | ||||
|     auto entry = delays[instr_info.instr_id]; | ||||
|     bool taken = exc_info.branch_taken; | ||||
|     if (exc_info.branch_taken && (entry.taken > 1)) | ||||
|         arch_instr->set_curr_instr_cycles(entry.taken); | ||||
|     else if (entry.not_taken > 1) | ||||
|         arch_instr->set_curr_instr_cycles(entry.not_taken); | ||||
|   | ||||
							
								
								
									
										133
									
								
								src/plugin/pctrace.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								src/plugin/pctrace.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,133 @@ | ||||
| #include <iss/arch_if.h> | ||||
| #include <iss/plugin/pctrace.h> | ||||
| #include <util/logging.h> | ||||
| #include <rapidjson/document.h> | ||||
| #include <rapidjson/istreamwrapper.h> | ||||
| #include "rapidjson/writer.h" | ||||
| #include "rapidjson/stringbuffer.h" | ||||
| #include <rapidjson/ostreamwrapper.h> | ||||
| #include <rapidjson/error/en.h> | ||||
| #include <fstream> | ||||
|  | ||||
| #include <iostream> | ||||
|  | ||||
|  | ||||
| using namespace rapidjson; | ||||
| using namespace std; | ||||
|  | ||||
| iss::plugin::cov::cov(std::string const &filename) | ||||
|     : instr_if(nullptr) | ||||
|     , filename(filename) | ||||
| { | ||||
|     output.open("output.trc"); | ||||
|     jumped = false; | ||||
|     first = true; | ||||
| } | ||||
|  | ||||
| iss::plugin::cov::~cov() { | ||||
|     output.close(); | ||||
| } | ||||
|  | ||||
| bool iss::plugin::cov::registration(const char *const version, vm_if& vm) { | ||||
|     instr_if = vm.get_arch()->get_instrumentation_if(); | ||||
|     if(!instr_if) return false; | ||||
|     const string  core_name = instr_if->core_type_name(); | ||||
|     if (filename.length() > 0) { | ||||
|         ifstream is(filename); | ||||
|         if (is.is_open()) { | ||||
|             try { | ||||
|                 IStreamWrapper isw(is); | ||||
|                 Document d; | ||||
|                 ParseResult ok = d.ParseStream(isw); | ||||
|                 if(ok) { | ||||
|                     Value& val = d[core_name.c_str()]; | ||||
|                     if(val.IsArray()){ | ||||
|                         delays.reserve(val.Size()); | ||||
|                         for (auto it = val.Begin(); it != val.End(); ++it) { | ||||
|                             auto& name = (*it)["name"]; | ||||
|                             auto& size = (*it)["size"]; | ||||
|                             auto& delay = (*it)["delay"]; | ||||
|                             auto& branch = (*it)["branch"]; | ||||
|                             if(delay.IsArray()) { | ||||
|                                 auto dt = delay[0].Get<unsigned>(); | ||||
|                                 auto dnt = delay[1].Get<unsigned>(); | ||||
|                                 delays.push_back(instr_desc{size.Get<unsigned>(), dt, dnt, branch.Get<bool>()}); | ||||
|                             } else if(delay.Is<unsigned>()) { | ||||
|                                 auto d = delay.Get<unsigned>(); | ||||
|                                 delays.push_back(instr_desc{size.Get<unsigned>(), d, d, branch.Get<bool>()}); | ||||
|                             } else | ||||
|                                 throw runtime_error("JSON parse error"); | ||||
|  | ||||
|                         } | ||||
|                     } else { | ||||
|                         LOG(ERR)<<"plugin cycle_estimate: could not find an entry for "<<core_name<<" in JSON file"<<endl; | ||||
|                         return false; | ||||
|                    } | ||||
|                 } else { | ||||
|                     LOG(ERR)<<"plugin cycle_estimate: could not parse in JSON file at "<< ok.Offset()<<": "<<GetParseError_En(ok.Code())<<endl; | ||||
|                     return false; | ||||
|                } | ||||
|             } catch (runtime_error &e) { | ||||
|                 LOG(ERR) << "Could not parse input file " << filename << ", reason: " << e.what(); | ||||
|                 return false; | ||||
|             } | ||||
|         } else { | ||||
|             LOG(ERR) << "Could not open input file " << filename; | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
|     return true; | ||||
|  | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
| inline string formatPC(uint64_t pc) { | ||||
|     stringstream stream; | ||||
|     stream << "0x" << std::hex << pc; | ||||
|     return stream.str(); | ||||
| } | ||||
|  | ||||
| void iss::plugin::cov::callback(instr_info_t iinfo, const exec_info& einfo) { | ||||
| //    auto delay = 0; | ||||
| //    auto entry = delays[iinfo.instr_id]; | ||||
| //    bool taken = einfo.branch_taken; | ||||
| //    if (einfo.branch_taken) | ||||
| //        delay = entry.taken; | ||||
| //    else | ||||
| //        delay = entry.not_taken; | ||||
| // | ||||
| //    if (first){ | ||||
| //        output << formatPC(instr_if->get_pc()) << "," << delay; | ||||
| //        first = false; | ||||
| //    } | ||||
| //    if(instr_if->get_next_pc()-instr_if->get_pc() != delays[iinfo.instr_id].size/8){ | ||||
| //        //The goal is to keep the output in start-target pairs, so after a jump the target address needs to get written | ||||
| //        //to the output. If the target happens to also be a start, we keep the pairing by adding a 0-delay entry. | ||||
| //        if (jumped) | ||||
| //            output <<"\n" <<formatPC(instr_if->get_pc()) << "," << 0; | ||||
| //        output <<"\n" << formatPC(instr_if->get_pc()) << "," << delay; | ||||
| //        jumped = true; | ||||
| //    } | ||||
| //    else{ | ||||
| //        if (jumped){ | ||||
| //            output <<"\n" << formatPC(instr_if->get_pc()) << "," << delay; | ||||
| //            jumped = false; | ||||
| //        } | ||||
| //        else if(delay!=1){ | ||||
| //            output <<"\n" << formatPC(instr_if->get_pc()) << "," << delay; | ||||
| //            output <<"\n" << formatPC(instr_if->get_pc()) << "," << 0; | ||||
| //        } | ||||
| // | ||||
| //    } | ||||
|  | ||||
| //source code for the full output | ||||
|     auto delay = 0; | ||||
|     auto entry = delays[iinfo.instr_id]; | ||||
|     bool taken = einfo.branch_taken; | ||||
|     if (einfo.branch_taken) | ||||
|         delay = entry.taken; | ||||
|     else | ||||
|        delay = entry.not_taken; | ||||
|     output<<std::hex <<"0x" << instr_if->get_pc() <<"," << delay << "\n"; | ||||
| } | ||||
| @@ -69,7 +69,7 @@ using tgc_d_xrb_nn_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d_xrb_n | ||||
| #include <array> | ||||
| #include <iss/plugin/cycle_estimate.h> | ||||
| #include <iss/plugin/instruction_count.h> | ||||
| #include <iss/plugin/cov.h> | ||||
| #include <iss/plugin/pctrace.h> | ||||
|  | ||||
| // clang-format on | ||||
|  | ||||
| @@ -136,7 +136,8 @@ public: | ||||
|         if (!owner->disass_output(pc, instr)) { | ||||
|             std::stringstream s; | ||||
|             s << "[p:" << lvl[this->reg.PRIV] << ";s:0x" << std::hex << std::setfill('0') | ||||
|               << std::setw(sizeof(reg_t) * 2) << (reg_t)this->state.mstatus << std::dec << ";c:" << this->reg.icount << "]"; | ||||
|               << std::setw(sizeof(reg_t) * 2) << (reg_t)this->state.mstatus << std::dec << ";c:" | ||||
|               << this->reg.icount + this->cycle_offset << "]"; | ||||
|             SCCDEBUG(owner->name())<<"disass: " | ||||
|                 << "0x" << std::setw(16) << std::right << std::setfill('0') << std::hex << pc << "\t\t" << std::setw(40) | ||||
|                 << std::setfill(' ') << std::left << instr << s.str(); | ||||
| @@ -425,8 +426,8 @@ void core_complex::before_end_of_elaboration() { | ||||
|                 auto *plugin = new iss::plugin::cycle_estimate(filename); | ||||
|                 cpu->vm->register_plugin(*plugin); | ||||
|                 plugin_list.push_back(plugin); | ||||
|             } else if (plugin_name == "cov") { | ||||
|                 auto *plugin = new iss::plugin::cov(); | ||||
|             } else if (plugin_name == "pctrace") { | ||||
|                 auto *plugin = new iss::plugin::cov(filename); | ||||
|                 cpu->vm->register_plugin(*plugin); | ||||
|                 plugin_list.push_back(plugin); | ||||
|             } else { | ||||
|   | ||||
| @@ -175,6 +175,15 @@ protected: | ||||
|         auto sign_mask = 1ULL<<(W-1); | ||||
|         return (from & mask) | ((from & sign_mask) ? ~mask : 0); | ||||
|     } | ||||
|      | ||||
|     inline void process_spawn_blocks() { | ||||
|         for(auto it = std::begin(spawn_blocks); it!=std::end(spawn_blocks);) | ||||
|              if(*it){ | ||||
|                  (*it)(); | ||||
|                  ++it; | ||||
|              } else | ||||
|                  spawn_blocks.erase(it); | ||||
|     } | ||||
|  | ||||
| private: | ||||
|     /**************************************************************************** | ||||
| @@ -397,7 +406,7 @@ private: | ||||
|         if(rd != 0) *(X+rd) = (int32_t)imm;  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 0); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -436,7 +445,7 @@ private: | ||||
|         if(rd != 0) *(X+rd) = *PC + (int32_t)imm;  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 1); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -483,7 +492,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 2); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -532,7 +541,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 3); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -579,7 +588,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 4); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -626,7 +635,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 5); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -673,7 +682,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 6); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -720,7 +729,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 7); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -767,7 +776,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 8); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -814,7 +823,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 9); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -857,7 +866,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 10); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -901,7 +910,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 11); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -945,7 +954,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 12); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -988,7 +997,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 13); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1032,7 +1041,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 14); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1072,7 +1081,7 @@ private: | ||||
|         writeSpace1(traits::MEM, *(X+rs1) + (int16_t)sext<12>(imm), (int8_t)*(X+rs2)); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 15); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1115,7 +1124,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 16); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1158,7 +1167,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 17); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1198,7 +1207,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) + (int16_t)sext<12>(imm);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 18); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1238,7 +1247,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = (int32_t)*(X+rs1) < (int16_t)sext<12>(imm)?  1 :  0;  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 19); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1278,7 +1287,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = (*(X+rs1) < (uint32_t)((int16_t)sext<12>(imm)))?  1 :  0;  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 20); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1318,7 +1327,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) ^ (int16_t)sext<12>(imm);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 21); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1358,7 +1367,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) | (int16_t)sext<12>(imm);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 22); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1398,7 +1407,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) & (int16_t)sext<12>(imm);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 23); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1443,7 +1452,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 24); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1488,7 +1497,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 25); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1533,7 +1542,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 26); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1573,7 +1582,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) + *(X+rs2);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 27); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1613,7 +1622,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) - *(X+rs2);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 28); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1653,7 +1662,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) << (*(X+rs2) & (traits::XLEN - 1));  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 29); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1693,7 +1702,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = (int32_t)*(X+rs1) < (int32_t)*(X+rs2)?  1 :  0;  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 30); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1733,7 +1742,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = (uint32_t)*(X+rs1) < (uint32_t)*(X+rs2)?  1 :  0;  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 31); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1773,7 +1782,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) ^ *(X+rs2);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 32); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1813,7 +1822,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) >> (*(X+rs2) & (traits::XLEN - 1));  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 33); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1853,7 +1862,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = (int32_t)*(X+rs1) >> (*(X+rs2) & (traits::XLEN - 1));  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 34); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1893,7 +1902,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) | *(X+rs2);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 35); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1933,7 +1942,7 @@ private: | ||||
|         if(rd !=  0) *(X+rd) = *(X+rs1) & *(X+rs2);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 36); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -1974,7 +1983,7 @@ private: | ||||
|         writeSpace1(traits::FENCE, traits::fence, pred << 4 | succ); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 37); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2007,7 +2016,7 @@ private: | ||||
|         raise(0,  11); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 38); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2040,7 +2049,7 @@ private: | ||||
|         raise(0,  3); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 39); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2073,7 +2082,7 @@ private: | ||||
|         leave(0); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 40); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2106,7 +2115,7 @@ private: | ||||
|         leave(1); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 41); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2139,7 +2148,7 @@ private: | ||||
|         leave(3); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 42); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2172,7 +2181,7 @@ private: | ||||
|         wait(1); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 43); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2215,7 +2224,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 44); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2265,7 +2274,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 45); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2310,7 +2319,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 46); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2355,7 +2364,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 47); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2399,7 +2408,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 48); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2443,7 +2452,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 49); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2487,7 +2496,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 50); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2526,7 +2535,7 @@ private: | ||||
|         writeSpace2(traits::FENCE, traits::fencei, imm); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 51); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2571,7 +2580,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 52); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2616,7 +2625,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 53); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2661,7 +2670,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 54); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2706,7 +2715,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 55); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2755,7 +2764,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 56); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2800,7 +2809,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 57); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2849,7 +2858,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 58); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2894,7 +2903,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 59); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2934,7 +2943,7 @@ private: | ||||
|         else raise(0,  2); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 60); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -2977,7 +2986,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 61); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3020,7 +3029,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 62); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3059,7 +3068,7 @@ private: | ||||
|         *(X+rs1) = *(X+rs1) + (int8_t)sext<6>(imm); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 63); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3094,7 +3103,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 64); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3135,7 +3144,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 65); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3176,7 +3185,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 66); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3218,7 +3227,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 67); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3257,7 +3266,7 @@ private: | ||||
|         else raise(0,  2); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 68); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3291,7 +3300,7 @@ private: | ||||
|         raise(0,  2); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 69); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3333,7 +3342,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 70); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3379,7 +3388,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 71); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3421,7 +3430,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 72); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3463,7 +3472,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 73); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3505,7 +3514,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 74); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3547,7 +3556,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 75); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3589,7 +3598,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 76); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3626,7 +3635,7 @@ private: | ||||
|         pc_assign(*NEXT_PC) = *PC + (int16_t)sext<12>(imm); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 77); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3665,7 +3674,7 @@ private: | ||||
|         if(*(X+(rs1 + 8)) == 0) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<9>(imm);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 78); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3704,7 +3713,7 @@ private: | ||||
|         if(*(X+(rs1 + 8)) != 0) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<9>(imm);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 79); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3743,7 +3752,7 @@ private: | ||||
|         if(nzuimm) *(X+rs1) = *(X+rs1) << nzuimm;  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 80); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3786,7 +3795,7 @@ private: | ||||
|         else raise(0, 2); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 81); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3825,7 +3834,7 @@ private: | ||||
|         if(rd != 0) *(X+rd) = *(X+rs2);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 82); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3864,7 +3873,7 @@ private: | ||||
|         else raise(0, 2); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 83); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3897,7 +3906,7 @@ private: | ||||
|         raise(0, 2); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 84); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3936,7 +3945,7 @@ private: | ||||
|         if(rd != 0) *(X+rd) = *(X+rd) + *(X+rs2);  | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 85); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -3978,7 +3987,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 86); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -4011,7 +4020,7 @@ private: | ||||
|         raise(0,  3); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 87); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -4053,7 +4062,7 @@ private: | ||||
|         } | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 88); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
| @@ -4086,7 +4095,7 @@ private: | ||||
|         raise(0,  2); | ||||
|         } catch(...){} | ||||
|         // post execution stuff | ||||
|         for(auto& spawn_block:spawn_blocks) spawn_block(); | ||||
|         process_spawn_blocks(); | ||||
|         if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 89); | ||||
|         // trap check | ||||
|         if(*trap_state!=0){ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user