Menu

[r2]: / trunk / FPGA / Conv_bsdl_padn.js  Maximize  Restore  History

Download this file

127 lines (100 with data), 2.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// permet de traiter un template de fichier .vhd dans le cadre du projet
// Depan'Trex.
// Les champs suivant sont traités:
// %BSDL_LOC% : remplacés par une liste de PADs trouvé dans le fichier BDSL du FPGA correspondant.
// author : P.CARTON
//Utils = require("D:\\DEV\\syntalyser\\common\\utils.js");
/*
require("lib/Scintilla.js");
sci = new Scintilla();
a=sci.Call(sci.Const.SCI_ZOOMIN,2,3);
*/
require("lib/msvcrt.js");
//MessageBox("Title of Box", "My important message");
//msvcrt.puts("gseeeeeeeeee");
//putchar('r');
//puts("caca\0\0");
//alert(JSON.stringify(Dialog, null, 4));
function Conv_bsdl_padn(){
// TBD : OpenFileName
var Bsdl_File = "c:/xilinx/14.5/ISE_DS/ISE/spartan6/data/xc6slx45_fgg484.bsd"
var fso = new ActiveXObject("Scripting.FileSystemObject");
if (fso.FileExists(Bsdl_File)){
var f = fso.OpenTextFile(Bsdl_File, 1, false, 0);
var text = f.ReadAll();
f.Close();
} else {
alert("Bsdl_File not found");
return;
}
var io_tab = new Array();
var match = text.match(/port \(((.|\n)+?)\); --end/m);
if (match == null){
alert("fichier inexploitable, pas trouvé les correspondances port io<->PADS");
return;
}
re = /\s*(\w+):.*--\s*PAD(\w+)/ig
for (var i = 1;; i++)
{
// if (i >= MAX_FOR_I)throw "infinite loop while doing regexp";
match = re.exec(text); // -- Doing the regexp --
if (match == null)break;
var io_name = match[1];
var pad_n = match[2];
io_tab[parseInt(pad_n)] = io_name;
//alert(io_name+" - "+pad_n);
}
// on a maintenant dans io_tab le tableau indexé PADnn, valeur = nom de l'IO
var io_group = new Array();
var t = "";
var n = 0;
io_tab.forEach(function (v, padn){
if (v != undefined && (m = /^IO_(.+)/i.exec(v)))
{
if (n == 0)t = padn+" ";
t += (n > 0 ? "," : "") + m[1];
n ++;
} else {
if (n != 0){
t += " "+ padn;
io_group.push(t);
}
t = ""; n = 0;
}
});
bsdl_loc = io_group[0];
var text = currentview.text;
/*
text = text.replace(/%bus_name%/, function(m){
return "IO_OUT_inoutp";
});
*/
text = text.replace(/%IO_OUT_inoutp_BSDL%/g, bsdl_loc);
currentview.text = text;
// currentview.pos = 1;
// currentview.text = res;
//var file = Editor.currentView.files[Editor.currentView.file];
//alert(file);
//alert(currentview.files);
}
//Conv_bsdl_padn(currentView.text);
(function(){
try {
Depan_trex = (Depan_trex ? Depan_trex : false)
} catch(e) {
Depan_trex = false
}
if (!Depan_trex){
Depan_trex = Editor.addMenu("Depan'trex");
var rconv = {
key: 53, //https://keycode.info/
ctrl:true,
text:"Conv_bsdl_padn",
cmd:function(){
Conv_bsdl_padn();
}
}
Depan_trex.addItem(rconv);
addHotKey(rconv);
}
})()