How to use quick_connect method in lisa

Best Python code snippet using lisa_python

digital_lib.py

Source:digital_lib.py Github

copy

Full Screen

...16 self.set_parameter('wg', get_kwarg(kwargs, 'wg', 150e-9))17 self.set_parameter('lg', get_kwarg(kwargs, 'lg', 20e-9))18 self.set_parameter('mfac', get_kwarg(kwargs, 'mfac', 1))19 # Connect20 mp = pch_slvt('mp', parent_cell=self, wg='wg', lg='lg', mfac='mfac').quick_connect(['b', 'd', 'g', 's'], ['vdd', 'vout', 'vin', 'vdd'])21 mn = nch_slvt('mn', parent_cell=self, wg='wg', lg='lg', mfac='mfac').quick_connect(['b', 'd', 'g', 's'], ['gnd', 'vout', 'vin', 'gnd'])22class Nor(Cell):23 """24 Nor gate25 Terminals: 'vin1', 'vin2', 'vout', 'vdd', 'gnd'26 """27 def __init__(self, instance_name, parent_cell, **kwargs):28 super().__init__("Nor", instance_name, parent_cell, declare=True, **kwargs)29 self.add_multiple_terminals(['vin1', 'vin2', 'vout', 'vdd', 'gnd'])30 # Add parameters31 self.set_parameter('wg', get_kwarg(kwargs, 'wg', 150e-9))32 self.set_parameter('lg', get_kwarg(kwargs, 'lg', 20e-9))33 self.set_parameter('mfac', get_kwarg(kwargs, 'mfac', 1))34 mp1 = pch_slvt('MP1', parent_cell=self, wg='wg', lg='lg', mfac='mfac').quick_connect(['b', 'd', 'g', 's'], ['vdd', 'a', 'vin1', 'vdd'])35 mp2 = pch_slvt('MP2', parent_cell=self, wg='wg', lg='lg', mfac='mfac').quick_connect(['b', 'd', 'g', 's'], ['vdd', 'vout', 'vin2', 'a'])36 mn1 = nch_slvt('MN1', parent_cell=self, wg='wg', lg='lg', mfac='mfac').quick_connect(['b', 'd', 'g', 's'], ['gnd', 'vout', 'vin1', 'gnd'])37 mn2 = nch_slvt('MN2', parent_cell=self, wg='wg', lg='lg', mfac='mfac').quick_connect(['b', 'd', 'g', 's'], ['gnd', 'vout', 'vin2', 'gnd'])38class Or(Cell):39 """40 Or gate41 Terminals: 'vin1', 'vin2', 'vout', 'vdd', 'gnd'42 """43 def __init__(self, instance_name, parent_cell, **kwargs):44 super().__init__("Or", instance_name, parent_cell, declare=True, **kwargs)45 self.add_multiple_terminals(['vin1', 'vin2', 'vout', 'vdd', 'gnd'])46 n0 = Nor('N0', parent_cell=self).quick_connect(47 ['vin1', 'vin2', 'vout', 'vdd', 'gnd'], ['vin1', 'vin2', 'a', 'vdd', 'gnd'])48 n1 = Not('N1', parent_cell=self).quick_connect(49 ['vdd', 'gnd', 'vin', 'vout'], ['vdd', 'gnd', 'a', 'vout'])50class Nand(Cell):51 """52 Nand gate53 Terminals: 'vin1', 'vin2', 'vout', 'vdd', 'gnd'54 """55 def __init__(self, instance_name, parent_cell, **kwargs):56 super().__init__("Nand", instance_name, parent_cell, declare=True, **kwargs)57 self.add_multiple_terminals(['vin1', 'vin2', 'vout', 'vdd', 'gnd'])58 mp1 = pch_slvt('MP1', parent_cell=self, wg=150e-9, lg=20e-9, mfac=1).quick_connect(['b', 'd', 'g', 's'], ['vdd', 'vout', 'vin1', 'vdd'])59 mp2 = pch_slvt('MP2', parent_cell=self, wg=150e-9, lg=20e-9, mfac=1).quick_connect(['b', 'd', 'g', 's'], ['vdd', 'vout', 'vin2', 'vdd'])60 mn1 = nch_slvt('MN1', parent_cell=self, wg=150e-9, lg=20e-9, mfac=1).quick_connect(['b', 'd', 'g', 's'], ['gnd', 'vout', 'vin1', 'a'])61 mn2 = nch_slvt('MN2', parent_cell=self, wg=150e-9, lg=20e-9, mfac=1).quick_connect(['b', 'd', 'g', 's'], ['gnd', 'a', 'vin2', 'gnd'])62class And(Cell):63 """64 Nand gate65 Terminals: 'vin1', 'vin2', 'vout', 'vdd', 'gnd'66 """67 def __init__(self, instance_name, parent_cell, **kwargs):68 super().__init__("And", instance_name, parent_cell, declare=True, **kwargs)69 self.add_multiple_terminals(['vin1', 'vin2', 'vout', 'vdd', 'gnd'])70 nand = Nand('N0', parent_cell=self).quick_connect(71 ['vin1', 'vin2', 'vout', 'vdd', 'gnd'], ['vin1', 'vin2', 'a', 'vdd', 'gnd'])72 n1 = Not('N1', parent_cell=self).quick_connect(73 ['vdd', 'gnd', 'vin', 'vout'], ['vdd', 'gnd', 'a', 'vout'])74class Nor3(Cell):75 """76 Nor gate with three inputs77 Terminals: 'vin1', 'vin2', 'vin3', 'vout', 'vdd', 'gnd'78 """79 def __init__(self, instance_name, parent_cell, **kwargs):80 super().__init__("Nor3", instance_name, parent_cell, declare=True, **kwargs)81 self.add_multiple_terminals(['vin1', 'vin2', 'vin3', 'vout', 'vdd', 'gnd'])82 mp1 = pch_slvt('MP1', parent_cell=self, wg=150e-9, lg=20e-9, mfac=1).quick_connect(['b', 'd', 'g', 's'], ['vdd', 'a', 'vin1', 'vdd'])83 mp2 = pch_slvt('MP2', parent_cell=self, wg=150e-9, lg=20e-9, mfac=1).quick_connect(['b', 'd', 'g', 's'], ['vdd', 'b', 'vin2', 'a'])84 mp3 = pch_slvt('MP3', parent_cell=self, wg=150e-9, lg=20e-9, mfac=1).quick_connect(['b', 'd', 'g', 's'], ['vdd', 'vout', 'vin3', 'b'])85 mn1 = nch_slvt('MN1', parent_cell=self, wg=150e-9, lg=20e-9, mfac=1).quick_connect(['b', 'd', 'g', 's'], ['gnd', 'vout', 'vin1', 'gnd'])86 mn2 = nch_slvt('MN2', parent_cell=self, wg=150e-9, lg=20e-9, mfac=1).quick_connect(['b', 'd', 'g', 's'], ['gnd', 'vout', 'vin2', 'gnd'])87 mn3 = nch_slvt('MN3', parent_cell=self, wg=150e-9, lg=20e-9, mfac=1).quick_connect(['b', 'd', 'g', 's'], ['gnd', 'vout', 'vin3', 'gnd'])88class vdigcode(Cell):89 """90 Voltage source, providing digital code stimulus91 Terminals: p, n92 Arguments:93 code: str94 0s and 1s that should be used as stimuli. Example: '1101001'95 period: float96 The period of the signals (inverse of frequency)97 v_high: str98 The voltage for each bit that is 199 v_low: str100 The voltage for each bit that is 0101 rise_time: str102 The rise time for the signal103 fall_time: str104 The fall time for the signal105 delay: str106 The delay before the code generation starts.107 The first voltage is given by the first bit in the code108 """109 # TODO: Support string period, rise_time and fall_time110 def __init__(self, instance_name, parent_cell, code, period, v_high, v_low=0, rise_time=1e-12, fall_time=1e-12, delay=None):111 # Call super init112 super().__init__('vsource', instance_name, parent_cell, declare=False, library_name="digital_lib")113 # Add terminals114 self.add_terminal("p")115 self.add_terminal("n")116 # Generate wave based on code117 wave = self.generate_wave(code, period, v_high, v_low, rise_time, fall_time)118 self.parameters = {'type': 'pwl', 'wave': wave}119 # Add optional properties120 if delay is not None:121 self.parameters['delay'] = num2string(delay)122 def generate_wave(self, code, period, v_high, v_low, rise_time, fall_time):123 wave = '[ '124 if(code[0]) == '1':125 volt = v_high126 else:127 volt = v_low128 for i, bit in enumerate(code):129 time = i*period130 if(bit == '1'):131 volt = v_high132 delayed_time = time+rise_time133 else:134 volt = v_low135 delayed_time = time+fall_time136 wave += num2string(time) + ' '137 wave += num2string(volt) + ' '138 wave += num2string(delayed_time) + ' '139 wave += num2string(volt) + ' '140 wave += num2string(time + period - 1e-12) + ' '141 wave += num2string(volt) + ' '142 wave += ']'143 return wave144class vdigcode_multiple(Cell):145 """146 Instansiates a multiple vdigcode cells, given multiple codes. Allows for single cell to drive multiple pins147 Terminals: p_{x}, n, where x is the positive148 Arguments:149 codes: [str]150 0s and 1s that should be used as stimuli. Example: ['1101001', '0010110', 0100101']151 period: float152 The period of the signals (inverse of frequency)153 v_high: str154 The voltage for each bit that is 1155 v_low: str156 The voltage for each bit that is 0157 rise_time: str158 The rise time for the signal159 fall_time: str160 The fall time for the signal161 delay: str162 The delay before the code generation starts.163 The first voltage is given by the first bit in the code164 """165 def __init__(self, instance_name, parent_cell, codes, period, v_high, v_low=0, rise_time=1e-12, fall_time=1e-12, delay=None, declare=True):166 # Call super init167 super().__init__('v1', instance_name, parent_cell, library_name="digital_lib")168 # Add terminals and subcells169 self.add_terminal("n")170 for i, code in enumerate(codes):171 self.add_terminal(f'p_{i}')172 subcell = vdigcode(f'{instance_name}_{i}', parent_cell, code, period, v_high, v_low=v_low, rise_time=rise_time, fall_time=fall_time, delay=delay, parent_cell=self)...

Full Screen

Full Screen

Item.py

Source:Item.py Github

copy

Full Screen

1import sqlite32import pandas as pd3import os4from os.path import exists567class Item:8 LATEST_ID = 0910 def __init__(self, label, count, image):11 self._id = str(Item.LATEST_ID)12 self._label = label13 self._count = count14 self._image = image15 @property16 def id(self):17 return self._id18 @property19 def label(self):20 return self._label21 @property22 def count(self):23 return self._count24 @property25 def image(self):26 return self._image27 @label.setter28 def label(self, label):29 self._label = label30 @count.setter31 def count(self, count):32 if count < 0:33 self._count = count3435 def create_item(self):36 quick_connect = sqlite3.connect("inventory.db")37 with quick_connect:38 quick_connect.cursor().execute(39 "INSERT INTO inventory VALUES (:id, :label, :count, :image)",40 {'id': self.id, 'label': self.label, 'count': self.count,41 'image': self.image}42 )4344 def update_item(self, db_id):45 quick_connect = sqlite3.connect("inventory.db")46 with quick_connect:47 quick_connect.cursor().execute(48 "UPDATE inventory SET label = (:label), count = (:count),"49 " image = (:image) WHERE id = (:id)",50 {'label': self.label, 'count': self.count, 'image': self.image,51 'id': db_id}52 )5354 @staticmethod55 def create_DB():56 if not exists("inventory.db"):57 quick_connect = sqlite3.connect("inventory.db")58 quick_connect.cursor().execute(59 """CREATE TABLE inventory (60 id text,61 label text,62 count integer,63 image text64 )"""65 )66 quick_connect.close()67 @staticmethod68 def delete_DB():69 if exists("inventory.db"):70 os.remove("inventory.db")7172 @staticmethod73 def delete_item(db_id):74 quick_connect = sqlite3.connect("inventory.db")75 with quick_connect:76 quick_connect.cursor().execute(77 "DELETE FROM inventory WHERE id = (:id)", {'id': db_id}78 )798081 @staticmethod82 def get_all():83 quick_connect = sqlite3.connect("inventory.db")84 with quick_connect:85 return quick_connect.cursor(). \86 execute("SELECT * FROM inventory").fetchall()8788 @staticmethod89 def get_csv():90 quick_connect = sqlite3.connect("inventory.db")91 with quick_connect:92 df = pd.read_sql_query("SELECT * FROM inventory", quick_connect)93 df.to_csv("inventory.csv", index=False)9495 @staticmethod96 def card_html():97 return """98 <div id={id} style='width:400px; height:500px; border: solid white;'>99 <div>100 <img src='{image}' alt='NO IMG' width=395px height=400px>101 </div>102 <div style='text-align:center'>{label}</div>103 <div style='text-align:center'>Inventory Count: {count}</div>104 <div style='text-align:center'>Item ID: {visible_id}</div> ...

Full Screen

Full Screen

tb_amplifier.py

Source:tb_amplifier.py Github

copy

Full Screen

...21 # The wire_up() method is called by the super constructor. A bit confusing, will probably change this.22 # Instantiate supply, stimuli, load and DUT inside this method.23 def wire_up(self):24 # SUPPLY25 vsupply = vdc('VDD', self, self.vdd).quick_connect(['p', 'n'], ['vdd', '0'])26 # STIMULI27 vin = vsin('VIN', self, 0, self.vi, self.fi).quick_connect(['p', 'n'], ['vi', '0'])28 # DUT29 ammplifier = amp('A0', self, gain=1000).quick_connect(30 ['vdd', 'vss', 'vin', 'vip', 'vop', 'von'],31 ['vdd', '0', '0', 'vx', 'vo', '0'] )32 # Inverting amplifier with resistive feedback33 r1 = res('R1', self, self.R1).quick_connect(['p', 'n'], ['vi', 'vx'])34 r2 = res('R2', self, self.R2).quick_connect(['p', 'n'], ['vx', 'vo'])35 # LOAD...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful