On 01/08/2012 12:06 AM, David Koontz wrote:
While technically challenging, a rather dry subject.
> ....

Hello David,

many thanks for the extensive analysis !!!

I tried a pragmatic approach, and wrote a small filter which generates
from the USE generated sdf files one that ghdl can digest. This
filter (see attachment) will

  1. use rtriples instead of an RNUMBER for VOLTAGE and TEMPERATURE clauses
  2. use rtriples instead of RNUMBER for all IOPATH clauses
  3. remove all TIMINGCHECK clauses

The original lines are preserved as C++ style comments.

This way several of my models now work also in ghdl with timing annotation.
In one case however the patched sdf files produced the error

  tbd_fifo_2c_dram_tsim.sdf_ghdl:208:26: bad character in SDF file

looking into the sdf file showed that the problem was in the middle
of unmodified and quite innocent text

      (CELL (CELLTYPE "X_OBUF")
        (INSTANCE DO_14_OBUF)
          (DELAY
            (ABSOLUTE
              (PORT I (19:24:24))
              (IOPATH I O (3566:4459:4459))
            )
          )
      )
      (CELL (CELLTYPE "X_BUF")
                             ^
                             208:26: bad character in SDF file
        (INSTANCE DI_12_IBUF)
          (DELAY
            (ABSOLUTE
              (IOPATH I O (120:150:150))
            )
          )
      )

Adding a blank line before '(CELL (CELLTYPE "X_BUF")' made the error
go away, a quite confusing behavior of the sdf parser in ghdl ...


                With best regards,      Walter

#!/usr/bin/perl -w
# $Id:  $
#
# Copyright 2012- by Walter F.J. Mueller <[email protected]>
#
# This program is free software; you may redistribute and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2, or at your option any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for complete details.
#
#  Revision History:
# Date         Rev Version  Comment
# 2012-01-07   451   1.0    Initial version
#
#
# Patch ISE generated sdf file such that it will be accepted by ghdl
#
# 1. use rtriples instead of an RNUMBER for VOLTAGE and TEMPERATURE clauses
#      {ghdl produces a "':' (colon) expected" error otherwise}
# 2. use rtriples instead of RNUMBER for all IOPATH clauses
#      {ghdl produces a "parse error" error otherwise}
# 3. remove all TIMINGCHECK clauses
#      {ghdl produces a "unhandled generic type for ..."  error otherwise}
#

use strict;

my $file = shift;

if (not defined $file) {
  print "xilinx_ghdl_sdf_filter-E: call with sdf file name\n";
  exit 1;
}

if (! -r $file) {
  print "xilinx_ghdl_sdf_filter-E: $file not found or readable\n";
  exit 1;
}

open(SFILE, "<$file") || die ("Can't open file $file: $!");

while (<SFILE>) {
  # fixup VOLTAGE and TEMPERATURE clauses
  if (m/(\(VOLTAGE|\(TEMPERATURE) ([0-9.]+)/) {
    print "//m $_";
    s/([0-9.]+)/$1:$1:$1/g;
  }

  # fixup IOPATH clauses with RNUMBER delval's
  if (m/\(IOPATH.*\( [0-9.]+ \)/ ) {
    print "//m $_";
    s/\( ([0-9.]+) \)/\($1:$1:$1\)/g;
  }

  # remove TIMINGCHECK clauses
  if (m/\(TIMINGCHECK/) {
    print "//d $_";
    while (<SFILE>) {
      print "//d $_";
      last if m/^\s*\)/;
    }
    next;
  }

  print;
}
close(SFILE);

_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to