Lines Matching refs:dec

2541 static void decode_inst_opcode(rv_decode *dec, rv_isa isa)  in decode_inst_opcode()  argument
2543 rv_inst inst = dec->inst; in decode_inst_opcode()
2616 if (dec->cfg && dec->cfg->ext_zcmop) { in decode_inst_opcode()
2622 if (dec->cfg->ext_zicfiss) { in decode_inst_opcode()
2717 if (dec->cfg && dec->cfg->ext_zcmp && ((inst >> 12) & 0b01)) { in decode_inst_opcode()
2743 if (dec->cfg && !dec->cfg->ext_zcmt) { in decode_inst_opcode()
2753 if (dec->cfg && !dec->cfg->ext_zcmp) { in decode_inst_opcode()
2961 if (dec->cfg && dec->cfg->ext_zicfilp && in decode_inst_opcode()
4063 if (dec->cfg && dec->cfg->ext_zimop) { in decode_inst_opcode()
4073 if (dec->cfg->ext_zicfiss && in decode_inst_opcode()
4092 if (dec->cfg->ext_zicfiss && in decode_inst_opcode()
4163 dec->op = op; in decode_inst_opcode()
4558 static void decode_inst_operands(rv_decode *dec, rv_isa isa) in decode_inst_operands() argument
4560 const rv_opcode_data *opcode_data = dec->opcode_data; in decode_inst_operands()
4561 rv_inst inst = dec->inst; in decode_inst_operands()
4562 dec->codec = opcode_data[dec->op].codec; in decode_inst_operands()
4563 switch (dec->codec) { in decode_inst_operands()
4565 dec->rd = dec->rs1 = dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4566 dec->imm = 0; in decode_inst_operands()
4569 dec->rd = operand_rd(inst); in decode_inst_operands()
4570 dec->rs1 = dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4571 dec->imm = operand_imm20(inst); in decode_inst_operands()
4574 dec->rd = operand_rd(inst); in decode_inst_operands()
4575 dec->rs1 = dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4576 dec->imm = operand_jimm20(inst); in decode_inst_operands()
4579 dec->rd = operand_rd(inst); in decode_inst_operands()
4580 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4581 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4582 dec->imm = operand_imm12(inst); in decode_inst_operands()
4585 dec->rd = operand_rd(inst); in decode_inst_operands()
4586 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4587 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4588 dec->imm = operand_shamt5(inst); in decode_inst_operands()
4591 dec->rd = operand_rd(inst); in decode_inst_operands()
4592 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4593 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4594 dec->imm = operand_shamt6(inst); in decode_inst_operands()
4597 dec->rd = operand_rd(inst); in decode_inst_operands()
4598 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4599 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4600 dec->imm = operand_shamt7(inst); in decode_inst_operands()
4603 dec->rd = operand_rd(inst); in decode_inst_operands()
4604 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4605 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4606 dec->imm = operand_csr12(inst); in decode_inst_operands()
4609 dec->rd = rv_ireg_zero; in decode_inst_operands()
4610 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4611 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4612 dec->imm = operand_simm12(inst); in decode_inst_operands()
4615 dec->rd = rv_ireg_zero; in decode_inst_operands()
4616 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4617 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4618 dec->imm = operand_sbimm12(inst); in decode_inst_operands()
4621 dec->rd = operand_rd(inst); in decode_inst_operands()
4622 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4623 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4624 dec->imm = 0; in decode_inst_operands()
4627 dec->rd = operand_rd(inst); in decode_inst_operands()
4628 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4629 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4630 dec->imm = 0; in decode_inst_operands()
4631 dec->rm = operand_rm(inst); in decode_inst_operands()
4634 dec->rd = operand_rd(inst); in decode_inst_operands()
4635 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4636 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4637 dec->rs3 = operand_rs3(inst); in decode_inst_operands()
4638 dec->imm = 0; in decode_inst_operands()
4639 dec->rm = operand_rm(inst); in decode_inst_operands()
4642 dec->rd = operand_rd(inst); in decode_inst_operands()
4643 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4644 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4645 dec->imm = 0; in decode_inst_operands()
4646 dec->aq = operand_aq(inst); in decode_inst_operands()
4647 dec->rl = operand_rl(inst); in decode_inst_operands()
4650 dec->rd = operand_rd(inst); in decode_inst_operands()
4651 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4652 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4653 dec->imm = 0; in decode_inst_operands()
4654 dec->aq = operand_aq(inst); in decode_inst_operands()
4655 dec->rl = operand_rl(inst); in decode_inst_operands()
4658 dec->rd = dec->rs1 = dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4659 dec->pred = operand_pred(inst); in decode_inst_operands()
4660 dec->succ = operand_succ(inst); in decode_inst_operands()
4661 dec->imm = 0; in decode_inst_operands()
4664 dec->rd = rv_ireg_zero; in decode_inst_operands()
4665 dec->rs1 = operand_crs1q(inst) + 8; in decode_inst_operands()
4666 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4667 dec->imm = operand_cimmb(inst); in decode_inst_operands()
4670 dec->rd = dec->rs1 = operand_crs1rdq(inst) + 8; in decode_inst_operands()
4671 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4672 dec->imm = operand_cimmi(inst); in decode_inst_operands()
4675 dec->rd = dec->rs1 = operand_crs1rdq(inst) + 8; in decode_inst_operands()
4676 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4677 dec->imm = operand_cimmsh5(inst); in decode_inst_operands()
4680 dec->rd = dec->rs1 = operand_crs1rdq(inst) + 8; in decode_inst_operands()
4681 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4682 dec->imm = operand_cimmshr6(inst, isa); in decode_inst_operands()
4685 dec->rd = dec->rs1 = operand_crs1rd(inst); in decode_inst_operands()
4686 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4687 dec->imm = operand_cimmi(inst); in decode_inst_operands()
4690 dec->rd = dec->rs1 = operand_crs1rd(inst); in decode_inst_operands()
4691 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4692 dec->imm = operand_cimmsh5(inst); in decode_inst_operands()
4695 dec->rd = dec->rs1 = operand_crs1rd(inst); in decode_inst_operands()
4696 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4697 dec->imm = operand_cimmshl6(inst, isa); in decode_inst_operands()
4700 dec->rd = rv_ireg_sp; in decode_inst_operands()
4701 dec->rs1 = rv_ireg_sp; in decode_inst_operands()
4702 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4703 dec->imm = operand_cimm16sp(inst); in decode_inst_operands()
4706 dec->rd = operand_crd(inst); in decode_inst_operands()
4707 dec->rs1 = rv_ireg_sp; in decode_inst_operands()
4708 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4709 dec->imm = operand_cimmlwsp(inst); in decode_inst_operands()
4712 dec->rd = operand_crd(inst); in decode_inst_operands()
4713 dec->rs1 = rv_ireg_sp; in decode_inst_operands()
4714 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4715 dec->imm = operand_cimmldsp(inst); in decode_inst_operands()
4718 dec->rd = operand_crd(inst); in decode_inst_operands()
4719 dec->rs1 = rv_ireg_sp; in decode_inst_operands()
4720 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4721 dec->imm = operand_cimmlqsp(inst); in decode_inst_operands()
4724 dec->rd = operand_crd(inst); in decode_inst_operands()
4725 dec->rs1 = rv_ireg_zero; in decode_inst_operands()
4726 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4727 dec->imm = operand_cimmi(inst); in decode_inst_operands()
4730 dec->rd = operand_crd(inst); in decode_inst_operands()
4731 dec->rs1 = rv_ireg_zero; in decode_inst_operands()
4732 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4733 dec->imm = operand_cimmui(inst); in decode_inst_operands()
4736 dec->rd = dec->rs1 = dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4737 dec->imm = 0; in decode_inst_operands()
4740 dec->rd = operand_crdq(inst) + 8; in decode_inst_operands()
4741 dec->rs1 = rv_ireg_sp; in decode_inst_operands()
4742 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4743 dec->imm = operand_cimm4spn(inst); in decode_inst_operands()
4746 dec->rd = dec->rs1 = dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4747 dec->imm = operand_cimmj(inst); in decode_inst_operands()
4750 dec->rd = rv_ireg_ra; in decode_inst_operands()
4751 dec->rs1 = dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4752 dec->imm = operand_cimmj(inst); in decode_inst_operands()
4755 dec->rd = operand_crdq(inst) + 8; in decode_inst_operands()
4756 dec->rs1 = operand_crs1q(inst) + 8; in decode_inst_operands()
4757 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4758 dec->imm = operand_cimmw(inst); in decode_inst_operands()
4761 dec->rd = operand_crdq(inst) + 8; in decode_inst_operands()
4762 dec->rs1 = operand_crs1q(inst) + 8; in decode_inst_operands()
4763 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4764 dec->imm = operand_cimmd(inst); in decode_inst_operands()
4767 dec->rd = operand_crdq(inst) + 8; in decode_inst_operands()
4768 dec->rs1 = operand_crs1q(inst) + 8; in decode_inst_operands()
4769 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4770 dec->imm = operand_cimmq(inst); in decode_inst_operands()
4773 dec->rd = dec->rs1 = operand_crs1rd(inst); in decode_inst_operands()
4774 dec->rs2 = operand_crs2(inst); in decode_inst_operands()
4775 dec->imm = 0; in decode_inst_operands()
4778 dec->rd = operand_crd(inst); in decode_inst_operands()
4779 dec->rs1 = operand_crs2(inst); in decode_inst_operands()
4780 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4781 dec->imm = 0; in decode_inst_operands()
4784 dec->rd = rv_ireg_ra; in decode_inst_operands()
4785 dec->rs1 = operand_crs1(inst); in decode_inst_operands()
4786 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4787 dec->imm = 0; in decode_inst_operands()
4790 dec->rd = rv_ireg_zero; in decode_inst_operands()
4791 dec->rs1 = operand_crs1(inst); in decode_inst_operands()
4792 dec->rs2 = rv_ireg_zero; in decode_inst_operands()
4793 dec->imm = 0; in decode_inst_operands()
4796 dec->rd = dec->rs1 = operand_crs1rdq(inst) + 8; in decode_inst_operands()
4797 dec->rs2 = operand_crs2q(inst) + 8; in decode_inst_operands()
4798 dec->imm = 0; in decode_inst_operands()
4801 dec->rd = rv_ireg_zero; in decode_inst_operands()
4802 dec->rs1 = operand_crs1q(inst) + 8; in decode_inst_operands()
4803 dec->rs2 = operand_crs2q(inst) + 8; in decode_inst_operands()
4804 dec->imm = operand_cimmw(inst); in decode_inst_operands()
4807 dec->rd = rv_ireg_zero; in decode_inst_operands()
4808 dec->rs1 = operand_crs1q(inst) + 8; in decode_inst_operands()
4809 dec->rs2 = operand_crs2q(inst) + 8; in decode_inst_operands()
4810 dec->imm = operand_cimmd(inst); in decode_inst_operands()
4813 dec->rd = rv_ireg_zero; in decode_inst_operands()
4814 dec->rs1 = operand_crs1q(inst) + 8; in decode_inst_operands()
4815 dec->rs2 = operand_crs2q(inst) + 8; in decode_inst_operands()
4816 dec->imm = operand_cimmq(inst); in decode_inst_operands()
4819 dec->rd = rv_ireg_zero; in decode_inst_operands()
4820 dec->rs1 = rv_ireg_sp; in decode_inst_operands()
4821 dec->rs2 = operand_crs2(inst); in decode_inst_operands()
4822 dec->imm = operand_cimmswsp(inst); in decode_inst_operands()
4825 dec->rd = rv_ireg_zero; in decode_inst_operands()
4826 dec->rs1 = rv_ireg_sp; in decode_inst_operands()
4827 dec->rs2 = operand_crs2(inst); in decode_inst_operands()
4828 dec->imm = operand_cimmsdsp(inst); in decode_inst_operands()
4831 dec->rd = rv_ireg_zero; in decode_inst_operands()
4832 dec->rs1 = rv_ireg_sp; in decode_inst_operands()
4833 dec->rs2 = operand_crs2(inst); in decode_inst_operands()
4834 dec->imm = operand_cimmsqsp(inst); in decode_inst_operands()
4837 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4838 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4839 dec->bs = operand_bs(inst); in decode_inst_operands()
4842 dec->rd = operand_rd(inst); in decode_inst_operands()
4843 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4844 dec->rnum = operand_rnum(inst); in decode_inst_operands()
4847 dec->rd = operand_rd(inst); in decode_inst_operands()
4848 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4849 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4850 dec->vm = operand_vm(inst); in decode_inst_operands()
4853 dec->rd = operand_rd(inst); in decode_inst_operands()
4854 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4855 dec->vm = operand_vm(inst); in decode_inst_operands()
4858 dec->rd = operand_rd(inst); in decode_inst_operands()
4859 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4860 dec->imm = operand_vimm(inst); in decode_inst_operands()
4861 dec->vm = operand_vm(inst); in decode_inst_operands()
4864 dec->rd = operand_rd(inst); in decode_inst_operands()
4865 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4866 dec->imm = operand_vzimm6(inst); in decode_inst_operands()
4867 dec->vm = operand_vm(inst); in decode_inst_operands()
4870 dec->rd = operand_rd(inst); in decode_inst_operands()
4871 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4872 dec->vzimm = operand_vzimm11(inst); in decode_inst_operands()
4875 dec->rd = operand_rd(inst); in decode_inst_operands()
4876 dec->imm = extract32(inst, 15, 5); in decode_inst_operands()
4877 dec->vzimm = operand_vzimm10(inst); in decode_inst_operands()
4880 dec->rs1 = operand_crs1q(inst) + 8; in decode_inst_operands()
4881 dec->rs2 = operand_crs2q(inst) + 8; in decode_inst_operands()
4882 dec->imm = operand_uimm_c_lb(inst); in decode_inst_operands()
4885 dec->rs1 = operand_crs1q(inst) + 8; in decode_inst_operands()
4886 dec->rs2 = operand_crs2q(inst) + 8; in decode_inst_operands()
4887 dec->imm = operand_uimm_c_lh(inst); in decode_inst_operands()
4890 dec->rd = operand_crs1q(inst) + 8; in decode_inst_operands()
4893 dec->rd = operand_crs1rdq(inst) + 8; in decode_inst_operands()
4894 dec->rs2 = operand_crs2q(inst) + 8; in decode_inst_operands()
4897 dec->imm = operand_zcmp_stack_adj(inst, isa); in decode_inst_operands()
4898 dec->rlist = operand_zcmp_rlist(inst); in decode_inst_operands()
4901 dec->rd = operand_sreg1(inst); in decode_inst_operands()
4902 dec->rs2 = operand_sreg2(inst); in decode_inst_operands()
4905 dec->imm = operand_tbl_index(inst); in decode_inst_operands()
4908 dec->rd = operand_rd(inst); in decode_inst_operands()
4909 dec->imm = operand_rs1(inst); in decode_inst_operands()
4912 dec->rd = operand_rd(inst); in decode_inst_operands()
4913 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4914 dec->imm = operand_rs2(inst); in decode_inst_operands()
4917 dec->rd = operand_rd(inst); in decode_inst_operands()
4918 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4921 dec->rd = operand_rd(inst); in decode_inst_operands()
4922 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4923 dec->imm = operand_imm6(inst); in decode_inst_operands()
4926 dec->rd = operand_rd(inst); in decode_inst_operands()
4927 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4928 dec->rs2 = operand_rs2(inst); in decode_inst_operands()
4929 dec->imm = operand_imm2(inst); in decode_inst_operands()
4932 dec->rd = operand_rd(inst); in decode_inst_operands()
4933 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4934 dec->imm = operand_immh(inst); in decode_inst_operands()
4935 dec->imm1 = operand_imml(inst); in decode_inst_operands()
4938 dec->rd = operand_rd(inst); in decode_inst_operands()
4939 dec->rs1 = operand_rs1(inst); in decode_inst_operands()
4940 dec->imm = sextract32(operand_rs2(inst), 0, 5); in decode_inst_operands()
4941 dec->imm1 = operand_imm2(inst); in decode_inst_operands()
4944 dec->imm = operand_lpl(inst); in decode_inst_operands()
4947 dec->rd = rv_ireg_zero; in decode_inst_operands()
4948 dec->rs1 = dec->rs2 = operand_crs1(inst); in decode_inst_operands()
4949 dec->imm = 0; in decode_inst_operands()
4956 static bool check_constraints(rv_decode *dec, const rvc_constraint *c) in check_constraints() argument
4958 int32_t imm = dec->imm; in check_constraints()
4959 uint8_t rd = dec->rd, rs1 = dec->rs1, rs2 = dec->rs2; in check_constraints()
5083 static GString *format_inst(size_t tab, rv_decode *dec) in format_inst() argument
5085 const rv_opcode_data *opcode_data = dec->opcode_data; in format_inst()
5089 fmt = opcode_data[dec->op].format; in format_inst()
5093 g_string_append(buf, opcode_data[dec->op].name); in format_inst()
5102 g_string_append_printf(buf, "%d", dec->bs); in format_inst()
5105 g_string_append_printf(buf, "%d", dec->rnum); in format_inst()
5108 g_string_append(buf, rv_ireg_name_sym[dec->rd]); in format_inst()
5111 g_string_append(buf, rv_ireg_name_sym[dec->rs1]); in format_inst()
5114 g_string_append(buf, rv_ireg_name_sym[dec->rs2]); in format_inst()
5117 if (dec->cfg && dec->cfg->ext_zfinx) { in format_inst()
5118 g_string_append(buf, rv_ireg_name_sym[dec->rd]); in format_inst()
5120 g_string_append(buf, rv_freg_name_sym[dec->rd]); in format_inst()
5124 if (dec->cfg && dec->cfg->ext_zfinx) { in format_inst()
5125 g_string_append(buf, rv_ireg_name_sym[dec->rs1]); in format_inst()
5127 g_string_append(buf, rv_freg_name_sym[dec->rs1]); in format_inst()
5131 if (dec->cfg && dec->cfg->ext_zfinx) { in format_inst()
5132 g_string_append(buf, rv_ireg_name_sym[dec->rs2]); in format_inst()
5134 g_string_append(buf, rv_freg_name_sym[dec->rs2]); in format_inst()
5138 if (dec->cfg && dec->cfg->ext_zfinx) { in format_inst()
5139 g_string_append(buf, rv_ireg_name_sym[dec->rs3]); in format_inst()
5141 g_string_append(buf, rv_freg_name_sym[dec->rs3]); in format_inst()
5145 g_string_append_printf(buf, "%d", dec->rs1); in format_inst()
5148 g_string_append_printf(buf, "%d", dec->imm); in format_inst()
5151 g_string_append_printf(buf, "%u", ((uint32_t)dec->imm & 0b111111)); in format_inst()
5154 g_string_append_printf(buf, "%d", dec->imm1); in format_inst()
5157 g_string_append_printf(buf, "%d", dec->imm); in format_inst()
5161 g_string_append_printf(buf, "# 0x%" PRIx64, dec->pc + dec->imm); in format_inst()
5165 g_string_append_printf(buf, "%d", dec->imm >> 12); in format_inst()
5170 g_string_append_printf(buf, "# 0x%" PRIx64, dec->pc + dec->imm); in format_inst()
5174 const char *name = csr_name(dec->imm & 0xfff); in format_inst()
5178 g_string_append_printf(buf, "0x%03x", dec->imm & 0xfff); in format_inst()
5183 switch (dec->rm) { in format_inst()
5208 if (dec->pred & rv_fence_i) { in format_inst()
5211 if (dec->pred & rv_fence_o) { in format_inst()
5214 if (dec->pred & rv_fence_r) { in format_inst()
5217 if (dec->pred & rv_fence_w) { in format_inst()
5222 if (dec->succ & rv_fence_i) { in format_inst()
5225 if (dec->succ & rv_fence_o) { in format_inst()
5228 if (dec->succ & rv_fence_r) { in format_inst()
5231 if (dec->succ & rv_fence_w) { in format_inst()
5241 if (dec->aq) { in format_inst()
5246 if (dec->rl) { in format_inst()
5254 if (dec->vm == 0) { in format_inst()
5259 g_string_append(buf, rv_vreg_name_sym[dec->rd]); in format_inst()
5262 g_string_append(buf, rv_vreg_name_sym[dec->rs1]); in format_inst()
5265 g_string_append(buf, rv_vreg_name_sym[dec->rs2]); in format_inst()
5268 g_string_append(buf, rv_vreg_name_sym[dec->rs3]); in format_inst()
5271 const int sew = 1 << (((dec->vzimm >> 3) & 0b111) + 3); in format_inst()
5272 const int lmul = dec->vzimm & 0b11; in format_inst()
5273 const int flmul = (dec->vzimm >> 2) & 1; in format_inst()
5274 const char *vta = (dec->vzimm >> 6) & 1 ? "ta" : "tu"; in format_inst()
5275 const char *vma = (dec->vzimm >> 7) & 1 ? "ma" : "mu"; in format_inst()
5300 switch (dec->rlist) { in format_inst()
5311 g_string_append_printf(buf, "{ra, s0-s%d}", dec->rlist - 5); in format_inst()
5317 g_string_append(buf, rv_fli_name_const[dec->imm]); in format_inst()
5330 static void decode_inst_lift_pseudo(rv_decode *dec) in decode_inst_lift_pseudo() argument
5332 const rv_opcode_data *opcode_data = dec->opcode_data; in decode_inst_lift_pseudo()
5333 const rv_comp_data *comp_data = opcode_data[dec->op].pseudo; in decode_inst_lift_pseudo()
5338 if (check_constraints(dec, comp_data->constraints)) { in decode_inst_lift_pseudo()
5339 dec->op = comp_data->op; in decode_inst_lift_pseudo()
5340 dec->codec = opcode_data[dec->op].codec; in decode_inst_lift_pseudo()
5349 static void decode_inst_decompress_rv32(rv_decode *dec) in decode_inst_decompress_rv32() argument
5351 const rv_opcode_data *opcode_data = dec->opcode_data; in decode_inst_decompress_rv32()
5352 int decomp_op = opcode_data[dec->op].decomp_rv32; in decode_inst_decompress_rv32()
5354 if ((opcode_data[dec->op].decomp_data & rvcd_imm_nz) in decode_inst_decompress_rv32()
5355 && dec->imm == 0) { in decode_inst_decompress_rv32()
5356 dec->op = rv_op_illegal; in decode_inst_decompress_rv32()
5358 dec->op = decomp_op; in decode_inst_decompress_rv32()
5359 dec->codec = opcode_data[decomp_op].codec; in decode_inst_decompress_rv32()
5364 static void decode_inst_decompress_rv64(rv_decode *dec) in decode_inst_decompress_rv64() argument
5366 const rv_opcode_data *opcode_data = dec->opcode_data; in decode_inst_decompress_rv64()
5367 int decomp_op = opcode_data[dec->op].decomp_rv64; in decode_inst_decompress_rv64()
5369 if ((opcode_data[dec->op].decomp_data & rvcd_imm_nz) in decode_inst_decompress_rv64()
5370 && dec->imm == 0) { in decode_inst_decompress_rv64()
5371 dec->op = rv_op_illegal; in decode_inst_decompress_rv64()
5373 dec->op = decomp_op; in decode_inst_decompress_rv64()
5374 dec->codec = opcode_data[decomp_op].codec; in decode_inst_decompress_rv64()
5379 static void decode_inst_decompress_rv128(rv_decode *dec) in decode_inst_decompress_rv128() argument
5381 const rv_opcode_data *opcode_data = dec->opcode_data; in decode_inst_decompress_rv128()
5382 int decomp_op = opcode_data[dec->op].decomp_rv128; in decode_inst_decompress_rv128()
5384 if ((opcode_data[dec->op].decomp_data & rvcd_imm_nz) in decode_inst_decompress_rv128()
5385 && dec->imm == 0) { in decode_inst_decompress_rv128()
5386 dec->op = rv_op_illegal; in decode_inst_decompress_rv128()
5388 dec->op = decomp_op; in decode_inst_decompress_rv128()
5389 dec->codec = opcode_data[decomp_op].codec; in decode_inst_decompress_rv128()
5394 static void decode_inst_decompress(rv_decode *dec, rv_isa isa) in decode_inst_decompress() argument
5398 decode_inst_decompress_rv32(dec); in decode_inst_decompress()
5401 decode_inst_decompress_rv64(dec); in decode_inst_decompress()
5404 decode_inst_decompress_rv128(dec); in decode_inst_decompress()
5414 rv_decode dec = { 0 }; in disasm_inst() local
5415 dec.pc = pc; in disasm_inst()
5416 dec.inst = inst; in disasm_inst()
5417 dec.cfg = cfg; in disasm_inst()
5446 dec.opcode_data = opcode_data; in disasm_inst()
5447 decode_func(&dec, isa); in disasm_inst()
5448 if (dec.op != rv_op_illegal) in disasm_inst()
5453 if (dec.op == rv_op_illegal) { in disasm_inst()
5454 dec.opcode_data = rvi_opcode_data; in disasm_inst()
5457 decode_inst_operands(&dec, isa); in disasm_inst()
5458 decode_inst_decompress(&dec, isa); in disasm_inst()
5459 decode_inst_lift_pseudo(&dec); in disasm_inst()
5460 return format_inst(24, &dec); in disasm_inst()