[Libre-soc-dev] daily kan-ban update 06AUG2020

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sat Aug 8 18:30:08 BST 2020

tobias this looks quite reasonable, still resting however
i think you managed it, where i couldn't quite work it out.


+    for i in range(len(signal)):
+        bit = signal[i]
+        for j in range(8):
+            lst += [bit]
+    return Cat(*lst)

this is what Repl is for.

use this instead:

for i in range(signal.width):
lst.append(Repl(signal[i], 8)
return Cat(*lst)

or perhaps:

for bit in signal:
lst.append(Repl(bit, 8))
return Cat(*lst)

i know it is possible to use list incomprehensions there,
however list incomprehensions are, by definition, incomprehensible.
i leave it to you to choose because four lines can be reduced to one
in this case.

 +    if(type(signal)==int):

use if isinstance(signal, int), never use "type" for this purpose.


crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68

More information about the Libre-soc-dev mailing list