yowasp-yosys 0.35.0.0.post605__py3-none-any.whl → 0.36.0.8.post623.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yowasp_yosys/share/cmp2softlogic.v +117 -0
- yowasp_yosys/share/include/backends/cxxrtl/{cxxrtl_capi.cc → runtime/cxxrtl/capi/cxxrtl_capi.cc} +3 -3
- yowasp_yosys/share/include/backends/cxxrtl/{cxxrtl_vcd_capi.cc → runtime/cxxrtl/capi/cxxrtl_capi_vcd.cc} +3 -3
- yowasp_yosys/share/include/backends/cxxrtl/{cxxrtl_vcd_capi.h → runtime/cxxrtl/capi/cxxrtl_capi_vcd.h} +3 -3
- yowasp_yosys/share/include/backends/cxxrtl/{cxxrtl.h → runtime/cxxrtl/cxxrtl.h} +2 -1
- yowasp_yosys/share/include/backends/cxxrtl/{cxxrtl_vcd.h → runtime/cxxrtl/cxxrtl_vcd.h} +1 -1
- yowasp_yosys/share/include/kernel/rtlil.h +3 -0
- yowasp_yosys/share/nexus/brams_map.v +6 -6
- yowasp_yosys/share/python3/ywio.py +8 -2
- yowasp_yosys/share/quicklogic/{pp3_cells_sim.v → pp3/cells_sim.v} +77 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/TDP18K_FIFO.v +344 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/arith_map.v +99 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/bram_types_sim.v +74035 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/brams_map.v +4288 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/brams_sim.v +10949 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/cells_sim.v +375 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/dsp_final_map.v +265 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/dsp_map.v +102 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/dsp_sim.v +4527 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/ffs_map.v +133 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/libmap_brams.txt +22 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/libmap_brams_map.v +483 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/sram1024x18_mem.v +64 -0
- yowasp_yosys/share/quicklogic/qlf_k6n10f/ufifo_ctl.v +620 -0
- yowasp_yosys/smtbmc.py +99 -55
- yowasp_yosys/witness.py +16 -7
- yowasp_yosys/yosys.wasm +0 -0
- yowasp_yosys/ywio.py +8 -2
- {yowasp_yosys-0.35.0.0.post605.dist-info → yowasp_yosys-0.36.0.8.post623.dev0.dist-info}/METADATA +12 -12
- {yowasp_yosys-0.35.0.0.post605.dist-info → yowasp_yosys-0.36.0.8.post623.dev0.dist-info}/RECORD +42 -28
- {yowasp_yosys-0.35.0.0.post605.dist-info → yowasp_yosys-0.36.0.8.post623.dev0.dist-info}/WHEEL +1 -1
- yowasp_yosys/share/quicklogic/lut_sim.v +0 -76
- /yowasp_yosys/share/include/backends/cxxrtl/{cxxrtl_capi.h → runtime/cxxrtl/capi/cxxrtl_capi.h} +0 -0
- /yowasp_yosys/share/quicklogic/{cells_sim.v → common/cells_sim.v} +0 -0
- /yowasp_yosys/share/quicklogic/{abc9_map.v → pp3/abc9_map.v} +0 -0
- /yowasp_yosys/share/quicklogic/{abc9_model.v → pp3/abc9_model.v} +0 -0
- /yowasp_yosys/share/quicklogic/{abc9_unmap.v → pp3/abc9_unmap.v} +0 -0
- /yowasp_yosys/share/quicklogic/{pp3_cells_map.v → pp3/cells_map.v} +0 -0
- /yowasp_yosys/share/quicklogic/{pp3_ffs_map.v → pp3/ffs_map.v} +0 -0
- /yowasp_yosys/share/quicklogic/{pp3_latches_map.v → pp3/latches_map.v} +0 -0
- /yowasp_yosys/share/quicklogic/{pp3_lut_map.v → pp3/lut_map.v} +0 -0
- {yowasp_yosys-0.35.0.0.post605.dist-info → yowasp_yosys-0.36.0.8.post623.dev0.dist-info}/entry_points.txt +0 -0
- {yowasp_yosys-0.35.0.0.post605.dist-info → yowasp_yosys-0.36.0.8.post623.dev0.dist-info}/top_level.txt +0 -0
yowasp_yosys/smtbmc.py
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
18
18
|
#
|
|
19
19
|
|
|
20
|
-
import os, sys, getopt, re, bisect
|
|
20
|
+
import os, sys, getopt, re, bisect, json
|
|
21
21
|
##yosys-sys-path##
|
|
22
22
|
from smtio import SmtIo, SmtOpts, MkVcd
|
|
23
23
|
from ywio import ReadWitness, WriteWitness, WitnessValues
|
|
@@ -56,6 +56,7 @@ binarymode = False
|
|
|
56
56
|
keep_going = False
|
|
57
57
|
check_witness = False
|
|
58
58
|
detect_loops = False
|
|
59
|
+
incremental = None
|
|
59
60
|
so = SmtOpts()
|
|
60
61
|
|
|
61
62
|
|
|
@@ -185,6 +186,9 @@ def help():
|
|
|
185
186
|
check if states are unique in temporal induction counter examples
|
|
186
187
|
(this feature is experimental and incomplete)
|
|
187
188
|
|
|
189
|
+
--incremental
|
|
190
|
+
run in incremental mode (experimental)
|
|
191
|
+
|
|
188
192
|
""" + so.helpmsg())
|
|
189
193
|
|
|
190
194
|
def usage():
|
|
@@ -196,7 +200,7 @@ try:
|
|
|
196
200
|
opts, args = getopt.getopt(sys.argv[1:], so.shortopts + "t:higcm:", so.longopts +
|
|
197
201
|
["help", "final-only", "assume-skipped=", "smtc=", "cex=", "aig=", "aig-noheader", "yw=", "btorwit=", "presat",
|
|
198
202
|
"dump-vcd=", "dump-yw=", "dump-vlogtb=", "vlogtb-top=", "dump-smtc=", "dump-all", "noinfo", "append=",
|
|
199
|
-
"smtc-init", "smtc-top=", "noinit", "binary", "keep-going", "check-witness", "detect-loops"])
|
|
203
|
+
"smtc-init", "smtc-top=", "noinit", "binary", "keep-going", "check-witness", "detect-loops", "incremental"])
|
|
200
204
|
except:
|
|
201
205
|
usage()
|
|
202
206
|
|
|
@@ -282,6 +286,9 @@ for o, a in opts:
|
|
|
282
286
|
check_witness = True
|
|
283
287
|
elif o == "--detect-loops":
|
|
284
288
|
detect_loops = True
|
|
289
|
+
elif o == "--incremental":
|
|
290
|
+
from smtbmc_incremental import Incremental
|
|
291
|
+
incremental = Incremental()
|
|
285
292
|
elif so.handle(o, a):
|
|
286
293
|
pass
|
|
287
294
|
else:
|
|
@@ -290,7 +297,7 @@ for o, a in opts:
|
|
|
290
297
|
if len(args) != 1:
|
|
291
298
|
usage()
|
|
292
299
|
|
|
293
|
-
if sum([tempind, gentrace, covermode]) > 1:
|
|
300
|
+
if sum([tempind, gentrace, covermode, incremental is not None]) > 1:
|
|
294
301
|
usage()
|
|
295
302
|
|
|
296
303
|
constr_final_start = None
|
|
@@ -444,8 +451,10 @@ if noinfo and vcdfile is None and vlogtbfile is None and outconstr is None:
|
|
|
444
451
|
smt.produce_models = False
|
|
445
452
|
|
|
446
453
|
def print_msg(msg):
|
|
447
|
-
|
|
448
|
-
|
|
454
|
+
if incremental:
|
|
455
|
+
incremental.print_msg(msg)
|
|
456
|
+
else:
|
|
457
|
+
print("%s %s" % (smt.timestamp(), msg), flush=True)
|
|
449
458
|
|
|
450
459
|
print_msg("Solver: %s" % (so.solver))
|
|
451
460
|
|
|
@@ -640,10 +649,9 @@ if aimfile is not None:
|
|
|
640
649
|
num_steps = max(num_steps, step+2)
|
|
641
650
|
step += 1
|
|
642
651
|
|
|
643
|
-
|
|
644
|
-
if
|
|
645
|
-
|
|
646
|
-
num_steps = 0
|
|
652
|
+
def ywfile_constraints(inywfile, constr_assumes, map_steps=None, skip_x=False):
|
|
653
|
+
if map_steps is None:
|
|
654
|
+
map_steps = {}
|
|
647
655
|
|
|
648
656
|
with open(inywfile, "r") as f:
|
|
649
657
|
inyw = ReadWitness(f)
|
|
@@ -662,10 +670,14 @@ if inywfile is not None:
|
|
|
662
670
|
addr_re = re.compile(r'\\\[[0-9]+\]$')
|
|
663
671
|
bits_re = re.compile(r'[01?]*$')
|
|
664
672
|
|
|
673
|
+
max_t = -1
|
|
674
|
+
|
|
665
675
|
for t, step in inyw.steps():
|
|
666
676
|
present_signals, missing = step.present_signals(inyw.sigmap)
|
|
667
677
|
for sig in present_signals:
|
|
668
678
|
bits = step[sig]
|
|
679
|
+
if skip_x:
|
|
680
|
+
bits = bits.replace('x', '?')
|
|
669
681
|
if not bits_re.match(bits):
|
|
670
682
|
raise ValueError("unsupported bit value in Yosys witness file")
|
|
671
683
|
|
|
@@ -684,7 +696,7 @@ if inywfile is not None:
|
|
|
684
696
|
if common_end <= common_offset:
|
|
685
697
|
continue
|
|
686
698
|
|
|
687
|
-
smt_expr = smt.witness_net_expr(topmod, f"s{t}", wire)
|
|
699
|
+
smt_expr = smt.witness_net_expr(topmod, f"s{map_steps.get(t, t)}", wire)
|
|
688
700
|
|
|
689
701
|
if not smt_bool:
|
|
690
702
|
slice_high = common_end - offset - 1
|
|
@@ -714,7 +726,7 @@ if inywfile is not None:
|
|
|
714
726
|
for mem in smt_mems[sig.memory_path]:
|
|
715
727
|
width, size, bv = mem["width"], mem["size"], mem["statebv"]
|
|
716
728
|
|
|
717
|
-
smt_expr = smt.net_expr(topmod, f"s{t}", mem["smtpath"])
|
|
729
|
+
smt_expr = smt.net_expr(topmod, f"s{map_steps.get(t, t)}", mem["smtpath"])
|
|
718
730
|
|
|
719
731
|
if bv:
|
|
720
732
|
word_low = sig.memory_addr * width
|
|
@@ -738,11 +750,21 @@ if inywfile is not None:
|
|
|
738
750
|
|
|
739
751
|
smt_constr = "(= %s #b%s)" % (smt_expr, bit_slice)
|
|
740
752
|
constr_assumes[t].append((inywfile, smt_constr))
|
|
753
|
+
max_t = t
|
|
741
754
|
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
755
|
+
return max_t
|
|
756
|
+
|
|
757
|
+
if inywfile is not None:
|
|
758
|
+
if not got_topt:
|
|
759
|
+
skip_steps = 0
|
|
760
|
+
num_steps = 0
|
|
761
|
+
|
|
762
|
+
max_t = ywfile_constraints(inywfile, constr_assumes)
|
|
763
|
+
|
|
764
|
+
if not got_topt:
|
|
765
|
+
if not check_witness:
|
|
766
|
+
skip_steps = max(skip_steps, max_t)
|
|
767
|
+
num_steps = max(num_steps, max_t+1)
|
|
746
768
|
|
|
747
769
|
if btorwitfile is not None:
|
|
748
770
|
with open(btorwitfile, "r") as f:
|
|
@@ -841,7 +863,7 @@ if btorwitfile is not None:
|
|
|
841
863
|
skip_steps = step
|
|
842
864
|
num_steps = step+1
|
|
843
865
|
|
|
844
|
-
def collect_mem_trace_data(
|
|
866
|
+
def collect_mem_trace_data(steps, vcd=None):
|
|
845
867
|
mem_trace_data = dict()
|
|
846
868
|
|
|
847
869
|
for mempath in sorted(smt.hiermems(topmod)):
|
|
@@ -849,16 +871,16 @@ def collect_mem_trace_data(steps_start, steps_stop, vcd=None):
|
|
|
849
871
|
|
|
850
872
|
expr_id = list()
|
|
851
873
|
expr_list = list()
|
|
852
|
-
for i in
|
|
874
|
+
for seq, i in enumerate(steps):
|
|
853
875
|
for j in range(rports):
|
|
854
|
-
expr_id.append(('R',
|
|
855
|
-
expr_id.append(('R',
|
|
876
|
+
expr_id.append(('R', seq, j, 'A'))
|
|
877
|
+
expr_id.append(('R', seq, j, 'D'))
|
|
856
878
|
expr_list.append(smt.mem_expr(topmod, "s%d" % i, mempath, "R%dA" % j))
|
|
857
879
|
expr_list.append(smt.mem_expr(topmod, "s%d" % i, mempath, "R%dD" % j))
|
|
858
880
|
for j in range(wports):
|
|
859
|
-
expr_id.append(('W',
|
|
860
|
-
expr_id.append(('W',
|
|
861
|
-
expr_id.append(('W',
|
|
881
|
+
expr_id.append(('W', seq, j, 'A'))
|
|
882
|
+
expr_id.append(('W', seq, j, 'D'))
|
|
883
|
+
expr_id.append(('W', seq, j, 'M'))
|
|
862
884
|
expr_list.append(smt.mem_expr(topmod, "s%d" % i, mempath, "W%dA" % j))
|
|
863
885
|
expr_list.append(smt.mem_expr(topmod, "s%d" % i, mempath, "W%dD" % j))
|
|
864
886
|
expr_list.append(smt.mem_expr(topmod, "s%d" % i, mempath, "W%dM" % j))
|
|
@@ -943,14 +965,14 @@ def collect_mem_trace_data(steps_start, steps_stop, vcd=None):
|
|
|
943
965
|
netpath[-1] += "<%0*x>" % ((len(addr)+3) // 4, int_addr)
|
|
944
966
|
vcd.add_net([topmod] + netpath, width)
|
|
945
967
|
|
|
946
|
-
for i in
|
|
968
|
+
for seq, i in enumerate(steps):
|
|
947
969
|
if i not in mem_trace_data:
|
|
948
970
|
mem_trace_data[i] = list()
|
|
949
|
-
mem_trace_data[i].append((netpath, int_addr, "".join(tdata[
|
|
971
|
+
mem_trace_data[i].append((netpath, int_addr, "".join(tdata[seq])))
|
|
950
972
|
|
|
951
973
|
return mem_trace_data
|
|
952
974
|
|
|
953
|
-
def write_vcd_trace(
|
|
975
|
+
def write_vcd_trace(steps, index, seq_time=False):
|
|
954
976
|
filename = vcdfile.replace("%", index)
|
|
955
977
|
print_msg("Writing trace to VCD file: %s" % (filename))
|
|
956
978
|
|
|
@@ -971,10 +993,10 @@ def write_vcd_trace(steps_start, steps_stop, index):
|
|
|
971
993
|
vcd.add_clock([topmod] + netpath, edge)
|
|
972
994
|
path_list.append(netpath)
|
|
973
995
|
|
|
974
|
-
mem_trace_data = collect_mem_trace_data(
|
|
996
|
+
mem_trace_data = collect_mem_trace_data(steps, vcd)
|
|
975
997
|
|
|
976
|
-
for i in
|
|
977
|
-
vcd.set_time(i)
|
|
998
|
+
for seq, i in enumerate(steps):
|
|
999
|
+
vcd.set_time(seq if seq_time else i)
|
|
978
1000
|
value_list = smt.get_net_bin_list(topmod, path_list, "s%d" % i)
|
|
979
1001
|
for path, value in zip(path_list, value_list):
|
|
980
1002
|
vcd.set_net([topmod] + path, value)
|
|
@@ -982,7 +1004,14 @@ def write_vcd_trace(steps_start, steps_stop, index):
|
|
|
982
1004
|
for path, addr, value in mem_trace_data[i]:
|
|
983
1005
|
vcd.set_net([topmod] + path, value)
|
|
984
1006
|
|
|
985
|
-
|
|
1007
|
+
if seq_time:
|
|
1008
|
+
end_time = len(steps)
|
|
1009
|
+
elif steps:
|
|
1010
|
+
end_time = steps[-1] + 1
|
|
1011
|
+
else:
|
|
1012
|
+
end_time = 0
|
|
1013
|
+
|
|
1014
|
+
vcd.set_time(end_time)
|
|
986
1015
|
|
|
987
1016
|
def detect_state_loop(steps_start, steps_stop):
|
|
988
1017
|
print_msg(f"Checking for loops in found induction counter example")
|
|
@@ -1027,7 +1056,7 @@ def escape_identifier(identifier):
|
|
|
1027
1056
|
|
|
1028
1057
|
|
|
1029
1058
|
|
|
1030
|
-
def write_vlogtb_trace(
|
|
1059
|
+
def write_vlogtb_trace(steps, index):
|
|
1031
1060
|
filename = vlogtbfile.replace("%", index)
|
|
1032
1061
|
print_msg("Writing trace to Verilog testbench: %s" % (filename))
|
|
1033
1062
|
|
|
@@ -1092,7 +1121,7 @@ def write_vlogtb_trace(steps_start, steps_stop, index):
|
|
|
1092
1121
|
print(" initial begin", file=f)
|
|
1093
1122
|
|
|
1094
1123
|
regs = sorted(smt.hiernets(vlogtb_topmod, regs_only=True))
|
|
1095
|
-
regvals = smt.get_net_bin_list(vlogtb_topmod, regs, vlogtb_state.replace("@@step_idx@@", str(
|
|
1124
|
+
regvals = smt.get_net_bin_list(vlogtb_topmod, regs, vlogtb_state.replace("@@step_idx@@", str(steps[0])))
|
|
1096
1125
|
|
|
1097
1126
|
print("`ifndef VERILATOR", file=f)
|
|
1098
1127
|
print(" #1;", file=f)
|
|
@@ -1107,7 +1136,7 @@ def write_vlogtb_trace(steps_start, steps_stop, index):
|
|
|
1107
1136
|
anyconsts = sorted(smt.hieranyconsts(vlogtb_topmod))
|
|
1108
1137
|
for info in anyconsts:
|
|
1109
1138
|
if info[3] is not None:
|
|
1110
|
-
modstate = smt.net_expr(vlogtb_topmod, vlogtb_state.replace("@@step_idx@@", str(
|
|
1139
|
+
modstate = smt.net_expr(vlogtb_topmod, vlogtb_state.replace("@@step_idx@@", str(steps[0])), info[0])
|
|
1111
1140
|
value = smt.bv2bin(smt.get("(|%s| %s)" % (info[1], modstate)))
|
|
1112
1141
|
print(" UUT.%s = %d'b%s;" % (".".join(escape_identifier(info[0] + [info[3]])), len(value), value), file=f);
|
|
1113
1142
|
|
|
@@ -1117,7 +1146,7 @@ def write_vlogtb_trace(steps_start, steps_stop, index):
|
|
|
1117
1146
|
|
|
1118
1147
|
addr_expr_list = list()
|
|
1119
1148
|
data_expr_list = list()
|
|
1120
|
-
for i in
|
|
1149
|
+
for i in steps:
|
|
1121
1150
|
for j in range(rports):
|
|
1122
1151
|
addr_expr_list.append(smt.mem_expr(vlogtb_topmod, vlogtb_state.replace("@@step_idx@@", str(i)), mempath, "R%dA" % j))
|
|
1123
1152
|
data_expr_list.append(smt.mem_expr(vlogtb_topmod, vlogtb_state.replace("@@step_idx@@", str(i)), mempath, "R%dD" % j))
|
|
@@ -1138,7 +1167,7 @@ def write_vlogtb_trace(steps_start, steps_stop, index):
|
|
|
1138
1167
|
print("", file=f)
|
|
1139
1168
|
anyseqs = sorted(smt.hieranyseqs(vlogtb_topmod))
|
|
1140
1169
|
|
|
1141
|
-
for i in
|
|
1170
|
+
for i in steps:
|
|
1142
1171
|
pi_names = [[name] for name, _ in primary_inputs if name not in clock_inputs]
|
|
1143
1172
|
pi_values = smt.get_net_bin_list(vlogtb_topmod, pi_names, vlogtb_state.replace("@@step_idx@@", str(i)))
|
|
1144
1173
|
|
|
@@ -1170,14 +1199,14 @@ def write_vlogtb_trace(steps_start, steps_stop, index):
|
|
|
1170
1199
|
print(" end", file=f)
|
|
1171
1200
|
print(" always @(posedge clock) begin", file=f)
|
|
1172
1201
|
|
|
1173
|
-
print(" genclock <= cycle < %d;" % (
|
|
1202
|
+
print(" genclock <= cycle < %d;" % (steps[-1]), file=f)
|
|
1174
1203
|
print(" cycle <= cycle + 1;", file=f)
|
|
1175
1204
|
print(" end", file=f)
|
|
1176
1205
|
|
|
1177
1206
|
print("endmodule", file=f)
|
|
1178
1207
|
|
|
1179
1208
|
|
|
1180
|
-
def write_constr_trace(
|
|
1209
|
+
def write_constr_trace(steps, index):
|
|
1181
1210
|
filename = outconstr.replace("%", index)
|
|
1182
1211
|
print_msg("Writing trace to constraints file: %s" % (filename))
|
|
1183
1212
|
|
|
@@ -1194,7 +1223,7 @@ def write_constr_trace(steps_start, steps_stop, index):
|
|
|
1194
1223
|
constr_prefix = smtctop[1] + "."
|
|
1195
1224
|
|
|
1196
1225
|
if smtcinit:
|
|
1197
|
-
|
|
1226
|
+
steps = [steps[-1]]
|
|
1198
1227
|
|
|
1199
1228
|
with open(filename, "w") as f:
|
|
1200
1229
|
primary_inputs = list()
|
|
@@ -1203,13 +1232,13 @@ def write_constr_trace(steps_start, steps_stop, index):
|
|
|
1203
1232
|
width = smt.modinfo[constr_topmod].wsize[name]
|
|
1204
1233
|
primary_inputs.append((name, width))
|
|
1205
1234
|
|
|
1206
|
-
if
|
|
1235
|
+
if steps[0] == 0 or smtcinit:
|
|
1207
1236
|
print("initial", file=f)
|
|
1208
1237
|
else:
|
|
1209
|
-
print("state %d" %
|
|
1238
|
+
print("state %d" % steps[0], file=f)
|
|
1210
1239
|
|
|
1211
1240
|
regnames = sorted(smt.hiernets(constr_topmod, regs_only=True))
|
|
1212
|
-
regvals = smt.get_net_list(constr_topmod, regnames, constr_state.replace("@@step_idx@@", str(
|
|
1241
|
+
regvals = smt.get_net_list(constr_topmod, regnames, constr_state.replace("@@step_idx@@", str(steps[0])))
|
|
1213
1242
|
|
|
1214
1243
|
for name, val in zip(regnames, regvals):
|
|
1215
1244
|
print("assume (= [%s%s] %s)" % (constr_prefix, ".".join(name), val), file=f)
|
|
@@ -1220,7 +1249,7 @@ def write_constr_trace(steps_start, steps_stop, index):
|
|
|
1220
1249
|
|
|
1221
1250
|
addr_expr_list = list()
|
|
1222
1251
|
data_expr_list = list()
|
|
1223
|
-
for i in
|
|
1252
|
+
for i in steps:
|
|
1224
1253
|
for j in range(rports):
|
|
1225
1254
|
addr_expr_list.append(smt.mem_expr(constr_topmod, constr_state.replace("@@step_idx@@", str(i)), mempath, "R%dA" % j))
|
|
1226
1255
|
data_expr_list.append(smt.mem_expr(constr_topmod, constr_state.replace("@@step_idx@@", str(i)), mempath, "R%dD" % j))
|
|
@@ -1236,7 +1265,7 @@ def write_constr_trace(steps_start, steps_stop, index):
|
|
|
1236
1265
|
for addr, data in addr_data.items():
|
|
1237
1266
|
print("assume (= (select [%s%s] %s) %s)" % (constr_prefix, ".".join(mempath), addr, data), file=f)
|
|
1238
1267
|
|
|
1239
|
-
for k in
|
|
1268
|
+
for k in steps:
|
|
1240
1269
|
if not smtcinit:
|
|
1241
1270
|
print("", file=f)
|
|
1242
1271
|
print("state %d" % k, file=f)
|
|
@@ -1247,11 +1276,14 @@ def write_constr_trace(steps_start, steps_stop, index):
|
|
|
1247
1276
|
for name, val in zip(pi_names, pi_values):
|
|
1248
1277
|
print("assume (= [%s%s] %s)" % (constr_prefix, ".".join(name), val), file=f)
|
|
1249
1278
|
|
|
1250
|
-
def write_yw_trace(
|
|
1251
|
-
filename
|
|
1252
|
-
|
|
1279
|
+
def write_yw_trace(steps, index, allregs=False, filename=None):
|
|
1280
|
+
if filename is None:
|
|
1281
|
+
if outywfile is None:
|
|
1282
|
+
return
|
|
1283
|
+
filename = outywfile.replace("%", index)
|
|
1284
|
+
print_msg("Writing trace to Yosys witness file: %s" % (filename))
|
|
1253
1285
|
|
|
1254
|
-
mem_trace_data = collect_mem_trace_data(
|
|
1286
|
+
mem_trace_data = collect_mem_trace_data(steps)
|
|
1255
1287
|
|
|
1256
1288
|
with open(filename, "w") as f:
|
|
1257
1289
|
inits, seqs, clocks, mems = smt.hierwitness(topmod, allregs)
|
|
@@ -1295,10 +1327,10 @@ def write_yw_trace(steps_start, steps_stop, index, allregs=False):
|
|
|
1295
1327
|
sig = yw.add_sig(word_path, overlap_start, overlap_end - overlap_start, True)
|
|
1296
1328
|
mem_init_values.append((sig, overlap_bits.replace("x", "?")))
|
|
1297
1329
|
|
|
1298
|
-
for k in
|
|
1330
|
+
for i, k in enumerate(steps):
|
|
1299
1331
|
step_values = WitnessValues()
|
|
1300
1332
|
|
|
1301
|
-
if
|
|
1333
|
+
if not i:
|
|
1302
1334
|
for sig, value in mem_init_values:
|
|
1303
1335
|
step_values[sig] = value
|
|
1304
1336
|
sigs = inits + seqs
|
|
@@ -1314,17 +1346,24 @@ def write_yw_trace(steps_start, steps_stop, index, allregs=False):
|
|
|
1314
1346
|
|
|
1315
1347
|
|
|
1316
1348
|
def write_trace(steps_start, steps_stop, index, allregs=False):
|
|
1349
|
+
if steps_stop is None:
|
|
1350
|
+
steps = steps_start
|
|
1351
|
+
seq_time = True
|
|
1352
|
+
else:
|
|
1353
|
+
steps = list(range(steps_start, steps_stop))
|
|
1354
|
+
seq_time = False
|
|
1355
|
+
|
|
1317
1356
|
if vcdfile is not None:
|
|
1318
|
-
write_vcd_trace(
|
|
1357
|
+
write_vcd_trace(steps, index, seq_time=seq_time)
|
|
1319
1358
|
|
|
1320
1359
|
if vlogtbfile is not None:
|
|
1321
|
-
write_vlogtb_trace(
|
|
1360
|
+
write_vlogtb_trace(steps, index)
|
|
1322
1361
|
|
|
1323
1362
|
if outconstr is not None:
|
|
1324
|
-
write_constr_trace(
|
|
1363
|
+
write_constr_trace(steps, index)
|
|
1325
1364
|
|
|
1326
1365
|
if outywfile is not None:
|
|
1327
|
-
write_yw_trace(
|
|
1366
|
+
write_yw_trace(steps, index, allregs)
|
|
1328
1367
|
|
|
1329
1368
|
|
|
1330
1369
|
def print_failed_asserts_worker(mod, state, path, extrainfo, infomap, infokey=()):
|
|
@@ -1596,7 +1635,11 @@ def smt_check_sat(expected=["sat", "unsat"]):
|
|
|
1596
1635
|
smt_forall_assert()
|
|
1597
1636
|
return smt.check_sat(expected=expected)
|
|
1598
1637
|
|
|
1599
|
-
|
|
1638
|
+
|
|
1639
|
+
if incremental:
|
|
1640
|
+
incremental.mainloop()
|
|
1641
|
+
|
|
1642
|
+
elif tempind:
|
|
1600
1643
|
retstatus = "FAILED"
|
|
1601
1644
|
skip_counter = step_size
|
|
1602
1645
|
for step in range(num_steps, -1, -1):
|
|
@@ -1954,5 +1997,6 @@ else: # not tempind, covermode
|
|
|
1954
1997
|
smt.write("(exit)")
|
|
1955
1998
|
smt.wait()
|
|
1956
1999
|
|
|
1957
|
-
|
|
1958
|
-
|
|
2000
|
+
if not incremental:
|
|
2001
|
+
print_msg("Status: %s" % retstatus)
|
|
2002
|
+
sys.exit(0 if retstatus == "PASSED" else 1)
|
yowasp_yosys/witness.py
CHANGED
|
@@ -33,10 +33,14 @@ def cli():
|
|
|
33
33
|
Display a Yosys witness trace in a human readable format.
|
|
34
34
|
""")
|
|
35
35
|
@click.argument("input", type=click.File("r"))
|
|
36
|
-
|
|
36
|
+
@click.option("--skip-x", help="Treat x bits as unassigned.", is_flag=True)
|
|
37
|
+
def display(input, skip_x):
|
|
37
38
|
click.echo(f"Reading Yosys witness trace {input.name!r}...")
|
|
38
39
|
inyw = ReadWitness(input)
|
|
39
40
|
|
|
41
|
+
if skip_x:
|
|
42
|
+
inyw.skip_x()
|
|
43
|
+
|
|
40
44
|
def output():
|
|
41
45
|
|
|
42
46
|
yield click.style("*** RTLIL bit-order below may differ from source level declarations ***", fg="red")
|
|
@@ -91,7 +95,11 @@ If two or more inputs are provided they will be concatenated together into the o
|
|
|
91
95
|
@click.option("--append", "-p", type=int, multiple=True,
|
|
92
96
|
help="Number of steps (+ve or -ve) to append to end of input trace. "
|
|
93
97
|
+"Can be defined multiple times, following the same order as input traces. ")
|
|
94
|
-
|
|
98
|
+
@click.option("--skip-x", help="Leave input x bits unassigned.", is_flag=True)
|
|
99
|
+
def yw2yw(inputs, output, append, skip_x):
|
|
100
|
+
if len(inputs) == 0:
|
|
101
|
+
raise click.ClickException(f"no inputs specified")
|
|
102
|
+
|
|
95
103
|
outyw = WriteWitness(output, "yosys-witness yw2yw")
|
|
96
104
|
join_inputs = len(inputs) > 1
|
|
97
105
|
inyws = {}
|
|
@@ -129,12 +137,12 @@ def yw2yw(inputs, output, append):
|
|
|
129
137
|
click.echo(f"Copying yosys witness trace from {input.name!r} to {output.name!r}...")
|
|
130
138
|
|
|
131
139
|
if first_witness:
|
|
132
|
-
outyw.step(init_values)
|
|
140
|
+
outyw.step(init_values, skip_x=skip_x)
|
|
133
141
|
else:
|
|
134
|
-
outyw.step(inyw.first_step())
|
|
142
|
+
outyw.step(inyw.first_step(), skip_x=skip_x)
|
|
135
143
|
|
|
136
144
|
for t, values in inyw.steps(1):
|
|
137
|
-
outyw.step(values)
|
|
145
|
+
outyw.step(values, skip_x=skip_x)
|
|
138
146
|
|
|
139
147
|
click.echo(f" copied {t + 1} time steps.")
|
|
140
148
|
first_witness = False
|
|
@@ -174,7 +182,8 @@ This requires a Yosys witness AIGER map file as generated by 'write_aiger -ywmap
|
|
|
174
182
|
@click.argument("input", type=click.File("r"))
|
|
175
183
|
@click.argument("mapfile", type=click.File("r"))
|
|
176
184
|
@click.argument("output", type=click.File("w"))
|
|
177
|
-
|
|
185
|
+
@click.option("--skip-x", help="Leave input x bits unassigned.", is_flag=True)
|
|
186
|
+
def aiw2yw(input, mapfile, output, skip_x):
|
|
178
187
|
input_name = input.name
|
|
179
188
|
click.echo(f"Converting AIGER witness trace {input_name!r} to Yosys witness trace {output.name!r}...")
|
|
180
189
|
click.echo(f"Using Yosys witness AIGER map file {mapfile.name!r}")
|
|
@@ -245,7 +254,7 @@ def aiw2yw(input, mapfile, output):
|
|
|
245
254
|
|
|
246
255
|
values[bit] = v
|
|
247
256
|
|
|
248
|
-
outyw.step(values)
|
|
257
|
+
outyw.step(values, skip_x=skip_x)
|
|
249
258
|
|
|
250
259
|
outyw.end_trace()
|
|
251
260
|
|
yowasp_yosys/yosys.wasm
CHANGED
|
Binary file
|
yowasp_yosys/ywio.py
CHANGED
|
@@ -351,11 +351,14 @@ class WriteWitness:
|
|
|
351
351
|
self.out.name("steps")
|
|
352
352
|
self.out.begin_array()
|
|
353
353
|
|
|
354
|
-
def step(self, values):
|
|
354
|
+
def step(self, values, skip_x=False):
|
|
355
355
|
if not self.header_written:
|
|
356
356
|
self.write_header()
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
packed = values.pack(self.sigmap)
|
|
359
|
+
if skip_x:
|
|
360
|
+
packed = packed.replace('x', '?')
|
|
361
|
+
self.out.value({"bits": packed})
|
|
359
362
|
|
|
360
363
|
self.t += 1
|
|
361
364
|
|
|
@@ -390,6 +393,9 @@ class ReadWitness:
|
|
|
390
393
|
|
|
391
394
|
self.bits = [step["bits"] for step in data["steps"]]
|
|
392
395
|
|
|
396
|
+
def skip_x(self):
|
|
397
|
+
self.bits = [step.replace('x', '?') for step in self.bits]
|
|
398
|
+
|
|
393
399
|
def init_step(self):
|
|
394
400
|
return self.step(0)
|
|
395
401
|
|
{yowasp_yosys-0.35.0.0.post605.dist-info → yowasp_yosys-0.36.0.8.post623.dev0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: yowasp-yosys
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.36.0.8.post623.dev0
|
|
4
4
|
Summary: Yosys Open SYnthesis Suite
|
|
5
5
|
Author-email: Catherine <whitequark@whitequark.org>
|
|
6
6
|
License: ISC
|
|
@@ -13,8 +13,8 @@ Requires-Dist: yowasp-runtime ~=1.12
|
|
|
13
13
|
Requires-Dist: click
|
|
14
14
|
Requires-Dist: importlib-resources ; python_version < "3.9"
|
|
15
15
|
|
|
16
|
-
YoWASP Yosys
|
|
17
|
-
|
|
16
|
+
YoWASP Yosys package
|
|
17
|
+
====================
|
|
18
18
|
|
|
19
19
|
This package provides [Yosys][] binaries built for [WebAssembly][]. See the [overview of the YoWASP project][yowasp] for details.
|
|
20
20
|
|
|
@@ -26,18 +26,18 @@ This package provides [Yosys][] binaries built for [WebAssembly][]. See the [ove
|
|
|
26
26
|
Versioning
|
|
27
27
|
----------
|
|
28
28
|
|
|
29
|
-
The version of this package is derived from the upstream Yosys package version in the
|
|
29
|
+
The version of this package is derived from the upstream Yosys package version in the `X.Y[.Z][+N]` format, and is comprised of five or six parts in a `X.Y.Z.N.postM[.dev]` format, where the symbols are:
|
|
30
30
|
|
|
31
|
-
1.
|
|
32
|
-
2.
|
|
33
|
-
3.
|
|
34
|
-
4.
|
|
35
|
-
5.
|
|
36
|
-
6.
|
|
31
|
+
1. `X`: Yosys major version
|
|
32
|
+
2. `Y`: Yosys minor version
|
|
33
|
+
3. `Z`: Yosys patch version; only present for some Yosys releases, zero if not present
|
|
34
|
+
4. `N`: zero for packages built from Yosys releases, `N` for packages built from unreleased Yosys snapshots; matches the `N` in the `X.Y+N` upstream version
|
|
35
|
+
5. `postM`: package build version; disambiguates different builds produced from the same Yosys source tree
|
|
36
|
+
6. `dev`: present only for packages built from unreleased Yosys snapshots; marks these packages as pre-releases
|
|
37
37
|
|
|
38
38
|
With this scheme, there is a direct correspondence between upstream versions and [PEP 440][pep440] Python package versions. Packages built from unreleased snapshots are ignored by pip by default, but can be still installed explicitly. (These packages are uploaded daily to [TestPyPI][], but only occasionally to [PyPI][].)
|
|
39
39
|
|
|
40
|
-
A different versioning scheme was used earlier, where the package build version was denoted by a
|
|
40
|
+
A different versioning scheme was used earlier, where the package build version was denoted by a `.devM` suffix. This scheme did not work well with [PEP 440 version specifiers][pep440-vs] and was retired.
|
|
41
41
|
|
|
42
42
|
[testpypi]: https://test.pypi.org/
|
|
43
43
|
[pypi]: https://pypi.org/
|
|
@@ -48,7 +48,7 @@ A different versioning scheme was used earlier, where the package build version
|
|
|
48
48
|
Configuration
|
|
49
49
|
-------------
|
|
50
50
|
|
|
51
|
-
See the documentation for [
|
|
51
|
+
See the documentation for [the Python YoWASP runtime](https://github.com/YoWASP/runtime-py#configuration).
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
License
|