示例#1
0
def test_L1_port_index():
    a = CaseConnectPortIndexComp.DUT()
    a.elaborate()
    a.apply(StructuralRTLIRGenL1Pass(gen_connections(a)))
    connections = a.get_metadata(StructuralRTLIRGenL1Pass.connections)
    comp = sexp.CurComp(a, 's')
    assert connections == \
      [(sexp.PortIndex(sexp.CurCompAttr(comp, 'in_'), 2), sexp.CurCompAttr(comp, 'out'))]
def test_L1_port_index():
    a = CaseConnectPortIndexComp.DUT()
    a.elaborate()
    a.apply(StructuralRTLIRGenL1Pass(gen_connections(a)))
    ns = a._pass_structural_rtlir_gen
    comp = sexp.CurComp(a, 's')
    assert ns.connections == \
      [(sexp.PortIndex(sexp.CurCompAttr(comp, 'in_'), 2), sexp.CurCompAttr(comp, 'out'))]
def test_L1_port_index():
    class A(dsl.Component):
        def construct(s):
            s.in_ = [dsl.InPort(Bits32) for _ in range(5)]
            s.out = dsl.OutPort(Bits32)
            dsl.connect(s.in_[2], s.out)

    a = A()
    a.elaborate()
    a.apply(StructuralRTLIRGenL1Pass(*gen_connections(a)))
    ns = a._pass_structural_rtlir_gen
    comp = sexp.CurComp(a, 's')
    assert ns.connections == \
      [(sexp.PortIndex(sexp.CurCompAttr(comp, 'in_'), 2), sexp.CurCompAttr(comp, 'out'))]