You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
743 B
27 lines
743 B
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() |