Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jiangshan00001/pyvcdr
this is a python library for vcd wave file read.
https://github.com/jiangshan00001/pyvcdr
Last synced: about 16 hours ago
JSON representation
this is a python library for vcd wave file read.
- Host: GitHub
- URL: https://github.com/jiangshan00001/pyvcdr
- Owner: Jiangshan00001
- License: mit
- Created: 2021-04-10T03:16:23.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-10T08:45:37.000Z (over 2 years ago)
- Last Synced: 2024-10-13T03:10:11.760Z (25 days ago)
- Language: Python
- Size: 27.3 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyvcdr
this is a python library for vcd wave file read.# install:
```
pip install pyvcdr
```or just copy pyvcdr.py file to your project.
# readfile:
```
import pyvcdr
a = pyvcdr.VcdR()
a.read_file('./test1.vcd')
```# read from str:
```
import pyvcdr
a = pyvcdr.VcdR()
a.parse_str('$var wire 1 ! D0 $end\n#0 0!\n')
```# use the data:
after read. their are two ways to access the data.
first is access data by signal:
```
print(a.signals[0])#Signal(wire, 1, !, D0)
print(a.signals[1])#Signal(wire, 1, ", D1)
print(a.signals[2])#Signal(wire, 1, #, D2)
print(a.signals[1].module)#D1
for i in a.signals[1].steps:
print(i)
#(0, '1') time, val
#(1250, '0')
#(6250, '1')
#。。。
```
second is access data by time:
```
for i in a.time_values:
print('time:', i[0], '. sig:', i[1], '. val:', i[2])
#(0, 'D0', '0')
#(0, 'D1', '1')
#(0, 'D2', '1')
#(1250, 'D1', '0')
#(6250, 'D1', '1')
#(10000, 'D1', '0')
#(15000, 'D1', '1')
#...
```# why I write this code:
I need a python vcd file read program.
I used this library first:
https://github.com/westerndigitalcorporation/pyvcd
but it could not read file. just write is supported.then this one:
https://github.com/em-/python-vcd/tree/master/vcd
it works, but is very very slow.# info and thanks:
- the class Signal is from pyvcd library.
- import error fix and pep8 sytle fix by @EtlamGit# any issues:
I just write it for my file read. so it may not fit some IEEE 1364-2005 protocol.
if it do not work for you,
add an issue on github:
https://github.com/Jiangshan00001/pyvcdrpost the file that could not work.
or you can also change the code yourself.# CHANGE:
- V0.9 2022.7.10 fix issue when no newline char. thanks to: @AcksID
- V0.8 2021.10.9 add parse_str function.
- V0.7 2021.5.9 BUG FIX: import error fix and pep8 sytle fix. thanks t: @EtlamGit.
- V0.6 2021.5.8. add suport for bBrR data support.