|
|
@ -199,14 +199,8 @@ def test_b01(mydir): |
|
|
|
bp_to_mv(s.s[1]) |
|
|
|
bp_to_mv(s.s[1]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sim_and_compare(v_file, stil_file, m=8): |
|
|
|
def sim_and_compare(c, test_resp, m=8): |
|
|
|
from kyupy import verilog, stil |
|
|
|
tests, resp = test_resp |
|
|
|
from kyupy.techlib import SAED32 |
|
|
|
|
|
|
|
c = verilog.load(v_file, branchforks=True, tlib=SAED32) |
|
|
|
|
|
|
|
c.resolve_tlib_cells(SAED32) |
|
|
|
|
|
|
|
s = stil.load(stil_file) |
|
|
|
|
|
|
|
tests = s.tests(c)[:,1:] |
|
|
|
|
|
|
|
resp = s.responses(c)[:,1:] |
|
|
|
|
|
|
|
lsim = LogicSim(c, m=m, sims=tests.shape[1]) |
|
|
|
lsim = LogicSim(c, m=m, sims=tests.shape[1]) |
|
|
|
lsim.s[0] = logic.mv_to_bp(tests) |
|
|
|
lsim.s[0] = logic.mv_to_bp(tests) |
|
|
|
lsim.s_to_c() |
|
|
|
lsim.s_to_c() |
|
|
@ -221,26 +215,46 @@ def sim_and_compare(v_file, stil_file, m=8): |
|
|
|
print(f'mismatch pattern:{pat} ppio:{idx} exp:{logic.mv_str(resp[idx,pat])} act:{logic.mv_str(resp_sim[idx,pat])}') |
|
|
|
print(f'mismatch pattern:{pat} ppio:{idx} exp:{logic.mv_str(resp[idx,pat])} act:{logic.mv_str(resp_sim[idx,pat])}') |
|
|
|
assert len(idxs) == 0 |
|
|
|
assert len(idxs) == 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sim_and_compare_6v(c, test_resp): |
|
|
|
|
|
|
|
tests, resp = test_resp |
|
|
|
|
|
|
|
lsim = LogicSim6V(c, sims=tests.shape[1]) |
|
|
|
|
|
|
|
lsim.s[0] = tests |
|
|
|
|
|
|
|
lsim.s_to_c() |
|
|
|
|
|
|
|
lsim.c_prop() |
|
|
|
|
|
|
|
lsim.c_to_s() |
|
|
|
|
|
|
|
resp_sim = lsim.s[1] |
|
|
|
|
|
|
|
idxs, pats = np.nonzero(((resp == logic.ONE) & (resp_sim != logic.ONE)) | ((resp == logic.ZERO) & (resp_sim != logic.ZERO))) |
|
|
|
|
|
|
|
for i, (idx, pat) in enumerate(zip(idxs, pats)): |
|
|
|
|
|
|
|
if i >= 10: |
|
|
|
|
|
|
|
print(f'...') |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
print(f'mismatch pattern:{pat} ppio:{idx} exp:{logic.mv_str(resp[idx,pat])} act:{logic.mv_str(resp_sim[idx,pat])}') |
|
|
|
|
|
|
|
assert len(idxs) == 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_b15_2ig_sa_2v(b15_2ig_circuit_resolved, b15_2ig_sa_nf_test_resp): |
|
|
|
|
|
|
|
sim_and_compare(b15_2ig_circuit_resolved, b15_2ig_sa_nf_test_resp, m=2) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_b15_2ig_sa_2v(mydir): |
|
|
|
def test_b15_2ig_sa_4v(b15_2ig_circuit_resolved, b15_2ig_sa_nf_test_resp): |
|
|
|
sim_and_compare(mydir / 'b15_2ig.v.gz', mydir / 'b15_2ig.sa_nf.stil.gz', m=2) |
|
|
|
sim_and_compare(b15_2ig_circuit_resolved, b15_2ig_sa_nf_test_resp, m=4) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_b15_2ig_sa_4v(mydir): |
|
|
|
def test_b15_2ig_sa_6v(b15_2ig_circuit_resolved, b15_2ig_sa_nf_test_resp): |
|
|
|
sim_and_compare(mydir / 'b15_2ig.v.gz', mydir / 'b15_2ig.sa_nf.stil.gz', m=4) |
|
|
|
sim_and_compare_6v(b15_2ig_circuit_resolved, b15_2ig_sa_nf_test_resp) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_b15_2ig_sa_8v(mydir): |
|
|
|
def test_b15_2ig_sa_8v(b15_2ig_circuit_resolved, b15_2ig_sa_nf_test_resp): |
|
|
|
sim_and_compare(mydir / 'b15_2ig.v.gz', mydir / 'b15_2ig.sa_nf.stil.gz', m=8) |
|
|
|
sim_and_compare(b15_2ig_circuit_resolved, b15_2ig_sa_nf_test_resp, m=8) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_b15_4ig_sa_2v(mydir): |
|
|
|
def test_b15_4ig_sa_2v(b15_4ig_circuit_resolved, b15_4ig_sa_rf_test_resp): |
|
|
|
sim_and_compare(mydir / 'b15_4ig.v.gz', mydir / 'b15_4ig.sa_rf.stil.gz', m=2) |
|
|
|
sim_and_compare(b15_4ig_circuit_resolved, b15_4ig_sa_rf_test_resp, m=2) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_b15_4ig_sa_4v(mydir): |
|
|
|
def test_b15_4ig_sa_4v(b15_4ig_circuit_resolved, b15_4ig_sa_rf_test_resp): |
|
|
|
sim_and_compare(mydir / 'b15_4ig.v.gz', mydir / 'b15_4ig.sa_rf.stil.gz', m=4) |
|
|
|
sim_and_compare(b15_4ig_circuit_resolved, b15_4ig_sa_rf_test_resp, m=4) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_b15_4ig_sa_8v(mydir): |
|
|
|
def test_b15_4ig_sa_8v(b15_4ig_circuit_resolved, b15_4ig_sa_rf_test_resp): |
|
|
|
sim_and_compare(mydir / 'b15_4ig.v.gz', mydir / 'b15_4ig.sa_rf.stil.gz', m=8) |
|
|
|
sim_and_compare(b15_4ig_circuit_resolved, b15_4ig_sa_rf_test_resp, m=8) |
|
|
|