blob: 27dc217c509ab4fdaf4289b9f996d818f1d64287 [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.
package dev.fpga.rapidwright;
import com.xilinx.rapidwright.design.*;
import com.xilinx.rapidwright.device.Site;
import com.xilinx.rapidwright.device.SiteTypeEnum;
import com.xilinx.rapidwright.device.Tile;
import java.io.IOException;
public class allffs {
public static void main(String[] args) throws IOException {
Design des = new Design("top", "xczu7ev-ffvc1156-2-e");
Cell d_iob = des.createAndPlaceIOB("d", PinType.IN , "B1", "LVCMOS33");
Cell clk_iob = des.createAndPlaceIOB("clk", PinType.IN , "B3", "LVCMOS33");
Cell q_iob = des.createAndPlaceIOB("q", PinType.OUT , "A2", "LVCMOS33");
q_iob.getSiteInst().addSitePIP("OUTMUX", "OP");
Net curr_d = des.createNet("d_IBUF");
curr_d.connect(d_iob, "O");
Net clk = des.createNet("clk_IBUF");
clk.connect(clk_iob, "O");
int idx = 0;
for (Tile t : des.getDevice().getAllTiles()) {
for (Site s : t.getSites()) {
if (s.getSiteTypeEnum() == SiteTypeEnum.SLICEL || s.getSiteTypeEnum() == SiteTypeEnum.SLICEM) {
Cell ff = des.createAndPlaceCell("ff_" + idx, Unisim.FDCE, s.getName() + "/AFF");
ff.getEDIFCellInst().addProperty("INIT", "1'b1");
clk.connect(ff, "C");
clk.addPin(new SitePinInst(false, "CLK1", des.getSiteInstFromSite(s)));
curr_d.connect(ff, "D");
curr_d.addPin(new SitePinInst(false, "AX", des.getSiteInstFromSite(s)));
des.getSiteInstFromSite(s).addSitePIP("FFMUXA1", "BYP");
des.getSiteInstFromSite(s).addSitePIP("CLK1INV", "CLK");
curr_d = des.createNet("ff_q_" + idx);
curr_d.connect(ff, "Q");
idx += 1;
}
}
}
curr_d.connect(q_iob, "I");
des.routeSites();
des.writeCheckpoint("rapidwright_test/ffs.dcp");
}
}