您也许可以使用XDL将DIRT约束插入NCD
谢谢!
这是有效的,虽然XDL格式比我预期的要复杂一点。
为了任何其他人试图这样做的好处,这里是我正在使用的(丑陋,混乱,黑客共同)代码。
显然,“cfg”字符串开头的空格很重要;
没有它PAR将进入100%CPU循环。
此外,在xdl-> ncd-> xdl转换往返中存在某种错误;
bitgen抱怨说,ncd-built-an-xdl没有指定输入焊盘的驱动强度或转换速率,它们不需要这些属性。
import java.io. *;
import java.util。*;
公共类DirtWriter {
public static void main(String [] args)throws Exception {
if(args.length!= 3){
System.err.println(“usage:java”+ DirtWriter.class.getName()+“design_in.xdl dirtconstraints.ucf design_out.xdl”);
返回;
}
HashMap constraints = new HashMap();
//由fpga_editor生成的UCF非常粗糙的解析器
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(args [1])));
StringBuffer acc = new StringBuffer();
String name = null;
while(true){
boolean semicolon = false;
String s = br.readLine();
if(s == null)break;
s = s.trim();
if(s.startsWith(“//”))继续;
if(s.startsWith(“NET ”“)){
s = s.substring(5);
name = s.substring(0,s.indexOf(“”“));
s = s.substring(s.indexOf(“”“)+ 1);
acc.append(s.trim());
继续;
}
if(s.startsWith(“”“))s = s.substring(1);
if(s.endsWith(“”“))s = s.substring(0,s.length() - 1);
else if(s.endsWith(“;”)){semicolon = true;
s = s.substring(0,s.length() - 1);
}
acc.append(一个或多个);
if(分号){
String a = acc.toString();
if(a.startsWith(“ROUTE =”))a = a.substring(6);
if(a.startsWith(“”“))a = a.substring(1);
if(a.endsWith(“”“))a = a.substring(0,a.length() - 1);
constraints.put(name,a);
acc.setLength(0);
}
}
br.close();
br = new BufferedReader(new InputStreamReader(new FileInputStream(args [0])));
PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(args [2])));
while(true){
String s = br.readLine();
if(s == null)break;
//粗
String s_save = s;
if(s.toLowerCase()。startsWith(“net”)){
s = s.substring(4);
if(s.startsWith(“”“)){
s = s.substring(1);
name = s.substring(0,s.indexOf(“”“));
s = s.substring(s.indexOf(“”“)+ 1);
String c = constraints.get(name);
if(c!= null){
pw.println(“net ”“+ name +”“,cfg ” n _NET_PROP :: ROUTE:“+ c +”“”+ s);
constraints.remove(名称);
继续;
}
}
}
pw.println(s_save);
}
pw.close();
br.close();
if(constraints.size()> 0){
System.out.println(“未应用的约束:”);
for(String s:constraints.keySet())System.out.println(s);
}
}
}
以上来自于谷歌翻译
以下为原文
You could perhaps use XDL to insert DIRT constraints into the NCD
Thanks! This works, though the XDL format is a bit more finicky than I'd expected. For the benefit of anybody else trying to do this, here's the (ugly, messy, hacked-together) code I'm using. Apparently the whitespace at the beginning of the "cfg" string is important; without it PAR will go into a 100% CPU loop.
Also, there's some sort of bug in the xdl->ncd->xdl conversion round trip; bitgen complains that the ncd-built-from-an-xdl does not specify the drive strength or slew rate for
input pads, which don't need those attributes.
import java.io.*;import java.util.*;public class DirtWriter { public static void main(String[] args) throws Exception { if (args.length != 3) { System.err.println("usage: java "+DirtWriter.class.getName()+" design_in.xdl dirtconstraints.ucf design_out.xdl"); return; } HashMap
constraints = new HashMap(); // incredibly crude parser for the UCFs produced by fpga_editor BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(args[1]))); StringBuffer acc = new StringBuffer(); String name = null; while(true) { boolean semicolon = false; String s = br.readLine(); if (s == null) break; s = s.trim(); if (s.startsWith("//")) continue; if (s.startsWith("NET "")) { s = s.substring(5); name = s.substring(0, s.indexOf(""")); s = s.substring(s.indexOf(""")+1); acc.append(s.trim()); continue; } if (s.startsWith(""")) s = s.substring(1); if (s.endsWith(""")) s = s.substring(0, s.length()-1); else if (s.endsWith(";")) { semicolon = true; s = s.substring(0, s.length()-1); } acc.append(s); if (semicolon) { String a = acc.toString(); if (a.startsWith("ROUTE=")) a = a.substring(6); if (a.startsWith(""")) a = a.substring(1); if (a.endsWith(""")) a = a.substring(0, a.length()-1); constraints.put(name, a); acc.setLength(0); } } br.close(); br = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]))); PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(args[2]))); while(true) { String s = br.readLine(); if (s == null) break; // gross String s_save = s; if (s.toLowerCase().startsWith("net ")) { s = s.substring(4); if (s.startsWith(""")) { s = s.substring(1); name = s.substring(0, s.indexOf(""")); s = s.substring(s.indexOf(""")+1); String c = constraints.get(name); if (c != null) { pw.println("net ""+name+"" , cfg "n _NET_PROP::ROUTE:"+c+"" "+s); constraints.remove(name); continue; } } } pw.println(s_save); } pw.close(); br.close(); if (constraints.size() > 0) { System.out.println("unapplied constraints:"); for (String s : constraints.keySet()) System.out.println(s); } }}
您也许可以使用XDL将DIRT约束插入NCD
谢谢!
这是有效的,虽然XDL格式比我预期的要复杂一点。
为了任何其他人试图这样做的好处,这里是我正在使用的(丑陋,混乱,黑客共同)代码。
显然,“cfg”字符串开头的空格很重要;
没有它PAR将进入100%CPU循环。
此外,在xdl-> ncd-> xdl转换往返中存在某种错误;
bitgen抱怨说,ncd-built-an-xdl没有指定输入焊盘的驱动强度或转换速率,它们不需要这些属性。
import java.io. *;
import java.util。*;
公共类DirtWriter {
public static void main(String [] args)throws Exception {
if(args.length!= 3){
System.err.println(“usage:java”+ DirtWriter.class.getName()+“design_in.xdl dirtconstraints.ucf design_out.xdl”);
返回;
}
HashMap constraints = new HashMap();
//由fpga_editor生成的UCF非常粗糙的解析器
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(args [1])));
StringBuffer acc = new StringBuffer();
String name = null;
while(true){
boolean semicolon = false;
String s = br.readLine();
if(s == null)break;
s = s.trim();
if(s.startsWith(“//”))继续;
if(s.startsWith(“NET ”“)){
s = s.substring(5);
name = s.substring(0,s.indexOf(“”“));
s = s.substring(s.indexOf(“”“)+ 1);
acc.append(s.trim());
继续;
}
if(s.startsWith(“”“))s = s.substring(1);
if(s.endsWith(“”“))s = s.substring(0,s.length() - 1);
else if(s.endsWith(“;”)){semicolon = true;
s = s.substring(0,s.length() - 1);
}
acc.append(一个或多个);
if(分号){
String a = acc.toString();
if(a.startsWith(“ROUTE =”))a = a.substring(6);
if(a.startsWith(“”“))a = a.substring(1);
if(a.endsWith(“”“))a = a.substring(0,a.length() - 1);
constraints.put(name,a);
acc.setLength(0);
}
}
br.close();
br = new BufferedReader(new InputStreamReader(new FileInputStream(args [0])));
PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(args [2])));
while(true){
String s = br.readLine();
if(s == null)break;
//粗
String s_save = s;
if(s.toLowerCase()。startsWith(“net”)){
s = s.substring(4);
if(s.startsWith(“”“)){
s = s.substring(1);
name = s.substring(0,s.indexOf(“”“));
s = s.substring(s.indexOf(“”“)+ 1);
String c = constraints.get(name);
if(c!= null){
pw.println(“net ”“+ name +”“,cfg ” n _NET_PROP :: ROUTE:“+ c +”“”+ s);
constraints.remove(名称);
继续;
}
}
}
pw.println(s_save);
}
pw.close();
br.close();
if(constraints.size()> 0){
System.out.println(“未应用的约束:”);
for(String s:constraints.keySet())System.out.println(s);
}
}
}
以上来自于谷歌翻译
以下为原文
You could perhaps use XDL to insert DIRT constraints into the NCD
Thanks! This works, though the XDL format is a bit more finicky than I'd expected. For the benefit of anybody else trying to do this, here's the (ugly, messy, hacked-together) code I'm using. Apparently the whitespace at the beginning of the "cfg" string is important; without it PAR will go into a 100% CPU loop.
Also, there's some sort of bug in the xdl->ncd->xdl conversion round trip; bitgen complains that the ncd-built-from-an-xdl does not specify the drive strength or slew rate for
input pads, which don't need those attributes.
import java.io.*;import java.util.*;public class DirtWriter { public static void main(String[] args) throws Exception { if (args.length != 3) { System.err.println("usage: java "+DirtWriter.class.getName()+" design_in.xdl dirtconstraints.ucf design_out.xdl"); return; } HashMap
constraints = new HashMap(); // incredibly crude parser for the UCFs produced by fpga_editor BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(args[1]))); StringBuffer acc = new StringBuffer(); String name = null; while(true) { boolean semicolon = false; String s = br.readLine(); if (s == null) break; s = s.trim(); if (s.startsWith("//")) continue; if (s.startsWith("NET "")) { s = s.substring(5); name = s.substring(0, s.indexOf(""")); s = s.substring(s.indexOf(""")+1); acc.append(s.trim()); continue; } if (s.startsWith(""")) s = s.substring(1); if (s.endsWith(""")) s = s.substring(0, s.length()-1); else if (s.endsWith(";")) { semicolon = true; s = s.substring(0, s.length()-1); } acc.append(s); if (semicolon) { String a = acc.toString(); if (a.startsWith("ROUTE=")) a = a.substring(6); if (a.startsWith(""")) a = a.substring(1); if (a.endsWith(""")) a = a.substring(0, a.length()-1); constraints.put(name, a); acc.setLength(0); } } br.close(); br = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]))); PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(args[2]))); while(true) { String s = br.readLine(); if (s == null) break; // gross String s_save = s; if (s.toLowerCase().startsWith("net ")) { s = s.substring(4); if (s.startsWith(""")) { s = s.substring(1); name = s.substring(0, s.indexOf(""")); s = s.substring(s.indexOf(""")+1); String c = constraints.get(name); if (c != null) { pw.println("net ""+name+"" , cfg "n _NET_PROP::ROUTE:"+c+"" "+s); constraints.remove(name); continue; } } } pw.println(s_save); } pw.close(); br.close(); if (constraints.size() > 0) { System.out.println("unapplied constraints:"); for (String s : constraints.keySet()) System.out.println(s); } }}
举报