adds reformat bc of verilog literals
This commit is contained in:
parent
a27850f841
commit
3cc8bd0854
|
@ -355,7 +355,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_const(32,(uint32_t)((int32_t)imm)),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -398,7 +398,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_const(32,(uint32_t)(PC+(int32_t)imm)),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -444,9 +444,9 @@ private:
|
|||
if(imm%static_cast<uint32_t>(traits::INSTR_ALIGNMENT)){ this->gen_raise_trap(0, 0);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_const(32,(uint32_t)(PC+ 4)),
|
||||
this->gen_const(32,(uint32_t)(PC+4)),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
auto PC_val_v = (uint32_t)(PC+(int32_t)sext<21>(imm));
|
||||
|
@ -516,9 +516,9 @@ private:
|
|||
this->builder.CreateBr(bb_merge);
|
||||
this->builder.SetInsertPoint(bb_else);
|
||||
{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_const(32,(uint32_t)(PC+ 4)),
|
||||
this->gen_const(32,(uint32_t)(PC+4)),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
auto PC_val_v = new_pc;
|
||||
|
@ -925,7 +925,7 @@ private:
|
|||
auto res =this->gen_ext(
|
||||
this->gen_read_mem(traits::MEM, load_address, 1),
|
||||
8, false);
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
res,
|
||||
|
@ -980,7 +980,7 @@ private:
|
|||
auto res =this->gen_ext(
|
||||
this->gen_read_mem(traits::MEM, load_address, 2),
|
||||
16, false);
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
res,
|
||||
|
@ -1035,7 +1035,7 @@ private:
|
|||
auto res =this->gen_ext(
|
||||
this->gen_read_mem(traits::MEM, load_address, 4),
|
||||
32, false);
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
res,
|
||||
|
@ -1088,7 +1088,7 @@ private:
|
|||
),
|
||||
32, true);
|
||||
auto res =this->gen_read_mem(traits::MEM, load_address, 1);
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
res,
|
||||
|
@ -1141,7 +1141,7 @@ private:
|
|||
),
|
||||
32, true);
|
||||
auto res =this->gen_read_mem(traits::MEM, load_address, 2);
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
res,
|
||||
|
@ -1337,7 +1337,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
|
@ -1386,15 +1386,15 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->gen_choose((this->builder.CreateICmp(ICmpInst::ICMP_SLT,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 32,true))
|
||||
),
|
||||
this->gen_const(8, 1),
|
||||
this->gen_const(8, 0),
|
||||
this->gen_const(8,1),
|
||||
this->gen_const(8,0),
|
||||
1), 32),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
|
@ -1437,14 +1437,14 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->gen_choose((this->builder.CreateICmp(ICmpInst::ICMP_ULT,
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_const(32,(uint32_t)((int16_t)sext<12>(imm))))
|
||||
),
|
||||
this->gen_const(8, 1),
|
||||
this->gen_const(8, 0),
|
||||
this->gen_const(8,1),
|
||||
this->gen_const(8,0),
|
||||
1), 32),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
|
@ -1487,7 +1487,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateXor(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
|
@ -1534,7 +1534,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateOr(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
|
@ -1581,7 +1581,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateAnd(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
|
@ -1628,7 +1628,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateShl(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
|
@ -1675,7 +1675,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateLShr(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
|
@ -1722,7 +1722,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAShr(
|
||||
|
@ -1772,7 +1772,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
|
@ -1821,7 +1821,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateSub(
|
||||
|
@ -1870,13 +1870,13 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->builder.CreateShl(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
(this->builder.CreateAnd(
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false),
|
||||
this->gen_const(64,(static_cast<uint32_t>(traits::XLEN)- 1)))
|
||||
this->gen_const(64,(static_cast<uint32_t>(traits::XLEN)-1)))
|
||||
))
|
||||
, 32, false),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -1920,7 +1920,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->gen_choose(this->builder.CreateICmp(ICmpInst::ICMP_SLT,
|
||||
this->gen_ext(
|
||||
|
@ -1928,8 +1928,8 @@ private:
|
|||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0), 32,true))
|
||||
,
|
||||
this->gen_const(8, 1),
|
||||
this->gen_const(8, 0),
|
||||
this->gen_const(8,1),
|
||||
this->gen_const(8,0),
|
||||
1), 32),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
|
@ -1972,14 +1972,14 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->gen_choose(this->builder.CreateICmp(ICmpInst::ICMP_ULT,
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
,
|
||||
this->gen_const(8, 1),
|
||||
this->gen_const(8, 0),
|
||||
this->gen_const(8,1),
|
||||
this->gen_const(8,0),
|
||||
1), 32),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
|
@ -2022,7 +2022,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateXor(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
|
@ -2069,13 +2069,13 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->builder.CreateLShr(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
(this->builder.CreateAnd(
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false),
|
||||
this->gen_const(64,(static_cast<uint32_t>(traits::XLEN)- 1)))
|
||||
this->gen_const(64,(static_cast<uint32_t>(traits::XLEN)-1)))
|
||||
))
|
||||
, 32, false),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -2119,7 +2119,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->gen_ext(this->builder.CreateAShr(
|
||||
|
@ -2127,7 +2127,7 @@ private:
|
|||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true), 64,true),
|
||||
(this->builder.CreateAnd(
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false),
|
||||
this->gen_const(64,(static_cast<uint32_t>(traits::XLEN)- 1)))
|
||||
this->gen_const(64,(static_cast<uint32_t>(traits::XLEN)-1)))
|
||||
))
|
||||
, 32, true)),
|
||||
32, true),
|
||||
|
@ -2172,7 +2172,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateOr(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
|
@ -2219,7 +2219,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateAnd(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
|
@ -2266,7 +2266,7 @@ private:
|
|||
/*generate behavior*/
|
||||
this->gen_write_mem(traits::FENCE,
|
||||
static_cast<uint32_t>(traits::fence),
|
||||
this->gen_const(8,(uint8_t)pred<< 4|succ));
|
||||
this->gen_const(8,(uint8_t)pred<<4|succ));
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
auto returnValue = std::make_tuple(CONT,bb);
|
||||
|
||||
|
@ -2402,7 +2402,7 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrs1 =this->gen_reg_load(rs1+ traits::X0, 0);
|
||||
if(rd!= 0){ auto xrd =this->gen_read_mem(traits::CSR, csr, 4);
|
||||
if(rd!=0){ auto xrd =this->gen_read_mem(traits::CSR, csr, 4);
|
||||
this->gen_write_mem(traits::CSR,
|
||||
csr,
|
||||
xrs1);
|
||||
|
@ -2456,7 +2456,7 @@ private:
|
|||
else{
|
||||
auto xrd =this->gen_read_mem(traits::CSR, csr, 4);
|
||||
auto xrs1 =this->gen_reg_load(rs1+ traits::X0, 0);
|
||||
if(rs1!= 0) {
|
||||
if(rs1!=0) {
|
||||
this->gen_write_mem(traits::CSR,
|
||||
csr,
|
||||
this->builder.CreateOr(
|
||||
|
@ -2464,7 +2464,7 @@ private:
|
|||
xrs1)
|
||||
);
|
||||
}
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
xrd,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -2510,7 +2510,7 @@ private:
|
|||
else{
|
||||
auto xrd =this->gen_read_mem(traits::CSR, csr, 4);
|
||||
auto xrs1 =this->gen_reg_load(rs1+ traits::X0, 0);
|
||||
if(rs1!= 0) {
|
||||
if(rs1!=0) {
|
||||
this->gen_write_mem(traits::CSR,
|
||||
csr,
|
||||
this->builder.CreateAnd(
|
||||
|
@ -2518,7 +2518,7 @@ private:
|
|||
this->builder.CreateNeg(xrs1))
|
||||
);
|
||||
}
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
xrd,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -2566,7 +2566,7 @@ private:
|
|||
this->gen_write_mem(traits::CSR,
|
||||
csr,
|
||||
this->gen_const(32,(uint32_t)zimm));
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
xrd,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -2611,7 +2611,7 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrd =this->gen_read_mem(traits::CSR, csr, 4);
|
||||
if(zimm!= 0) {
|
||||
if(zimm!=0) {
|
||||
this->gen_write_mem(traits::CSR,
|
||||
csr,
|
||||
this->builder.CreateOr(
|
||||
|
@ -2619,7 +2619,7 @@ private:
|
|||
this->gen_const(32,(uint32_t)zimm))
|
||||
);
|
||||
}
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
xrd,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -2664,7 +2664,7 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrd =this->gen_read_mem(traits::CSR, csr, 4);
|
||||
if(zimm!= 0) {
|
||||
if(zimm!=0) {
|
||||
this->gen_write_mem(traits::CSR,
|
||||
csr,
|
||||
this->builder.CreateAnd(
|
||||
|
@ -2672,7 +2672,7 @@ private:
|
|||
this->gen_const(32,~ ((uint32_t)zimm)))
|
||||
);
|
||||
}
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
xrd,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -2997,12 +2997,12 @@ private:
|
|||
auto divisor =this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
32, false);
|
||||
if(rd!= 0){ auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
if(rd!=0){ auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
auto bb_else = BasicBlock::Create(this->mod->getContext(), "bb_else", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_ext(this->builder.CreateICmp(ICmpInst::ICMP_NE,
|
||||
divisor,
|
||||
this->gen_ext(this->gen_const(8, 0), 32,false))
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
, 1), bb_then, bb_else);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
{
|
||||
|
@ -3095,7 +3095,7 @@ private:
|
|||
auto bb_else = BasicBlock::Create(this->mod->getContext(), "bb_else", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_ext(this->builder.CreateICmp(ICmpInst::ICMP_NE,
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_ext(this->gen_const(8, 0), 32,false))
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
, 1), bb_then, bb_else);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
{
|
||||
|
@ -3165,7 +3165,7 @@ private:
|
|||
auto bb_else = BasicBlock::Create(this->mod->getContext(), "bb_else", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_ext(this->builder.CreateICmp(ICmpInst::ICMP_NE,
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_ext(this->gen_const(8, 0), 32,false))
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
, 1), bb_then, bb_else);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
{
|
||||
|
@ -3189,7 +3189,7 @@ private:
|
|||
{
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->gen_const(8, 0), 32),
|
||||
this->gen_ext(this->gen_const(8,0), 32),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
}
|
||||
|
@ -3269,7 +3269,7 @@ private:
|
|||
auto bb_else = BasicBlock::Create(this->mod->getContext(), "bb_else", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_ext(this->builder.CreateICmp(ICmpInst::ICMP_NE,
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_ext(this->gen_const(8, 0), 32,false))
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
, 1), bb_then, bb_else);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
{
|
||||
|
@ -3335,7 +3335,7 @@ private:
|
|||
this->gen_ext(this->gen_const(16,imm), 64,false))
|
||||
),
|
||||
32, false),
|
||||
get_reg_ptr(rd+ 8 + traits::X0), false);
|
||||
get_reg_ptr(rd+8 + traits::X0), false);
|
||||
}
|
||||
else{
|
||||
this->gen_raise_trap(0, 2);
|
||||
|
@ -3376,7 +3376,7 @@ private:
|
|||
/*generate behavior*/
|
||||
auto offs =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ 8+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(rs1+8+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_const(8,uimm), 64,false))
|
||||
),
|
||||
32, false);
|
||||
|
@ -3386,7 +3386,7 @@ private:
|
|||
this->gen_read_mem(traits::MEM, offs, 4),
|
||||
32, false),
|
||||
32, true),
|
||||
get_reg_ptr(rd+ 8 + traits::X0), false);
|
||||
get_reg_ptr(rd+8 + traits::X0), false);
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
auto returnValue = std::make_tuple(CONT,bb);
|
||||
|
||||
|
@ -3423,14 +3423,14 @@ private:
|
|||
/*generate behavior*/
|
||||
auto offs =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ 8+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(rs1+8+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_const(8,uimm), 64,false))
|
||||
),
|
||||
32, false);
|
||||
this->gen_write_mem(traits::MEM,
|
||||
offs,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ 8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+8+ traits::X0, 0),
|
||||
32, false));
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
auto returnValue = std::make_tuple(CONT,bb);
|
||||
|
@ -3469,7 +3469,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rs1!= 0) {
|
||||
if(rs1!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
|
@ -3537,7 +3537,7 @@ private:
|
|||
|
||||
/*generate behavior*/
|
||||
this->builder.CreateStore(
|
||||
this->gen_const(32,(uint32_t)(PC+ 2)),
|
||||
this->gen_const(32,(uint32_t)(PC+2)),
|
||||
get_reg_ptr(1 + traits::X0), false);
|
||||
auto PC_val_v = (uint32_t)(PC+(int16_t)sext<12>(imm));
|
||||
this->builder.CreateStore(this->gen_const(32,PC_val_v), get_reg_ptr(traits::NEXT_PC), false);
|
||||
|
@ -3579,7 +3579,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_const(32,(uint32_t)((int8_t)sext<6>(imm))),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -3618,10 +3618,10 @@ private:
|
|||
this->gen_set_pc(pc, traits::NEXT_PC);
|
||||
|
||||
/*generate behavior*/
|
||||
if(imm== 0||rd>=static_cast<uint32_t>(traits::RFS)) {
|
||||
if(imm==0||rd>=static_cast<uint32_t>(traits::RFS)) {
|
||||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_const(32,(uint32_t)((int32_t)sext<18>(imm))),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -3731,10 +3731,10 @@ private:
|
|||
/*generate behavior*/
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateLShr(
|
||||
this->gen_reg_load(rs1+ 8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
this->gen_ext(this->gen_const(8,shamt), 32,false))
|
||||
,
|
||||
get_reg_ptr(rs1+ 8 + traits::X0), false);
|
||||
get_reg_ptr(rs1+8 + traits::X0), false);
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
auto returnValue = std::make_tuple(CONT,bb);
|
||||
|
||||
|
@ -3772,24 +3772,24 @@ private:
|
|||
this->gen_ext(
|
||||
(this->builder.CreateAShr(
|
||||
(this->gen_ext(
|
||||
this->gen_reg_load(rs1+ 8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
32, false)),
|
||||
this->gen_ext(this->gen_const(8,shamt), 32,false))
|
||||
),
|
||||
32, true),
|
||||
get_reg_ptr(rs1+ 8 + traits::X0), false);
|
||||
get_reg_ptr(rs1+8 + traits::X0), false);
|
||||
}
|
||||
else{
|
||||
if(static_cast<uint32_t>(traits::XLEN)== 128){ this->builder.CreateStore(
|
||||
if(static_cast<uint32_t>(traits::XLEN)==128){ this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAShr(
|
||||
(this->gen_ext(
|
||||
this->gen_reg_load(rs1+ 8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
32, false)),
|
||||
this->gen_ext(this->gen_const(8, 64), 32,false))
|
||||
this->gen_ext(this->gen_const(8,64), 32,false))
|
||||
),
|
||||
32, true),
|
||||
get_reg_ptr(rs1+ 8 + traits::X0), false);
|
||||
get_reg_ptr(rs1+8 + traits::X0), false);
|
||||
}
|
||||
}
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
|
@ -3828,11 +3828,11 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAnd(
|
||||
this->gen_reg_load(rs1+ 8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
this->gen_ext(this->gen_const(8,(int8_t)sext<6>(imm)), 32,true))
|
||||
),
|
||||
32, true),
|
||||
get_reg_ptr(rs1+ 8 + traits::X0), false);
|
||||
get_reg_ptr(rs1+8 + traits::X0), false);
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
auto returnValue = std::make_tuple(CONT,bb);
|
||||
|
||||
|
@ -3869,11 +3869,11 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateSub(
|
||||
this->gen_ext(this->gen_reg_load(rd+ 8+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(rs2+ 8+ traits::X0, 0), 64,false))
|
||||
this->gen_ext(this->gen_reg_load(rd+8+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(rs2+8+ traits::X0, 0), 64,false))
|
||||
),
|
||||
32, true),
|
||||
get_reg_ptr(rd+ 8 + traits::X0), false);
|
||||
get_reg_ptr(rd+8 + traits::X0), false);
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
auto returnValue = std::make_tuple(CONT,bb);
|
||||
|
||||
|
@ -3909,10 +3909,10 @@ private:
|
|||
/*generate behavior*/
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateXor(
|
||||
this->gen_reg_load(rd+ 8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ 8+ traits::X0, 0))
|
||||
this->gen_reg_load(rd+8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+8+ traits::X0, 0))
|
||||
,
|
||||
get_reg_ptr(rd+ 8 + traits::X0), false);
|
||||
get_reg_ptr(rd+8 + traits::X0), false);
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
auto returnValue = std::make_tuple(CONT,bb);
|
||||
|
||||
|
@ -3948,10 +3948,10 @@ private:
|
|||
/*generate behavior*/
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateOr(
|
||||
this->gen_reg_load(rd+ 8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ 8+ traits::X0, 0))
|
||||
this->gen_reg_load(rd+8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+8+ traits::X0, 0))
|
||||
,
|
||||
get_reg_ptr(rd+ 8 + traits::X0), false);
|
||||
get_reg_ptr(rd+8 + traits::X0), false);
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
auto returnValue = std::make_tuple(CONT,bb);
|
||||
|
||||
|
@ -3987,10 +3987,10 @@ private:
|
|||
/*generate behavior*/
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateAnd(
|
||||
this->gen_reg_load(rd+ 8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ 8+ traits::X0, 0))
|
||||
this->gen_reg_load(rd+8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+8+ traits::X0, 0))
|
||||
,
|
||||
get_reg_ptr(rd+ 8 + traits::X0), false);
|
||||
get_reg_ptr(rd+8 + traits::X0), false);
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
auto returnValue = std::make_tuple(CONT,bb);
|
||||
|
||||
|
@ -4062,8 +4062,8 @@ private:
|
|||
auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_ext(this->builder.CreateICmp(ICmpInst::ICMP_EQ,
|
||||
this->gen_reg_load(rs1+ 8+ traits::X0, 0),
|
||||
this->gen_ext(this->gen_const(8, 0), 32,false))
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
, 1), bb_then, bb_merge);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
{
|
||||
|
@ -4109,8 +4109,8 @@ private:
|
|||
auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_ext(this->builder.CreateICmp(ICmpInst::ICMP_NE,
|
||||
this->gen_reg_load(rs1+ 8+ traits::X0, 0),
|
||||
this->gen_ext(this->gen_const(8, 0), 32,false))
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
, 1), bb_then, bb_merge);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
{
|
||||
|
@ -4157,7 +4157,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rs1!= 0) {
|
||||
if(rs1!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateShl(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
|
@ -4199,7 +4199,7 @@ private:
|
|||
this->gen_set_pc(pc, traits::NEXT_PC);
|
||||
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rd== 0) {
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rd==0) {
|
||||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
|
@ -4254,7 +4254,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -4292,10 +4292,9 @@ private:
|
|||
this->gen_set_pc(pc, traits::NEXT_PC);
|
||||
|
||||
/*generate behavior*/
|
||||
if(rs1&&rs1<static_cast<uint32_t>(traits::RFS)){ auto addr_mask =this->gen_const(32,(uint32_t)- 2);
|
||||
auto PC_val_v = this->builder.CreateAnd(
|
||||
if(rs1&&rs1<static_cast<uint32_t>(traits::RFS)){ auto PC_val_v = this->builder.CreateAnd(
|
||||
this->gen_reg_load(rs1%static_cast<uint32_t>(traits::RFS)+ traits::X0, 0),
|
||||
addr_mask)
|
||||
this->gen_const(32,~ 1))
|
||||
;
|
||||
this->builder.CreateStore(PC_val_v, get_reg_ptr(traits::NEXT_PC), false);
|
||||
this->builder.CreateStore(this->gen_const(32,2U), get_reg_ptr(traits::LAST_BRANCH), false);
|
||||
|
@ -4364,7 +4363,7 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
|
@ -4411,14 +4410,13 @@ private:
|
|||
this->gen_raise_trap(0, 2);
|
||||
}
|
||||
else{
|
||||
auto addr_mask =this->gen_const(32,(uint32_t)- 2);
|
||||
auto new_pc =this->gen_reg_load(rs1+ traits::X0, 0);
|
||||
this->builder.CreateStore(
|
||||
this->gen_const(32,(uint32_t)(PC+ 2)),
|
||||
this->gen_const(32,(uint32_t)(PC+2)),
|
||||
get_reg_ptr(1 + traits::X0), false);
|
||||
auto PC_val_v = this->builder.CreateAnd(
|
||||
new_pc,
|
||||
addr_mask)
|
||||
this->gen_const(32,~ 1))
|
||||
;
|
||||
this->builder.CreateStore(PC_val_v, get_reg_ptr(traits::NEXT_PC), false);
|
||||
this->builder.CreateStore(this->gen_const(32,2U), get_reg_ptr(traits::LAST_BRANCH), false);
|
||||
|
|
|
@ -349,7 +349,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.constant((uint32_t)((int32_t)imm),32));
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.constant((uint32_t)(PC+(int32_t)imm),32));
|
||||
}
|
||||
|
@ -422,9 +422,9 @@ private:
|
|||
if(imm%static_cast<uint32_t>(traits:: INSTR_ALIGNMENT)){ this->gen_raise_trap(tu, 0, 0);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.constant((uint32_t)(PC+ 4),32));
|
||||
tu.constant((uint32_t)(PC+4),32));
|
||||
}
|
||||
auto PC_val_v = tu.assignment("PC_val", (uint32_t)(PC+(int32_t)sext<21>(imm)),32);
|
||||
tu.store(traits::NEXT_PC, PC_val_v);
|
||||
|
@ -473,9 +473,9 @@ private:
|
|||
tu.constant(static_cast<uint32_t>(traits:: INSTR_ALIGNMENT),32)));
|
||||
this->gen_raise_trap(tu, 0, 0);
|
||||
tu.open_else();
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.constant((uint32_t)(PC+ 4),32));
|
||||
tu.constant((uint32_t)(PC+4),32));
|
||||
}
|
||||
auto PC_val_v = tu.assignment("PC_val", new_pc,32);
|
||||
tu.store(traits::NEXT_PC, PC_val_v);
|
||||
|
@ -775,7 +775,7 @@ private:
|
|||
tu.load(rs1+ traits::X0, 0),
|
||||
tu.constant((int16_t)sext<12>(imm),16))),32,false),32);
|
||||
auto res = tu.assignment(tu.ext(tu.read_mem(traits::MEM, load_address, 8),8,true),8);
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext(res,32,false));
|
||||
}
|
||||
|
@ -815,7 +815,7 @@ private:
|
|||
tu.load(rs1+ traits::X0, 0),
|
||||
tu.constant((int16_t)sext<12>(imm),16))),32,false),32);
|
||||
auto res = tu.assignment(tu.ext(tu.read_mem(traits::MEM, load_address, 16),16,true),16);
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext(res,32,false));
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ private:
|
|||
tu.load(rs1+ traits::X0, 0),
|
||||
tu.constant((int16_t)sext<12>(imm),16))),32,false),32);
|
||||
auto res = tu.assignment(tu.ext(tu.read_mem(traits::MEM, load_address, 32),32,true),32);
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext(res,32,false));
|
||||
}
|
||||
|
@ -895,7 +895,7 @@ private:
|
|||
tu.load(rs1+ traits::X0, 0),
|
||||
tu.constant((int16_t)sext<12>(imm),16))),32,false),32);
|
||||
auto res = tu.assignment(tu.read_mem(traits::MEM, load_address, 8),8);
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext(res,32,false));
|
||||
}
|
||||
|
@ -935,7 +935,7 @@ private:
|
|||
tu.load(rs1+ traits::X0, 0),
|
||||
tu.constant((int16_t)sext<12>(imm),16))),32,false),32);
|
||||
auto res = tu.assignment(tu.read_mem(traits::MEM, load_address, 16),16);
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext(res,32,false));
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext((tu.add(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1117,11 +1117,11 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.conditionalAssignment((tu.icmp(ICmpInst::ICMP_SLT,
|
||||
tu.ext(tu.load(rs1+ traits::X0, 0),32,true),
|
||||
tu.constant((int16_t)sext<12>(imm),16))), tu.constant( 1,8),tu.constant( 0,8)));
|
||||
tu.constant((int16_t)sext<12>(imm),16))), tu.constant(1,8),tu.constant(0,8)));
|
||||
}
|
||||
}
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
@ -1155,11 +1155,11 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.conditionalAssignment((tu.icmp(ICmpInst::ICMP_ULT,
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
tu.constant((uint32_t)((int16_t)sext<12>(imm)),32))), tu.constant( 1,8),tu.constant( 0,8)));
|
||||
tu.constant((uint32_t)((int16_t)sext<12>(imm)),32))), tu.constant(1,8),tu.constant(0,8)));
|
||||
}
|
||||
}
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
@ -1193,7 +1193,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.bitwise_xor(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1231,7 +1231,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.bitwise_or(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1269,7 +1269,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.bitwise_and(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1307,7 +1307,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.shl(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1345,7 +1345,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.lshr(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1383,7 +1383,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext((tu.ashr(
|
||||
tu.ext(tu.load(rs1+ traits::X0, 0),32,true),
|
||||
|
@ -1421,7 +1421,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext((tu.add(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1459,7 +1459,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext((tu.sub(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1497,13 +1497,13 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.shl(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
(tu.bitwise_and(
|
||||
tu.load(rs2+ traits::X0, 0),
|
||||
tu.constant((static_cast<uint32_t>(traits:: XLEN)- 1),64)))));
|
||||
tu.constant((static_cast<uint32_t>(traits:: XLEN)-1),64)))));
|
||||
}
|
||||
}
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
@ -1537,11 +1537,11 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.conditionalAssignment(tu.icmp(ICmpInst::ICMP_SLT,
|
||||
tu.ext(tu.load(rs1+ traits::X0, 0),32,true),
|
||||
tu.ext(tu.load(rs2+ traits::X0, 0),32,true)), tu.constant( 1,8),tu.constant( 0,8)));
|
||||
tu.ext(tu.load(rs2+ traits::X0, 0),32,true)), tu.constant(1,8),tu.constant(0,8)));
|
||||
}
|
||||
}
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
@ -1575,11 +1575,11 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.conditionalAssignment(tu.icmp(ICmpInst::ICMP_ULT,
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
tu.load(rs2+ traits::X0, 0)), tu.constant( 1,8),tu.constant( 0,8)));
|
||||
tu.load(rs2+ traits::X0, 0)), tu.constant(1,8),tu.constant(0,8)));
|
||||
}
|
||||
}
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
@ -1613,7 +1613,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.bitwise_xor(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1651,13 +1651,13 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.lshr(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
(tu.bitwise_and(
|
||||
tu.load(rs2+ traits::X0, 0),
|
||||
tu.constant((static_cast<uint32_t>(traits:: XLEN)- 1),64)))));
|
||||
tu.constant((static_cast<uint32_t>(traits:: XLEN)-1),64)))));
|
||||
}
|
||||
}
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
@ -1691,13 +1691,13 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext((tu.ashr(
|
||||
tu.ext(tu.load(rs1+ traits::X0, 0),32,true),
|
||||
(tu.bitwise_and(
|
||||
tu.load(rs2+ traits::X0, 0),
|
||||
tu.constant((static_cast<uint32_t>(traits:: XLEN)- 1),64))))),32,false));
|
||||
tu.constant((static_cast<uint32_t>(traits:: XLEN)-1),64))))),32,false));
|
||||
}
|
||||
}
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
@ -1731,7 +1731,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.bitwise_or(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1769,7 +1769,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.bitwise_and(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -1805,7 +1805,7 @@ private:
|
|||
pc=pc+ 4;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.write_mem(traits::FENCE, static_cast<uint32_t>(traits:: fence), tu.constant((uint8_t)pred<< 4|succ,8));
|
||||
tu.write_mem(traits::FENCE, static_cast<uint32_t>(traits:: fence), tu.constant((uint8_t)pred<<4|succ,8));
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
||||
tu.close_scope();
|
||||
|
@ -1926,7 +1926,7 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrs1 = tu.assignment(tu.load(rs1+ traits::X0, 0),32);
|
||||
if(rd!= 0){ auto xrd = tu.assignment(tu.read_mem(traits::CSR, csr, 32),32);
|
||||
if(rd!=0){ auto xrd = tu.assignment(tu.read_mem(traits::CSR, csr, 32),32);
|
||||
tu.write_mem(traits::CSR, csr, xrs1);
|
||||
tu.store(rd + traits::X0,
|
||||
xrd);
|
||||
|
@ -1968,12 +1968,12 @@ private:
|
|||
else{
|
||||
auto xrd = tu.assignment(tu.read_mem(traits::CSR, csr, 32),32);
|
||||
auto xrs1 = tu.assignment(tu.load(rs1+ traits::X0, 0),32);
|
||||
if(rs1!= 0) {
|
||||
if(rs1!=0) {
|
||||
tu.write_mem(traits::CSR, csr, tu.bitwise_or(
|
||||
xrd,
|
||||
xrs1));
|
||||
}
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
xrd);
|
||||
}
|
||||
|
@ -2011,12 +2011,12 @@ private:
|
|||
else{
|
||||
auto xrd = tu.assignment(tu.read_mem(traits::CSR, csr, 32),32);
|
||||
auto xrs1 = tu.assignment(tu.load(rs1+ traits::X0, 0),32);
|
||||
if(rs1!= 0) {
|
||||
if(rs1!=0) {
|
||||
tu.write_mem(traits::CSR, csr, tu.bitwise_and(
|
||||
xrd,
|
||||
tu.logical_neg(xrs1)));
|
||||
}
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
xrd);
|
||||
}
|
||||
|
@ -2054,7 +2054,7 @@ private:
|
|||
else{
|
||||
auto xrd = tu.assignment(tu.read_mem(traits::CSR, csr, 32),32);
|
||||
tu.write_mem(traits::CSR, csr, tu.constant((uint32_t)zimm,32));
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
xrd);
|
||||
}
|
||||
|
@ -2091,12 +2091,12 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrd = tu.assignment(tu.read_mem(traits::CSR, csr, 32),32);
|
||||
if(zimm!= 0) {
|
||||
if(zimm!=0) {
|
||||
tu.write_mem(traits::CSR, csr, tu.bitwise_or(
|
||||
xrd,
|
||||
tu.constant((uint32_t)zimm,32)));
|
||||
}
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
xrd);
|
||||
}
|
||||
|
@ -2133,12 +2133,12 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrd = tu.assignment(tu.read_mem(traits::CSR, csr, 32),32);
|
||||
if(zimm!= 0) {
|
||||
if(zimm!=0) {
|
||||
tu.write_mem(traits::CSR, csr, tu.bitwise_and(
|
||||
xrd,
|
||||
tu.constant(~ ((uint32_t)zimm),32)));
|
||||
}
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
xrd);
|
||||
}
|
||||
|
@ -2171,7 +2171,7 @@ private:
|
|||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.write_mem(traits::FENCE, static_cast<uint32_t>(traits:: fencei), tu.constant(imm,16));
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
auto returnValue = std::make_tuple(FLUSH);
|
||||
|
||||
tu.close_scope();
|
||||
gen_trap_check(tu);
|
||||
|
@ -2366,9 +2366,9 @@ private:
|
|||
else{
|
||||
auto dividend = tu.assignment(tu.ext(tu.load(rs1+ traits::X0, 0),32,true),32);
|
||||
auto divisor = tu.assignment(tu.ext(tu.load(rs2+ traits::X0, 0),32,true),32);
|
||||
if(rd!= 0){ tu.open_if(tu.icmp(ICmpInst::ICMP_NE,
|
||||
if(rd!=0){ tu.open_if(tu.icmp(ICmpInst::ICMP_NE,
|
||||
divisor,
|
||||
tu.constant( 0,8)));
|
||||
tu.constant(0,8)));
|
||||
auto MMIN = tu.assignment(tu.constant(((uint32_t)1)<<(static_cast<uint32_t>(traits:: XLEN)-1),32),32);
|
||||
tu.open_if(tu.logical_and(
|
||||
tu.icmp(ICmpInst::ICMP_EQ,
|
||||
|
@ -2424,7 +2424,7 @@ private:
|
|||
else{
|
||||
tu.open_if(tu.icmp(ICmpInst::ICMP_NE,
|
||||
tu.load(rs2+ traits::X0, 0),
|
||||
tu.constant( 0,8)));
|
||||
tu.constant(0,8)));
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext((tu.udiv(
|
||||
|
@ -2471,7 +2471,7 @@ private:
|
|||
else{
|
||||
tu.open_if(tu.icmp(ICmpInst::ICMP_NE,
|
||||
tu.load(rs2+ traits::X0, 0),
|
||||
tu.constant( 0,8)));
|
||||
tu.constant(0,8)));
|
||||
auto MMIN = tu.assignment(tu.constant((uint32_t)1<<(static_cast<uint32_t>(traits:: XLEN)-1),32),32);
|
||||
tu.open_if(tu.logical_and(
|
||||
tu.icmp(ICmpInst::ICMP_EQ,
|
||||
|
@ -2482,7 +2482,7 @@ private:
|
|||
tu.constant(- 1,8))));
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.constant( 0,8));
|
||||
tu.constant(0,8));
|
||||
}
|
||||
tu.open_else();
|
||||
if(rd!=0) {
|
||||
|
@ -2532,7 +2532,7 @@ private:
|
|||
else{
|
||||
tu.open_if(tu.icmp(ICmpInst::ICMP_NE,
|
||||
tu.load(rs2+ traits::X0, 0),
|
||||
tu.constant( 0,8)));
|
||||
tu.constant(0,8)));
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.urem(
|
||||
|
@ -2573,7 +2573,7 @@ private:
|
|||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
if(imm) {
|
||||
tu.store(rd+ 8 + traits::X0,
|
||||
tu.store(rd+8 + traits::X0,
|
||||
tu.ext((tu.add(
|
||||
tu.load(2+ traits::X0, 0),
|
||||
tu.constant(imm,16))),32,false));
|
||||
|
@ -2609,9 +2609,9 @@ private:
|
|||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
auto offs = tu.assignment(tu.ext((tu.add(
|
||||
tu.load(rs1+ 8+ traits::X0, 0),
|
||||
tu.load(rs1+8+ traits::X0, 0),
|
||||
tu.constant(uimm,8))),32,false),32);
|
||||
tu.store(rd+ 8 + traits::X0,
|
||||
tu.store(rd+8 + traits::X0,
|
||||
tu.ext(tu.ext(tu.read_mem(traits::MEM, offs, 32),32,true),32,false));
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
||||
|
@ -2641,9 +2641,9 @@ private:
|
|||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
auto offs = tu.assignment(tu.ext((tu.add(
|
||||
tu.load(rs1+ 8+ traits::X0, 0),
|
||||
tu.load(rs1+8+ traits::X0, 0),
|
||||
tu.constant(uimm,8))),32,false),32);
|
||||
tu.write_mem(traits::MEM, offs, tu.ext(tu.load(rs2+ 8+ traits::X0, 0),32,false));
|
||||
tu.write_mem(traits::MEM, offs, tu.ext(tu.load(rs2+8+ traits::X0, 0),32,false));
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
||||
tu.close_scope();
|
||||
|
@ -2674,7 +2674,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rs1!= 0) {
|
||||
if(rs1!=0) {
|
||||
tu.store(rs1 + traits::X0,
|
||||
tu.ext((tu.add(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -2729,7 +2729,7 @@ private:
|
|||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.store(1 + traits::X0,
|
||||
tu.constant((uint32_t)(PC+ 2),32));
|
||||
tu.constant((uint32_t)(PC+2),32));
|
||||
auto PC_val_v = tu.assignment("PC_val", (uint32_t)(PC+(int16_t)sext<12>(imm)),32);
|
||||
tu.store(traits::NEXT_PC, PC_val_v);
|
||||
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
|
||||
|
@ -2763,7 +2763,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.constant((uint32_t)((int8_t)sext<6>(imm)),32));
|
||||
}
|
||||
|
@ -2794,10 +2794,10 @@ private:
|
|||
pc=pc+ 2;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
if(imm== 0||rd>=static_cast<uint32_t>(traits:: RFS)) {
|
||||
if(imm==0||rd>=static_cast<uint32_t>(traits:: RFS)) {
|
||||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.constant((uint32_t)((int32_t)sext<18>(imm)),32));
|
||||
}
|
||||
|
@ -2884,9 +2884,9 @@ private:
|
|||
pc=pc+ 2;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.store(rs1+ 8 + traits::X0,
|
||||
tu.store(rs1+8 + traits::X0,
|
||||
tu.lshr(
|
||||
tu.load(rs1+ 8+ traits::X0, 0),
|
||||
tu.load(rs1+8+ traits::X0, 0),
|
||||
tu.constant(shamt,8)));
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
||||
|
@ -2914,16 +2914,16 @@ private:
|
|||
pc=pc+ 2;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
if(shamt){ tu.store(rs1+ 8 + traits::X0,
|
||||
if(shamt){ tu.store(rs1+8 + traits::X0,
|
||||
tu.ext((tu.ashr(
|
||||
(tu.ext(tu.load(rs1+ 8+ traits::X0, 0),32,true)),
|
||||
(tu.ext(tu.load(rs1+8+ traits::X0, 0),32,true)),
|
||||
tu.constant(shamt,8))),32,false));
|
||||
}
|
||||
else{
|
||||
if(static_cast<uint32_t>(traits:: XLEN)== 128){ tu.store(rs1+ 8 + traits::X0,
|
||||
if(static_cast<uint32_t>(traits:: XLEN)==128){ tu.store(rs1+8 + traits::X0,
|
||||
tu.ext((tu.ashr(
|
||||
(tu.ext(tu.load(rs1+ 8+ traits::X0, 0),32,true)),
|
||||
tu.constant( 64,8))),32,false));
|
||||
(tu.ext(tu.load(rs1+8+ traits::X0, 0),32,true)),
|
||||
tu.constant(64,8))),32,false));
|
||||
}
|
||||
}
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
@ -2952,9 +2952,9 @@ private:
|
|||
pc=pc+ 2;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.store(rs1+ 8 + traits::X0,
|
||||
tu.store(rs1+8 + traits::X0,
|
||||
tu.ext((tu.bitwise_and(
|
||||
tu.load(rs1+ 8+ traits::X0, 0),
|
||||
tu.load(rs1+8+ traits::X0, 0),
|
||||
tu.constant((int8_t)sext<6>(imm),8))),32,false));
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
||||
|
@ -2982,10 +2982,10 @@ private:
|
|||
pc=pc+ 2;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.store(rd+ 8 + traits::X0,
|
||||
tu.store(rd+8 + traits::X0,
|
||||
tu.ext((tu.sub(
|
||||
tu.load(rd+ 8+ traits::X0, 0),
|
||||
tu.load(rs2+ 8+ traits::X0, 0))),32,false));
|
||||
tu.load(rd+8+ traits::X0, 0),
|
||||
tu.load(rs2+8+ traits::X0, 0))),32,false));
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
||||
tu.close_scope();
|
||||
|
@ -3012,10 +3012,10 @@ private:
|
|||
pc=pc+ 2;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.store(rd+ 8 + traits::X0,
|
||||
tu.store(rd+8 + traits::X0,
|
||||
tu.bitwise_xor(
|
||||
tu.load(rd+ 8+ traits::X0, 0),
|
||||
tu.load(rs2+ 8+ traits::X0, 0)));
|
||||
tu.load(rd+8+ traits::X0, 0),
|
||||
tu.load(rs2+8+ traits::X0, 0)));
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
||||
tu.close_scope();
|
||||
|
@ -3042,10 +3042,10 @@ private:
|
|||
pc=pc+ 2;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.store(rd+ 8 + traits::X0,
|
||||
tu.store(rd+8 + traits::X0,
|
||||
tu.bitwise_or(
|
||||
tu.load(rd+ 8+ traits::X0, 0),
|
||||
tu.load(rs2+ 8+ traits::X0, 0)));
|
||||
tu.load(rd+8+ traits::X0, 0),
|
||||
tu.load(rs2+8+ traits::X0, 0)));
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
||||
tu.close_scope();
|
||||
|
@ -3072,10 +3072,10 @@ private:
|
|||
pc=pc+ 2;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.store(rd+ 8 + traits::X0,
|
||||
tu.store(rd+8 + traits::X0,
|
||||
tu.bitwise_and(
|
||||
tu.load(rd+ 8+ traits::X0, 0),
|
||||
tu.load(rs2+ 8+ traits::X0, 0)));
|
||||
tu.load(rd+8+ traits::X0, 0),
|
||||
tu.load(rs2+8+ traits::X0, 0)));
|
||||
auto returnValue = std::make_tuple(CONT);
|
||||
|
||||
tu.close_scope();
|
||||
|
@ -3131,8 +3131,8 @@ private:
|
|||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.open_if(tu.icmp(ICmpInst::ICMP_EQ,
|
||||
tu.load(rs1+ 8+ traits::X0, 0),
|
||||
tu.constant( 0,8)));
|
||||
tu.load(rs1+8+ traits::X0, 0),
|
||||
tu.constant(0,8)));
|
||||
auto PC_val_v = tu.assignment("PC_val", (uint32_t)(PC+(int16_t)sext<9>(imm)),32);
|
||||
tu.store(traits::NEXT_PC, PC_val_v);
|
||||
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
|
||||
|
@ -3164,8 +3164,8 @@ private:
|
|||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
tu.open_if(tu.icmp(ICmpInst::ICMP_NE,
|
||||
tu.load(rs1+ 8+ traits::X0, 0),
|
||||
tu.constant( 0,8)));
|
||||
tu.load(rs1+8+ traits::X0, 0),
|
||||
tu.constant(0,8)));
|
||||
auto PC_val_v = tu.assignment("PC_val", (uint32_t)(PC+(int16_t)sext<9>(imm)),32);
|
||||
tu.store(traits::NEXT_PC, PC_val_v);
|
||||
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
|
||||
|
@ -3200,7 +3200,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rs1!= 0) {
|
||||
if(rs1!=0) {
|
||||
tu.store(rs1 + traits::X0,
|
||||
tu.shl(
|
||||
tu.load(rs1+ traits::X0, 0),
|
||||
|
@ -3233,7 +3233,7 @@ private:
|
|||
pc=pc+ 2;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
if(rd>=static_cast<uint32_t>(traits:: RFS)||rd== 0) {
|
||||
if(rd>=static_cast<uint32_t>(traits:: RFS)||rd==0) {
|
||||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
|
@ -3273,7 +3273,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.load(rs2+ traits::X0, 0));
|
||||
}
|
||||
|
@ -3303,10 +3303,9 @@ private:
|
|||
pc=pc+ 2;
|
||||
gen_set_pc(tu, pc, traits::NEXT_PC);
|
||||
tu.open_scope();
|
||||
if(rs1&&rs1<static_cast<uint32_t>(traits:: RFS)) {
|
||||
auto PC_val_v = tu.assignment("PC_val", tu.bitwise_and(
|
||||
if(rs1&&rs1<static_cast<uint32_t>(traits:: RFS)){ auto PC_val_v = tu.assignment("PC_val", tu.bitwise_and(
|
||||
tu.load(rs1%static_cast<uint32_t>(traits:: RFS)+ traits::X0, 0),
|
||||
tu.constant(~ 0x1,8)),32);
|
||||
tu.constant(~ 1,32)),32);
|
||||
tu.store(traits::NEXT_PC, PC_val_v);
|
||||
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
|
||||
}
|
||||
|
@ -3365,7 +3364,7 @@ private:
|
|||
this->gen_raise_trap(tu, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0) {
|
||||
if(rd!=0) {
|
||||
tu.store(rd + traits::X0,
|
||||
tu.ext((tu.add(
|
||||
tu.load(rd+ traits::X0, 0),
|
||||
|
@ -3403,10 +3402,10 @@ private:
|
|||
else{
|
||||
auto new_pc = tu.assignment(tu.load(rs1+ traits::X0, 0),32);
|
||||
tu.store(1 + traits::X0,
|
||||
tu.constant((uint32_t)(PC+ 2),32));
|
||||
tu.constant((uint32_t)(PC+2),32));
|
||||
auto PC_val_v = tu.assignment("PC_val", tu.bitwise_and(
|
||||
new_pc,
|
||||
tu.constant(~ 0x1,8)),32);
|
||||
tu.constant(~ 1,32)),32);
|
||||
tu.store(traits::NEXT_PC, PC_val_v);
|
||||
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue