def _default_wgs(self): wg_in = i3.RoundedWaveguide(name=self.name + "_wg_in", trace_template=self.wg_coupler_template) wg_pass = i3.RoundedWaveguide(name=self.name + "_wg_pass", trace_template=self.wg_coupler_template) # wg_ring = i3.RoundedWaveguide(name=self.name+"_wg_ring", trace_template=self.wg_coupler_template) return wg_in, wg_pass # , wg_pass, wg_ring
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 _default_wgs(self): wgs = [] name_list = ["_wg_in1", "_wg_in2", "_wg_out1", "_wg_out2"] template_list = [ self.wg_template1, self.wg_template2, self.wg_template1, self.wg_template2 ] for idx, name in enumerate(name_list): wg = i3.RoundedWaveguide(name=self.name + name_list[idx], trace_template=template_list[idx]) wgs.append(wg) return wgs
def manhattan(start_port, end_port, name=None, control_points=[], shape=None, connector_kwargs={}): trace_template = get_template(start_port,end_port) if "bend_radius" in connector_kwargs: bend_radius = connector_kwargs["bend_radius"] else: bend_radius = 20. if shape is None: shape = route_manhattan(start_port=start_port, end_port=end_port, bend_radius=bend_radius,control_points=control_points) wav = i3.RoundedWaveguide(trace_template=trace_template, name=name) wav.Layout(bend_radius=bend_radius, shape=shape) return wav
def sbend(start_port, end_port, name=None, shape=None, connector_kwargs={}): trace_template = get_template(start_port, end_port) if "bend_radius" in connector_kwargs: bend_radius = connector_kwargs["bend_radius"] else: bend_radius = 20.0 if shape == None: shape = route_sbend(start_port=start_port, end_port=end_port, bend_radius=bend_radius) wav = i3.RoundedWaveguide(trace_template=trace_template,name=name) lv = wav.Layout(bend_radius=bend_radius, shape=shape) return wav
def __example1(cls): from technologies import silicon_photonics from picazzo3.fibcoup.curved import FiberCouplerCurvedGrating from picazzo3.routing.place_route import PlaceComponents from ipkiss3 import all as i3 from routing.route_through_control_points import RouteManhattanControlPoints # Placing the components of the circuit gr = FiberCouplerCurvedGrating() circuit = PlaceComponents(child_cells={ 'gr': gr, 'grb1': gr, 'grb2': gr }) circuit_layout = circuit.Layout( child_transformations={ 'gr': (0, 0), 'grb1': (-100, 0), 'grb2': i3.Rotation(rotation=180.0) + i3.Translation((+100, 0)) }) # We now use the placed components and make waveguides. control_points = [(-40, 20), (50, 0)] route = RouteManhattanControlPoints( input_port=circuit_layout.instances['grb1'].ports['out'], output_port=circuit_layout.instances['grb2'].ports['out'], control_points=control_points, rounding_algorithm=None) wire = i3.RoundedWaveguide() wl = wire.Layout(shape=route) # We create a new placecomponents with the wire included. circuit_child_cells = dict(circuit.child_cells) circuit_child_cells['wire'] = wire circuit_with_wire = PlaceComponents(child_cells=circuit_child_cells) circuit_with_wire_layout = circuit_with_wire.Layout( child_transformations=circuit_layout.child_transformations) circuit_with_wire_layout.visualize()
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 _generate_instances(self, insts): # Generates taper clip # make my OWN custom waveguide trace template # wg_trace = f_MyIMECWaveguideTemplate(core_width=self.taper_prop_dict['width1'], # cladding_width=self.taper_prop_dict['width1'] + 2.0 * self.taper_prop_dict['width_etch']) # make waveguide wg = i3.Waveguide(trace_template=StripWgTemplate(), name=self.name + '_WG') wg_round = i3.RoundedWaveguide(trace_template=StripWgTemplate(), name=self.name + '_WG_ROUND') # how much to translate bends left/right # t_left = i3.Translation((self.bend_radius + (float(self.n_rows)/2.0) )) t_left = i3.Translation((-2.5 * self.bend_radius, 0.0)) t_right = i3.Translation((2.5 * self.bend_radius, 0.0)) # draw taper pair rows for ii in range(self.n_rows): # add rows tp_rows_layout = TaperPairRow(name=self.name + '_TProw' + str(ii)).get_default_view( i3.LayoutView) tp_rows_layout.set( taper_prop_dict=self.taper_prop_dict, connect_length=self.connect_length, pair_connect_length=self.pair_connect_length, n_pairs=self.n_taper_pairs_per_row) # set translation t = i3.Translation((0.0, float(ii) * self.row_spacing)) # place taper pair row tp_row_name = self.name + '_TP_ROW' + str(ii) insts += i3.SRef(name=tp_row_name, reference=tp_rows_layout, transformation=t) # draw connecting arcs if ii > 0: if (ii % 2) == 1: # bend on the right # make shape bend row_name = self.name + '_TP_ROW' + str(ii - 1) shape_bend = i3.ShapeBend(start_point=insts[row_name]. ports['right'].position, radius=self.bend_radius, start_angle=-90.05, end_angle=90.05, angle_step=0.1) # add 180 deg bend wg_copy = i3.Waveguide( trace_template=StripWgTemplate(), name=self.name + '_arc_r' + str(ii)) arc_name = self.name + '_arc' + str(ii) insts += i3.SRef( name=arc_name, reference=wg_copy.Layout(shape=shape_bend), transformation=t_right) # connect bottom wgs # get coords in_port_coords = insts[arc_name].ports['in'].position out_port_coords = insts[row_name].ports[ 'right'].position # draw bezier curve bez = BezierCurve( N=100, P0=(in_port_coords[0] + 0.01, in_port_coords[1]), P1=(in_port_coords[0] - self.bend_radius / 2.0, in_port_coords[1]), P2=(out_port_coords[0] + self.bend_radius / 2.0, out_port_coords[1]), P3=(out_port_coords[0] - 0.01, out_port_coords[1]), R=(-self.bend_radius, +self.bend_radius), dy_dx=(0.0, -0.0)) bez_coords = bez.bezier_coords() # make ipkiss shape s = i3.Shape(bez_coords) # add bottom wg connector wg_copy = i3.Waveguide( trace_template=StripWgTemplate(), name=self.name + '_arc_r_con' + str(ii)) insts += i3.SRef(name=self.name + '_con_wg_r_b_' + str(ii), reference=wg_copy.Layout(shape=s)) # connect top wgs next_row_name = self.name + '_TP_ROW' + str(ii) in_port_coords = insts[arc_name].ports['out'].position out_port_coords = insts[next_row_name].ports[ 'right'].position # draw bezier curve bez = BezierCurve( N=500, P0=(in_port_coords[0] + 0.01, in_port_coords[1]), P1=(in_port_coords[0] - self.bend_radius / 2.0, in_port_coords[1]), P2=(out_port_coords[0] + self.bend_radius / 2.0, out_port_coords[1]), P3=(out_port_coords[0] - 0.01, out_port_coords[1]), R=(self.bend_radius, -self.bend_radius), dy_dx=(0.0, -0.0)) bez_coords = bez.bezier_coords() # make ipkiss shape s = i3.Shape(bez_coords) # add wg bend wg_copy = i3.Waveguide( trace_template=StripWgTemplate(), name=self.name + '_bez_r' + str(ii)) insts += i3.SRef(name=self.name + '_con_wg_r_t_' + str(ii), reference=wg_copy.Layout(shape=s)) else: # bend on the left # make shape bend row_name = self.name + '_TP_ROW' + str(ii - 1) shape_bend = i3.ShapeBend(start_point=( insts[row_name].ports['left'].position), radius=self.bend_radius, start_angle=90.05, end_angle=-90.05, angle_step=0.1, clockwise=False) # add 180 deg bend wg_copy = i3.Waveguide( trace_template=StripWgTemplate(), name=self.name + '_arc_l' + str(ii)) arc_name = self.name + '_arc' + str(ii) insts += i3.SRef( name=arc_name, reference=wg_copy.Layout(shape=shape_bend), transformation=t_left) # connect bottom wgs # get coords in_port_coords = insts[arc_name].ports['out'].position out_port_coords = insts[row_name].ports[ 'left'].position # draw bezier curve bez = BezierCurve( N=100, P0=(in_port_coords[0] - 0.01, in_port_coords[1]), P1=(in_port_coords[0] + self.bend_radius / 2.0, in_port_coords[1]), P2=(out_port_coords[0] - self.bend_radius / 2.0, out_port_coords[1]), P3=(out_port_coords[0] + 0.01, out_port_coords[1]), R=(-self.bend_radius, +self.bend_radius), dy_dx=(0.0, -0.0)) bez_coords = bez.bezier_coords() # make ipkiss shape s = i3.Shape(bez_coords) # add bottom wg connector wg_copy = i3.Waveguide( trace_template=StripWgTemplate(), name=self.name + '_arc_l_con' + str(ii)) insts += i3.SRef(name=self.name + '_con_wg_l_b_' + str(ii), reference=wg_copy.Layout(shape=s)) # connect top wgs next_row_name = self.name + '_TP_ROW' + str(ii) in_port_coords = insts[arc_name].ports['in'].position out_port_coords = insts[next_row_name].ports[ 'left'].position # draw bezier curve bez = BezierCurve( N=500, P0=(in_port_coords[0] - 0.01, in_port_coords[1]), P1=(in_port_coords[0] + self.bend_radius / 2.0, in_port_coords[1]), P2=(out_port_coords[0] - self.bend_radius / 2.0, out_port_coords[1]), P3=(out_port_coords[0] + 0.01, out_port_coords[1]), R=(-self.bend_radius, +self.bend_radius), dy_dx=(0.0, -0.0)) bez_coords = bez.bezier_coords() # make ipkiss shape s = i3.Shape(bez_coords) # add wg bend wg_copy = i3.Waveguide( trace_template=StripWgTemplate(), name=self.name + '_bez_l' + str(ii)) insts += i3.SRef(name=self.name + '_con_wg_l_t_' + str(ii), reference=wg_copy.Layout(shape=s)) # end if bend # end drawing connecting arcs # end for ii in range(self.rows) # # connect the input grating # # pick grating layout to return # grating_layout = { # 'FGCCTE_FC1DC_625_313': FGCCTE_FC1DC_625_313().Layout(), # 'FGCCTE_FCWFC1DC_630_378': FGCCTE_FCWFC1DC_630_378().Layout(), # 'FGCCTM_FC1DC_984_492': FGCCTM_FC1DC_984_492().Layout(), # }[self.grating_name] # # # # # place bottom grating # # always assuming bottom grating starts on the left # bot_grating_name = self.name+'_bot_grating' # t = i3.vector_match_transform( grating_layout.ports['waveguide'], # insts[self.name + '_TP_ROW0'].ports['left'] ) + \ # i3.Translation( ( -self.bot_gc_connect_length, 0.0 ) ) # # insts += i3.SRef( name = bot_grating_name, # reference = grating_layout, # transformation = t ) # # # connect bottom grating to taper # route_wg_bot = i3.RouteManhattan( input_port = insts[bot_grating_name].ports['waveguide'], # output_port = insts[self.name + '_TP_ROW0'].ports['left'] ) # # # add wg # wg_bot = i3.Waveguide( trace_template = StripWgTemplate(), name = self.name + '_WG_BOT') # insts += i3.SRef(name=self.name + '_connect_wg_bot', reference=wg_bot.Layout(shape=route_wg_bot)) # # # # # place top grating # top_grating_name = self.name + '_top_grating' # if (self.n_rows % 2) == 1: # # even # of rows, output is to the right # t = i3.vector_match_transform( grating_layout.ports['waveguide'], # insts[self.name + '_TP_ROW' + str(self.n_rows-1)].ports['right'], # mirrored = True ) + \ # i3.Translation((self.top_gc_connect_length, 0.0)) # # insts += i3.SRef( name = top_grating_name, # reference = grating_layout, # transformation = t) # # # connect top grating to taper # route_wg_top = i3.RouteManhattan( input_port = insts[top_grating_name].ports['waveguide'], # output_port = insts[self.name + '_TP_ROW' + str(self.n_rows-1)].ports['right']) # # # add wg # wg_top = i3.Waveguide( trace_template = StripWgTemplate(), name = self.name + '_WG_TOP') # insts += i3.SRef(name=self.name + '_connect_wg_top', reference=wg_top.Layout(shape=route_wg_top)) # # else: # # odd # of rows, output is to the left # t = i3.vector_match_transform( grating_layout.ports['waveguide'], # insts[self.name + '_TP_ROW' + str(self.n_rows-1)].ports['left'], # mirrored = False ) + \ # i3.Translation((-self.top_gc_connect_length, 0.0)) # # insts += i3.SRef( name = top_grating_name, # reference = grating_layout, # transformation = t) # # # connect top grating to taper # route_wg_top = i3.RouteManhattan( input_port = insts[top_grating_name].ports['waveguide'], # output_port = insts[self.name + '_TP_ROW' + str(self.n_rows-1)].ports['left']) # # # add wg # wg_top = i3.Waveguide( trace_template = StripWgTemplate(), name = self.name + '_WG_TOP') # insts += i3.SRef(name=self.name + '_connect_wg_top', reference=wg_top.Layout(shape=route_wg_top)) return insts
# Creation of an S-Bend from technologies import silicon_photonics from ipkiss3 import all as i3 ### Solution ### wg_t_2 = WireWaveguideTemplate() wg_t_2.Layout(core_width=0.3, cladding_width=2 * 3.0 + 0.47) start_point = i3.Coord2((0.0, 0.0)) end_point = i3.Coord2((20.0, 20.0)) offset = i3.Coord2(10.0, 0) middle_point = (start_point + end_point) * 0.5 bend_radius = (end_point[0] - start_point[0]) / 2.0 shape = [ start_point, start_point + offset, middle_point, end_point - offset, end_point ] wg = i3.RoundedWaveguide(trace_template=wg_t_2) # Assign a shape to the waveguide. layout = wg.Layout(shape=shape, bend_radius=bend_radius, manhattan=False, draw_control_shape=True) layout.visualize()
def _default_wg_SM(self): wg = i3.RoundedWaveguide(trace_template=self.wg_SM_template) return wg
def _default_gc_slab(self): slab = i3.RoundedWaveguide(trace_template=self.gc_slab_template) return slab
def _default_expanded_wg(self): expanded_wg = i3.RoundedWaveguide( trace_template=self.expanded_wg_template) return expanded_wg
def _default_wg_right(self): wg_right = i3.RoundedWaveguide(trace_template=self.trace_template) return wg_right
def _default_wgs_straights(self): wgs = [] for cnt in xrange(0, 3): wg = i3.RoundedWaveguide(trace_template=self.wg_template) wgs.append(wg) return wgs
def _default_waveguide(self): return i3.RoundedWaveguide(trace_template=self.trace_template)
# First we load a PDK (demolib in this case) import demolib.all as demo import ipkiss3.all as i3 wg_t = demo.SiWireWaveguideTemplate() wg_t_lo = wg_t.Layout(core_width=0.5) # Define a rounded waveguide wg = i3.RoundedWaveguide(name='MyWaveguide', trace_template=wg_t) wg_lo = wg.Layout(shape=[(-15, 3), (-10, 3), (-5, 0), (5, 0), (10, 3), (15, 3)]) wg_lo.visualize(annotate=True)