my $def_impl = $options->{'top_module'};
- my $lpf1 = $options->{'top_module'} . '_constraints.lpf';
- my $lpf2 = '../base/' . $options->{'top_module'} . '.lpf';
-
- if (not (-e $lpf1) and not (-e $lpf2)) {
- print "WARNING: Could not find LPF files. Searched at\n $lpf1\n $lpf2\n";
- print " Diamond will not open the project unless you at atleast one lpf\n";
- }
-
print FH "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
print FH "<BaliProject version=\"2.0\" title=\"$prj_title\" device=\"$device\" default_implementation=\"$def_impl\">\n";
print FH " <Options/>\n";
print FH " <Implementation title=\"$def_impl\" dir=\"$def_impl\" description=\"Automatically generated implemenatation\" default_strategy=\"Strategy1\">\n";
- print FH " <Options/>\n";
+ print FH " <Options def_top=\"$def_impl\" top=\"$def_impl\"/>\n";
for my $filer (@{$files}) {
my $file = $filer->[1];
my $lib = $filer->[0];
print FH " <Source name=\"$fpath\" type=\"VHDL\" type_short=\"VHDL\"><Options lib=\"$lib\" /></Source>\n"
} elsif ("v" eq $suffix) {
print FH " <Source name=\"$fpath\" type=\"Verilog\" type_short=\"Verilog\"><Options lib=\"$lib\" /></Source>\n"
+ } elsif ("lpf" eq $suffix) {
+ print FH " <Source name=\"$fpath\" type=\"Logic Preference\" type_short=\"LPF\"><Options/></Source>\n"
} else {
print "WARNING: Could not determine type of input file $file. Not included!\n";
}
}
-
- print FH " <Source name=\"../$lpf1\" type=\"Logic Preference\" type_short=\"LPF\"><Options/></Source>\n" if (-e $lpf1);
- print FH " <Source name=\"../$lpf2\" type=\"Logic Preference\" type_short=\"LPF\"><Options/></Source>\n" if (-e $lpf2);
-
print FH " </Implementation>\n";
print FH " <Strategy name=\"Strategy1\" file=\"auto_strat.sty\"/>\n";
# create dir if necessary
mkdir 'project' unless (-e 'project');
-
+
+# create workdir
+ if (-e './compile_constraints.pl') {
+ my $workdir = 'project/' . $options->{'top_module'};
+ my $lpffile = $workdir . '/' . $options->{'top_module'} . ".lpf";
+
+ print "NOTE: execute ./compile_constraints.pl $workdir\n";
+ system "./compile_constraints.pl $workdir";
+
+ if(-e $lpffile) {
+ rename $lpffile, 'project/' . $options->{'top_module'} . '.lpf';
+ push @$files, ['work', 'project/' . $options->{'top_module'} . '.lpf'];
+ } else {
+ print "WARNING: compile_constraints did not generate $lpffile. Please include the necessary contraint files manually\n";
+ }
+ } else {
+ print "No ./compile_constraints.pl script found. Please make sure, the workdir contains all links and constraint-files\n";
+ }
+
# generate ldf
my $project_file = 'project/' . $options->{'top_module'} . '.ldf';
if (-e $project_file) {move $project_file, $project_file . '.backup'};
generateSTY 'project/auto_strat.sty';
print "NOTE: STY generated\n";
}
-
+
+
+
+print "\nNOTE: The version.vhd file is neither generated nor updated when building in diamond.\n"
+print "\nUse command-line compilation to create a version file.\n"
print "\nDone. Execute \n> diamond $project_file\nto open the project\n";
#they have to be in the directory were all the reports and bitfiles end up!
#usually ./workdir (command line script) or ./$PROJECTNAME (Diamond)
+#it is assumed, that pwd is the first dir in the designs directory, e.g.
+#trb3/DESIGN/workdir. If this is not the case pass as first parameter a
+#path suffix to get to this level. For instance if you're in
+#trb3/DESIGN/project/TOPNAME call "../../../base/linkdesignfiles.sh .."
+
+if [ $1 ]
+then
+ prefix=$1
+else
+ prefix="."
+fi
+
+ln -sf $prefix/../../../trbnet/gbe2_ecp3/ipcores_ecp3/sgmii_gbe_pcs35/sgmii_gbe_pcs35.ngo
+ln -sf $prefix/../../../trbnet/gbe2_ecp3/ipcores_ecp3/tsmac35/tsmac35.ngo
+ln -sf $prefix/../../../trbnet/gbe2_ecp3/ipcores_ecp3/tsmac35/pmi_ram_dpEbnonessdn208256208256.ngo
+ln -sf $prefix/../../../trbnet/gbe2_ecp3/ipcores_ecp3/tsmac35/pmi_ram_dpEbnonessdn96649664.ngo
+ln -sf $prefix/../../../trbnet/gbe2_ecp3/ipcores_ecp3/serdes_gbe_0ch/serdes_gbe_0ch.txt
+ln -sf $prefix/../../../trbnet/gbe2_ecp3/ipcores_ecp3/serdes_ch4.txt
+ln -sf $prefix/../../../trbnet/media_interfaces/ecp3_sfp/sfp_0_200_int.txt
+ln -sf $prefix/../../../trbnet/media_interfaces/ecp3_sfp/sfp_1_200_int.txt
+ln -sf $prefix/../../../trbnet/media_interfaces/ecp3_sfp/sfp_1_125_int.txt
+ln -sf $prefix/../../../trbnet/media_interfaces/ecp3_sfp/sfp_0_200_ctc.txt
+ln -sf $prefix/../../../trbnet/media_interfaces/ecp3_sfp/serdes_onboard_full.txt
+ln -sf $prefix/../../../trbnet/media_interfaces/ecp3_sfp/serdes_sync_0.txt
+ln -sf $prefix/../../../trbnet/media_interfaces/ecp3_sfp/serdes_sync_125_0.txt
+ln -sf $prefix/../../../trbnet/media_interfaces/ecp3_sfp/serdes_full_ctc.txt
-ln -s ../../../trbnet/gbe2_ecp3/ipcores_ecp3/sgmii_gbe_pcs35/sgmii_gbe_pcs35.ngo
-ln -s ../../../trbnet/gbe2_ecp3/ipcores_ecp3/tsmac35/tsmac35.ngo
-ln -s ../../../trbnet/gbe2_ecp3/ipcores_ecp3/tsmac35/pmi_ram_dpEbnonessdn208256208256.ngo
-ln -s ../../../trbnet/gbe2_ecp3/ipcores_ecp3/tsmac35/pmi_ram_dpEbnonessdn96649664.ngo
-ln -s ../../../trbnet/gbe2_ecp3/ipcores_ecp3/serdes_gbe_0ch/serdes_gbe_0ch.txt
-ln -s ../../../trbnet/gbe2_ecp3/ipcores_ecp3/serdes_ch4.txt
-ln -s ../../../trbnet/media_interfaces/ecp3_sfp/sfp_0_200_int.txt
-ln -s ../../../trbnet/media_interfaces/ecp3_sfp/sfp_1_200_int.txt
-ln -s ../../../trbnet/media_interfaces/ecp3_sfp/sfp_1_125_int.txt
-ln -s ../../../trbnet/media_interfaces/ecp3_sfp/sfp_0_200_ctc.txt
-ln -s ../../../trbnet/media_interfaces/ecp3_sfp/serdes_onboard_full.txt
-ln -s ../../../trbnet/media_interfaces/ecp3_sfp/serdes_sync_0.txt
-ln -s ../../../trbnet/media_interfaces/ecp3_sfp/serdes_sync_125_0.txt
-ln -s ../../../trbnet/media_interfaces/ecp3_sfp/serdes_full_ctc.txt
#ln -s ../../../trbnet/gbe2_ecp3/ipcores_ecp3/sgmii_gbe_pcs36.ngo
#ln -s ../../../trbnet/gbe2_ecp3/ipcores_ecp3/tsmac36.ngo
#ln -s ../../../trbnet/gbe2_ecp3/ipcores_ecp3/pmi_ram_dpEbnonessdn208256208256p13732cfe.ngo
my $PACKAGE="FPBGA1156";
my $SPEEDGRADE="8";
-unless(-e 'workdir') {
- print "Creating workdir\n";
- system ("mkdir workdir");
- system ("cd workdir; ../../base/linkdesignfiles.sh; cd ..;");
- system ("ln -sfT ../tdc_release/Adder_304.ngo workdir/Adder_304.ngo");
-}
-
-#create full lpf file
-system("cp ../base/trb3_central_cts.lpf workdir/$TOPNAME.lpf");
-system("cat tdc_release/tdc_constraints_4.lpf >> workdir/$TOPNAME.lpf");
-system("cat ".$TOPNAME."_constraints.lpf >> workdir/$TOPNAME.lpf");
-system("sed -i 's#THE_TDC/#gen_TDC_THE_TDC/#g' workdir/$TOPNAME.lpf");
+system("./compile_constraints.pl");
system("ln -f -s config_default.vhd config.vhd");
--- /dev/null
+#!/usr/bin/perl
+use warnings;
+use strict;
+use File::Basename;
+use Cwd 'realpath';
+
+my $TOPNAME = 'trb3_central';
+my $workdir = './workdir';
+
+my $script_dir = dirname(realpath(__FILE__));
+$workdir = $ARGV[0] if (@ARGV);
+
+die("workdir has to be relative to compile_constraints.pl") if $workdir =~ m/^\//;
+die("workdir must not contain ..") if $workdir =~ m/\.\./;
+$workdir =~ s/(\.\/|\/$)//g; # remove ./ and trailing slash
+$workdir =~ s/\/{2,}/\//g; # remove multiple // in path
+
+my $back = "../" x ($workdir =~ tr/\///);
+$back = './' unless $back;
+
+chdir($script_dir);
+
+unless(-e $workdir) {
+ print "Creating workdir\n";
+ system ("mkdir $workdir");
+}
+
+chdir($workdir);
+system ("$back/../../base/linkdesignfiles.sh '$back'");
+
+chdir($script_dir);
+
+system ("ln -sfT $back/../tdc_release/Adder_304.ngo $workdir/Adder_304.ngo");
+
+system("cp ../base/trb3_central_cts.lpf $workdir/$TOPNAME.lpf");
+system("cat tdc_release/tdc_constraints_4.lpf >> $workdir/$TOPNAME.lpf");
+system("cat ".$TOPNAME."_constraints.lpf >> $workdir/$TOPNAME.lpf");
+system("sed -i 's#THE_TDC/#gen_TDC_THE_TDC/#g' $workdir/$TOPNAME.lpf");
\ No newline at end of file