1 changed files with 0 additions and 27 deletions
@ -1,27 +0,0 @@
@@ -1,27 +0,0 @@
|
||||
import numpy as np |
||||
from PIL import Image |
||||
from kyupy import vcd |
||||
|
||||
def var_filter(var): |
||||
#print(var.scope.path) |
||||
return var.scope.path.endswith('picorv32_core') |
||||
|
||||
def step_filter(time, values, var_map): |
||||
#print(time) |
||||
return time is not None and time > 1000000000 and (time % 10000) == 0 and time <= 1600000000 |
||||
#(time % 100000) == 0 |
||||
|
||||
_palette = np.full(8, 128, dtype=np.uint8) |
||||
_palette[0] = 0 # black |
||||
_palette[3] = 255 # white |
||||
|
||||
def to_image(data: np.ndarray, path: str): |
||||
pixels = _palette[data] |
||||
Image.fromarray(pixels, mode='L').save(path) |
||||
|
||||
def main(): |
||||
vcddata = vcd.load('tests/testbench.vcd', var_filter=var_filter, step_filter=step_filter) |
||||
to_image(vcddata.data, 'out.png') |
||||
|
||||
if __name__ == "__main__": |
||||
main() |
||||
Loading…
Reference in new issue