[libre-riscv-dev] Fwd: Introduction

Luke Kenneth Casson Leighton lkcl at lkcl.net
Fri May 3 02:00:48 BST 2019


On Fri, May 3, 2019 at 1:49 AM Jacob Lifshay <programmerjake at gmail.com> wrote:
>
> 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

 yes, that's what i intended.... except of course it doesn't help,
it's not "mixing" - selecting a bit *from* "bits", it's returning
*all* of "bits" each time.

there must be a way to do that.... in the meantime, looks like the j
+= 1 thing is the best option, after all, samuel.

l.



More information about the libre-riscv-dev mailing list