Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageperl
titlePerl Code to wire a 50 pin Xilinx I/O bank for DDR4 Memory
#!/usr/bin/perl
use strict;
use warnings;
my $expString="";
#you need to create code that adds comma separated signal names to the $expString variable
#note that strict is enforced so you need to declare your variables with 'my'

my $highLow=0; #set to 1 for bus 63:32, set to 0 for bus 31:0
my $byteOrderHighToLow=0; #set to 1 to make the bytes/strobes descend
                      #set to 0 to make them ascend

my $msb_unib=$highLow? 63 : 31;
my $msb_lnib=$msb_unib-4;
my $dqs_start=$highLow? 7 : 3;
$expString="!skip[3:0],";
my @loopList=$byteOrderHighToLow ? (0,1,2,3) :(3,2,1,0);

#skip the first 4 pins in the bank (to get to first strobe pins
$expString="!skip[3:0],";

foreach my $i (@loopList) {
  #add strobe diff pair
  $expString.=sprintf(
                      "io:dqs%d_c,io:dqs%d_t,",
                      $dqs_start-$i,
                      $dqs_start-$i,
                     );
  #add upper nibble
  $expString.=sprintf(
                      "io:dq[%d:%d],",
                      ($msb_unib)-8*$i,($msb_unib)-8*$i-3,
                     );
  #skip the _n pin
  $expString.="!skip,";
  #add the dm pin
  $expString.=sprintf(
                      "in:dm%d,",
                      $dqs_start-$i,
                     );
  #add the lower nibble
  $expString.=sprintf(
                      "io:dq[%d:%d],",
                      ($msb_lnib)-8*$i,($msb_lnib)-8*$i-3
                     );


}
#print $expString ,"\n";

#this needs to be the last thing you do in this code

$expString=$expString;