blob: a9107a60a9bfc336c44decfb809cb9e1968702fe [file] [log] [blame] [edit]
# Copyright 2020 Project U-Ray Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
root = sys.argv[1]
X = 8
with open(root + "/rclkroute_leafdly/run.sh", "w") as f:
print("#/usr/bin/env bash", file=f)
print("set -ex", file=f)
print("vivado -mode batch -nolog -nojournal -source ../../ultra/spec/delayfuzz.tcl -tclargs $1", file=f)
print("if [ $? -eq 0 ]; then", file=f)
print(" ../../ultra/tools/dump_bitstream %s/specimen_clk/rclkroute_leafdly$1.bit %s/frames.txt > %s/specimen_clk/rclkroute_leafdly$1.dump" % (root, root, root), file=f)
print(" CLOCK_ONLY=1 python3 ../../ultra/tools/bits_to_tiles.py %s/tilebits.json %s/specimen_clk/rclkroute_leafdly$1.dump > %s/specimen_clk/rclkroute_leafdly$1.tbits" % (root, root, root), file=f)
#print(" rm %s/specimen_clk/rclkroute$1.bit" % (root, ), file=f)
#print(" rm %s/specimen_clk/rclkroute$1.dump" % (root, ), file=f)
print("else", file=f)
print(" rm %s/specimen_clk/rclkroute_leafdly$1.dump" % (root, ), file=f)
print(" rm %s/specimen_clk/rclkroute_leafdly$1.tbits" % (root, ), file=f)
print(" rm %s/specimen_clk/rclkroute_leafdly$1.dcp" % (root, ), file=f)
print(" rm %s/specimen_clk/rclkroute_leafdly$1.bit" % (root, ), file=f)
print(" rm %s/specimen_clk/rclkroute_leafdly$1.features" % (root, ), file=f)
print("fi", file=f)
with open(root + "/rclkroute_leafdly/Makefile", "w") as f:
print("all: %s" % " ".join(["%d.done" % i for i in range(X)]), file=f)
print("", file=f)
print("%.done: ", file=f)
print("\tbash run.sh $*", file=f)
print("\ttouch $@", file=f)
print("", file=f)
print("clean: ", file=f)
print("\trm -f *.done", file=f)