Пример #1
0
 def _setUpTest(self):
     if RandomUtils.random32(0, 1) == 1:
         choices_mod = ChoicesModifier(self.genThread)
         choice_weights = {"Aligned": 80, "Unaligned": 20}
         choices_mod.modifyOperandChoices("Data alignment", choice_weights)
         choices_mod.commitSet()
         self._mUnalignedAllowed = True
Пример #2
0
def gen_thread_initialization(gen_thread):
    choices_mod = ChoicesModifier(gen_thread)

    # Increase the likelihood of using GPRs  x10, x11, x12 and x13 by
    # increasing the weighting.  The default weighting in the
    # operand_choices.xml file is 10 for each GPR.
    choices_mod.modifyOperandChoices("GPRs", {"x10": 40, "x11": 40, "x12": 60, "x13": 60})

    choices_mod.commitSet()
Пример #3
0
    def generate(self, **kwargs):

        choices_mod = ChoicesModifier(self.genThread)

        for _ in range(10):

            # Generate instructions with the default choices settings
            # except for the paging choices for "Page size#4K
            # granule#S#stage 1" which was set before this generate was called
            # via the GenThreadInitialization below.

            for _ in range(20):
                if self.getGlobalState("AppRegisterWidth") == 32:
                    instr = self.pickWeighted(RV32_G_instructions)
                else:
                    instr = self.pickWeighted(RV_G_instructions)
                self.genInstruction(instr)

            # Modify the choices settings
            choices_mod.modifyOperandChoices(
                "Rounding mode",
                {"RNE": 0, "RTZ": 0, "RDN": 50, "RUP": 0, "RMM": 0, "DYN": 50},
            )

            choices_mod.modifyOperandChoices(
                "Read after write address reuse", {"No reuse": 50, "Reuse": 50}
            )
            choices_mod.commitSet()

            # generate instructions
            for _ in range(20):

                if self.getGlobalState("AppRegisterWidth") == 32:
                    instr_mix = {RV32F_map: 10, LDST32_All_map: 10}
                else:
                    instr_mix = {ALU_Float_All_map: 10, LDST_All_map: 10}

                instr = self.pickWeighted(instr_mix)
                self.genInstruction(instr)

            # undo the choices settings - revert back to prior
            choices_mod.revert()
Пример #4
0
    def generate(self, **kwargs):

        choices_mod = ChoicesModifier(self.genThread)

        for _ in range(10):

            # Generate instructions with the default choices settings
            # except for the paging choices for "Page size#4K
            # granule#S#stage 1" which was set before this generate was called
            # via the GenThreadInitialization below.

            self._gen_rv_g_instructions()

            # Modify the choices settings
            choices_mod.modifyOperandChoices(
                "Rounding mode",
                {
                    "RNE": 0,
                    "RTZ": 0,
                    "RDN": 50,
                    "RUP": 0,
                    "RMM": 0,
                    "DYN": 50
                },
            )

            choices_mod.modifyOperandChoices("Read after write address reuse",
                                             {
                                                 "No reuse": 50,
                                                 "Reuse": 50
                                             })
            choices_mod.commitSet()

            # generate instructions
            self._gen_data_processing_and_load_store_instructions()

            # undo the choices settings - revert back to prior
            choices_mod.revert()