コード例 #1
0
 def init_offset_reg(self):
     for i in range(len(self.rs1_reg)):
         la_instr = riscv_pseudo_instr()
         la_instr.pseudo_instr_name = riscv_pseudo_instr_name_t.LA
         la_instr.rd = self.rs1_reg[i]
         la_instr.imm_str = "{}+{}".format(
             cfg.amo_region[self.data_page_id].name, self.offset[i])
         self.instr_list.insert(0, la_instr)
コード例 #2
0
 def add_rs1_init_la_instr(self, gpr, idx, base = 0):
     la_instr = riscv_pseudo_instr()
     la_instr.pseudo_instr_name = riscv_pseudo_instr_name_t.LA
     la_instr.rd = gpr
     if self.load_store_shared_memory:
         la_instr.imm_str = "{}+{}".format(cfg.amo_region[idx].name, base)
     elif self.kernel_mode:
         la_instr.imm_str = "{}{}+{}".format(pkg_ins.hart_prefix(self.hart),
                                             cfg.s_mem_region[idx].name, base)
     else:
         la_instr.imm_str = "{}{}+{}".format(pkg_ins.hart_prefix(self.hart),
                                             cfg.mem_region[idx].name, base)
     self.instr_list.insert(0, la_instr)
コード例 #3
0
 def post_randomize(self):
     self.init_instr = [None] * self.num_of_avail_regs
     for i in range(len(self.init_val_type)):
         if self.init_val_type[i] == int_numeric_e.Zero:
             self.init_val[i] = 0
         elif self.init_val_type[i] == int_numeric_e.AllOne:
             self.init_val[i] = 1
         elif self.init_val_type[i] == int_numeric_e.NegativeMax:
             self.init_val[i] = 1 << (rcs.XLEN - 1)
         self.init_instr[i] = riscv_pseudo_instr()
         self.init_instr[i].rd = self.avail_regs[i]
         self.init_instr[i].pseudo_instr_name = riscv_pseudo_instr_name_t.LI
         self.init_instr[i].imm_str = "0x%0x" % (self.init_val[i])
         self.instr_list.append(self.init_instr[i])
     for i in range(self.num_of_instr):
         instr = riscv_instr.get_rand_instr(
             include_category = ['ARITHMETIC'],
             exclude_group = ['RV32C', 'RV64C', 'RV32F', 'RV64F', 'RV32D', 'RV64D'])
         instr = self.randomize_gpr(instr)
         self.instr_list.append(instr)
     super().post_randomize()