<s> from migen import * <EOL> from migen . fhdl import verilog <EOL> from functools import reduce <EOL> from operator import or_ <EOL> def gen_list ( n ) : <EOL> s = [ Signal ( ) for i in range ( n ) ] <EOL> return s <EOL> def gen_2list ( n ) : <EOL> s = [ Signal ( <NUM_LIT:2> ) for i in range ( n ) ] <EOL> return s <EOL> class Foo : <EOL> def __init__ ( self ) : <EOL> la = gen_list ( <NUM_LIT:3> ) <EOL> lb = gen_2list ( <NUM_LIT:2> ) <EOL> self . sigs = la + lb <EOL> class Bar : <EOL> def __init__ ( self ) : <EOL> self . sigs = gen_list ( <NUM_LIT:2> ) <EOL> class Example ( Module ) : <EOL> def __init__ ( self ) : <EOL> a = [ Bar ( ) for x in range ( <NUM_LIT:3> ) ] <EOL> b = [ Foo ( ) for x in range ( <NUM_LIT:3> ) ] <EOL> c = b <EOL> b = [ Bar ( ) for x in range ( <NUM_LIT:2> ) ] <EOL> output = Signal ( ) <EOL> allsigs = [ ] <EOL> for lst in [ a , b , c ] : <EOL> for obj in lst : <EOL> allsigs . extend ( obj . sigs ) <EOL> self . comb += output . eq ( reduce ( or_ , allsigs ) ) <EOL> print ( verilog . convert ( Example ( ) ) ) </s>
