From f18a219be47c820aa22111c443a701f34a09a421 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 15 Nov 2021 16:41:04 -0500 Subject: [PATCH] Modified the set_user_id script so that if it happens to be run on a repository where the user_id_programming GDS has been compressed, it will handle it correctly. --- info.yaml | 19 +++++++++++++++++++ scripts/set_user_id.py | 30 +++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 info.yaml diff --git a/info.yaml b/info.yaml new file mode 100644 index 00000000..64e70641 --- /dev/null +++ b/info.yaml @@ -0,0 +1,19 @@ +--- +project: + description: "A template SoC for Google sponsored Open MPW shuttles for SKY130." + foundry: "SkyWater" + git_url: "https://github.com/efabless/caravel_openframe.git" + organization: "Efabless" + organization_url: "http://efabless.com" + owner: "Tim Edwards" + process: "SKY130" + project_name: "Caravel" + project_id: "00000000" + tags: + - "Open MPW" + - "Test Harness" + category: "Test Harness" + top_level_netlist: "verilog/gl/caravel.v" + user_level_netlist: "verilog/gl/user_project_wrapper.v" + version: "2.00" + cover_image: "docs/caravel_block_diagram.svg" diff --git a/scripts/set_user_id.py b/scripts/set_user_id.py index 6596bd05..50d9fc69 100755 --- a/scripts/set_user_id.py +++ b/scripts/set_user_id.py @@ -72,6 +72,7 @@ import os import sys import re +import subprocess def usage(): print("Usage:") @@ -205,6 +206,26 @@ if __name__ == '__main__': viarec = "00 06 0d 02 00 43 00 06 0e 02 00 2c 00 2c 10 03 " viabytes = bytes.fromhex(viarec) + # Check for either GDS file being gzipped + gdsbakgz = gdspath + '/user_id_prog_zero.gds.gz' + gdsfilegz = gdspath + '/user_id_programming.gds.gz' + + if os.path.isfile(gdsbakgz): + subprocess.run(['gunzip', gdsbakgz], + stdout = subprocess.DEVNULL, + stderr = subprocess.DEVNULL) + zero_zipped = True + else: + zero_zipped = False + + if os.path.isfile(gdsfilegz): + subprocess.run(['gunzip', gdsfilegz], + stdout = subprocess.DEVNULL, + stderr = subprocess.DEVNULL) + file_zipped = True + else: + file_zipped = False + # Read the GDS file. If a backup was made of the zero-value # program, then use it. @@ -284,10 +305,17 @@ if __name__ == '__main__': if errors == 0: # Keep a copy of the original if not os.path.isfile(gdsbak): - os.rename(gdsfile, gdsbak) + if file_zipped: + os.rename(gdsfilegz, gdsbakgz) + else: + os.rename(gdsfile, gdsbak) with open(gdsfile, 'wb') as ofile: ofile.write(gdsdata) + if file_zipped: + subprocess.run(['gzip', gdsdata, '-n', '--best'], + stdout = subprocess.DEVNULL, + stderr = subprocess.DEVNULL) print('Done!')