コード例 #1
0
 def init_floating_point_gpr(self):
     for i in range(rcs.NUM_FLOAT_GPR):
         vsc.randselect([
             (1, lambda: self.init_floating_point_gpr_with_spf(i)),
             (riscv_instr_group_t.RV64D in rcs.supported_isa,
              lambda: self.init_floating_point_gpr_with_dpf(i))])
     # Initialize rounding mode of FCSR
     fsrmi_instr = "{}fsrmi {}".format(pkg_ins.indent, cfg.fcsr_rm)
     self.instr_stream.append(fsrmi_instr)
コード例 #2
0
    def test_randselect(self):
        hist = [0] * 4

        def task(idx):
            hist[idx] += 1

        for i in range(100):
            vsc.randselect([(1, lambda: task(0)), (1, lambda: task(1)),
                            (10, lambda: task(2)), (10, lambda: task(3))])
        print("hist: " + str(hist))
        self.assertGreater(hist[3], hist[0])
        self.assertGreater(hist[2], hist[1])
コード例 #3
0
 def get_val(self):
     vsc.randselect([(1, lambda: self.task(0x12345678, 0x9abcdef0)),
                     (0, lambda: self.task(0x232456ab, 0x00000000))
                     ])