]> jspc29.x-matter.uni-frankfurt.de Git - trb3.git/commitdiff
Diamond project creation tool. See daqdocu
authorManuel Penschuck <manuel.penschuck@stud.uni-frankfurt.de>
Thu, 22 May 2014 11:38:11 +0000 (13:38 +0200)
committerManuel Penschuck <manuel.penschuck@stud.uni-frankfurt.de>
Thu, 22 May 2014 11:38:11 +0000 (13:38 +0200)
base/create_project.pl
base/linkdesignfiles.sh
cts/compile_central_frankfurt.pl
cts/compile_constraints.pl [new file with mode: 0755]

index 31cbf6e0a88b47e9acbe7211c0808c6d6280721d..089581cacb9da236fe6b54887b840dfaedc8661f 100755 (executable)
@@ -49,19 +49,11 @@ sub generateLDF {
 
    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];
@@ -72,14 +64,12 @@ sub generateLDF {
          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";
@@ -297,7 +287,25 @@ STY
 
 # 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'};
@@ -309,5 +317,9 @@ STY
       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";
index 9a4f3014692e84c4821da3c37432453ea19e17e6..e3d2db1967e4d85741e68f17ab22649418a7a9ef 100755 (executable)
@@ -3,21 +3,33 @@
 #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
index d77d2bcc65b43908d2ef58177e87df0ff37df1e8..d7728965c7e026f6bab4f7b166434ad1124e083d 100755 (executable)
@@ -39,18 +39,7 @@ my $DEVICENAME="LFE3-150EA";
 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");
 
diff --git a/cts/compile_constraints.pl b/cts/compile_constraints.pl
new file mode 100755 (executable)
index 0000000..1aa1f02
--- /dev/null
@@ -0,0 +1,38 @@
+#!/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