fix templates to comply with CoreDSL2

This commit is contained in:
2021-03-01 21:07:20 +00:00
parent 4aa26b85a0
commit be0e7db185
7 changed files with 277 additions and 269 deletions

View File

@ -30,6 +30,8 @@
*
*******************************************************************************/
<%
import com.minres.coredsl.util.BigIntegerWithRadix
def nativeTypeSize(int size){
if(size<=8) return 8; else if(size<=16) return 16; else if(size<=32) return 32; else return 64;
}
@ -54,6 +56,12 @@ def byteSize(int size){
if(size<=64) return 64;
return 128;
}
def getCString(def val){
if(val instanceof BigIntegerWithRadix)
return ((BigIntegerWithRadix)val).toCString()
else
return val.toString()
}
%>
#ifndef _${coreDef.name.toUpperCase()}_H_
#define _${coreDef.name.toUpperCase()}_H_
@ -78,7 +86,7 @@ template <> struct traits<${coreDef.name.toLowerCase()}> {
static constexpr std::array<const char*, ${registers.size}> reg_aliases{
{"${registers.collect{it.alias}.join('", "')}"}};
enum constants {${constants.collect{c -> c.name+"="+c.value}.join(', ')}};
enum constants {${constants.collect{c -> c.name+"="+getCString(c.value)}.join(', ')}};
constexpr static unsigned FP_REGS_SIZE = ${constants.find {it.name=='FLEN'}?.value?:0};