Skip to content

Commit

Permalink
Merge pull request f4pga#1666 from antmicro/update-vtr
Browse files Browse the repository at this point in the history
Update VTR
  • Loading branch information
acomodi committed Sep 18, 2020
2 parents 8b9105d + 0eb9af3 commit 6e6e8c7
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 18 deletions.
11 changes: 5 additions & 6 deletions common/cmake/devices.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@ function(DEFINE_DEVICE)
--device ${DEVICE_FULL}
${WIRE_EBLIF}
--place_algorithm bounding_box
--enable_timing_computations off
--route_chan_width 6
--echo_file on
--min_route_chan_width_hint 1
Expand Down Expand Up @@ -1549,7 +1548,7 @@ function(ADD_FPGA_TARGET)

# Generate placement constraints.
# -------------------------------------------------------------------------
set(FIX_PINS_ARG "")
set(FIX_CLUSTERS_ARG "")

if(NOT ${ADD_FPGA_TARGET_INPUT_IO_FILE} STREQUAL "" OR NOT ${ADD_FPGA_TARGET_INPUT_XDC_FILE} STREQUAL "")
get_target_property_required(NO_PINS ${ARCH} NO_PINS)
Expand Down Expand Up @@ -1631,9 +1630,9 @@ function(ADD_FPGA_TARGET)
add_output_to_fpga_target(${NAME} IO_PLACE ${OUT_CONSTR_REL})
append_file_dependency(VPR_DEPS ${OUT_CONSTR_REL})

set(FIX_PINS_ARG --fix_pins ${OUT_CONSTR})
set(FIX_CLUSTERS_ARG --fix_clusters ${OUT_CONSTR})
else()
set(FIX_PINS_ARG --fix_pins ${OUT_IO})
set(FIX_CLUSTERS_ARG --fix_clusters ${OUT_IO})
endif()

endif()
Expand All @@ -1644,7 +1643,7 @@ function(ADD_FPGA_TARGET)
add_custom_command(
OUTPUT ${OUT_PLACE}
DEPENDS ${OUT_NET} ${VPR_DEPS}
COMMAND ${VPR_CMD} ${FIX_PINS_ARG} --place
COMMAND ${VPR_CMD} ${FIX_CLUSTERS_ARG} --place
COMMAND
${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/vpr_stdout.log
${OUT_LOCAL}/place.log
Expand All @@ -1655,7 +1654,7 @@ function(ADD_FPGA_TARGET)
add_custom_command(
OUTPUT ${ECHO_OUT_PLACE}
DEPENDS ${ECHO_OUT_NET} ${VPR_DEPS}
COMMAND ${VPR_CMD} ${FIX_PINS_ARG} --echo_file on --place
COMMAND ${VPR_CMD} ${FIX_CLUSTERS_ARG} --echo_file on --place
COMMAND
${CMAKE_COMMAND} -E copy ${OUT_LOCAL}/echo/vpr_stdout.log
${OUT_LOCAL}/echo/place.log
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- symbiflow-yosys=0.8_6021_gd8b2d1a2=20200708_083630
- symbiflow-yosys-plugins=1.0.0.7_0060_g7454cd6=20200902_114536
- symbiflow-vtr=8.0.0.rc2_4003_g8980e4621=20200720_145630
- symbiflow-vtr=8.0.0.rc2_5097_gf1a3bcc2a=20200916_072439
- zachjs-sv2v=0.0.5_0018_ga170536
- cmake
- make
Expand Down
3 changes: 2 additions & 1 deletion ice40/icestorm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ function(icestorm_setup)
\${PYTHON3} \${PLACE_TOOL} \
--map \${PINMAP} \
--blif \${OUT_EBLIF} \
--pcf \${INPUT_IO_FILE}"
--pcf \${INPUT_IO_FILE} \
--net \${OUT_NET}"
CELLS_SIM ${CELLS_SIM}
BIT_TO_V ${ICEBOX_VLOG}
BIT_TO_V_CMD "${ICEBOX_VLOG} -D -c -n \${TOP} -p \${INPUT_IO_FILE} -d \${PACKAGE} \${OUT_BITSTREAM} > \${OUT_BIT_VERILOG}"
Expand Down
11 changes: 10 additions & 1 deletion ice40/utils/ice40_create_ioplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
required=True,
help='Pin map CSV file'
)
parser.add_argument(
"--net",
'-n',
type=argparse.FileType('r'),
required=True,
help='VPR Packed netlist file'
)
parser.add_argument(
"--output",
'-o',
Expand All @@ -59,9 +66,11 @@ def main(argv):
io_place = vpr_io_place.IoPlace()

io_place.read_io_list_from_eblif(args.blif)
io_place.load_net_file_ios(args.net)

for name, (loc, pcf_line) in locs.items():
io_place.constrain_net(net_name=name, loc=loc, comment=pcf_line)
if io_place.is_net_packed(name):
io_place.constrain_net(net_name=name, loc=loc, comment=pcf_line)

io_place.output_io_place(args.output)

Expand Down
16 changes: 8 additions & 8 deletions utils/print_qor.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ def scan_critical(fname):
try:
with open(fname, 'r') as f:
for line in f:
if line.startswith('Final critical path:'):
if line.startswith('Final critical path delay'):
parts = line.split()
if len(parts) >= 7:
# Final critical path: 16.8182 ns, Fmax: 59.4592 MHz
critical_path = float(parts[3])
fmax = float(parts[6])
if len(parts) >= 9:
# Final critical path delay (least slack): 16.8182 ns, Fmax: 59.4592 MHz
critical_path = float(parts[6])
fmax = float(parts[9])
return str(critical_path), str(fmax)
elif len(parts) == 5 and parts[4].strip() == 'ns':
# Final critical path: 17.9735 ns
critical_path = float(parts[3])
elif len(parts) == 8 and parts[7].strip() == 'ns':
# Final critical path delay (least slack): 17.9735 ns
critical_path = float(parts[6])
fmax = 1000. / critical_path
return str(critical_path), str(fmax)
except FileNotFoundError:
Expand Down
25 changes: 25 additions & 0 deletions utils/vpr_io_place.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self):
self.net_map = {}
self.inout_nets = set()
self.net_to_pad = set()
self.net_file_io = set()

def read_io_loc_pairs(self, blif):
"""
Expand Down Expand Up @@ -90,6 +91,27 @@ def load_block_names_from_net_file(self, net_file):
top_block = top_block.getparent()
self.net_to_block[block.get("name")] = top_block.get("name")

def load_net_file_ios(self, net_file):
"""
Loads input and outputs net names from the netlist file.
"""

def get_ios(net_root, io_types):
"Get the top level io signals from the netlist XML root."
for io_type in io_types:
io = net_root.xpath("/block/{}/text ()".format(io_type))

if len(io) == 1:
yield io[0]

net_xml = ET.parse(net_file)
net_root = net_xml.getroot()

for io_line in get_ios(net_root, ["inputs", "outputs"]):
io_list = io_line.split(" ")
for io in io_list:
self.net_file_io.add(io.replace("out:", ""))

def constrain_net(self, net_name, loc, comment=""):
assert len(loc) == 3
assert net_name not in self.constraints
Expand Down Expand Up @@ -180,6 +202,9 @@ def output_io_place(self, f):
def is_net(self, net):
return net in self.net_map.values()

def is_net_packed(self, net):
return net in self.net_file_io

def get_nets(self):
for net in self.inputs:
yield self.net_map[net]
Expand Down
2 changes: 1 addition & 1 deletion xc/xc7/toolchain_wrappers/symbiflow_place
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ OUT_NOISY_WARNINGS=noisy_warnings-${DEVICE}_place.log
echo "Generating coinstrains ..."
symbiflow_generate_constraints $EBLIF $NET $PART $DEVICE $ARCH_DEF $PCF

run_vpr --fix_pins constraints.place --place
run_vpr --fix_clusters constraints.place --place

mv vpr_stdout.log place.log

0 comments on commit 6e6e8c7

Please sign in to comment.