Indexing into a list of submodules and writing/reading the submodule ports is not translatable:
class ListOfModules( Model ):
def __init__( s ):
s.in_ = [ InPort ( 4 ) for x in range(2) ]
s.out = [ OutPort( 4 ) for x in range(2) ]
def elaborate_logic( s ):
s.mod = [ PassThrough( 4 ) for x in range(2) ]
@s.combinational
def logic():
for i in range( 2 ):
# Writing to the input port of each submodule in a list!
s.mod[i].in_.value = s.in_[i]
# Reading the output port of each submodule in a list!
s.out[i].value = s.mod[i].out
Indexing into a list of submodules and writing/reading the submodule ports is not translatable: