Exemple #1
0
    def load_builtins_and_core(cls, database: hammer_config.HammerDatabase) -> None:
        """
        Helper function that loads builtins and core into a HammerDatabase.
        """

        # Load in builtins.
        builtins_path = os.path.join(cls.hammer_vlsi_path, "builtins.yml")
        if not os.path.exists(builtins_path):
            raise FileNotFoundError(
                "hammer-vlsi builtin settings not found. Did you call HammerVLSISettings.set_hammer_vlsi_path_from_environment()?")

        database.update_builtins([
            hammer_config.load_config_from_file(builtins_path, strict=True),
            HammerVLSISettings.get_config()
        ])

        # Read in core defaults.
        database.update_core(hammer_config.load_config_from_defaults(cls.hammer_vlsi_path, strict=True))
Exemple #2
0
 def get_config(self) -> List[dict]:
     """Get the config for this tool."""
     return reduce(add_lists, map(lambda path: hammer_config.load_config_from_defaults(path), self.config_dirs))
Exemple #3
0
 def get_config(self) -> List[dict]:
     """Get the hammer configuration for this technology. Not to be confused with the ".tech.json" which self.config refers to."""
     return hammer_config.load_config_from_defaults(self.path)
Exemple #4
0
    def __init__(self,
                 options: HammerDriverOptions,
                 extra_project_config: dict = {}) -> None:
        """
        Create a hammer-vlsi driver, which is a higher level convenience function
        for quickly using hammer-vlsi. It imports and uses the hammer-vlsi blocks.

        Set up logging, databases, context, etc.

        :param options: Driver options.
        :param extra_project_config: An extra flattened config for the project. Optional.
        """

        # Create global logging context.
        file_logger = HammerVLSIFileLogger(options.log_file)
        HammerVLSILogging.add_callback(file_logger.callback)
        self.log = HammerVLSILogging.context(
        )  # type: HammerVLSILoggingContext

        # Create a new hammer database.
        self.database = hammer_config.HammerDatabase(
        )  # type: hammer_config.HammerDatabase

        self.log.info("Loading hammer-vlsi libraries and reading settings")

        # Store the run dir.
        self.obj_dir = options.obj_dir  # type: str

        # Load in builtins.
        self.database.update_builtins([
            hammer_config.load_config_from_file(os.path.join(
                HammerVLSISettings.hammer_vlsi_path, "builtins.yml"),
                                                strict=True),
            HammerVLSISettings.get_config()
        ])

        # Read in core defaults.
        self.database.update_core(
            hammer_config.load_config_from_defaults(
                HammerVLSISettings.hammer_vlsi_path))

        # Read in the environment config for paths to CAD tools, etc.
        for config in options.environment_configs:
            if not os.path.exists(config):
                self.log.error("Environment config %s does not exist!" %
                               (config))
        self.database.update_environment(
            hammer_config.load_config_from_paths(options.environment_configs,
                                                 strict=True))

        # Read in the project config to find the syn, par, and tech.
        project_configs = hammer_config.load_config_from_paths(
            options.project_configs, strict=True)
        project_configs.append(extra_project_config)
        self.project_configs = []  # type: List[dict]
        self.update_project_configs(project_configs)

        # Get the technology and load technology settings.
        self.tech = None  # type: Optional[hammer_tech.HammerTechnology]
        self.load_technology()

        # Keep track of what the synthesis and par configs are since
        # update_tools() just takes a whole list.
        self.tool_configs = {}  # type: Dict[str, List[dict]]

        # Initialize tool fields.
        self.syn_tool = None  # type: Optional[HammerSynthesisTool]
        self.par_tool = None  # type: Optional[HammerPlaceAndRouteTool]

        # Initialize tool hooks. Used to specify resume/pause hooks after custom hooks have been registered.
        self.post_custom_syn_tool_hooks = [
        ]  # type: List[HammerToolHookAction]
        self.post_custom_par_tool_hooks = [
        ]  # type: List[HammerToolHookAction]
Exemple #5
0
 def get_config(self) -> List[dict]:
     """Get the config for this tool."""
     return reduce(add_lists, map(lambda path: hammer_config.load_config_from_defaults(path), self.config_dirs))
Exemple #6
0
 def get_config(self) -> List[dict]:
     """Get the hammer configuration for this technology. Not to be confused with the ".tech.json" which self.config refers to."""
     return hammer_config.load_config_from_defaults(self.path)