import itertools
import math
+
def first_zero(x):
res = 0
for i in range(16):
sync += self.mux_out.eq(PMux(m, ppts, self.mux_sel, self.a, self.b))
sync += self.mux_out2.eq(Mux(self.mux_sel2, self.a, self.b))
# scalar left shift
- comb += self.bsig.eq(self.b.sig)
+ comb += self.bsig.eq(self.b.lower())
sync += self.ls_scal_output.eq(self.a << self.bsig)
sync += self.rs_scal_output.eq(self.a >> self.bsig)
comb += self.rs_output.eq(self.a >> self.b)
ppts = self.partpoints
# scalar left shift
- comb += self.bsig.eq(self.b.sig)
+ comb += self.bsig.eq(self.b.lower())
comb += self.ls_scal_output.eq(self.a << self.bsig)
# scalar right shift
comb += self.rs_scal_output.eq(self.a >> self.bsig)
sel |= maskbit_list[i]
selmask |= mask_list[i]
- yield module.a.eq(a)
- yield module.b.eq(b)
+ yield module.a.lower().eq(a)
+ yield module.b.lower().eq(b)
yield module.mux_sel.eq(sel)
- yield module.mux_sel2.sig.eq(sel)
+ yield module.mux_sel2.lower().eq(sel)
yield Delay(0.1e-6)
y = 0
# do the partitioned tests
print ("apart bpart", hex(a), hex(b),
list(map(hex, apart)), list(map(hex, bpart)))
- yield module.a.eq(a)
- yield module.b.eq(b)
+ yield module.a.lower().eq(a)
+ yield module.b.lower().eq(b)
yield Delay(0.1e-6)
y = 0
(0x0000, 0x0000),
(0xFFFF, 0xFFFF),
(0x0000, 0xFFFF)] + rand_data:
- yield module.a.eq(a)
- yield module.b.eq(b)
+ yield module.a.lower().eq(a)
+ yield module.b.lower().eq(b)
carry_sig = 0xf if carry else 0
yield module.carry_in.eq(carry_sig)
yield Delay(0.1e-6)
f" => 0x{carry_result:X} != 0x{c_outval:X}"
self.assertEqual(carry_result, c_outval, msg)
+ # run through series of operations with corresponding
+ # "helper" routines to reproduce the result (test_fn). the same
+ # a/b input is passed to *all* outputs, where the name of the
+ # output attribute (mod_attr) will contain the result to be
+ # compared against the expected output from test_fn
for (test_fn, mod_attr) in (
(test_ls_scal_fn, "ls_scal"),
(test_ls_fn, "ls"),
(0xABCD, 0xABCE),
(0x8000, 0x0000),
(0xBEEF, 0xFEED)]:
- yield module.a.eq(a)
- yield module.b.eq(b)
+ yield module.a.lower().eq(a)
+ yield module.b.lower().eq(b)
yield Delay(0.1e-6)
# convert to mask_list
mask_list = []