Skip to content
Snippets Groups Projects
Commit d21eb0b4 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Util] bugfix in list_stream_if, use vars for stream signal names

parent c7eb0487
No related branches found
No related tags found
No related merge requests found
...@@ -28,15 +28,18 @@ ...@@ -28,15 +28,18 @@
from vcdvcd import VCDVCD from vcdvcd import VCDVCD
vname = "TVALID"
rname = "TREADY"
def list_stream_if(vcd_file): def list_stream_if(vcd_file):
"Return a list of stream interface names from given vcd trace." "Return a list of stream interface names from given vcd trace."
sig_names = VCDVCD(vcd_file, print_dumps=False, only_sigs=True).get_signals() sig_names = VCDVCD(vcd_file, print_dumps=False, only_sigs=True).get_signals()
stream_if_names = [] stream_if_names = []
for cand_name in filter(lambda x: "tvalid" in x, sig_names): for cand_name in filter(lambda x: x.endswith(vname), sig_names):
base_name = cand_name.strip("tvalid") base_name = cand_name.replace(vname, "")
if base_name + "tready" in sig_names: if base_name + rname in sig_names:
stream_if_names.append(base_name) stream_if_names.append(base_name)
return stream_if_names return stream_if_names
...@@ -61,8 +64,8 @@ def get_stream_if_stats(vcd_file, if_base_name): ...@@ -61,8 +64,8 @@ def get_stream_if_stats(vcd_file, if_base_name):
Here we can see the stream was transmitting values 7.7% of the time, Here we can see the stream was transmitting values 7.7% of the time,
and 9.2% of the time there was no incoming data (valid 0, ready 1) and 9.2% of the time there was no incoming data (valid 0, ready 1)
""" """
if_valid = if_base_name + "tvalid" if_valid = if_base_name + vname
if_ready = if_base_name + "tready" if_ready = if_base_name + rname
vcd = VCDVCD(vcd_file, print_dumps=False, only_sigs=True) vcd = VCDVCD(vcd_file, print_dumps=False, only_sigs=True)
assert if_valid in vcd.get_signals(), "Streaming interface not found" assert if_valid in vcd.get_signals(), "Streaming interface not found"
assert if_ready in vcd.get_signals(), "Streaming interface not found" assert if_ready in vcd.get_signals(), "Streaming interface not found"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment