XOR_check.log during precheck is shown below; Check if the two resulting GDSes have any differences and write them to a file
klayout_rb_drc_xor_file_path = parent_directory / 'xor.rb.drc'
xor_resulting_shapes_gds_file_path = outputs_directory / f"{project_config['user_module']}.xor.gds"
xor_total_file_path = logs_directory / 'xor_check.total'
xor_command = ['klayout', '-b', '-r', klayout_rb_drc_xor_file_path,
'-rd', 'ext=gds',
'-rd', 'top_cell=xor_target',
'-rd', f'thr={os.cpu_count()}',
'-rd', f'a={gds_ut_box_erased_path}',
'-rd', f'b={gds_golden_wrapper_box_erased_file_path}',
'-rd', f'o={xor_resulting_shapes_gds_file_path}',
'-rd', f'ol={xor_resulting_shapes_gds_file_path}',
'-rd', f'xor_total_file_path={xor_total_file_path}']
subprocess.run(xor_command, stderr=xor_log, stdout=xor_log)
try:
with open(xor_total_file_path) as xor_total:
xor_violations_count = xor_total.read()
logging.info(f"{{{{XOR CHECK UPDATE}}}} Total XOR differences: {xor_violations_count}, for more details view {xor_resulting_shapes_gds_file_path}")
if xor_violations_count == '0':
return True
else:
return False
except FileNotFoundError:
logging.error(f"XOR CHECK FILE NOT FOUND in {xor_total_file_path}")