mirror of https://github.com/openXC7/prjxray.git
Merge pull request #1628 from antmicro/add-clock-info-ports-json
cells_data: add clock information on ports.json
This commit is contained in:
commit
a613dc48ba
|
|
@ -65,7 +65,8 @@ Ports files
|
||||||
|
|
||||||
This is a JSON file containing a dictionary of ports, each one with two attributes:
|
This is a JSON file containing a dictionary of ports, each one with two attributes:
|
||||||
|
|
||||||
- Direction: Corresponds to the port directiona and can have the ``input`` or ``output`` values.
|
- Direction: Corresponds to the port directiona and can have the ``input``, ``output``, ``clock`` values.
|
||||||
|
Note that the ``clock`` value is implicitly considered also as an ``input``.
|
||||||
- Width: Indicates the width of the port bus.
|
- Width: Indicates the width of the port bus.
|
||||||
|
|
||||||
As an example of parameter please, refer to the following::
|
As an example of parameter please, refer to the following::
|
||||||
|
|
|
||||||
|
|
@ -6,28 +6,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: ISC
|
# SPDX-License-Identifier: ISC
|
||||||
|
|
||||||
proc dump_pins {file_name site_prefix} {
|
source "$::env(XRAY_DIR)/utils/utils.tcl"
|
||||||
set fp [open $file_name w]
|
|
||||||
|
|
||||||
puts $fp "name,is_input,is_output"
|
|
||||||
set site [lindex [get_sites $site_prefix*] 0]
|
|
||||||
|
|
||||||
set pins [get_site_pins -of_objects $site]
|
|
||||||
foreach pin $pins {
|
|
||||||
set connected_pip [get_pips -of_objects [get_nodes -of_objects $pin]]
|
|
||||||
|
|
||||||
if { $connected_pip == "" } {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
set pin_name [lindex [split $pin "/"] 1]
|
|
||||||
set is_input [get_property IS_INPUT $pin]
|
|
||||||
set is_output [get_property IS_OUTPUT $pin]
|
|
||||||
|
|
||||||
puts $fp "$pin_name,$is_input,$is_output"
|
|
||||||
}
|
|
||||||
close $fp
|
|
||||||
}
|
|
||||||
|
|
||||||
create_project -force -name design -part $::env(XRAY_PART)
|
create_project -force -name design -part $::env(XRAY_PART)
|
||||||
set_property design_mode PinPlanning [current_fileset]
|
set_property design_mode PinPlanning [current_fileset]
|
||||||
|
|
|
||||||
|
|
@ -6,28 +6,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: ISC
|
# SPDX-License-Identifier: ISC
|
||||||
|
|
||||||
proc dump_pins {file_name site_prefix} {
|
source "$::env(XRAY_DIR)/utils/utils.tcl"
|
||||||
set fp [open $file_name w]
|
|
||||||
|
|
||||||
puts $fp "name,is_input,is_output"
|
|
||||||
set site [lindex [get_sites $site_prefix*] 0]
|
|
||||||
|
|
||||||
set pins [get_site_pins -of_objects $site]
|
|
||||||
foreach pin $pins {
|
|
||||||
set connected_pip [get_pips -of_objects [get_nodes -of_objects $pin]]
|
|
||||||
|
|
||||||
if { $connected_pip == "" } {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
set pin_name [lindex [split $pin "/"] 1]
|
|
||||||
set is_input [get_property IS_INPUT $pin]
|
|
||||||
set is_output [get_property IS_OUTPUT $pin]
|
|
||||||
|
|
||||||
puts $fp "$pin_name,$is_input,$is_output"
|
|
||||||
}
|
|
||||||
close $fp
|
|
||||||
}
|
|
||||||
|
|
||||||
create_project -force -name design -part $::env(XRAY_PART)
|
create_project -force -name design -part $::env(XRAY_PART)
|
||||||
set_property design_mode PinPlanning [current_fileset]
|
set_property design_mode PinPlanning [current_fileset]
|
||||||
|
|
|
||||||
|
|
@ -904,13 +904,13 @@
|
||||||
"type": "INT",
|
"type": "INT",
|
||||||
"values": [1, 2, 4, 8],
|
"values": [1, 2, 4, 8],
|
||||||
"encoding": [0, 1, 2, 3],
|
"encoding": [0, 1, 2, 3],
|
||||||
"digits": 3
|
"digits": 2
|
||||||
},
|
},
|
||||||
"RXOUT_DIV": {
|
"RXOUT_DIV": {
|
||||||
"type": "INT",
|
"type": "INT",
|
||||||
"values": [1, 2, 4, 8],
|
"values": [1, 2, 4, 8],
|
||||||
"encoding": [0, 1, 2, 3],
|
"encoding": [0, 1, 2, 3],
|
||||||
"digits": 3
|
"digits": 2
|
||||||
},
|
},
|
||||||
"CFOK_CFG": {
|
"CFOK_CFG": {
|
||||||
"type": "BIN",
|
"type": "BIN",
|
||||||
|
|
|
||||||
|
|
@ -6,28 +6,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: ISC
|
# SPDX-License-Identifier: ISC
|
||||||
|
|
||||||
proc dump_pins {file_name site_prefix} {
|
source "$::env(XRAY_DIR)/utils/utils.tcl"
|
||||||
set fp [open $file_name w]
|
|
||||||
|
|
||||||
puts $fp "name,is_input,is_output"
|
|
||||||
set site [lindex [get_sites $site_prefix*] 0]
|
|
||||||
|
|
||||||
set pins [get_site_pins -of_objects $site]
|
|
||||||
foreach pin $pins {
|
|
||||||
set connected_pip [get_pips -of_objects [get_nodes -of_objects $pin]]
|
|
||||||
|
|
||||||
if { $connected_pip == "" } {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
set pin_name [lindex [split $pin "/"] 1]
|
|
||||||
set is_input [get_property IS_INPUT $pin]
|
|
||||||
set is_output [get_property IS_OUTPUT $pin]
|
|
||||||
|
|
||||||
puts $fp "$pin_name,$is_input,$is_output"
|
|
||||||
}
|
|
||||||
close $fp
|
|
||||||
}
|
|
||||||
|
|
||||||
create_project -force -name design -part $::env(XRAY_PART)
|
create_project -force -name design -part $::env(XRAY_PART)
|
||||||
set_property design_mode PinPlanning [current_fileset]
|
set_property design_mode PinPlanning [current_fileset]
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,12 @@ def main():
|
||||||
# Get direction
|
# Get direction
|
||||||
is_input = int(pin["is_input"])
|
is_input = int(pin["is_input"])
|
||||||
is_output = int(pin["is_output"])
|
is_output = int(pin["is_output"])
|
||||||
|
is_clock = int(pin["is_clock"])
|
||||||
|
|
||||||
if is_input:
|
if is_input:
|
||||||
direction = "input"
|
direction = "input"
|
||||||
|
if is_clock:
|
||||||
|
direction = "clock"
|
||||||
elif is_output:
|
elif is_output:
|
||||||
direction = "output"
|
direction = "output"
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -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,36 @@ 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(' ')
|
|
||||||
|
os.remove(tmp_file)
|
||||||
|
|
||||||
|
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 +78,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 "}"
|
||||||
|
|
|
||||||
|
|
@ -168,3 +168,37 @@ proc generate_top {} {
|
||||||
write_checkpoint -force design.dcp
|
write_checkpoint -force design.dcp
|
||||||
write_bitstream -force design.bit
|
write_bitstream -force design.bit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Dumps all pins of a site, with the direction info (clock, input, output)
|
||||||
|
proc dump_pins {file_name site_prefix} {
|
||||||
|
set fp [open $file_name w]
|
||||||
|
|
||||||
|
puts $fp "name,is_input,is_output,is_clock"
|
||||||
|
set site [lindex [get_sites $site_prefix*] 0]
|
||||||
|
set bel [get_bels -of_objects $site]
|
||||||
|
set bel_pins [get_bel_pins -of_objects $bel]
|
||||||
|
|
||||||
|
set bel_pins_dict [dict create]
|
||||||
|
foreach pin $bel_pins {
|
||||||
|
set pin_name [lindex [split $pin "/"] 2]
|
||||||
|
set is_clock [get_property IS_CLOCK $pin]
|
||||||
|
dict set bel_pins_dict $pin_name $is_clock
|
||||||
|
}
|
||||||
|
|
||||||
|
set site_pins [get_site_pins -of_objects $site]
|
||||||
|
foreach pin $site_pins {
|
||||||
|
set connected_pip [get_pips -of_objects [get_nodes -of_objects $pin]]
|
||||||
|
|
||||||
|
if { $connected_pip == "" } {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set pin_name [lindex [split $pin "/"] 1]
|
||||||
|
set is_input [get_property IS_INPUT $pin]
|
||||||
|
set is_output [get_property IS_OUTPUT $pin]
|
||||||
|
set is_clock [dict get $bel_pins_dict $pin_name]
|
||||||
|
|
||||||
|
puts $fp "$pin_name,$is_input,$is_output,$is_clock"
|
||||||
|
}
|
||||||
|
close $fp
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue