[libre-riscv-dev] Fwd: Introduction
Jacob Lifshay
programmerjake at gmail.com
Fri May 3 01:49:29 BST 2019
On Thu, May 2, 2019, 17:39 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
wrote:
>
> j = 0
> o_bits = []
> for i in range(self.o_dat.nbits):
> if i in self.retained_bits:
> o_bits.append(self.bits[j])
> j = j + 1
> else:
> o_bits.append(C(0,1))
> m.d.comb += self.o_dat.eq(Cat(*o_bits))
>
> there's proooobably.... there's probably a way to get that down
> somewhat (getting rid of j) by using "yield from", moving it to a
> function...
>
yield from doesn't do the same thing:
yield from bits
is like
for i in bits:
yield i
it goes through every element in bits before going back, rather than
inserting the C(0, 1) values in the sequence like the original code does.
Jacob
More information about the libre-riscv-dev
mailing list