def METHOD_NAME(
    generator_class: str, generator_cores: int, mem_size: MemorySize
):
    if generator_class == "LinearGenerator":
        from gem5.components.processors.linear_generator import LinearGenerator
        return LinearGenerator(
            duration="250us",
            rate="40GB/s",
            num_cores=generator_cores,
            max_addr=mem_size,
        )
    elif generator_class == "RandomGenerator":
        from gem5.components.processors.random_generator import RandomGenerator
        return RandomGenerator(
            duration="250us",
            rate="40GB/s",
            num_cores=generator_cores,
            max_addr=mem_size,
        )
    elif generator_class == "GUPSGenerator":
        if generator_cores != 1:
            raise ValueError(
                "Only one core should be used with GUPSGenerator. "
                "In order to use multiple cores of GUPS generator, use either "
                "GUPSGeneratorEP or GUPSGeneratorPAR."
            )
        from gem5.components.processors.gups_generator import GUPSGenerator
        table_size = f"{int(mem_size / 2)}B"
        return GUPSGenerator(0, table_size, update_limit=1000, clk_freq="2GHz")
    elif generator_class == "GUPSGeneratorEP":
        from gem5.components.processors.gups_generator_ep import (
            GUPSGeneratorEP,
        )
        table_size = f"{int(mem_size / 2)}B"
        return GUPSGeneratorEP(
            generator_cores, 0, table_size, update_limit=1000, clk_freq="2GHz"
        )
    elif generator_class == "GUPSGeneratorPAR":
        from gem5.components.processors.gups_generator_par import (
            GUPSGeneratorPAR,
        )
        table_size = f"{int(mem_size / 2)}B"
        return GUPSGeneratorPAR(
            generator_cores, 0, table_size, update_limit=1000, clk_freq="2GHz"
        )
    else:
        raise ValueError(f"Unknown generator class {generator_class}")