def _generate_instances(self, insts): swg_l, flyback_l, bend_l, taper_swg_l, taper_flyback_l = self._get_components( ) for ii in range(self.numrows): # Find component translations (for all numrows) t_swg = i3.Translation((0.0, ii * self.pitch)) t_taper_swg_w = vector_match_transform( taper_swg_l.ports["out"], swg_l.ports['in']) + t_swg t_taper_swg_e = vector_match_transform( taper_swg_l.ports["out"], swg_l.ports['out'], mirrored=True) + t_swg # Add instances (for all numrows) insts += i3.SRef(reference=swg_l, name="SidewallGratWg" + str(ii), transformation=t_swg) insts += i3.SRef(reference=taper_swg_l, name="SwgTaper_West" + str(ii), transformation=t_taper_swg_w) insts += i3.SRef(reference=taper_swg_l, name="SwgTaper_East" + str(ii), transformation=t_taper_swg_e) if ii < (self.numrows - 1): # Find component translations (for numrows-1) flyback_offset = self.grat_wg_width / 2 + self.spacing + self.flyback_wg_width / 2 t_flyback = i3.Translation( (0.0, ii * self.pitch + flyback_offset)) t_taper_flyback_w = vector_match_transform( taper_flyback_l.ports["out"], flyback_l.ports['in']) + t_flyback t_taper_flyback_e = vector_match_transform( taper_flyback_l.ports["out"], flyback_l.ports['out'], mirrored=True) + t_flyback t_bend_e = i3.VMirror() + vector_match_transform( bend_l.ports['in'], taper_swg_l.ports["in"], mirrored=True) + t_taper_swg_e t_bend_w = i3.VMirror() + vector_match_transform( bend_l.ports['out'], taper_flyback_l.ports["in"] ) + t_taper_flyback_w + i3.Translation((0.0, self.pitch)) # Add instances (for numrows-1) insts += i3.SRef(reference=flyback_l, name="FlybackWg" + str(ii), transformation=t_flyback) insts += i3.SRef(reference=taper_flyback_l, name="FlybackTaper_West" + str(ii), transformation=t_taper_flyback_w) insts += i3.SRef(reference=taper_flyback_l, name="FlybackTaper_East" + str(ii), transformation=t_taper_flyback_e) insts += i3.SRef(reference=bend_l, name="Bend_West" + str(ii), transformation=t_bend_w) insts += i3.SRef(reference=bend_l, name="Bend_East" + str(ii), transformation=t_bend_e) return insts
def _default_child_transformations(self): return { "dc1": (0, 0), "dc2": i3.VMirror(0.0) + i3.Translation( (0, self._get_distance_between_dc())) }
def _generate_instances(self, insts): delta = self.trace_template.core_width + self.spacing bend_radius = self.bend_radius coupler_length = self.cell.get_default_view( i3.CircuitModelView).coupler_length shape = i3.Shape([ (-coupler_length / 2.0 - bend_radius, bend_radius), (-coupler_length / 2.0 - bend_radius, 0.0), (-coupler_length / 2.0, 0.0), (coupler_length / 2.0, 0.0), (coupler_length / 2.0 + bend_radius, 0.0), (coupler_length / 2.0 + bend_radius, bend_radius) ]) wg = i3.RoundedWaveguide(name=self.name + "_wg", trace_template=self.trace_template) wg_layout = wg.Layout(shape=shape) insts += i3.SRef(reference=wg_layout, name="wav_top", position=(0, delta / 2.0)) insts += i3.SRef(reference=wg_layout, name="wav_bot", transformation=i3.VMirror() + i3.Translation(translation=(0, -delta / 2.0))) return insts
def _generate_instances(self, insts): insts += i3.SRef(reference=self.cross_marks[0]) insts += i3.SRef(reference=self.cross_marks[1]) vern_1_horz_trans = i3.VMirror() + \ i3.Translation((0, -self.cross_boundary_width * 0.5 - self.vern_cross_spacing - (self.vern_bar_length + self.vern_bar_extra_length) - self.vern_layer_gap)) insts += i3.SRef(reference=self.verniers[0], transformation=vern_1_horz_trans) vern_2_horz_trans = i3.Translation((0, -self.cross_boundary_width * 0.5 - self.vern_cross_spacing - (self.vern_bar_length + self.vern_bar_extra_length))) insts += i3.SRef(reference=self.verniers[1], transformation=vern_2_horz_trans) vern_1_vert_trans = i3.Rotation(rotation=90) + \ i3.Translation((-self.cross_boundary_width*0.5 - self.vern_cross_spacing - (self.vern_bar_length + self.vern_bar_extra_length) - self.vern_layer_gap, 0)) insts += i3.SRef(reference=self.verniers[0], transformation=vern_1_vert_trans) vern_2_vert_trans = i3.Rotation(rotation=270) + \ i3.Translation((-self.cross_boundary_width*0.5 - (self.vern_bar_length + self.vern_bar_extra_length) - self.vern_cross_spacing, 0)) insts += i3.SRef(reference=self.verniers[1], transformation=vern_2_vert_trans) return insts
def _default_child_transformations(self): return { 'splitter': (-(self.spacing_x / 2), 0), 'combiner': i3.HMirror() + i3.Translation((self.spacing_x / 2, 0)), 'modulator1': i3.VMirror() + i3.Translation(translation=(-self.length_modulator / 2.0, -self.spacing_y / 2)), 'modulator2': i3.Translation( (-self.length_modulator / 2.0, self.spacing_y / 2)), }
def _generate_elements(self, elems): elems = super(DropRingAtWavelength.Layout, self)._generate_elements(elems) r = self.directional_coupler.bend_radius dcl = self.directional_coupler.coupler_length # Metal 1 ring_s = i3.RingSegment(layer=self.layer_heater, center=(-dcl / 2.0, r), angle_start=180, angle_end=270, inner_radius=r - self.width_m1 / 2.0, outer_radius=r + self.width_m1 / 2.0) elems += ring_s trans = [ i3.HMirror(), i3.VMirror(mirror_plane_y=self._get_distance_between_dc() / 2.0) ] trans.append(trans[0] + trans[1]) for t in trans: elems += ring_s.transform_copy(t) straights = i3.Path(layer=self.layer_heater, shape=[(-r - dcl / 2.0, r), (-r - dcl / 2.0, self._get_distance_between_dc() - r)], line_width=self.width_m1) elems += straights elems += straights.transform_copy(trans[0]) top = i3.Path(layer=self.layer_heater, shape=[(-dcl / 2.0, self._get_distance_between_dc()), (dcl / 2.0, self._get_distance_between_dc())], line_width=self.width_m1) elems += top return elems
def _default_child_transformations(self): d = {} for counter, child in enumerate(self.child_cells): # We get the layoutview of the childcell spiral = self.child_cells[child].get_default_view(self) isz_0 = spiral.instances['Spiral0'].reference.inner_size sx = isz_0[1] + 200 print 'sx = ', sx #print("inner_size = {}".format(isz_0, isz_1)) number = self.n if self.tipo == 1: d['Spirals' + str(counter)] = i3.Translation( translation=(0.0, (counter) * sx)) #+i3.HMirror()+i3.VMirror() if self.tipo == 2: d['Spirals' + str(counter)] = i3.Translation(translation=( 0.0, -(counter) * sx)) + i3.HMirror() + i3.VMirror() return d
def _generate_instances(self, insts): # Define some parameters gap = 0.2 core_width = wg_t_lo.core_width # Define a rounded waveguide wg = i3.RoundedWaveguide(name=self.name + '_wg1', trace_template=wg_t) wg.Layout(shape=[(-15, 3), (-10, 3), (-5, 0), (5, 0), (10, 3), (15, 3)]) # Define instances insts += i3.SRef(name='wg_top', reference=wg, position=(0, 0.5 * (core_width + gap))) insts += i3.SRef(name='wg_bottom', reference=wg, position=(0, -0.5 * (core_width + gap)), transformation=i3.VMirror()) return insts
def _default_child_transformations(self): trans = dict() row = 5000 trans["CHILD0"] = (0, 0) #MMI trans["CHILD1"] = i3.HMirror(2500) - i3.Translation( (5000, 0)) #MMI trans["CHILD2"] = i3.HMirror(0) + i3.Translation((20000, 0)) # MMI trans["CHILD3"] = i3.Translation((16000, 10000)) # MMI trans['CHILD4'] = i3.VMirror(0) + i3.Translation( (16000, 20000)) #MMI trans['CHIL0'] = (-16000, -4000 + row * 0) trans['CHIL1'] = (-16000, -4000 + row * 1) trans['CHIL2'] = (-16000, -4000 + row * 2) trans['CHIL3'] = (-16000, -4000 + row * 3) trans['CHIL4'] = (-16000, -4000 + row * 4) trans['CHIL5'] = (-16000, -4000 + row * 5) trans['CHIL6'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 0)) trans['CHIL7'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 1)) trans['CHIL8'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 2)) trans['CHIL9'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 3)) trans['CHIL10'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 4)) trans['CHIL11'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 5)) trans['CHIL12'] = (4000, -4000 + row * 0) trans['CHIL13'] = (4000, -4000 + row * 1) trans['CHIL14'] = (4000, -4000 + row * 2) trans['CHIL15'] = (4000, -4000 + row * 3) trans['CHIL16'] = (4000, -4000 + row * 4) trans['CHIL17'] = (4000, -4000 + row * 5) trans['CHIL18'] = (-16000, -4000 + row * 0) trans['CHIL19'] = (-16000, -4000 + row * 1) trans['CHIL20'] = (-16000, -4000 + row * 2) trans['CHIL21'] = (-16000, -4000 + row * 3) trans['CHIL22'] = (-16000, -4000 + row * 4) trans['CHIL23'] = (-16000, -4000 + row * 5) trans['CHIL24'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 0)) trans['CHIL25'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 1)) trans['CHIL26'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 2)) trans['CHIL27'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 3)) trans['CHIL28'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 4)) trans['CHIL29'] = i3.Rotation(rotation=180) + i3.Translation( (16000, -1000 + row * 5)) # for _ in np.arange(10): # trans['CHIL{}'.format(_)] = NotImplemented for _ in range(30, 36, 1): trans['CHIL{}'.format(_)] = (4000, -4000 + row * (_ - 30)) # trans['CHIL30'] = (4000, -4000 + row * 0) # trans['CHIL31'] = (4000, -4000 + row * 1) # trans['CHIL32'] = (4000, -4000 + row * 2) # trans['CHIL33'] = (4000, -4000 + row * 3) # trans['CHIL34'] = (4000, -4000 + row * 4) # trans['CHIL35'] = (4000, -4000 + row * 5) # trans['CHILD23'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 0)) # trans['CHILD24'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 1)) # trans['CHILD25'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 2)) # trans['CHILD26'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 3)) # trans['CHILD27'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 4)) # trans['CHILD28'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 5)) # trans['CHILD29'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 6)) # trans['CHILD32'] = (-14500, -3000 + row * 0) # trans['CHILD33'] = (-14500, -3000 + row * 1) # trans['CHILD34'] = (-14500, -3000 + row * 2) # trans['CHILD35'] = (-14500, -3000 + row * 3) # trans['CHILD36'] = (-14500, -3000 + row * 4) # trans['CHILD37'] = (-14500, -3000 + row * 5) # trans['CHILD38'] = (-14500, -3000 + row * 6) # trans['CHILD39'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 0)) # trans['CHILD40'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 1)) # trans['CHILD41'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 2)) # trans['CHILD42'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 3)) # trans['CHILD43'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 4)) # trans['CHILD44'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 5)) # trans['CHILD45'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 6)) # trans['CHILD46'] = (-2500, -3000 + row * 0) # trans['CHILD47'] = (-2500, -3000 + row * 1) # trans['CHILD48'] = (-2500, -3000 + row * 2) # trans['CHILD49'] = (-2500, -3000 + row * 3) # trans['CHILD50'] = (-2500, -3000 + row * 4) # trans['CHILD51'] = (-2500, -3000 + row * 5) # trans['CHILD52'] = (-2500, -3000 + row * 6) # trans['CHILD53'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 0)) # trans['CHILD54'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 1)) # trans['CHILD55'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 2)) # trans['CHILD56'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 3)) # trans['CHILD57'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 4)) # trans['CHILD58'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 5)) # trans['CHILD59'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 6)) # # trans['CHILD60'] = (-14500, -3000 + row * 0) # trans['CHILD61'] = (-14500, -3000 + row * 1) # trans['CHILD62'] = (-14500, -3000 + row * 2) # trans['CHILD63'] = (-14500, -3000 + row * 3) # trans['CHILD64'] = (-14500, -3000 + row * 4) # trans['CHILD65'] = (-14500, -3000 + row * 5) # trans['CHILD66'] = (-14500, -3000 + row * 6) # trans['CHILD67'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 0)) # trans['CHILD68'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 1)) # trans['CHILD69'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 2)) # trans['CHILD70'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 3)) # trans['CHILD71'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 4)) # trans['CHILD72'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 5)) # trans['CHILD73'] = i3.Rotation(rotation=180) + i3.Translation((14500, 0 + row * 6)) # trans['CHILD74'] = (-2500, -3000 + row * 0) # trans['CHILD75'] = (-2500, -3000 + row * 1) # trans['CHILD76'] = (-2500, -3000 + row * 2) # trans['CHILD77'] = (-2500, -3000 + row * 3) # trans['CHILD78'] = (-2500, -3000 + row * 4) # trans['CHILD79'] = (-2500, -3000 + row * 5) # trans['CHILD80'] = (-2500, -3000 + row * 6) # trans['CHILD81'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 0)) # trans['CHILD82'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 1)) # trans['CHILD83'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 2)) # trans['CHILD84'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 3)) # trans['CHILD85'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 4)) # trans['CHILD86'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 5)) # trans['CHILD87'] = i3.Rotation(rotation=180) + i3.Translation((26500, 0 + row * 6)) return trans
spr6_layout = spr6.Layout() spr7 = my_dc(gap_inc_vec=[300, 200], sm_width=4.0) spr7_layout = spr7.Layout() spr8 = my_dc(gap_inc_vec=[300, 200], sm_width=4.2) spr8_layout = spr8.Layout() pr = PlaceAndAutoRoute( child_cells={ "dc1": spr1, "dc2": spr2, "dc3": spr3, "dc4": spr4, "dc5": spr5, "dc6": spr6, "dc7": spr7, "dc8": spr8 }) pr_layout = pr.Layout( child_transformations={ "dc1": (0, 0), "dc2": i3.VMirror(-2000) + i3.Translation((0, 4000)), "dc3": (0, 8500), "dc4": i3.VMirror(-2000) + i3.Translation((0, 12500)), "dc5": (0, 17000), "dc6": i3.VMirror(-2000) + i3.Translation((0, 21000)), "dc7": (0, 25500), "dc8": i3.VMirror(-2000) + i3.Translation((0, 29500)) }) # pr_layout.visualize() pr_layout.write_gdsii("spiral.gds")
def _generate_instances(self, insts): swg_l, flyback_l, bend_l, taper_swg_l, taper_flyback_l = self._get_components( ) # Hard code the tapers into here: (I hate hardcoding stuff, but no choice here) taper_length = 79.0 # 79 is the best according to deniz' sims width_etch = 4.0 wg_width = 0.5 taper_swg = ParabolicTaper( name=self.name + '_TAPER').get_default_view(i3.LayoutView) taper_swg.set(length=taper_length, width1=wg_width, width2=self.grat_wg_width, width_etch=width_etch) taper_flyback = ParabolicTaper( name=self.name + '_OTHERTAPER').get_default_view(i3.LayoutView) taper_flyback.set(length=taper_length, width1=wg_width, width2=self.flyback_wg_width, width_etch=width_etch) for ii in range(self.numrows): # Find component translations (for all numrows) t_swg = i3.Translation((0.0, ii * self.pitch)) # t_taper_swg_w = vector_match_transform(taper_swg_l.ports["out"], swg_l.ports['in']) + t_swg # t_taper_swg_e = vector_match_transform(taper_swg_l.ports["out"], swg_l.ports['out'], mirrored=True) + t_swg t_taper_swg_w = vector_match_transform( taper_swg.ports["right"], swg_l.ports['in']) + t_swg t_taper_swg_e = vector_match_transform( taper_swg.ports["right"], swg_l.ports['out'], mirrored=True) + t_swg # Add grating rows + grating row tapers insts += i3.SRef(reference=swg_l, name="SidewallGratWg" + str(ii), transformation=t_swg) # insts += i3.SRef(reference=taper_swg_l, name="SwgTaper_West" + str(ii), transformation=t_taper_swg_w) # insts += i3.SRef(reference=taper_swg_l, name="SwgTaper_East" + str(ii), transformation=t_taper_swg_e) insts += i3.SRef(reference=taper_swg, name="SwgTaper_West" + str(ii), transformation=t_taper_swg_w) insts += i3.SRef(reference=taper_swg, name="SwgTaper_East" + str(ii), transformation=t_taper_swg_e) if ii < (self.numrows - 1): # Find component translations (for numrows-1) flyback_offset = self.grat_wg_width / 2 + self.spacing + self.flyback_wg_width / 2 t_flyback = i3.Translation( (0.0, ii * self.pitch + flyback_offset)) # t_taper_flyback_w = vector_match_transform(taper_flyback_l.ports["out"], flyback_l.ports['in']) + t_flyback # t_taper_flyback_e = vector_match_transform(taper_flyback_l.ports["out"], flyback_l.ports['out'], # mirrored=True) + t_flyback t_taper_flyback_w = vector_match_transform( taper_flyback.ports["right"], flyback_l.ports['in'] ) \ + t_flyback t_taper_flyback_e = vector_match_transform( taper_flyback.ports["right"], flyback_l.ports['out'], mirrored = True ) \ + t_flyback # t_bend_e = i3.VMirror() + vector_match_transform(bend_l.ports['in'], taper_swg_l.ports["in"],mirrored=True) + t_taper_swg_e t_bend_e = i3.VMirror() \ + vector_match_transform( bend_l.ports['in'], taper_swg.ports["left"], mirrored = True ) \ + t_taper_swg_e t_bend_w = i3.VMirror() \ + vector_match_transform( bend_l.ports['out'], taper_flyback.ports["left"] ) \ + t_taper_flyback_w \ + i3.Translation( (0.0, self.pitch) ) # Add instances (for numrows-1) # flyback waveguide insts += i3.SRef(reference=flyback_l, name="FlybackWg" + str(ii), transformation=t_flyback) # flyback tapers # insts += i3.SRef( reference = taper_flyback_l, # name = "FlybackTaper_West" + str(ii), # transformation = t_taper_flyback_w ) # insts += i3.SRef( reference = taper_flyback_l, # name = "FlybackTaper_East" + str(ii), # transformation = t_taper_flyback_e ) insts += i3.SRef(reference=taper_flyback, name="FlybackTaper_West" + str(ii), transformation=t_taper_flyback_w) insts += i3.SRef(reference=taper_flyback, name="FlybackTaper_East" + str(ii), transformation=t_taper_flyback_e) # bends insts += i3.SRef(reference=bend_l, name="Bend_West" + str(ii), transformation=t_bend_w) insts += i3.SRef(reference=bend_l, name="Bend_East" + str(ii), transformation=t_bend_e) # end if # end for loop return insts