From 14b75815c41b3531345728791d62fa8fd2e59824 Mon Sep 17 00:00:00 2001 From: Manuel Penschuck Date: Thu, 22 May 2014 13:38:11 +0200 Subject: [PATCH] Diamond project creation tool. See daqdocu --- base/create_project.pl | 42 ++++++++++++++++++++------------ base/linkdesignfiles.sh | 40 +++++++++++++++++++----------- cts/compile_central_frankfurt.pl | 13 +--------- cts/compile_constraints.pl | 38 +++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 41 deletions(-) create mode 100755 cts/compile_constraints.pl diff --git a/base/create_project.pl b/base/create_project.pl index 31cbf6e..089581c 100755 --- a/base/create_project.pl +++ b/base/create_project.pl @@ -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 "\n"; print FH "\n"; print FH " \n"; print FH " \n"; - print FH " \n"; + print FH " \n"; for my $filer (@{$files}) { my $file = $filer->[1]; my $lib = $filer->[0]; @@ -72,14 +64,12 @@ sub generateLDF { print FH " \n" } elsif ("v" eq $suffix) { print FH " \n" + } elsif ("lpf" eq $suffix) { + print FH " \n" } else { print "WARNING: Could not determine type of input file $file. Not included!\n"; } } - - print FH " \n" if (-e $lpf1); - print FH " \n" if (-e $lpf2); - print FH " \n"; print FH " \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"; diff --git a/base/linkdesignfiles.sh b/base/linkdesignfiles.sh index 9a4f301..e3d2db1 100755 --- a/base/linkdesignfiles.sh +++ b/base/linkdesignfiles.sh @@ -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 diff --git a/cts/compile_central_frankfurt.pl b/cts/compile_central_frankfurt.pl index d77d2bc..d772896 100755 --- a/cts/compile_central_frankfurt.pl +++ b/cts/compile_central_frankfurt.pl @@ -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 index 0000000..1aa1f02 --- /dev/null +++ b/cts/compile_constraints.pl @@ -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 -- 2.43.0