cornell-brg / pymtl

Python-based hardware modeling framework
BSD 3-Clause "New" or "Revised" License
237 stars 82 forks source link

Reading/Writing List-of-Modules Ports in a Concurrent Block not translatable #58

Closed dmlockhart closed 10 years ago

dmlockhart commented 10 years ago

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