mirror of https://github.com/openXC7/prjxray.git
fuzzers: 007: produce sdf files for routing bels
Signed-off-by: Karol Gugala <kgugala@antmicro.com>
This commit is contained in:
parent
b0cc42353a
commit
cb3a2b42d7
|
|
@ -1,13 +1,13 @@
|
|||
all: build/slicel.json build/slicem.json
|
||||
all: build/slicel.sdf build/slicem.sdf
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
build/slicel.json: build/slicel.txt
|
||||
python3 tim2sdf.py --timings build/slicel.txt --json build/slicel.json
|
||||
build/slicel.sdf: build/slicel.txt
|
||||
python3 tim2sdf.py --timings build/slicel.txt --site slicel --sdf build/slicel.sdf
|
||||
|
||||
build/slicem.json: build/slicem.txt
|
||||
python3 tim2sdf.py --timings build/slicem.txt --json build/slicem.json
|
||||
build/slicem.sdf: build/slicem.txt
|
||||
python3 tim2sdf.py --timings build/slicem.txt --site slicem --sdf build/slicem.sdf
|
||||
|
||||
build/slicel.txt build/slicem.txt:
|
||||
bash runme.sh
|
||||
|
|
|
|||
|
|
@ -2,11 +2,29 @@
|
|||
|
||||
import argparse
|
||||
import json
|
||||
from sdf_timing import sdfparse
|
||||
from sdf_timing import utils
|
||||
|
||||
|
||||
def read_raw_timings(fin):
|
||||
def generate_sdf(timings, sdffile):
|
||||
|
||||
sdf_data = sdfparse.emit(timings, timescale='1ns')
|
||||
with open(sdffile, 'w') as fp:
|
||||
fp.write(sdf_data)
|
||||
|
||||
|
||||
def add_timing_paths_entry(paths, type, values):
|
||||
paths[type] = dict()
|
||||
paths[type]['min'] = values[0]
|
||||
paths[type]['avg'] = values[1]
|
||||
paths[type]['max'] = values[2]
|
||||
return paths
|
||||
|
||||
|
||||
def read_raw_timings(fin, site):
|
||||
|
||||
timings = dict()
|
||||
timings['cells'] = dict()
|
||||
with open(fin, "r") as f:
|
||||
for line in f:
|
||||
|
||||
|
|
@ -17,12 +35,33 @@ def read_raw_timings(fin):
|
|||
speed_model = speed_model[6:]
|
||||
|
||||
if speed_model not in timings:
|
||||
timings[speed_model] = dict()
|
||||
timings['cells'][speed_model] = dict()
|
||||
|
||||
if site not in timings['cells'][speed_model]:
|
||||
timings['cells'][speed_model][site] = dict()
|
||||
|
||||
if speed_model not in timings['cells'][speed_model][site]:
|
||||
timings['cells'][speed_model][site][speed_model] = dict()
|
||||
|
||||
delays = dict()
|
||||
# each timing entry reports 5 delays
|
||||
for d in range(0, 5):
|
||||
(t, v) = raw_data[d + 1].split(':')
|
||||
timings[speed_model][t] = v
|
||||
delays[t] = v
|
||||
|
||||
# create entry for sdf writer
|
||||
port = dict()
|
||||
port['port'] = speed_model
|
||||
port['edge'] = None
|
||||
paths = dict()
|
||||
paths = add_timing_paths_entry(
|
||||
paths, 'slow', [delays['SLOW_MIN'], None, delays['SLOW_MAX']])
|
||||
paths = add_timing_paths_entry(
|
||||
paths, 'fast', [delays['FAST_MIN'], None, delays['FAST_MAX']])
|
||||
timings['cells'][speed_model][site][
|
||||
speed_model] = utils.add_device(port, paths)
|
||||
timings['cells'][speed_model][site][speed_model][
|
||||
'is_absolute'] = True
|
||||
|
||||
return timings
|
||||
|
||||
|
|
@ -30,14 +69,19 @@ def read_raw_timings(fin):
|
|||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--timings', type=str, help='Raw timing input file')
|
||||
parser.add_argument('--json', type=str, help='json output file')
|
||||
parser.add_argument('--sdf', type=str, help='output sdf file')
|
||||
parser.add_argument(
|
||||
'--site', type=str, help='Site of the processed timings')
|
||||
parser.add_argument(
|
||||
'--debug', type=bool, default=False, help='Enable debug json dumps')
|
||||
args = parser.parse_args()
|
||||
|
||||
timings = read_raw_timings(args.timings)
|
||||
with open(args.json, 'w') as fp:
|
||||
json.dump(timings, fp, indent=4, sort_keys=True)
|
||||
timings = read_raw_timings(args.timings, args.site)
|
||||
if args.debug:
|
||||
with open("debug" + args.site + ".json", 'w') as fp:
|
||||
json.dump(timings, fp, indent=4, sort_keys=True)
|
||||
|
||||
generate_sdf(timings, args.sdf)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Reference in New Issue