f4pga / ideas

Random ideas and interesting ideas for things we hope to eventually do.
86 stars 9 forks source link

Create a really good library for parsing / producing SDF files #17

Open mithro opened 6 years ago

mithro commented 6 years ago

Create a really good library for parsing / producing SDF files

Standard Delay Format (SDF) format is an IEEE standard for the representation and interpretation of timing data for use at any stage of an electronic design process. It finds wide applicability in design flows, and forms an efficient bridge between Dynamic timing verification and Static timing analysis.

It has usually two sections: one for interconnect delays and the other for cell delays.

SDF format can be used for back-annotation as well as forward-annotation.

The SDF format version 2.1 is produced by Verilog to Routing for post implementation timing analysis. It is also used by a lot of other EDA tools.

Expected results

A Python library published on PyPi which makes it easy to read and write SDF files.

Further reading

Knowledge Prerequisites

euripedesrocha commented 5 years ago

I can put some effort here, do you have any use cases or an idea for the interface? How the information will be consumed and produced?

mithro commented 5 years ago

The data will mainly be used to generate delay specifications for Verilog to Routing. See http://vtr-verilog-to-routing.readthedocs.io/en/latest/tutorials/arch/timing_modeling/index.html for example.

On Sun., 15 Jul. 2018, 3:33 pm Euripedes, notifications@github.com wrote:

I can put some effort here, do you have any use cases or an idea for the interface? How the information will be consumed and produced?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SymbiFlow/ideas/issues/17#issuecomment-405123456, or mute the thread https://github.com/notifications/unsubscribe-auth/AABS3Bc-nM8YMfmJuc6hfO9BFoiSUXeJks5uG8NHgaJpZM4U0-ne .

mithro commented 5 years ago

Another common thing that you would want to do with the SDF delays it to split or join them together.

If a pathway when A -> B -> C, you would want to add the delay A->B and B->C. Conversely if you had delay 'A -> C' you might want to confirm that A->B + B->C is the same value.

Another common thing you might want to do is if you have the following set of delays; A->B->C = 100ps A->B->D == 40ps E->B->D == 20ps Then you want to work out what the possible range of values of each of the sections would be.

mithro commented 5 years ago

With something like this;

from collections import namedtuple

Times = namedtuple("Times", ("min", "typical", "max"))

IoPath = namedtuple("IoPath", ("src", "dst", "low2high", "high2low"))

lt_paths = [
    IoPath("in0",           "ltout", Times(293.136, 324.149, 364.700), Times(310.048, 342.850, 385.740)),
    IoPath("in1",           "ltout", Times(259.313, 286.747, 322.619), Times(304.411, 336.616, 378.727)),
    IoPath("in2",           "ltout", Times(248.039, 274.280, 308.592), Times(276.225, 305.448, 343.659)),
    IoPath("in3",           "ltout", Times(214.215, 236.878, 266.511), Times(219.852, 243.112, 273.525)),
]

lc_paths = [
    IoPath("in0",           "lcout", Times(360.783, 398.952, 448.861), Times(310.048, 342.850, 385.740)),
    IoPath("in1",           "lcout", Times(321.323, 355.317, 399.767), Times(304.411, 336.616, 378.727)),
    IoPath("in2",           "lcout", Times(304.411, 336.616, 378.727), Times(281.862, 311.682, 350.673)),
    IoPath("in3",           "lcout", Times(253.676, 280.513, 315.606), Times(231.127, 255.579, 287.552)),
]

We can calculate the common part of the delay between XX->ltout and XX->lcout

in0
            ltout       lcout       delta    
       min  293.136000  360.783000  67.647000
   typical  324.149000  398.952000  74.803000
       max  364.700000  448.861000  84.161000

in1
            ltout       lcout       delta    
       min  259.313000  321.323000  62.010000
   typical  286.747000  355.317000  68.570000
       max  322.619000  399.767000  77.148000

in2
            ltout       lcout       delta    
       min  248.039000  304.411000  56.372000
   typical  274.280000  336.616000  62.336000
       max  308.592000  378.727000  70.135000

in3
            ltout       lcout       delta    
       min  214.215000  253.676000  39.461000
   typical  236.878000  280.513000  43.635000
       max  266.511000  315.606000  49.095000
mithro commented 5 years ago

Does that help?

euripedesrocha commented 5 years ago

Yes, that's what I was looking for.

XVilka commented 5 years ago

@euripedesrocha were there any updates on this?

euripedesrocha commented 5 years ago

Sadly I had little time to work on this. I intend to pu some effort in january, If you want to lead the effort I'll be glad to provide you any help I can.

rochus-keller commented 5 years ago

I will implement parsers for a couple of other file formats in VerilogCreator, but in C++. Do we have access to IEEE 1497-2001?

kgugala commented 5 years ago

python SDF parser being developed in https://github.com/SymbiFlow/python-sdf-timing SDF producer is a part of this PR https://github.com/SymbiFlow/prjxray/pull/706

GitHub
SymbiFlow/python-sdf-timing
Python library for working Standard Delay Format (SDF) Timing Annotation files. - SymbiFlow/python-sdf-timing
kgugala commented 5 years ago

The tool is more or less ready. I'm pretty sure it has bugs, and does not handle all the SDF spec. Will fix the bugs as they appear in testing.

mithro commented 5 years ago

@kgugala I think we should change this bug to "Improve the python-sdf-timing library", some improvements that I can think of;

mithro commented 5 years ago

@rochus-keller - FYI There is a C++ library for parsing sdf files at https://github.com/kmurray/libsdfparse -- it might be worth adding SDF support to VerilogCreator if it isn't too much trouble.

GitHub
kmurray/libsdfparse
A simple C++ SDF parser. Contribute to kmurray/libsdfparse development by creating an account on GitHub.