示例#1
0
文件: nes.py 项目: coolon97/NESEmu
 def reset(self):
     self.io = nesio.NesIO()
     self.ram = ram.RAM()
     self.apu = apu.APU()
     self.rom = False
     self.cpu = False
     self.cycles = 0
示例#2
0
    def __init__(self):
        """Creates an instance of the main application window, which
        displays all widgets with information about CPU and memory usage
        """
        super().__init__()
        self.attributes('-alpha', 1)
        self.attributes('-topmost', True)
        self.resizable(False, False)
        self.title(settings.APPLICATION_TITLE)

        self.__cpu_load_labels = list()
        self.__cpu_load_progress_bars = list()
        self.__ram_load_label = None
        self.__ram_load_bar = None

        self.__cpu = cpu.CPU()
        self.__ram = ram.RAM()
        self.__create_widgets()
        self.__configure_cpu_section()
        self.__configure_ram_section()
示例#3
0
    def create_all_dict(self):
        data1 = cpu.CPU()
        cpu_dict = data1.clean_dict(
        )  # instantiate cpu class, creates cpu dict

        data2 = gpu.GPU()
        gpu_dict = data2.clean_dict(
        )  # instantiate gpu class, creates gpu dict

        data3 = ram.RAM()
        ram_dict = data3.clean_dict(
        )  # instantiate ram class, creates ram dict

        year1 = 1960
        value_list = []

        while year1 < 2021:
            if str(year1) in ram_dict.keys():
                if str(year1) in gpu_dict.keys():
                    if str(year1) in cpu_dict.keys(
                    ):  # checks to see if year1 value is a key in all three dictionaries (cpu, gpu, and ram)
                        ram_value = ram_dict[str(
                            year1
                        )]  # sets variable equal to value of dictionary key
                        gpu_value = gpu_dict[str(year1)]
                        cpu_value = cpu_dict[str(year1)]
                        value_list.append(ram_value)  # appends value to list
                        value_list.append(gpu_value)
                        value_list.append(cpu_value)

                        for x in value_list:  # iterate through list of values
                            x = (map(float, x))
                            valueSum = (sum(x) / 3)
                            self.all_dict[year1] = round(valueSum, 2)

            year1 += 1
示例#4
0
def main():
    exitFalse = True
    while exitFalse:
        userInput = int(
            input('''
                Please select an option below:
                1) CPU Data
                2) GPU DATA
                3) RAM Data
                4) All Data
                5) Exit
                '''))

        if userInput == 1:
            cpuExitTrue = False
            choice_cpu = cpu.CPU()

            while cpuExitTrue is False:
                cpu_selection = int(
                    input('''
                Please select an option below:
                1) Year by year analysis
                2) Moore's Law (two year) analysis
                3) Exit
                '''))

                if cpu_selection == 1:
                    choice_cpu.avg_perc_inc()

                elif cpu_selection == 2:
                    choice_cpu.two_year_inc()

                elif cpu_selection == 3:
                    cpuExitTrue = True

                else:
                    print('Invalid Selection')

        elif userInput == 2:
            gpuExitTrue = False
            choice_gpu = gpu.GPU()

            while gpuExitTrue is False:
                gpu_selection = int(
                    input('''
                Please select an option below:
                1) Year by year analysis
                2) Moore's Law (two year) analysis
                3) Exit
                '''))

                if gpu_selection == 1:
                    choice_gpu.avg_perc_inc()

                elif gpu_selection == 2:
                    choice_gpu.two_year_inc()

                elif gpu_selection == 3:
                    gpuExitTrue = True

                else:
                    print('Invalid Selection')

        elif userInput == 3:
            ramExitTrue = False
            choice_ram = ram.RAM()

            while ramExitTrue is False:
                ram_selection = int(
                    input('''
                Please select an option below:
                1) Year by year analysis
                2) Moore's Law (two year) analysis
                3) Exit
                '''))

                if ram_selection == 1:
                    choice_ram.avg_perc_inc()

                elif ram_selection == 2:
                    choice_ram.two_year_inc()

                elif ram_selection == 3:
                    ramExitTrue = True

                else:
                    print('Invalid Selection')

        elif userInput == 4:
            allExitTrue = False
            choice_all = all.ALL()

            while allExitTrue is False:
                all_selection = int(
                    input('''
                Please select an option below:
                1) Year by year analysis
                2) Moore's Law (two year) analysis
                3) Exit
                '''))

                if all_selection == 1:
                    choice_all.avg_perc_inc()

                elif all_selection == 2:
                    choice_all.two_year_inc()

                elif all_selection == 3:
                    allExitTrue = True

                else:
                    print('Invalid Selection')

        elif userInput == 5:
            exitFalse = False

        else:
            print('Invalid selection')
示例#5
0
 def setUp(self):
     self.MEM_SIZE = 4096
     self.OFFSET = 0x200
     self.display = mock.MagicMock()
     self.ram = ram.RAM(self.MEM_SIZE, self.OFFSET)
     self.cpu = CPU(self.ram, self.display)