def __init__(s, dtype): s.in_ = InPort(dtype) s.out = OutPort(dtype) s.incrs = [RegIncr(dtype) for _ in range(2)] s.connect(s.in_, s.incrs[0].in_) #------------------------------------------------------- # TASK 2.8: Comment out the Exception and implement the # structural composition below. #------------------------------------------------------- s.connect(s.incrs[0].out, s.incrs[1].in_) s.connect(s.out, s.incrs[-1].out)
def __init__(s, dtype): s.in_ = InPort(dtype) s.out = OutPort(dtype) s.incrs = [RegIncr(dtype) for _ in range(2)] s.connect(s.in_, s.incrs[0].in_) #------------------------------------------------------------------- # TASK 2.8: Comment out the Exception and implement the # structural composition below. #------------------------------------------------------------------- # # - create connections between RegIncrs # - connect s.out to the last RegIncr in list # # Hint: here's a tip for easily indexing the last item in the list: # # s.connect( s.out, s.incrs[-1].out) raise NotImplementedError( 'RegIncrPipeline has not been implemented yet!\n ' 'Put your implementation code here!')