mirror of
				https://github.com/YosysHQ/sby.git
				synced 2025-10-30 20:42:30 +00:00 
			
		
		
		
	sby: core: backported changes from #212 for sby-stages integration
This commit is contained in:
		
							parent
							
								
									b53bcf8c11
								
							
						
					
					
						commit
						44bd9ed04b
					
				
					 1 changed files with 33 additions and 2 deletions
				
			
		|  | @ -642,7 +642,7 @@ class SbyTaskloop: | ||||||
|             self.tasks = [] |             self.tasks = [] | ||||||
|             for task in tasks: |             for task in tasks: | ||||||
|                 task.check_timeout() |                 task.check_timeout() | ||||||
|                 if task.procs_pending or task.procs_running: |                 if task.procs_pending or task.procs_running or task.stage_running: | ||||||
|                     self.tasks.append(task) |                     self.tasks.append(task) | ||||||
|                 else: |                 else: | ||||||
|                     task.exit_callback() |                     task.exit_callback() | ||||||
|  | @ -876,6 +876,9 @@ class SbyTask(SbyConfig): | ||||||
|         self.taskloop = taskloop or SbyTaskloop() |         self.taskloop = taskloop or SbyTaskloop() | ||||||
|         self.taskloop.tasks.append(self) |         self.taskloop.tasks.append(self) | ||||||
| 
 | 
 | ||||||
|  |         self.base_dependencies = [] | ||||||
|  |         self.stages_running = [] | ||||||
|  | 
 | ||||||
|         self.procs_running = [] |         self.procs_running = [] | ||||||
|         self.procs_pending = [] |         self.procs_pending = [] | ||||||
| 
 | 
 | ||||||
|  | @ -1075,7 +1078,7 @@ class SbyTask(SbyConfig): | ||||||
|             proc = SbyProc( |             proc = SbyProc( | ||||||
|                 self, |                 self, | ||||||
|                 model_name, |                 model_name, | ||||||
|                 [], |                 self.base_dependencies, | ||||||
|                 "cd {}/src; {} -ql ../model/design.log ../model/design.ys".format(self.workdir, self.exe_paths["yosys"]) |                 "cd {}/src; {} -ql ../model/design.log ../model/design.ys".format(self.workdir, self.exe_paths["yosys"]) | ||||||
|             ) |             ) | ||||||
|             proc.checkretcode = True |             proc.checkretcode = True | ||||||
|  | @ -1329,6 +1332,8 @@ class SbyTask(SbyConfig): | ||||||
|             self.retcode = 0 |             self.retcode = 0 | ||||||
|             return |             return | ||||||
| 
 | 
 | ||||||
|  |         # TODO: Stage stuff | ||||||
|  | 
 | ||||||
|         if self.opt_make_model is not None: |         if self.opt_make_model is not None: | ||||||
|             for name in self.opt_make_model.split(","): |             for name in self.opt_make_model.split(","): | ||||||
|                 self.model(name.strip()) |                 self.model(name.strip()) | ||||||
|  | @ -1359,6 +1364,12 @@ class SbyTask(SbyConfig): | ||||||
|             if opt not in self.used_options: |             if opt not in self.used_options: | ||||||
|                 self.error(f"Unused option: {opt}") |                 self.error(f"Unused option: {opt}") | ||||||
| 
 | 
 | ||||||
|  |     def setup_stage(self, setupmode, config, name, depends): | ||||||
|  |         stage = SbyStage(config, self, name) | ||||||
|  |         stage.base_dependencies.extend(depends) | ||||||
|  |         self.stages_running.append(stage) | ||||||
|  |         stage.setup_procs(setupmode) | ||||||
|  | 
 | ||||||
|     def summarize(self): |     def summarize(self): | ||||||
|         total_clock_time = int(monotonic() - self.start_clock_time) |         total_clock_time = int(monotonic() - self.start_clock_time) | ||||||
| 
 | 
 | ||||||
|  | @ -1492,3 +1503,23 @@ class SbyTask(SbyConfig): | ||||||
|         print('</system-err>', file=f) |         print('</system-err>', file=f) | ||||||
|         print(f'</testsuite>', file=f) |         print(f'</testsuite>', file=f) | ||||||
|         print(f'</testsuites>', file=f) |         print(f'</testsuites>', file=f) | ||||||
|  | 
 | ||||||
|  | class SbyStage(SbyTask): | ||||||
|  |     def __init__(self, sbyconfig, main_task, name): | ||||||
|  |         self.main_task = main_task | ||||||
|  |         self.name = name | ||||||
|  |         workdir = f'{main_task.workdir}/stage_{name}' | ||||||
|  |         os.mkdir(workdir) | ||||||
|  | 
 | ||||||
|  |         super().__init__( | ||||||
|  |             sbyconfig, workdir, | ||||||
|  |             early_logs = [], reusedir = False, | ||||||
|  |             taskloop = main_task.taskloop, logfile = main_task.logfile | ||||||
|  |         ) | ||||||
|  | 
 | ||||||
|  |         self.exit_callback = self.handle_stage_exit | ||||||
|  | 
 | ||||||
|  |     def handle_stage_exit(self): | ||||||
|  |         self.main_task.stages_running.remove(self) | ||||||
|  | 
 | ||||||
|  |         # TODO pass the status back to the main task | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue