11 using namespace etiss;
31 rd += R_rd_0.
read(ba) << 0;
34 rm += R_rm_0.
read(ba) << 0;
37 rs1 += R_rs1_0.
read(ba) << 0;
44 cp.
code() = std::string(
"//FCVT_L_S\n");
48 cp.
code() +=
"{ // block\n";
50 cp.
code() +=
"} // block\n";
53 cp.
code() +=
"{ // block\n";
54 cp.
code() +=
"etiss_int64 res = fcvt_32_64(unbox_s(((RV64IMACFD*)cpu)->F[" + std::to_string(rs1) +
"ULL]), 0LL, " + std::to_string(rm) +
"ULL);\n";
55 if ((rd % 32ULL) != 0LL) {
56 cp.
code() +=
"*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) +
"ULL] = res;\n";
58 cp.
code() +=
"etiss_uint32 flags = fget_flags();\n";
59 cp.
code() +=
"((RV64IMACFD*)cpu)->FCSR = (((RV64IMACFD*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n";
60 cp.
code() +=
"} // block\n";
63 cp.
code() +=
"cpu->instructionPointer = cpu->nextPc;\n";
76 rd += R_rd_0.read(ba) << 0;
79 rm += R_rm_0.read(ba) << 0;
82 rs1 += R_rs1_0.read(ba) << 0;
88 ss <<
"fcvt_l_s" <<
" # " << ba << (
" [rd=" + std::to_string(rd) +
" | rm=" + std::to_string(rm) +
" | rs1=" + std::to_string(rs1) +
"]");
110 rd += R_rd_0.
read(ba) << 0;
113 rm += R_rm_0.
read(ba) << 0;
116 rs1 += R_rs1_0.
read(ba) << 0;
123 cp.
code() = std::string(
"//FCVT_LU_S\n");
127 cp.
code() +=
"{ // block\n";
129 cp.
code() +=
"} // block\n";
132 cp.
code() +=
"{ // block\n";
133 cp.
code() +=
"etiss_uint64 res = fcvt_32_64(unbox_s(((RV64IMACFD*)cpu)->F[" + std::to_string(rs1) +
"ULL]), 1ULL, " + std::to_string(rm) +
"ULL);\n";
134 if ((rd % 32ULL) != 0LL) {
135 cp.
code() +=
"*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) +
"ULL] = res;\n";
137 cp.
code() +=
"etiss_uint32 flags = fget_flags();\n";
138 cp.
code() +=
"((RV64IMACFD*)cpu)->FCSR = (((RV64IMACFD*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n";
139 cp.
code() +=
"} // block\n";
142 cp.
code() +=
"cpu->instructionPointer = cpu->nextPc;\n";
155 rd += R_rd_0.read(ba) << 0;
158 rm += R_rm_0.read(ba) << 0;
161 rs1 += R_rs1_0.read(ba) << 0;
165 std::stringstream ss;
167 ss <<
"fcvt_lu_s" <<
" # " << ba << (
" [rd=" + std::to_string(rd) +
" | rm=" + std::to_string(rm) +
" | rs1=" + std::to_string(rs1) +
"]");
189 rd += R_rd_0.
read(ba) << 0;
192 rm += R_rm_0.
read(ba) << 0;
195 rs1 += R_rs1_0.
read(ba) << 0;
202 cp.
code() = std::string(
"//FCVT_S_L\n");
206 cp.
code() +=
"{ // block\n";
208 cp.
code() +=
"} // block\n";
211 cp.
code() +=
"{ // block\n";
212 cp.
code() +=
"etiss_uint32 res = fcvt_64_32(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) +
"ULL], 2ULL, " + std::to_string(rm) +
"ULL);\n";
214 cp.
code() +=
"{ // block\n";
215 cp.
code() +=
"((RV64IMACFD*)cpu)->F[" + std::to_string(rd) +
"ULL] = -4294967296LL | (etiss_uint64)(res);\n";
216 cp.
code() +=
"} // block\n";
218 cp.
code() +=
"} // block\n";
221 cp.
code() +=
"cpu->instructionPointer = cpu->nextPc;\n";
234 rd += R_rd_0.read(ba) << 0;
237 rm += R_rm_0.read(ba) << 0;
240 rs1 += R_rs1_0.read(ba) << 0;
244 std::stringstream ss;
246 ss <<
"fcvt_s_l" <<
" # " << ba << (
" [rd=" + std::to_string(rd) +
" | rm=" + std::to_string(rm) +
" | rs1=" + std::to_string(rs1) +
"]");
268 rd += R_rd_0.
read(ba) << 0;
271 rm += R_rm_0.
read(ba) << 0;
274 rs1 += R_rs1_0.
read(ba) << 0;
281 cp.
code() = std::string(
"//FCVT_S_LU\n");
285 cp.
code() +=
"{ // block\n";
287 cp.
code() +=
"} // block\n";
290 cp.
code() +=
"{ // block\n";
291 cp.
code() +=
"etiss_uint32 res = fcvt_64_32(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) +
"ULL], 3ULL, " + std::to_string(rm) +
"ULL);\n";
293 cp.
code() +=
"{ // block\n";
294 cp.
code() +=
"((RV64IMACFD*)cpu)->F[" + std::to_string(rd) +
"ULL] = -4294967296LL | (etiss_uint64)(res);\n";
295 cp.
code() +=
"} // block\n";
297 cp.
code() +=
"} // block\n";
300 cp.
code() +=
"cpu->instructionPointer = cpu->nextPc;\n";
313 rd += R_rd_0.read(ba) << 0;
316 rm += R_rm_0.read(ba) << 0;
319 rs1 += R_rs1_0.read(ba) << 0;
323 std::stringstream ss;
325 ss <<
"fcvt_s_lu" <<
" # " << ba << (
" [rd=" + std::to_string(rd) +
" | rm=" + std::to_string(rm) +
" | rs1=" + std::to_string(rs1) +
"]");
etiss::instr::InstructionGroup ISA32_RV64IMACFD("ISA32_RV64IMACFD", 32)
static InstructionDefinition fcvt_s_lu_rd_rm_rs1(ISA32_RV64IMACFD, "fcvt_s_lu",(uint32_t) 0xd0300053,(uint32_t) 0xfff0007f, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rm=0;static BitArrayRange R_rm_0(14, 12);rm+=R_rm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//FCVT_S_LU\n");{ cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="} // block\n";} { cp.code()+="{ // block\n";cp.code()+="etiss_uint32 res = fcvt_64_32(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL], 3ULL, "+std::to_string(rm)+"ULL);\n";{ cp.code()+="{ // block\n";cp.code()+="((RV64IMACFD*)cpu)->F["+std::to_string(rd)+"ULL] = -4294967296LL | (etiss_uint64)(res);\n";cp.code()+="} // block\n";} cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rm=0;static BitArrayRange R_rm_0(14, 12);rm+=R_rm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;std::stringstream ss;ss<< "fcvt_s_lu"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rm="+std::to_string(rm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition fcvt_lu_s_rd_rm_rs1(ISA32_RV64IMACFD, "fcvt_lu_s",(uint32_t) 0xc0300053,(uint32_t) 0xfff0007f, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rm=0;static BitArrayRange R_rm_0(14, 12);rm+=R_rm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//FCVT_LU_S\n");{ cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="} // block\n";} { cp.code()+="{ // block\n";cp.code()+="etiss_uint64 res = fcvt_32_64(unbox_s(((RV64IMACFD*)cpu)->F["+std::to_string(rs1)+"ULL]), 1ULL, "+std::to_string(rm)+"ULL);\n";if((rd % 32ULL) !=0LL) { cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = res;\n";} cp.code()+="etiss_uint32 flags = fget_flags();\n";cp.code()+="((RV64IMACFD*)cpu)->FCSR = (((RV64IMACFD*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rm=0;static BitArrayRange R_rm_0(14, 12);rm+=R_rm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;std::stringstream ss;ss<< "fcvt_lu_s"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rm="+std::to_string(rm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition fcvt_l_s_rd_rm_rs1(ISA32_RV64IMACFD, "fcvt_l_s",(uint32_t) 0xc0200053,(uint32_t) 0xfff0007f, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rm=0;static BitArrayRange R_rm_0(14, 12);rm+=R_rm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//FCVT_L_S\n");{ cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="} // block\n";} { cp.code()+="{ // block\n";cp.code()+="etiss_int64 res = fcvt_32_64(unbox_s(((RV64IMACFD*)cpu)->F["+std::to_string(rs1)+"ULL]), 0LL, "+std::to_string(rm)+"ULL);\n";if((rd % 32ULL) !=0LL) { cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = res;\n";} cp.code()+="etiss_uint32 flags = fget_flags();\n";cp.code()+="((RV64IMACFD*)cpu)->FCSR = (((RV64IMACFD*)cpu)->FCSR & -32LL) | (flags & 31ULL);\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rm=0;static BitArrayRange R_rm_0(14, 12);rm+=R_rm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;std::stringstream ss;ss<< "fcvt_l_s"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rm="+std::to_string(rm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition fcvt_s_l_rd_rm_rs1(ISA32_RV64IMACFD, "fcvt_s_l",(uint32_t) 0xd0200053,(uint32_t) 0xfff0007f, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rm=0;static BitArrayRange R_rm_0(14, 12);rm+=R_rm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//FCVT_S_L\n");{ cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="} // block\n";} { cp.code()+="{ // block\n";cp.code()+="etiss_uint32 res = fcvt_64_32(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL], 2ULL, "+std::to_string(rm)+"ULL);\n";{ cp.code()+="{ // block\n";cp.code()+="((RV64IMACFD*)cpu)->F["+std::to_string(rd)+"ULL] = -4294967296LL | (etiss_uint64)(res);\n";cp.code()+="} // block\n";} cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rm=0;static BitArrayRange R_rm_0(14, 12);rm+=R_rm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;std::stringstream ss;ss<< "fcvt_s_l"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rm="+std::to_string(rm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static __inline__ uint32_t
Contains a small code snipped.
RegisterSet & getAffectedRegisters()
void append(const CodePart &part, CodePart::TYPE type)
void add(const RegisterPart &rp)
add a registerPart to the set or just its relevant bits if a register with the same name is already p...
Reading through it will only return bits within the range.
I read(const BitArray &ba)
reads bits from the range to the return value starting at the lsb.
this class contains parameters that persist in between instruction lookpus/translation within a trans...
uint64_t current_address_
start address of current instruction
holds information and translation callbacks for an instruction.
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.