@@ -1177,6 +1177,18 @@ export async function verilator_lint(filenames: string[], dirname?: string, opti
11771177 }
11781178}
11791179
1180+ export function yosys2digitaljs ( obj : Yosys . Output , options : Options = { } ) : Digitaljs . TopModule {
1181+ const portmaps = order_ports ( obj ) ;
1182+ const out = yosys_to_digitaljs ( obj , portmaps , options ) ;
1183+ const toporder = topsort ( module_deps ( obj ) ) ;
1184+ toporder . pop ( ) ;
1185+ const toplevel = toporder . pop ( ) ;
1186+ const output : Digitaljs . TopModule = { subcircuits : { } , ... out [ toplevel ] } ;
1187+ for ( const x of toporder )
1188+ output . subcircuits [ x ] = out [ x ] ;
1189+ return output ;
1190+ }
1191+
11801192export async function process ( filenames : string [ ] , dirname ? : string , options : Options = { } ) : Promise < Output > {
11811193 const optimize_simp = options . optimize ? "; opt" : "; opt_clean" ;
11821194 const optimize = options . optimize ? "; opt -full" : "; opt_clean" ;
@@ -1203,13 +1215,7 @@ export async function process(filenames: string[], dirname?: string, options: Op
12031215 }
12041216 obj = JSON . parse ( fs . readFileSync ( tmpjson , 'utf8' ) ) ;
12051217 await promisify ( fs . unlink ) ( tmpjson ) ;
1206- const portmaps = order_ports ( obj ) ;
1207- const out = yosys_to_digitaljs ( obj , portmaps , options ) ;
1208- const toporder = topsort ( module_deps ( obj ) ) ;
1209- toporder . pop ( ) ;
1210- const toplevel = toporder . pop ( ) ;
1211- const output : Digitaljs . TopModule = { subcircuits : { } , ... out [ toplevel ] } ;
1212- for ( const x of toporder ) output . subcircuits [ x ] = out [ x ] ;
1218+ const output = yosys2digitaljs ( obj , options ) ;
12131219 const ret : Output = {
12141220 output : output ,
12151221 yosys_output : obj ,
0 commit comments