Compare commits
	
		
			2 Commits
		
	
	
		
			65b4db5eca
			...
			msvc_compa
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| c8679fca85 | |||
| f0ada1ba8c | 
| @@ -48,16 +48,24 @@ if(WITH_LLVM) | |||||||
| endif() | endif() | ||||||
|  |  | ||||||
| # Define the library | # Define the library | ||||||
| add_library(${PROJECT_NAME} SHARED ${LIB_SOURCES}) | add_library(${PROJECT_NAME} ${LIB_SOURCES}) | ||||||
| # list code gen dependencies | # list code gen dependencies | ||||||
| if(TARGET ${CORE_NAME}_cpp) | if(TARGET ${CORE_NAME}_cpp) | ||||||
|     add_dependencies(${PROJECT_NAME} ${CORE_NAME}_cpp) |     add_dependencies(${PROJECT_NAME} ${CORE_NAME}_cpp) | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| target_compile_options(${PROJECT_NAME} PRIVATE -Wno-shift-count-overflow) | if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
|  |      target_compile_options(${PROJECT_NAME} PRIVATE -Wno-shift-count-overflow) | ||||||
|  | elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | ||||||
|  |     target_compile_options(${PROJECT_NAME} PRIVATE /wd4293) | ||||||
|  | endif() | ||||||
| target_include_directories(${PROJECT_NAME} PUBLIC incl) | target_include_directories(${PROJECT_NAME} PUBLIC incl) | ||||||
| target_link_libraries(${PROJECT_NAME} PUBLIC softfloat scc-util jsoncpp) | target_link_libraries(${PROJECT_NAME} PUBLIC softfloat scc-util jsoncpp) | ||||||
| target_link_libraries(${PROJECT_NAME} PUBLIC -Wl,--whole-archive dbt-core -Wl,--no-whole-archive) | if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||||||
|  |     target_link_libraries(${PROJECT_NAME} PUBLIC -Wl,--whole-archive dbt-core -Wl,--no-whole-archive) | ||||||
|  | else() | ||||||
|  |     target_link_libraries(${PROJECT_NAME} PUBLIC dbt-core) | ||||||
|  | endif() | ||||||
| if(TARGET CONAN_PKG::elfio) | if(TARGET CONAN_PKG::elfio) | ||||||
|     target_link_libraries(${PROJECT_NAME} PUBLIC CONAN_PKG::elfio) |     target_link_libraries(${PROJECT_NAME} PUBLIC CONAN_PKG::elfio) | ||||||
| elseif(TARGET elfio::elfio) | elseif(TARGET elfio::elfio) | ||||||
| @@ -98,16 +106,15 @@ if(WITH_LLVM) | |||||||
|     target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs}) |     target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs}) | ||||||
| endif() | endif() | ||||||
| # Links the target exe against the libraries | # Links the target exe against the libraries | ||||||
| target_link_libraries(${PROJECT_NAME} dbt-rise-tgc) | target_link_libraries(${PROJECT_NAME} PUBLIC dbt-rise-tgc) | ||||||
| #target_link_libraries(${PROJECT_NAME} jsoncpp) |  | ||||||
| if(TARGET Boost::program_options) | if(TARGET Boost::program_options) | ||||||
|     target_link_libraries(${PROJECT_NAME} Boost::program_options Boost::thread) |     target_link_libraries(${PROJECT_NAME} PUBLIC Boost::program_options Boost::thread) | ||||||
| else() | else() | ||||||
|     target_link_libraries(${PROJECT_NAME} ${BOOST_program_options_LIBRARY} ${BOOST_thread_LIBRARY}) |     target_link_libraries(${PROJECT_NAME} PUBLIC ${BOOST_program_options_LIBRARY} ${BOOST_thread_LIBRARY}) | ||||||
| endif() | endif() | ||||||
| target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS}) | target_link_libraries(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS}) | ||||||
| if (Tcmalloc_FOUND) | if (Tcmalloc_FOUND) | ||||||
|     target_link_libraries(${PROJECT_NAME} ${Tcmalloc_LIBRARIES}) |     target_link_libraries(${PROJECT_NAME} PUBLIC ${Tcmalloc_LIBRARIES}) | ||||||
| endif(Tcmalloc_FOUND) | endif(Tcmalloc_FOUND) | ||||||
|  |  | ||||||
| install(TARGETS tgc-sim | install(TARGETS tgc-sim | ||||||
|   | |||||||
| @@ -1,16 +0,0 @@ | |||||||
| import "CoreDSL-Instruction-Set-Description/RV32I.core_desc" |  | ||||||
| import "CoreDSL-Instruction-Set-Description/RVM.core_desc" |  | ||||||
| import "CoreDSL-Instruction-Set-Description/RVC.core_desc" |  | ||||||
|  |  | ||||||
| Core TGC_B provides RV32I { |  | ||||||
| 	architectural_state { |  | ||||||
|         unsigned XLEN=32; |  | ||||||
|         unsigned PCLEN=32; |  | ||||||
|         // definitions for the architecture wrapper |  | ||||||
|         //                    XL    ZYXWVUTSRQPONMLKJIHGFEDCBA |  | ||||||
|         unsigned MISA_VAL = 0b01000000000000000000000100000000; |  | ||||||
|         unsigned PGSIZE = 0x1000; //1 << 12; |  | ||||||
|         unsigned PGMASK = 0xfff; //PGSIZE-1 |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| @@ -1,15 +0,0 @@ | |||||||
| import "CoreDSL-Instruction-Set-Description/RV32I.core_desc" |  | ||||||
| import "CoreDSL-Instruction-Set-Description/RVM.core_desc" |  | ||||||
| import "CoreDSL-Instruction-Set-Description/RVC.core_desc" |  | ||||||
|  |  | ||||||
| Core TGC_C provides RV32I, RV32M, RV32IC { |  | ||||||
|     architectural_state { |  | ||||||
|         unsigned XLEN=32; |  | ||||||
|         unsigned PCLEN=32; |  | ||||||
|         // definitions for the architecture wrapper |  | ||||||
|         //                    XL    ZYXWVUTSRQPONMLKJIHGFEDCBA |  | ||||||
|         unsigned MISA_VAL = 0b01000000000000000001000100000100; |  | ||||||
|         unsigned PGSIZE = 0x1000; //1 << 12; |  | ||||||
|         unsigned PGMASK = 0xfff; //PGSIZE-1 |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,13 +0,0 @@ | |||||||
| import "CoreDSL-Instruction-Set-Description/RV32I.core_desc" |  | ||||||
| import "CoreDSL-Instruction-Set-Description/RVM.core_desc" |  | ||||||
| import "CoreDSL-Instruction-Set-Description/RVC.core_desc" |  | ||||||
|  |  | ||||||
| Core TGC_D provides RV32I, RV32M, RV32IC { |  | ||||||
|     architectural_state { |  | ||||||
|         unsigned XLEN=32; |  | ||||||
|         unsigned PCLEN=32; |  | ||||||
|         // definitions for the architecture wrapper |  | ||||||
|         //                    XL    ZYXWVUTSRQPONMLKJIHGFEDCBA |  | ||||||
|         unsigned MISA_VAL = 0b01000000000000000001000100000100; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,73 +0,0 @@ | |||||||
| import "CoreDSL-Instruction-Set-Description/RISCVBase.core_desc" |  | ||||||
| import "CoreDSL-Instruction-Set-Description/RV32I.core_desc" |  | ||||||
| import "CoreDSL-Instruction-Set-Description/RVM.core_desc" |  | ||||||
| import "CoreDSL-Instruction-Set-Description/RVC.core_desc" |  | ||||||
|  |  | ||||||
| InstructionSet X_RB_MAC extends RISCVBase { |  | ||||||
|   architectural_state { |  | ||||||
|     register unsigned<64> ACC; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   instructions { |  | ||||||
|     RESET_ACC { // v-- funct7       v-- funct3 |  | ||||||
|       encoding: 7'd0 :: 10'b0 :: 3'd0 :: 5'b0 :: 7'b0001011; |  | ||||||
|       behavior: ACC = 0; |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     GET_ACC_LO { |  | ||||||
|       encoding: 7'd1 :: 10'b0 :: 3'd0 :: rd[4:0] :: 7'b0001011; |  | ||||||
|       behavior: if (rd != 0) X[rd] = ACC[31:0]; |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     GET_ACC_HI { |  | ||||||
|       encoding: 7'd2 :: 10'b0 :: 3'd0 :: rd[4:0] :: 7'b0001011; |  | ||||||
|       behavior: if (rd != 0) X[rd] = ACC[63:32]; |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     MACU_32 { |  | ||||||
|       encoding: 7'd0 :: rs2[4:0] :: rs1[4:0] :: 3'd1 :: 5'b0 :: 7'b0001011; |  | ||||||
|       behavior: { |  | ||||||
|         unsigned<64> mul = X[rs1]    * X[rs2]; |  | ||||||
|         unsigned<33> add = mul[31:0] + ACC[31:0]; |  | ||||||
|         ACC = add[31:0]; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     MACS_32 { |  | ||||||
|       encoding: 7'd1 :: rs2[4:0] :: rs1[4:0] :: 3'd1 :: 5'b0 :: 7'b0001011; |  | ||||||
|       behavior: { |  | ||||||
|         signed<64> mul = ((signed) X[rs1])    * ((signed) X[rs2]); |  | ||||||
|         signed<33> add = ((signed) mul[31:0]) + ((signed) ACC[31:0]); |  | ||||||
|         ACC = add[31:0]; // bit range always yields unsigned type |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     MACU_64 { |  | ||||||
|       encoding: 7'd0 :: rs2[4:0] :: rs1[4:0] :: 3'd2 :: 5'b0 :: 7'b0001011; |  | ||||||
|       behavior: { |  | ||||||
|         unsigned<64> mul = X[rs1] * X[rs2]; |  | ||||||
|         unsigned<65> add = mul    + ACC; |  | ||||||
|         ACC = add[63:0]; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     MACS_64 { |  | ||||||
|       encoding: 7'd1 :: rs2[4:0] :: rs1[4:0] :: 3'd2 :: 5'b0 :: 7'b0001011; |  | ||||||
|       behavior: { |  | ||||||
|         signed<64> mul = ((signed) X[rs1]) * ((signed) X[rs2]); |  | ||||||
|         signed<65> add =           mul     + ((signed) ACC); |  | ||||||
|         ACC = add[63:0]; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| Core TGC_D_XRB_MAC provides RV32I, RV32M, RV32IC, X_RB_MAC { |  | ||||||
|     architectural_state { |  | ||||||
|         unsigned XLEN=32; |  | ||||||
|         unsigned PCLEN=32; |  | ||||||
|         // definitions for the architecture wrapper |  | ||||||
|         //                    XL    ZYXWVUTSRQPONMLKJIHGFEDCBA |  | ||||||
|         unsigned MISA_VAL = 0b01000000000000000001000100000100; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
							
								
								
									
										37
									
								
								gen_input/TGFS.core_desc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								gen_input/TGFS.core_desc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | |||||||
|  | import "CoreDSL-Instruction-Set-Description/RV32I.core_desc" | ||||||
|  | import "CoreDSL-Instruction-Set-Description/RVM.core_desc" | ||||||
|  | import "CoreDSL-Instruction-Set-Description/RVC.core_desc" | ||||||
|  |  | ||||||
|  | Core TGC_B provides RV32I { | ||||||
|  | 	architectural_state { | ||||||
|  |         unsigned XLEN=32; | ||||||
|  |         unsigned PCLEN=32; | ||||||
|  |         // definitions for the architecture wrapper | ||||||
|  |         //                    XL    ZYXWVUTSRQPONMLKJIHGFEDCBA | ||||||
|  |         unsigned MISA_VAL = 0b01000000000000000000000100000000; | ||||||
|  |         unsigned PGSIZE = 0x1000; //1 << 12; | ||||||
|  |         unsigned PGMASK = 0xfff; //PGSIZE-1 | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | Core TGC_C provides RV32I, RV32M, RV32IC { | ||||||
|  |     architectural_state { | ||||||
|  |         unsigned XLEN=32; | ||||||
|  |         unsigned PCLEN=32; | ||||||
|  |         // definitions for the architecture wrapper | ||||||
|  |         //                    XL    ZYXWVUTSRQPONMLKJIHGFEDCBA | ||||||
|  |         unsigned MISA_VAL = 0b01000000000000000001000100000100; | ||||||
|  |         unsigned PGSIZE = 0x1000; //1 << 12; | ||||||
|  |         unsigned PGMASK = 0xfff; //PGSIZE-1 | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | Core TGC_D provides RV32I, RV32M, RV32IC { | ||||||
|  |     architectural_state { | ||||||
|  |         unsigned XLEN=32; | ||||||
|  |         unsigned PCLEN=32; | ||||||
|  |         // definitions for the architecture wrapper | ||||||
|  |         //                    XL    ZYXWVUTSRQPONMLKJIHGFEDCBA | ||||||
|  |         unsigned MISA_VAL = 0b01000000000000000001000100000100; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -362,8 +362,8 @@ riscv_hart_m_p<BASE>::riscv_hart_m_p() | |||||||
|     csr_rd_cb[mie] = &this_class::read_ie; |     csr_rd_cb[mie] = &this_class::read_ie; | ||||||
|     csr_wr_cb[mie] = &this_class::write_ie; |     csr_wr_cb[mie] = &this_class::write_ie; | ||||||
|     csr_rd_cb[mhartid] = &this_class::read_hartid; |     csr_rd_cb[mhartid] = &this_class::read_hartid; | ||||||
| //    csr_rd_cb[mcounteren] = &this_class::read_null; |     csr_rd_cb[mcounteren] = &this_class::read_null; | ||||||
| //    csr_wr_cb[mcounteren] = &this_class::write_null; |     csr_wr_cb[mcounteren] = &this_class::write_null; | ||||||
|     csr_wr_cb[misa] = &this_class::write_null; |     csr_wr_cb[misa] = &this_class::write_null; | ||||||
|     csr_wr_cb[mvendorid] = &this_class::write_null; |     csr_wr_cb[mvendorid] = &this_class::write_null; | ||||||
|     csr_wr_cb[marchid] = &this_class::write_null; |     csr_wr_cb[marchid] = &this_class::write_null; | ||||||
| @@ -397,7 +397,7 @@ template <typename BASE> std::pair<uint64_t, bool> riscv_hart_m_p<BASE>::load_fi | |||||||
|                             traits<BASE>::MEM, pseg->get_physical_address(), |                             traits<BASE>::MEM, pseg->get_physical_address(), | ||||||
|                             fsize, reinterpret_cast<const uint8_t *const>(seg_data)); |                             fsize, reinterpret_cast<const uint8_t *const>(seg_data)); | ||||||
|                     if (res != iss::Ok) |                     if (res != iss::Ok) | ||||||
|                         LOG(ERROR) << "problem writing " << fsize << "bytes to 0x" << std::hex |                         LOG(ERR) << "problem writing " << fsize << "bytes to 0x" << std::hex | ||||||
|                                    << pseg->get_physical_address(); |                                    << pseg->get_physical_address(); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @@ -948,7 +948,11 @@ template <typename BASE> uint64_t riscv_hart_m_p<BASE>::enter_trap(uint64_t flag | |||||||
|     this->reg.PRIV = PRIV_M; |     this->reg.PRIV = PRIV_M; | ||||||
|     this->reg.trap_state = 0; |     this->reg.trap_state = 0; | ||||||
|     std::array<char, 32> buffer; |     std::array<char, 32> buffer; | ||||||
|  | #if defined(_MSC_VER) | ||||||
|  |     sprintf(buffer.data(), "0x%016llx", addr); | ||||||
|  | #else | ||||||
|     sprintf(buffer.data(), "0x%016lx", addr); |     sprintf(buffer.data(), "0x%016lx", addr); | ||||||
|  | #endif | ||||||
|     if((flags&0xffffffff) != 0xffffffff) |     if((flags&0xffffffff) != 0xffffffff) | ||||||
|     CLOG(INFO, disass) << (trap_id ? "Interrupt" : "Trap") << " with cause '" |     CLOG(INFO, disass) << (trap_id ? "Interrupt" : "Trap") << " with cause '" | ||||||
|                        << (trap_id ? irq_str[cause] : trap_str[cause]) << "' (" << cause << ")" |                        << (trap_id ? irq_str[cause] : trap_str[cause]) << "' (" << cause << ")" | ||||||
|   | |||||||
| @@ -49,7 +49,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
|  |  | ||||||
| /*---------------------------------------------------------------------------- | /*---------------------------------------------------------------------------- | ||||||
| *----------------------------------------------------------------------------*/ | *----------------------------------------------------------------------------*/ | ||||||
|  | #ifdef __GNUC__ | ||||||
| #define SOFTFLOAT_BUILTIN_CLZ 1 | #define SOFTFLOAT_BUILTIN_CLZ 1 | ||||||
| #define SOFTFLOAT_INTRINSIC_INT128 1 | #define SOFTFLOAT_INTRINSIC_INT128 1 | ||||||
|  | #endif | ||||||
| #include "opts-GCC.h" | #include "opts-GCC.h" | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/main.cpp
									
									
									
									
									
								
							| @@ -49,11 +49,6 @@ using tgc_b_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_b>; | |||||||
| #include "iss/arch/tgc_d.h" | #include "iss/arch/tgc_d.h" | ||||||
| using tgc_d_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d, (iss::arch::features_e)(iss::arch::FEAT_PMP | iss::arch::FEAT_CLIC | iss::arch::FEAT_EXT_N)>; | using tgc_d_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d, (iss::arch::features_e)(iss::arch::FEAT_PMP | iss::arch::FEAT_CLIC | iss::arch::FEAT_EXT_N)>; | ||||||
| #endif | #endif | ||||||
| #ifdef CORE_TGC_D_XRB_MAC |  | ||||||
| #include "iss/arch/riscv_hart_mu_p.h" |  | ||||||
| #include "iss/arch/tgc_d_xrb_mac.h" |  | ||||||
| using tgc_d_xrb_mac_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d_xrb_mac, (iss::arch::features_e)(iss::arch::FEAT_PMP | iss::arch::FEAT_CLIC | iss::arch::FEAT_EXT_N)>; |  | ||||||
| #endif |  | ||||||
| #ifdef WITH_LLVM | #ifdef WITH_LLVM | ||||||
| #include <iss/llvm/jit_helper.h> | #include <iss/llvm/jit_helper.h> | ||||||
| #endif | #endif | ||||||
| @@ -143,15 +138,9 @@ int main(int argc, char *argv[]) { | |||||||
|             std::tie(cpu, vm) = |             std::tie(cpu, vm) = | ||||||
|                 iss::create_cpu<tgc_d_plat_type>(clim["backend"].as<std::string>(), clim["gdb-port"].as<unsigned>()); |                 iss::create_cpu<tgc_d_plat_type>(clim["backend"].as<std::string>(), clim["gdb-port"].as<unsigned>()); | ||||||
|         } else |         } else | ||||||
| #endif |  | ||||||
| #ifdef CORE_TGC_D_XRB_MAC |  | ||||||
|         if (isa_opt == "tgc_d_xrb_mac") { |  | ||||||
|             std::tie(cpu, vm) = |  | ||||||
|                 iss::create_cpu<tgc_d_xrb_mac_plat_type>(clim["backend"].as<std::string>(), clim["gdb-port"].as<unsigned>()); |  | ||||||
|         } else |  | ||||||
| #endif | #endif | ||||||
|         { |         { | ||||||
|             LOG(ERROR) << "Illegal argument value for '--isa': " << clim["isa"].as<std::string>() << std::endl; |             LOG(ERR) << "Illegal argument value for '--isa': " << clim["isa"].as<std::string>() << std::endl; | ||||||
|             return 127; |             return 127; | ||||||
|         } |         } | ||||||
|         if (clim.count("plugin")) { |         if (clim.count("plugin")) { | ||||||
| @@ -172,7 +161,7 @@ int main(int argc, char *argv[]) { | |||||||
|                     vm->register_plugin(*ce_plugin); |                     vm->register_plugin(*ce_plugin); | ||||||
|                     plugin_list.push_back(ce_plugin); |                     plugin_list.push_back(ce_plugin); | ||||||
|                 } else { |                 } else { | ||||||
|                     LOG(ERROR) << "Unknown plugin name: " << plugin_name << ", valid names are 'ce', 'ic'" << std::endl; |                     LOG(ERR) << "Unknown plugin name: " << plugin_name << ", valid names are 'ce', 'ic'" << std::endl; | ||||||
|                     return 127; |                     return 127; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @@ -207,7 +196,7 @@ int main(int argc, char *argv[]) { | |||||||
|         auto cycles = clim["instructions"].as<uint64_t>(); |         auto cycles = clim["instructions"].as<uint64_t>(); | ||||||
|         res = vm->start(cycles, dump); |         res = vm->start(cycles, dump); | ||||||
|     } catch (std::exception &e) { |     } catch (std::exception &e) { | ||||||
|         LOG(ERROR) << "Unhandled Exception reached the top of main: " << e.what() << ", application will now exit" |         LOG(ERR) << "Unhandled Exception reached the top of main: " << e.what() << ", application will now exit" | ||||||
|                    << std::endl; |                    << std::endl; | ||||||
|         res = 2; |         res = 2; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -47,10 +47,10 @@ iss::plugin::cycle_estimate::cycle_estimate(std::string config_file_name) | |||||||
|             try { |             try { | ||||||
|                 is >> root; |                 is >> root; | ||||||
|             } catch (Json::RuntimeError &e) { |             } catch (Json::RuntimeError &e) { | ||||||
|                 LOG(ERROR) << "Could not parse input file " << config_file_name << ", reason: " << e.what(); |                 LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what(); | ||||||
|             } |             } | ||||||
|         } else { |         } else { | ||||||
|             LOG(ERROR) << "Could not open input file " << config_file_name; |             LOG(ERR) << "Could not open input file " << config_file_name; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -77,7 +77,7 @@ bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if& | |||||||
|     		} |     		} | ||||||
|     	} |     	} | ||||||
|     } else { |     } else { | ||||||
|         LOG(ERROR)<<"plugin cycle_estimate: could not find an entry for "<<core_name<<" in JSON file"<<std::endl; |         LOG(ERR)<<"plugin cycle_estimate: could not find an entry for "<<core_name<<" in JSON file"<<std::endl; | ||||||
|     } |     } | ||||||
| 	return true; | 	return true; | ||||||
|  |  | ||||||
| @@ -87,6 +87,8 @@ void iss::plugin::cycle_estimate::callback(instr_info_t instr_info, exec_info co | |||||||
|     assert(arch_instr && "No instrumentation interface available but callback executed"); |     assert(arch_instr && "No instrumentation interface available but callback executed"); | ||||||
| 	auto entry = delays[instr_info.instr_id]; | 	auto entry = delays[instr_info.instr_id]; | ||||||
| 	bool taken = (arch_instr->get_next_pc()-arch_instr->get_pc()) != (entry.size/8); | 	bool taken = (arch_instr->get_next_pc()-arch_instr->get_pc()) != (entry.size/8); | ||||||
|     uint32_t delay = taken ? entry.taken : entry.not_taken; |     if (taken && entry.taken > 1) | ||||||
|     if(delay>1) arch_instr->set_curr_instr_cycles(delay); |         arch_instr->set_curr_instr_cycles(entry.taken); | ||||||
|  |     else if (entry.not_taken > 1) | ||||||
|  |         arch_instr->set_curr_instr_cycles(entry.not_taken); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -46,10 +46,10 @@ iss::plugin::instruction_count::instruction_count(std::string config_file_name) | |||||||
|             try { |             try { | ||||||
|                 is >> root; |                 is >> root; | ||||||
|             } catch (Json::RuntimeError &e) { |             } catch (Json::RuntimeError &e) { | ||||||
|                 LOG(ERROR) << "Could not parse input file " << config_file_name << ", reason: " << e.what(); |                 LOG(ERR) << "Could not parse input file " << config_file_name << ", reason: " << e.what(); | ||||||
|             } |             } | ||||||
|         } else { |         } else { | ||||||
|             LOG(ERROR) << "Could not open input file " << config_file_name; |             LOG(ERR) << "Could not open input file " << config_file_name; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -85,7 +85,7 @@ bool iss::plugin::instruction_count::registration(const char* const version, vm_ | |||||||
|     	} |     	} | ||||||
|     	rep_counts.resize(delays.size()); |     	rep_counts.resize(delays.size()); | ||||||
|     } else { |     } else { | ||||||
|         LOG(ERROR)<<"plugin instruction_count: could not find an entry for "<<core_name<<" in JSON file"<<std::endl; |         LOG(ERR)<<"plugin instruction_count: could not find an entry for "<<core_name<<" in JSON file"<<std::endl; | ||||||
|     } |     } | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -30,6 +30,13 @@ | |||||||
|  * |  * | ||||||
|  *******************************************************************************/ |  *******************************************************************************/ | ||||||
|  |  | ||||||
|  | // clang-format off | ||||||
|  | #include "iss/debugger/gdb_session.h" | ||||||
|  | #include "iss/debugger/encoderdecoder.h" | ||||||
|  | #include "iss/debugger/server.h" | ||||||
|  | #include "iss/debugger/target_adapter_if.h" | ||||||
|  | #include "iss/iss.h" | ||||||
|  | #include "iss/vm_types.h" | ||||||
| #include "sysc/core_complex.h" | #include "sysc/core_complex.h" | ||||||
| #ifdef CORE_TGC_B | #ifdef CORE_TGC_B | ||||||
| #include "iss/arch/riscv_hart_m_p.h" | #include "iss/arch/riscv_hart_m_p.h" | ||||||
| @@ -44,21 +51,11 @@ using tgc_c_plat_type = iss::arch::riscv_hart_m_p<iss::arch::tgc_c>; | |||||||
| #include "iss/arch/tgc_d.h" | #include "iss/arch/tgc_d.h" | ||||||
| using tgc_d_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d, iss::arch::FEAT_PMP>; | using tgc_d_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d, iss::arch::FEAT_PMP>; | ||||||
| #endif | #endif | ||||||
| #ifdef CORE_TGC_D_XRB_MAC |  | ||||||
| #include "iss/arch/riscv_hart_mu_p.h" |  | ||||||
| #include "iss/arch/tgc_d_xrb_mac.h" |  | ||||||
| using tgc_d_xrb_mac_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d_xrb_mac, iss::arch::FEAT_PMP>; |  | ||||||
| #endif |  | ||||||
| #include "iss/debugger/encoderdecoder.h" |  | ||||||
| #include "iss/debugger/gdb_session.h" |  | ||||||
| #include "iss/debugger/server.h" |  | ||||||
| #include "iss/debugger/target_adapter_if.h" |  | ||||||
| #include "iss/iss.h" |  | ||||||
| #include "iss/vm_types.h" |  | ||||||
| #include "scc/report.h" | #include "scc/report.h" | ||||||
| #include <iostream> | #include <iostream> | ||||||
| #include <sstream> | #include <sstream> | ||||||
| #include <array> | #include <array> | ||||||
|  | // clang-format on | ||||||
|  |  | ||||||
| #define STR(X) #X | #define STR(X) #X | ||||||
| #define CREATE_CORE(CN) \ | #define CREATE_CORE(CN) \ | ||||||
| @@ -77,6 +74,12 @@ using namespace scv_tr; | |||||||
| #define GET_PROP_VALUE(P) P.getValue() | #define GET_PROP_VALUE(P) P.getValue() | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #ifdef _MSC_VER | ||||||
|  | // not #if defined(_WIN32) || defined(_WIN64) because we have strncasecmp in mingw | ||||||
|  | #define strncasecmp _strnicmp | ||||||
|  | #define strcasecmp _stricmp | ||||||
|  | #endif | ||||||
|  |  | ||||||
| namespace sysc { | namespace sysc { | ||||||
| namespace tgfs { | namespace tgfs { | ||||||
| using namespace std; | using namespace std; | ||||||
| @@ -290,12 +293,9 @@ public: | |||||||
| #endif | #endif | ||||||
| #ifdef CORE_TGC_D | #ifdef CORE_TGC_D | ||||||
|         CREATE_CORE(tgc_d) |         CREATE_CORE(tgc_d) | ||||||
| #endif |  | ||||||
| #ifdef CORE_TGC_D_XRB_MACD |  | ||||||
|         CREATE_CORE(tgc_d_xrb_mac) |  | ||||||
| #endif | #endif | ||||||
|         { |         { | ||||||
|             LOG(ERROR) << "Illegal argument value for core type: " << type << std::endl; |             LOG(ERR) << "Illegal argument value for core type: " << type << std::endl; | ||||||
|         } |         } | ||||||
|         auto *srv = debugger::server<debugger::gdb_session>::get(); |         auto *srv = debugger::server<debugger::gdb_session>::get(); | ||||||
|         if (srv) tgt_adapter = srv->get_target(); |         if (srv) tgt_adapter = srv->get_target(); | ||||||
|   | |||||||
| @@ -30,23 +30,21 @@ | |||||||
|  * |  * | ||||||
|  *******************************************************************************/ |  *******************************************************************************/ | ||||||
|  |  | ||||||
| #include "../fp_functions.h" | // clang-format off | ||||||
| #include <iss/arch/tgc_c.h> |  | ||||||
| #include <iss/arch/riscv_hart_m_p.h> |  | ||||||
| #include <iss/debugger/gdb_session.h> | #include <iss/debugger/gdb_session.h> | ||||||
| #include <iss/debugger/server.h> | #include <iss/debugger/server.h> | ||||||
| #include <iss/iss.h> | #include <iss/iss.h> | ||||||
|  | #include <iss/arch/tgc_c.h> | ||||||
|  | #include <iss/arch/riscv_hart_m_p.h> | ||||||
| #include <iss/interp/vm_base.h> | #include <iss/interp/vm_base.h> | ||||||
|  | #include "../fp_functions.h" | ||||||
| #include <util/logging.h> | #include <util/logging.h> | ||||||
| #include <sstream> | #include <sstream> | ||||||
|  |  | ||||||
| #ifndef FMT_HEADER_ONLY |  | ||||||
| #define FMT_HEADER_ONLY |  | ||||||
| #endif |  | ||||||
| #include <fmt/format.h> | #include <fmt/format.h> | ||||||
|  |  | ||||||
| #include <array> | #include <array> | ||||||
| #include <iss/debugger/riscv_target_adapter.h> | #include <iss/debugger/riscv_target_adapter.h> | ||||||
|  | // clang-format on | ||||||
|  |  | ||||||
| namespace iss { | namespace iss { | ||||||
| namespace interp { | namespace interp { | ||||||
| @@ -4138,8 +4136,8 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co | |||||||
|             this->do_sync(POST_SYNC, std::numeric_limits<unsigned>::max()); |             this->do_sync(POST_SYNC, std::numeric_limits<unsigned>::max()); | ||||||
|             pc.val = super::core.enter_trap(std::numeric_limits<uint64_t>::max(), pc.val, 0); |             pc.val = super::core.enter_trap(std::numeric_limits<uint64_t>::max(), pc.val, 0); | ||||||
|         } else { |         } else { | ||||||
|             if (is_jump_to_self_enabled(cond) && |             if (is_jump_to_self_enabled(cond) && (insn == 0x0000006f || (insn&0xffff)==0xa001)) | ||||||
|                     (insn == 0x0000006f || (insn&0xffff)==0xa001)) throw simulation_stopped(0); // 'J 0' or 'C.J 0' |                 throw simulation_stopped(0); // 'J 0' or 'C.J 0' | ||||||
|             auto f = decode_inst(insn); |             auto f = decode_inst(insn); | ||||||
|             pc = (this->*f)(pc, insn); |             pc = (this->*f)(pc, insn); | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user