adds remaining register offsets

This commit is contained in:
Eyck-Alexander Jentzsch 2023-05-14 17:16:42 +02:00
parent 95ba5c901a
commit ee2ded931d
2 changed files with 8 additions and 5 deletions

View File

@ -33,8 +33,7 @@
def getRegisterSizes(){ def getRegisterSizes(){
def regs = registers.collect{it.size} def regs = registers.collect{it.size}
regs[-1]=64 // correct for NEXT_PC regs[-1]=64 // correct for NEXT_PC
//regs+=[32, 32, 64, 64, 64, 32] // append TRAP_STATE, PENDING_TRAP, ICOUNT, CYCLE, INSTRET, INSTRUCTION regs+=[32,32, 64, 64, 64, 32, 32] // append TRAP_STATE, PENDING_TRAP, ICOUNT, CYCLE, INSTRET, INSTRUCTION, LAST_BRANCH
regs += [32] // append LAST_BRANCH
return regs return regs
} }
%> %>

View File

@ -37,8 +37,7 @@ def nativeTypeSize(int size){
} }
def getRegisterSizes(){ def getRegisterSizes(){
def regs = registers.collect{nativeTypeSize(it.size)} def regs = registers.collect{nativeTypeSize(it.size)}
// regs+=[32,32, 64, 64, 64, 32] // append TRAP_STATE, PENDING_TRAP, ICOUNT, CYCLE, INSTRET, INSTRUCTION regs+=[32,32, 64, 64, 64, 32, 32] // append TRAP_STATE, PENDING_TRAP, ICOUNT, CYCLE, INSTRET, INSTRUCTION, LAST_BRANCH
regs += [32] // append LAST_BRANCH
return regs return regs
} }
def getRegisterOffsets(){ def getRegisterOffsets(){
@ -92,7 +91,7 @@ template <> struct traits<${coreDef.name.toLowerCase()}> {
constexpr static unsigned FP_REGS_SIZE = ${constants.find {it.name=='FLEN'}?.value?:0}; constexpr static unsigned FP_REGS_SIZE = ${constants.find {it.name=='FLEN'}?.value?:0};
enum reg_e { enum reg_e {
${registers.collect{it.name}.join(', ')}, NUM_REGS, LAST_BRANCH=NUM_REGS ${registers.collect{it.name}.join(', ')}, NUM_REGS, TRAP_STATE=NUM_REGS, PENDING_TRAP, ICOUNT, CYCLE, INSTRET, INSTRUCTION, LAST_BRANCH
}; };
using reg_t = uint${addrDataWidth}_t; using reg_t = uint${addrDataWidth}_t;
@ -163,6 +162,11 @@ struct ${coreDef.name.toLowerCase()}: public arch_if {
registers.each { reg -> if(reg.size>0) {%> registers.each { reg -> if(reg.size>0) {%>
uint${byteSize(reg.size)}_t ${reg.name} = 0;<% uint${byteSize(reg.size)}_t ${reg.name} = 0;<%
}}%> }}%>
uint32_t trap_state = 0, pending_trap = 0;
uint64_t icount = 0;
uint64_t cycle = 0;
uint64_t instret = 0;
uint32_t instruction = 0;
uint32_t last_branch = 0; uint32_t last_branch = 0;
} reg; } reg;
#pragma pack(pop) #pragma pack(pop)