change interpreter structure

This commit is contained in:
Eyck Jentzsch 2022-03-06 15:11:38 +01:00
parent 3d32c33333
commit 2e670c4d03
2 changed files with 88 additions and 88 deletions

View File

@ -326,7 +326,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
}
// post execution stuff
process_spawn_blocks();
if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 65);
if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, static_cast<unsigned>(inst_id));
// trap check
if(*trap_state!=0){
super::core.enter_trap(*trap_state, pc.val, instr);

View File

@ -439,7 +439,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
if(imm % traits::INSTR_ALIGNMENT) {
raise(0, 0);
raise( 0, 0);
}
else {
if(rd != 0) *(X+rd) = *PC + 4;
@ -469,7 +469,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
{
int32_t new_pc = (*(X+rs1) + (int16_t)sext<12>(imm)) & ~ 1;
if(new_pc % traits::INSTR_ALIGNMENT) {
raise(0, 0);
raise( 0, 0);
}
else {
if(rd != 0) *(X+rd) = *PC + 4;
@ -498,7 +498,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
if(*(X+rs1) == *(X+rs2)) if(imm % traits::INSTR_ALIGNMENT) {
raise(0, 0);
raise( 0, 0);
}
else {
pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm);
@ -526,7 +526,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
if(*(X+rs1) != *(X+rs2)) if(imm % traits::INSTR_ALIGNMENT) {
raise(0, 0);
raise( 0, 0);
}
else {
pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm);
@ -554,7 +554,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
if((int32_t)*(X+rs1) < (int32_t)*(X+rs2)) if(imm % traits::INSTR_ALIGNMENT) {
raise(0, 0);
raise( 0, 0);
}
else {
pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm);
@ -582,7 +582,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
if((int32_t)*(X+rs1) >= (int32_t)*(X+rs2)) if(imm % traits::INSTR_ALIGNMENT) {
raise(0, 0);
raise( 0, 0);
}
else {
pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm);
@ -610,7 +610,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
if(*(X+rs1) < *(X+rs2)) if(imm % traits::INSTR_ALIGNMENT) {
raise(0, 0);
raise( 0, 0);
}
else {
pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm);
@ -638,7 +638,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
if(*(X+rs1) >= *(X+rs2)) if(imm % traits::INSTR_ALIGNMENT) {
raise(0, 0);
raise( 0, 0);
}
else {
pc_assign(*NEXT_PC) = *PC + (int16_t)sext<13>(imm);
@ -983,7 +983,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction
try {
if(shamt > 31) {
raise(0, 0);
raise( 0, 0);
}
else {
if(rd != 0) *(X+rd) = *(X+rs1) << shamt;
@ -1009,7 +1009,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction
try {
if(shamt > 31) {
raise(0, 0);
raise( 0, 0);
}
else {
if(rd != 0) *(X+rd) = *(X+rs1) >> shamt;
@ -1035,7 +1035,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction
try {
if(shamt > 31) {
raise(0, 0);
raise( 0, 0);
}
else {
if(rd != 0) *(X+rd) = (int32_t)*(X+rs1) >> shamt;
@ -1285,7 +1285,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 4;
// execute instruction
try {
raise(0, 11);
raise( 0, 11);
} catch(...){}
}
break;
@ -1299,7 +1299,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 4;
// execute instruction
try {
raise(0, 3);
raise( 0, 3);
} catch(...){}
}
break;
@ -1313,7 +1313,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 4;
// execute instruction
try {
leave(0);
leave( 0);
} catch(...){}
}
break;
@ -1327,7 +1327,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 4;
// execute instruction
try {
leave(1);
leave( 1);
} catch(...){}
}
break;
@ -1341,7 +1341,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 4;
// execute instruction
try {
leave(3);
leave( 3);
} catch(...){}
}
break;
@ -1355,7 +1355,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 4;
// execute instruction
try {
wait(1);
wait( 1);
} catch(...){}
}
break;
@ -1374,7 +1374,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction
try {
{
if(*PRIV < 4) raise(0, 2);
if(*PRIV < 4) raise( 0, 2);
else {
pc_assign(*NEXT_PC) = *DPC;
*PRIV &= 0x3;
@ -1793,8 +1793,8 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 2;
// execute instruction
try {
if(imm) *(X+(rd + 8)) = *(X+2) + imm;
else raise(0, 2);
if(imm) *(X+rd + 8) = *(X+2) + imm;
else raise( 0, 2);
} catch(...){}
}
break;
@ -1816,8 +1816,8 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction
try {
{
uint32_t load_address = *(X+(rs1 + 8)) + uimm;
*(X+(rd + 8)) = (int32_t)readSpace4(traits::MEM, load_address);
uint32_t load_address = *(X+rs1 + 8) + uimm;
*(X+rd + 8) = (int32_t)readSpace4(traits::MEM, load_address);
}
} catch(...){}
}
@ -1840,8 +1840,8 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction
try {
{
uint32_t load_address = *(X+(rs1 + 8)) + uimm;
writeSpace4(traits::MEM, load_address, *(X+(rs2 + 8)));
uint32_t load_address = *(X+rs1 + 8) + uimm;
writeSpace4(traits::MEM, load_address, *(X+rs2 + 8));
}
} catch(...){}
}
@ -1943,7 +1943,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction
try {
{
if(imm == 0) raise(0, 2);
if(imm == 0) raise( 0, 2);
if(rd != 0) *(X+rd) = (int32_t)sext<18>(imm);
}
} catch(...){}
@ -1965,7 +1965,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction
try {
if(nzimm) *(X+2) = *(X+2) + (int16_t)sext<10>(nzimm);
else raise(0, 2);
else raise( 0, 2);
} catch(...){}
}
break;
@ -1980,7 +1980,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 2;
// execute instruction
try {
raise(0, 2);
raise( 0, 2);
} catch(...){}
}
break;
@ -2075,7 +2075,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
uint32_t rd_idx = rd + 8;
*(X+rd_idx) = *(X+rd_idx) - *(X+(rs2 + 8));
*(X+rd_idx) = *(X+rd_idx) - *(X+rs2 + 8);
}
} catch(...){}
}
@ -2098,7 +2098,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
uint32_t rd_idx = rd + 8;
*(X+rd_idx) = *(X+rd_idx) ^ *(X+(rs2 + 8));
*(X+rd_idx) = *(X+rd_idx) ^ *(X+rs2 + 8);
}
} catch(...){}
}
@ -2121,7 +2121,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
uint32_t rd_idx = rd + 8;
*(X+rd_idx) = *(X+rd_idx) | *(X+(rs2 + 8));
*(X+rd_idx) = *(X+rd_idx) | *(X+rs2 + 8);
}
} catch(...){}
}
@ -2144,7 +2144,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
try {
{
uint32_t rd_idx = rd + 8;
*(X+rd_idx) = *(X+rd_idx) & *(X+(rs2 + 8));
*(X+rd_idx) = *(X+rd_idx) & *(X+rs2 + 8);
}
} catch(...){}
}
@ -2183,7 +2183,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 2;
// execute instruction
try {
if(*(X+(rs1 + 8)) == 0) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<9>(imm);
if(*(X+rs1 + 8) == 0) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<9>(imm);
} catch(...){}
}
break;
@ -2203,7 +2203,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 2;
// execute instruction
try {
if(*(X+(rs1 + 8)) != 0) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<9>(imm);
if(*(X+rs1 + 8) != 0) pc_assign(*NEXT_PC) = *PC + (int16_t)sext<9>(imm);
} catch(...){}
}
break;
@ -2247,7 +2247,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
uint32_t offs = *(X+2) + uimm;
*(X+rd) = (int32_t)readSpace4(traits::MEM, offs);
}
else raise(0, 2);
else raise( 0, 2);
} catch(...){}
}
break;
@ -2287,7 +2287,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
// execute instruction
try {
if(rs1) pc_assign(*NEXT_PC) = *(X+rs1) & ~ 0x1;
else raise(0, 2);
else raise( 0, 2);
} catch(...){}
}
break;
@ -2301,7 +2301,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 2;
// execute instruction
try {
raise(0, 2);
raise( 0, 2);
} catch(...){}
}
break;
@ -2358,7 +2358,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 2;
// execute instruction
try {
raise(0, 3);
raise( 0, 3);
} catch(...){}
}
break;
@ -2395,7 +2395,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
*NEXT_PC = *PC + 2;
// execute instruction
try {
raise(0, 2);
raise( 0, 2);
} catch(...){}
}
break;
@ -2406,7 +2406,7 @@ typename vm_base<ARCH>::virt_addr_t vm_impl<ARCH>::execute_inst(finish_cond_e co
}
// post execution stuff
process_spawn_blocks();
if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, 65);
if(this->sync_exec && POST_SYNC) this->do_sync(POST_SYNC, static_cast<unsigned>(inst_id));
// trap check
if(*trap_state!=0){
super::core.enter_trap(*trap_state, pc.val, instr);