A Python wrapper for SIS
Project description
SISWRAPPER
Siswrapper is a wrapper for SIS, the tool for synthesis and optimization of sequential circuits.
Siswrapper enables developers to code scripts that embeds SIS in any way.
Read this README in:
English Italiano
Disclaimer:
I'm not affiliated with the SIS developers in any way.
The aim of this library is to enable the developers to use SIS via the Python programming language.
Index
Description ![](https://pypi-camo.freetls.fastly.net/b985d13f4b722e37f2159fe0f0725eed97c0f576/68747470733a2f2f692e696d6775722e636f6d2f774d64614c49302e706e67)
This library enables the developer
to control SIS via Python using an istance of the siswrapper.Siswrapper
class.
This is possible thanks to pexpect, a Python library that can easily be used to control interactive shells by spawning and connecting to their process.
Requirements ![](https://pypi-camo.freetls.fastly.net/0be5ce3f68a7cf01b53a156dbb3bb53309ec0431/68747470733a2f2f692e696d6775722e636f6d2f48336f42756d712e706e67)
- Unix-like OS
pexpect doesn't have all its features on Windows and SIS works best on linux OSes
- Python 3
- the pexpect library for Python: control interactive shells via Python
- SIS, set in the path environment variable (callable with the
sis
command): the tool for synthesis and optimization of sequential circuitsYou can download it here
Installation
You can install this library by:
-
Running the following pip command:
pip install siswrapper
-
Build the python wheel file using the following command:
python3 setup.py bdist_wheel
And install the wheel by executing this command:
pip install siswrapper-<version>-py3-none-any.whl
<version>
is siswrapper's version
Usage
After siswrapper's installation you can import siswrapper inside a script or inside the interpreter.
import siswrapper
Now you can instance an object from the siswrapper.Siswrapper()
class:
sis = siswrapper.Siswrapper()
This instruction spawns a SIS process using pexpect.
From now on it is possible to execute sis commands using Python:
sis.stop() # stop SIS and tmux's session
sis.start() # start a tmux session and start SIS
# > Executed automatically after the instance creation
# > (useful after sis.stop() )
path = "file.blif"
sis.read_blif(path) # reads a blif file
sis.simulate("010010") # executes a simulation
# > No need for spaces between each input !!
# optimize the circuit using the rugged script
sis.script_rugged()
# execute a command that is not
# directly supported by this library:
sis.exec("help")
# try to execute a command and parse the output
# without calling directly the correct method
# > fallback method in case the command is not recognized: exec()
sis.parsed_exec("simulate 00 10 11")
# save the circuit to a new file
sis.write_blif("optimized.blif")
# if necessary it is possible to interact with SIS' shell
sis.interact()
All the methods return a dictionary with:
- a success exit status (which can be False or True)
- errors list (empty if there were no errors)
- warnings list (empty if there were no warnings, only on some commands that can return warnings)
- stdout of the command (None if the command returns nothing)
- parsed output of the SIS command (on some commands that return data)
Changelog ![](https://pypi-camo.freetls.fastly.net/aed7f740843707bc1bea78d6a7d95d2e3e563ac8/68747470733a2f2f692e696d6775722e636f6d2f53444b4870616b2e706e67)
2021-01-04 1.1.0:
Added features
-
Added the
parsed_output()
method: it reads a command and automatically calls the best method to parse the output of that command.If the command is not recognized it falls back to the
exec()
method.
Changes
- The
simulate()
method now returns a string with the outputs (not space between each output):there was no reason to calculate sums, subtractions, ... from the output so the string type makes more sense
Fixes
- Now the
exec()
knows how to treat thequit
andexit
commands without raising Exceptions.
2020-11-14 1.0.0:
First commit
Author ![](https://pypi-camo.freetls.fastly.net/571e1b4c4ba2afa5e206965406e8852a221a548e/68747470733a2f2f692e696d6775722e636f6d2f656a34455646362e706e67)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for siswrapper-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58716f1791591b9e6dfb267193268b3b88e1754a66921def5dbda64587dc20cd |
|
MD5 | 5f2acafe32bb82f8005dc56baf544f4c |
|
BLAKE2b-256 | df90a63fe14d3593967e1bdc1bea23636f1a86b3888a6a2e9d1cf002eaa3a9ee |