mirror of https://github.com/openXC7/prjxray.git
update_resources: skip parts with same speedgrade to get pins
Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
This commit is contained in:
parent
0219727e9c
commit
cb54b7f012
|
|
@ -13,6 +13,8 @@ import yaml
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import tempfile
|
||||||
|
import json
|
||||||
from prjxray import util
|
from prjxray import util
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -39,23 +41,34 @@ def main():
|
||||||
information = {}
|
information = {}
|
||||||
|
|
||||||
parts = util.get_parts(args.db_root)
|
parts = util.get_parts(args.db_root)
|
||||||
|
processed_parts = dict()
|
||||||
for part in parts.keys():
|
for part in parts.keys():
|
||||||
|
# Skip parts which differ only in the speedgrade, as they have the same pins
|
||||||
|
fields = part.split("-")
|
||||||
|
common_part = fields[0]
|
||||||
|
if common_part in processed_parts:
|
||||||
|
information[part] = processed_parts[common_part]
|
||||||
|
continue
|
||||||
|
|
||||||
print("Find pins for {}".format(part))
|
print("Find pins for {}".format(part))
|
||||||
env['XRAY_PART'] = part
|
env['XRAY_PART'] = part
|
||||||
|
_, tmp_file = tempfile.mkstemp()
|
||||||
# Asks with get_package_pins and different filters for pins with
|
# Asks with get_package_pins and different filters for pins with
|
||||||
# specific properties.
|
# specific properties.
|
||||||
command = "{} -mode batch -source update_resources.tcl".format(
|
command = "env TMP_FILE={} {} -mode batch -source update_resources.tcl".format(
|
||||||
env['XRAY_VIVADO'])
|
tmp_file, env['XRAY_VIVADO'])
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
command.split(' '),
|
command.split(' '),
|
||||||
check=True,
|
check=True,
|
||||||
env=env,
|
env=env,
|
||||||
cwd=cwd,
|
cwd=cwd,
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
# Formats the output and stores the pins
|
|
||||||
output = result.stdout.decode('utf-8').splitlines()
|
with open(tmp_file, "r") as fp:
|
||||||
clk_pins = output[-4].split(' ')
|
pins_json = json.load(fp)
|
||||||
data_pins = output[-2].strip().split(' ')
|
|
||||||
|
clk_pins = pins_json["clk_pins"].split()
|
||||||
|
data_pins = pins_json["data_pins"].split()
|
||||||
pins = {
|
pins = {
|
||||||
0: clk_pins[0],
|
0: clk_pins[0],
|
||||||
1: data_pins[0],
|
1: data_pins[0],
|
||||||
|
|
@ -63,6 +76,7 @@ def main():
|
||||||
3: data_pins[-1]
|
3: data_pins[-1]
|
||||||
}
|
}
|
||||||
information[part] = {'pins': pins}
|
information[part] = {'pins': pins}
|
||||||
|
processed_parts[common_part] = {'pins': pins}
|
||||||
|
|
||||||
# Overwrites the <family>/resources.yaml file completly with new data
|
# Overwrites the <family>/resources.yaml file completly with new data
|
||||||
util.set_part_resources(resource_path, information)
|
util.set_part_resources(resource_path, information)
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,9 @@ foreach bank [split $banks " "] {
|
||||||
append data_pins " " [get_package_pins -filter "IS_GENERAL_PURPOSE && BANK==$bank"]
|
append data_pins " " [get_package_pins -filter "IS_GENERAL_PURPOSE && BANK==$bank"]
|
||||||
}
|
}
|
||||||
|
|
||||||
puts $clk_pins
|
set fp [open $::env(TMP_FILE) w]
|
||||||
puts $data_pins
|
|
||||||
|
puts $fp "{"
|
||||||
|
puts $fp "\t\"clk_pins\": \"$clk_pins\","
|
||||||
|
puts $fp "\t\"data_pins\": \"$data_pins\""
|
||||||
|
puts $fp "}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue