@@ -88,23 +88,13 @@ def set_tag(self):
8888 self .logger .info (f"Run tag: { self .args .tag } " )
8989
9090 def set_paths (self , design_info ):
91- if not os .path .exists (design_info ["CARAVEL_ROOT" ]) or not os .path .exists (
92- design_info ["MCW_ROOT" ]
93- ):
94- raise NotADirectoryError (
95- f"CARAVEL_ROOT or MCW_ROOT not a correct directory CARAVEL_ROOT:{ design_info ['CARAVEL_ROOT' ]} MCW_ROOT:{ design_info ['MCW_ROOT' ]} "
96- )
97- if self .args .check_commits :
98- GitRepoChecker (
99- design_info ["CARAVEL_ROOT" ]
100- ) # check repo synced with last commit
101- GitRepoChecker (
102- design_info ["MCW_ROOT" ]
103- ) # check repo synced with last commit
104- if not os .path .exists (f'{ design_info ["PDK_ROOT" ]} /{ design_info ["PDK" ]} ' ):
105- raise NotADirectoryError (
106- f"PDK_ROOT/PDK is not a directory PDK_ROOT:{ design_info ['PDK_ROOT' ]} /{ design_info ['PDK' ]} "
107- )
91+ RUN_PATH = self .args .run_path
92+ SIM_PATH = (
93+ f"{ RUN_PATH } /sim"
94+ if self .args .sim_path is None
95+ else f"{ self .args .sim_path } /sim"
96+ )
97+ VERILOG_PATH = f"{ design_info ['MCW_ROOT' ]} /verilog"
10898 if not os .path .exists (design_info ["USER_PROJECT_ROOT" ]):
10999 raise NotADirectoryError (
110100 f"USER_PROJECT_ROOT is not a directory USER_PROJECT_ROOT:{ design_info ['USER_PROJECT_ROOT' ]} "
@@ -114,36 +104,76 @@ def set_paths(self, design_info):
114104 GitRepoChecker (
115105 design_info ["USER_PROJECT_ROOT" ]
116106 ) # check repo synced with last commit
117- Paths = namedtuple (
118- "Paths" ,
119- "CARAVEL_ROOT MCW_ROOT PDK_ROOT PDK CARAVEL_VERILOG_PATH VERILOG_PATH CARAVEL_PATH FIRMWARE_PATH RUN_PATH USER_PROJECT_ROOT SIM_PATH" ,
120- )
121- CARAVEL_VERILOG_PATH = f"{ design_info ['CARAVEL_ROOT' ]} /verilog"
122- VERILOG_PATH = f"{ design_info ['MCW_ROOT' ]} /verilog"
123- CARAVEL_PATH = f"{ CARAVEL_VERILOG_PATH } "
107+ if not os .path .exists (f'{ design_info ["PDK_ROOT" ]} /{ design_info ["PDK" ]} ' ):
108+ raise NotADirectoryError (
109+ f"PDK_ROOT/PDK is not a directory PDK_ROOT:{ design_info ['PDK_ROOT' ]} /{ design_info ['PDK' ]} "
110+ )
124111 if os .path .exists (f"{ design_info ['MCW_ROOT' ]} /verilog/dv/fw" ):
125112 FIRMWARE_PATH = f"{ design_info ['MCW_ROOT' ]} /verilog/dv/fw"
126113 else :
127114 FIRMWARE_PATH = f"{ design_info ['MCW_ROOT' ]} /verilog/dv/firmware"
128- RUN_PATH = self .args .run_path
129- SIM_PATH = (
130- f"{ RUN_PATH } /sim"
131- if self .args .sim_path is None
132- else f"{ self .args .sim_path } /sim"
133- )
134- self .paths = Paths (
135- design_info ["CARAVEL_ROOT" ],
136- design_info ["MCW_ROOT" ],
137- design_info ["PDK_ROOT" ],
138- design_info ["PDK" ],
139- CARAVEL_VERILOG_PATH ,
140- VERILOG_PATH ,
141- CARAVEL_PATH ,
142- FIRMWARE_PATH ,
143- RUN_PATH ,
144- design_info ["USER_PROJECT_ROOT" ],
145- SIM_PATH ,
146- )
115+
116+ if "CARAVEL_ROOT" in design_info :
117+ if not os .path .exists (design_info ["CARAVEL_ROOT" ]) or not os .path .exists (
118+ design_info ["MCW_ROOT" ]
119+ ):
120+ raise NotADirectoryError (
121+ f"CARAVEL_ROOT or MCW_ROOT not a correct directory CARAVEL_ROOT:{ design_info ['CARAVEL_ROOT' ]} MCW_ROOT:{ design_info ['MCW_ROOT' ]} "
122+ )
123+ if self .args .check_commits :
124+ GitRepoChecker (
125+ design_info ["CARAVEL_ROOT" ]
126+ ) # check repo synced with last commit
127+ GitRepoChecker (
128+ design_info ["MCW_ROOT" ]
129+ ) # check repo synced with last commit
130+ Paths = namedtuple (
131+ "Paths" ,
132+ "CARAVEL_ROOT MCW_ROOT PDK_ROOT PDK CARAVEL_VERILOG_PATH VERILOG_PATH CARAVEL_PATH FIRMWARE_PATH RUN_PATH USER_PROJECT_ROOT SIM_PATH" ,
133+ )
134+ CARAVEL_VERILOG_PATH = f"{ design_info ['CARAVEL_ROOT' ]} /verilog"
135+ CARAVEL_PATH = f"{ CARAVEL_VERILOG_PATH } "
136+ self .paths = Paths (
137+ design_info ["CARAVEL_ROOT" ],
138+ design_info ["MCW_ROOT" ],
139+ design_info ["PDK_ROOT" ],
140+ design_info ["PDK" ],
141+ CARAVEL_VERILOG_PATH ,
142+ VERILOG_PATH ,
143+ CARAVEL_PATH ,
144+ FIRMWARE_PATH ,
145+ RUN_PATH ,
146+ design_info ["USER_PROJECT_ROOT" ],
147+ SIM_PATH ,
148+ )
149+ elif "FRIGATE_ROOT" in design_info :
150+ Paths = namedtuple (
151+ "Paths" ,
152+ "FRIGATE_ROOT MCW_ROOT PDK_ROOT PDK RUN_PATH VERILOG_PATH FIRMWARE_PATH USER_PROJECT_ROOT SIM_PATH" ,
153+ )
154+ if not os .path .exists (design_info ["FRIGATE_ROOT" ]):
155+ raise NotADirectoryError (
156+ f"FRIGATE_ROOT is not a correct directory FRIGATE_ROOT:{ design_info ['FRIGATE_ROOT' ]} "
157+ )
158+ if not os .path .exists (design_info ["MCW_ROOT" ]):
159+ raise NotADirectoryError (
160+ f"MCW_ROOT is not a correct directory MCW_ROOT:{ design_info ['MCW_ROOT' ]} "
161+ )
162+ self .paths = Paths (
163+ design_info ["FRIGATE_ROOT" ],
164+ design_info ["MCW_ROOT" ],
165+ design_info ["PDK_ROOT" ],
166+ design_info ["PDK" ],
167+ RUN_PATH ,
168+ VERILOG_PATH ,
169+ FIRMWARE_PATH ,
170+ design_info ["USER_PROJECT_ROOT" ],
171+ SIM_PATH ,
172+ )
173+
174+
175+
176+
147177
148178 def set_cpu_type (self ):
149179 def_h_file = f"{ self .paths .FIRMWARE_PATH } /defs.h"
@@ -208,13 +238,22 @@ def set_config_script(self, design_info):
208238 design_configs = dict (
209239 clock = self .args .clk , max_err = self .args .maxerr , PDK = self .args .pdk
210240 )
211- design_configs .update (
212- dict (
213- CARAVEL_ROOT = self .paths .CARAVEL_ROOT ,
214- MCW_ROOT = self .paths .MCW_ROOT ,
215- PDK_ROOT = f'{ self .paths .PDK_ROOT } /{ design_info ["PDK" ]} ' ,
241+ if "CARAVEL_ROOT" in self .paths ._fields :
242+ design_configs .update (
243+ dict (
244+ CARAVEL_ROOT = self .paths .CARAVEL_ROOT ,
245+ MCW_ROOT = self .paths .MCW_ROOT ,
246+ PDK_ROOT = f'{ self .paths .PDK_ROOT } /{ design_info ["PDK" ]} ' ,
247+ )
248+ )
249+ elif "FRIGATE_ROOT" in self .paths ._fields :
250+ design_configs .update (
251+ dict (
252+ FRIGATE_ROOT = self .paths .FRIGATE_ROOT ,
253+ MCW_ROOT = self .paths .MCW_ROOT ,
254+ PDK_ROOT = f'{ self .paths .PDK_ROOT } /{ design_info ["PDK" ]} ' ,
255+ )
216256 )
217- )
218257 with open (new_config_path , "w" ) as file :
219258 yaml .dump (design_configs , file )
220259
0 commit comments