Code Monkey home page Code Monkey logo

f4pga-sdf-timing's Introduction

python-sdf-timing

Python library for working Standard Delay Format (SDF) Timing Annotation files.

From Wikipedia;

Standard Delay Format (SDF) 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 is an ASCII format that is represented in a tool and language independent way and includes path delays, timing constraint values, interconnect delays and high level technology parameters.

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.

Links

f4pga-sdf-timing's People

Contributors

christian-lanius avatar elms avatar kgugala avatar mithro avatar mkurc-ant avatar tmichalak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

f4pga-sdf-timing's Issues

Add license automated check in Travis

There should be an automated test to check that all source code in the project has the SPDX Identifier, and, in case of third_party tools, that the LICENSE file is present.

This script can be used and changed accordingly to the source file-types by adding/removing the correct extensions

Names with escaped brackets do not match

Hi all,
I have found another issue regarding matching of more obscure valid sdf. Valid names in verilog netlists include names such as TESTENV/reset_synchronizer_genblk1\[0\]\.ff_1_reg/RESET. The grammar to match the name does not match to this, instead returning an error that the character "" is an invalid name. I will provide a pull request for this issue soon.

Add license header to top of all code files

See https://opensource.google/docs/releasing/licenses/

We can either use;

Copyright (C) 2020  The SymbiFlow Authors.

Use of this source code is governed by a ISC-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/ISC

Or put the full license at the top;

Copyright (C) 2020  The SymbiFlow Authors.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Make travis pass

https://travis-ci.com/SymbiFlow/python-sdf-timing/jobs/190714510

0.01s$ source ~/virtualenv/python2.7/bin/activate
$ python --version
Python 2.7.14
$ pip --version
pip 9.0.1 from /home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages (python 2.7)
install
2.42s$ pip install tox
Collecting tox
  Downloading https://files.pythonhosted.org/packages/d2/68/d8a9466c8ecda020b36cd5f5d0c274403941a401fe613d868ecf5fc84dd5/tox-3.8.6-py2.py3-none-any.whl (73kB)
    100% |████████████████████████████████| 81kB 2.9MB/s 
Requirement already satisfied: py<2,>=1.4.17 in /home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages (from tox)
Requirement already satisfied: six<2,>=1.0.0 in /home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages (from tox)
Requirement already satisfied: setuptools>=30.0.0 in /home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages (from tox)
Collecting filelock<4,>=3.0.0 (from tox)
  Downloading https://files.pythonhosted.org/packages/2a/bd/6a87635dba4906ae56377b22f64805b2f00d8cafb26e411caaf3559a5475/filelock-3.0.10.tar.gz
Collecting toml>=0.9.4 (from tox)
  Downloading https://files.pythonhosted.org/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl
Collecting virtualenv>=1.11.2 (from tox)
  Downloading https://files.pythonhosted.org/packages/33/5d/314c760d4204f64e4a968275182b7751bd5c3249094757b39ba987dcfb5a/virtualenv-16.4.3-py2.py3-none-any.whl (2.0MB)
    100% |████████████████████████████████| 2.0MB 665kB/s 
Requirement already satisfied: pluggy<1,>=0.3.0 in /home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages (from tox)
Building wheels for collected packages: filelock
  Running setup.py bdist_wheel for filelock ... done
  Stored in directory: /home/travis/.cache/pip/wheels/46/b3/26/8803692ec1f1729fcf201583b5de74f112da1f1488f36e47b0
Successfully built filelock
Installing collected packages: filelock, toml, virtualenv, tox
Successfully installed filelock-3.0.10 toml-0.10.0 tox-3.8.6 virtualenv-16.4.3
10.50s$ tox
GLOB sdist-make: /home/travis/build/SymbiFlow/python-sdf-timing/setup.py
py27 create: /home/travis/build/SymbiFlow/python-sdf-timing/.tox/py27
py27 installdeps: check-manifest, pyjson, flake8, pytest
py27 inst: /home/travis/build/SymbiFlow/python-sdf-timing/.tox/.tmp/package/1/sdf_timing-0.0.1.zip
py27 installed: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.,atomicwrites==1.3.0,attrs==19.1.0,check-manifest==0.37,configparser==3.7.4,entrypoints==0.3,enum34==1.1.6,flake8==3.7.7,funcsigs==1.0.2,functools32==3.2.3.post2,mccabe==0.6.1,more-itertools==5.0.0,pathlib2==2.3.3,pluggy==0.9.0,ply==3.11,py==1.8.0,pycodestyle==2.5.0,pyflakes==2.1.1,pyjson==1.3.0,pytest==4.4.0,scandir==1.10.0,sdf-timing==0.0.1,six==1.12.0,typing==3.6.6
py27 run-test-pre: PYTHONHASHSEED='3997939947'
py27 run-test: commands[0] | check-manifest --ignore 'tox.ini,tests*'
lists of files in version control and sdist match
py27 run-test: commands[1] | python setup.py check -m -s
running check
py27 run-test: commands[2] | flake8 --ignore F401 .
./sdf_timing/sdfparse.py:8:1: E302 expected 2 blank lines, found 1
./sdf_timing/sdfparse.py:9:5: F821 undefined name 'sdflex'
./sdf_timing/sdfparse.py:10:26: F821 undefined name 'sdflex'
./sdf_timing/sdfparse.py:13:1: E302 expected 2 blank lines, found 1
./sdf_timing/sdflex.py:74:1: E302 expected 2 blank lines, found 1
./sdf_timing/sdflex.py:78:1: E305 expected 2 blank lines after class or function definition, found 1
ERROR: InvocationError for command /home/travis/build/SymbiFlow/python-sdf-timing/.tox/py27/bin/flake8 --ignore F401 . (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   py27: commands failed
The command "tox" exited with 1.
Done. Your build exited with 1.
``

Make the tool parse all the test sdfs

Current result:

testing tests/data/bigchip.sdf
Generating LALR tables
Syntax error at 'DATE' line: 4
Illegal character '"'
Illegal character ','
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '-'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '['
Illegal character ']'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '-'
Illegal character '-'
Illegal character '-'
testing tests/data/clb.sdf
Generating LALR tables
testing tests/data/empty.sdf
Generating LALR tables
testing tests/data/modulo6.sdf
Generating LALR tables
Illegal character '"'
Syntax error at 'OVI' line: 2
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '-'
Illegal character '-'
Illegal character '"'
Illegal character '“'
Illegal character '"'
testing tests/data/spec-example1.sdf
Generating LALR tables
Syntax error at 'DATE' line: 4
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
testing tests/data/spec-example2.sdf
Generating LALR tables
Syntax error at 'DATE' line: 4
Illegal character '"'
Illegal character ','
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '.'
Illegal character '"'
Illegal character '.'
Illegal character '.'
Illegal character '='
Illegal character '='
Illegal character '&'
Illegal character '&'
Illegal character '='
Illegal character '='
Illegal character '&'
Illegal character '&'
Illegal character '='
Illegal character '='
Illegal character '='
Illegal character '='
Illegal character '&'
Illegal character '&'
Illegal character '='
Illegal character '='
Illegal character '&'
Illegal character '&'
Illegal character '='
Illegal character '='
Illegal character '='
Illegal character '='
Illegal character '&'
Illegal character '&'
Illegal character '='
Illegal character '='
Illegal character '&'
Illegal character '&'
Illegal character '='
Illegal character '='
Illegal character '='
Illegal character '='
Illegal character '&'
Illegal character '&'
Illegal character '='
Illegal character '='
Illegal character '&'
Illegal character '&'
Illegal character '='
Illegal character '='
testing tests/data/spec-example3.sdf
Generating LALR tables
Syntax error at 'DATE' line: 4
Illegal character '"'
Illegal character ','
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '.'
Illegal character '"'
Illegal character '.'
Illegal character '.'
Illegal character '~'
Illegal character '~'
testing tests/data/spec-example4.sdf
Generating LALR tables
Syntax error at 'DATE' line: 4
Illegal character '"'
Illegal character ','
Illegal character '"'
Illegal character '"'
Illegal character '.'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '"'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
Illegal character '.'
testing tests/data/test1.sdf
Generating LALR tables
Syntax error at '/' line: 3

Failing files:

  • bigchip.sdf
  • modulo6.sdf
  • spec-example1.sdf
  • spec-example2.sdf
  • spec-example3.sdf
  • spec-example4.sdf
  • test1.sdf

`port_condition` portion of `port_spec` is dropped

Converting https://github.com/SymbiFlow/python-sdf-timing/blob/master/tests/data/modulo6.sdf#L30-L31
I only one entry for width_CLK_CLK and it is the second entry in the SDF.

                "width_CLK_CLK": {
                    "cond_equation": null,
                    "delay_paths": {
                        "nominal": {
                            "avg": 0.072,
                            "max": 0.072,
                            "min": 0.072
                        }
                    },
                    "from_pin": "CLK",
                    "is_absolute": false,
                    "is_cond": false,
                    "is_incremental": false,
                    "is_timing_check": true,
                    "is_timing_env": false,
                    "name": "width_CLK_CLK",
                    "to_pin": "CLK",
                    "type": "width"
                },

https://github.com/SymbiFlow/python-sdf-timing/blob/master/sdf_timing/sdfyacc.py#L385-L393

Conditions are not matching HDL literals

The following is a valid line of sdf:
(COND B==1'b0&&C==1'b0&&D==1'b0 (IOPATH A Z (61.500:100.000:150.900) (26.900:40.000:61.400)))
However, the literal "1'b0" is not being matched, as it does not match to the regex for a float. I am unsure if the sdf standard allows for floating points to be used at this point.
I will open a pull request with a very simple fix to this issue. With my simple test .sdf unfortunately the test fails, as the white spacing is different. Though that should be a simple case to add to the test suite.

Create a SDF file canonicalizer

We need a tool which takes a SDF file and generates a "canonical" form. It probably wants to sort via INSTANCE and then CELLTYPE.

Currently we get SLICEL and SLICEM timing information stored together;

    (CELL
        (CELLTYPE "SELMUX2_1")
        (INSTANCE SLICEL/F7AMUX)
        (DELAY
            (ABSOLUTE
                (IOPATH 0 OUT (0.053::0.067)(0.153::0.190))
                (IOPATH 1 OUT (0.055::0.069)(0.156::0.193))
                (IOPATH S0 OUT (0.085::0.106)(0.222::0.276))
            )
        )
    )
    (CELL
        (CELLTYPE "LUT_OR_MEM5LRAM")
        (INSTANCE SLICEM/B5LUT)
        (DELAY
            (ABSOLUTE
                (IOPATH A1 O5 (0.045::0.056)(0.122::0.152))
                (IOPATH A2 O5 (0.044::0.055)(0.122::0.152))
                (IOPATH A3 O5 (0.043::0.053)(0.121::0.150))
                (IOPATH A4 O5 (0.047::0.058)(0.121::0.150))
                (IOPATH A5 O5 (0.048::0.060)(0.094::0.117))
                (IOPATH CLK O5 (0.348::0.434)(0.957::1.187))
            )
        )
        (TIMINGCHECK
            (HOLD CLK (posedge CLK) (0.154::0.191))
            (SETUP CLK (posedge CLK) (0.250::0.311))
        )
    )
    (CELL
        (CELLTYPE "LUT_OR_MEM5SHFREG")
        (INSTANCE SLICEM/B5LUT)
        (DELAY
            (ABSOLUTE
                (IOPATH CLK O5 (0.439::0.547)(1.190::1.476))
            )
        )
        (TIMINGCHECK
            (HOLD CLK (posedge CLK) (0.070::0.087))
            (SETUP CLK (posedge CLK) (0.126::0.156))
        )
    )
    (CELL
        (CELLTYPE "LUT6")
        (INSTANCE SLICEL/C6LUT)
        (DELAY
            (ABSOLUTE
                (IOPATH A1 O6 (0.045::0.056)(0.100::0.124))
                (IOPATH A2 O6 (0.045::0.056)(0.100::0.124))
                (IOPATH A3 O6 (0.045::0.056)(0.100::0.124))
                (IOPATH A4 O6 (0.045::0.056)(0.100::0.124))
                (IOPATH A5 O6 (0.045::0.056)(0.100::0.124))
                (IOPATH A6 O6 (0.045::0.056)(0.100::0.124))
            )
        )
    )

add tests

Travis fails because we don't have any tests (see #10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.