From b95f518c91ee67b8234876ebbd52da82540577e9 Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Mon, 3 Feb 2025 12:33:05 +0100 Subject: [PATCH] updates templates for interp to make extension specific includes conditonal --- gen_input/templates/interp/CORENAME.cpp.gtl | 16 ++++++++++++---- src/vm/interp/vm_tgc5c.cpp | 4 +--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/gen_input/templates/interp/CORENAME.cpp.gtl b/gen_input/templates/interp/CORENAME.cpp.gtl index 3834cbf..20704b8 100644 --- a/gen_input/templates/interp/CORENAME.cpp.gtl +++ b/gen_input/templates/interp/CORENAME.cpp.gtl @@ -30,6 +30,9 @@ * *******************************************************************************/ <% +def floating_point = registers.find {it.name=='FCSR'} +def vector = registers.find {it.name=='vtype'} +def aes = functions.find { it.contains('aes') } def nativeTypeSize(int size){ if(size<=8) return 8; else if(size<=16) return 16; else if(size<=32) return 32; else return 64; } @@ -41,9 +44,16 @@ def nativeTypeSize(int size){ #include #include #include +<% +if(floating_point != null) {%> #include +<%} +if(vector != null) {%> #include +<%} +if(aes != null) {%> #include +<%}%> #include #include #include @@ -103,12 +113,10 @@ protected: using compile_func = compile_ret_t (this_class::*)(virt_addr_t &pc, code_word_t instr); inline const char *name(size_t index){return traits::reg_aliases.at(index);} -<% -def fcsr = registers.find {it.name=='FCSR'} -if(fcsr != null) {%> +<% +if(floating_point != null) {%> inline const char *fname(size_t index){return index < 32?name(index+traits::F0):"illegal";} <%} -def vector = registers.find {it.name=='vtype'} if(vector != null) {%> inline const char *vname(size_t index){return index < 32?name(index+traits::V0):"illegal";} inline const char *sew_name(size_t bits){ diff --git a/src/vm/interp/vm_tgc5c.cpp b/src/vm/interp/vm_tgc5c.cpp index cef3d0c..a8e8e36 100644 --- a/src/vm/interp/vm_tgc5c.cpp +++ b/src/vm/interp/vm_tgc5c.cpp @@ -37,9 +37,7 @@ #include #include #include -#include -#include -#include + #include #include #include