def stimulus(): stopped.next = 0 exp = intbv(0)[W:] val = intbv(0)[W:] v = [intbv(0)[W:] for i in range(L)] random_word = intbv(0)[32:] random_word[:] = 93 for i in range(2**18): exp[:] = 0 for s in range(L): random_word[:] = glibc_random(random_word) val[:] = random_word[W:] if exp < val: exp[:] = val v[s][:] = val a0.next = v[0] a1.next = v[1] a2.next = v[2] a3.next = v[3] a4.next = v[4] a5.next = v[5] a6.next = v[6] a7.next = v[7] a8.next = v[8] a9.next = v[9] a10.next = v[10] a11.next = v[11] a12.next = v[12] a13.next = v[13] a14.next = v[14] a15.next = v[15] a16.next = v[16] a17.next = v[17] a18.next = v[18] a19.next = v[19] a20.next = v[20] a21.next = v[21] a22.next = v[22] a23.next = v[23] a24.next = v[24] a25.next = v[25] a26.next = v[26] a27.next = v[27] a28.next = v[28] a29.next = v[29] a30.next = v[30] a31.next = v[31] yield clock.negedge assert z == exp stopped.next = 1 yield delay(10)
def stimulus(): stopped.next = 0 yield delay(10) random_word = intbv(0)[32:] p = intbv(0)[16:] q = intbv(0)[22:] d = intbv(0)[38:] yield clock.negedge reset.next = 0 yield clock.negedge reset.next = 1 yield clock.negedge reset.next = 0 start.next = 0 yield clock.negedge random_word[:] = 94 for i in range(nrvectors): yield clock.negedge random_word[:] = glibc_random(random_word) p[:] = random_word[16:] random_word[:] = glibc_random(random_word) q[:] = random_word[22:] if p == 0: q[:] = MAXVAL d[:] = p * q dividend.next = d divisor.next = p start.next = 1 yield clock.negedge start.next = 0 yield ready.posedge """compensate for Verilog's non-determinism""" yield delay(1) #print d, p, q, quotient assert quotient == q stopped.next = 1 yield delay(10)
def stimulus(): stopped.next = 0 yield delay(10) exp = intbv(0)[W:] val = intbv(0)[W:] random_word = intbv(0)[32:] random_word[:] = 93 for i in range(2**18): exp[:] = 0 for s in range(L): random_word[:] = glibc_random(random_word) val[:] = random_word[W:] if exp < val: exp[:] = val a[s].next = val yield clock.negedge assert z == exp stopped.next = 1 yield delay(10)