chipsalliance / f4pga-sdf-timing Goto Github PK
View Code? Open in Web Editor NEWPython library for working Standard Delay Format (SDF) Timing Annotation files.
License: Apache License 2.0
Python library for working Standard Delay Format (SDF) Timing Annotation files.
License: Apache License 2.0
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.
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.
``
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:
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.
Current the sdf output code is in prjxray at https://github.com/SymbiFlow/prjxray/blob/801ec5cbc5d6eeb467e204694ce941e5d72d5837/utils/makesdf.py
We should move it into this repository and support "round tripping" the sdf files. (IE SDF->Python->SDF).
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))
)
)
)
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
We will need this for defining routing BELs delays.
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.
If parse is called multiple times in one script the parser appends the results
From https://help.github.com/en/articles/creating-and-highlighting-code-blocks#syntax-highlighting
We use Linguist to perform language detection and to select third-party grammars for syntax highlighting. You can find out which keywords are valid in the languages YAML file.
See also https://github.com/github/linguist/blob/master/vendor/README.md
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
Travis fails because we don't have any tests (see #10)
currently we get something like:
Illegal character '"'
We should at least print line number
currently license says
Copyright (C) 2012 - 2017 Clifford Wolf <[email protected]>
which is not certainly true.
I was thinking it was part of https://docs.pytest.org/en/latest/goodpractices.html
Maybe it is just py.test --doctest-modules
without any arguments?
We need syntax highlighting for SDF files. pygments is used by sphinx, so we should add SDF syntax highlighting to that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.