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.
This commit is contained in:
Tim Edwards 2021-11-15 16:41:04 -05:00
parent 098b4befb2
commit f18a219be4
2 changed files with 48 additions and 1 deletions

19
info.yaml Normal file
View File

@ -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"

View File

@ -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!')