Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3 support and compile fixes #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions scripts/valtab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
import sys
import getopt
from functools import cmp_to_key

opts, args = getopt.getopt(sys.argv, "", [])
args.pop(0)
Expand Down Expand Up @@ -94,7 +95,7 @@ def binary2decimal(bits, signed):
if len(bitpartitions) != 0:
for part in bitpartitions:
vars_found_diff = False
ref_lst = data[idx]['split_outputs'].keys()[0]
ref_lst = list(data[idx]['split_outputs'].keys())[0]
for lst in data[idx]['split_outputs'].keys():
if data[idx]['split_outputs'][lst][part[2]] != data[idx]['split_outputs'][ref_lst][part[2]]:
vars_found_diff = True
Expand Down Expand Up @@ -135,22 +136,22 @@ def pretty_list(txt):
for idx in sorted(data.keys()):
d = data[idx]
if len(d['split_outputs']) > 1:
print '<table class="valuestab" border><tr><th colspan="2" align="left">Pattern #{}</th><th>binary</th><th>decimal</th></tr>'.format(idx)
print('<table class="valuestab" border><tr><th colspan="2" align="left">Pattern #{}</th><th>binary</th><th>decimal</th></tr>'.format(idx))
first_var = True
for key in sorted(d['inputs'].keys()):
if first_var:
print '<tr><td rowspan="{}">input signals</td><td>{}</td><td>{}</td><td>{}</td></tr>'.format(len(d['inputs']), key, d['inputs'][key][0], d['inputs'][key][1])
print('<tr><td rowspan="{}">input signals</td><td>{}</td><td>{}</td><td>{}</td></tr>'.format(len(d['inputs']), key, d['inputs'][key][0], d['inputs'][key][1]))
else:
print '<tr><td>{}</td><td>{}</td><td>{}</td></tr>'.format(key, d['inputs'][key][0], d['inputs'][key][1])
print('<tr><td>{}</td><td>{}</td><td>{}</td></tr>'.format(key, d['inputs'][key][0], d['inputs'][key][1]))
first_var = False
for lst in sorted(d['split_outputs'].keys()):
first_var = True
for var in sorted(d['split_outputs'][lst].keys(), cmp=outvar_compare):
for var in sorted(d['split_outputs'][lst].keys(), key=cmp_to_key(outvar_compare)):
if first_var:
print '<tr><td class="valsimlist" rowspan="{}">{}</td><td>{}</td><td>{}</td><td>{}</td></tr>'.format(
len(d['split_outputs'][lst].keys()), pretty_list(lst), var, d['split_outputs'][lst][var][0], d['split_outputs'][lst][var][1])
print('<tr><td class="valsimlist" rowspan="{}">{}</td><td>{}</td><td>{}</td><td>{}</td></tr>'.format(
len(d['split_outputs'][lst].keys()), pretty_list(lst), var, d['split_outputs'][lst][var][0], d['split_outputs'][lst][var][1]))
else:
print '<tr><td>{}</td><td>{}</td><td>{}</td></tr>'.format(var, d['split_outputs'][lst][var][0], d['split_outputs'][lst][var][1])
print('<tr><td>{}</td><td>{}</td><td>{}</td></tr>'.format(var, d['split_outputs'][lst][var][0], d['split_outputs'][lst][var][1]))
first_var = False
print '</table>'
print('</table>')

2 changes: 1 addition & 1 deletion scripts/verilator_tb.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bool pattern_bits[PATTERN_BITS_N];
int pattern_cursor, pattern_idx;

std::string input_pat_list;
std::vector<string> input_patterns_buf;
std::vector<std::string> input_patterns_buf;
std::set<int> undef_bits;

static inline void set_pattern(const char *pattern)
Expand Down