def test_array_one(): c = MOSGenerator() ports = {'SA': [('M1', 'S')], 'DA': [('M1', 'D')], 'GA': [('M1', 'G')]} parameters = {'m': 4, 'nf': 2, 'real_inst_type': 'n'} c.addNMOSArray(None, 2, 1, None, ports, **parameters) fn = "test_transistor_array_1" compare_with_golden(fn, c)
def test_array_two(): c = MOSGenerator() ports = { 'S': [('M1', 'S'), ('M2', 'S')], 'DA': [('M1', 'D')], 'DB': [('M2', 'D')], 'GA': [('M1', 'G')], 'GB': [('M2', 'G')] } parameters = {'m': 4, 'stack': 4, 'real_inst_type': 'n'} c.addNMOSArray(None, 1, 1, None, ports, **parameters) fn = "test_transistor_array_2" compare_with_golden(fn, c)
def test_duo_one(): c = MOSGenerator() parameters = {'M': 1, 'NFIN': 4, 'real_inst_type': 'p'} parameters['NF'] = 2 c.addNMOSArray(2, 1, 1, None, ports_duo[0], **parameters) c.gen_data(run_drc=True) export_to_viewer(get_test_id(), c) if c.drc.num_errors > 0 or len(c.rd.opens) > 0 or len(c.rd.shorts) > 0: assert False, f'{get_test_id()}'
def test_uno_drc(n_row, n_col, nf, device_type, ports): logger.info(f'running {get_test_id()}') c = MOSGenerator() parameters = {'M': n_row*n_col, 'NFIN': 4, 'real_inst_type': 'n'} if device_type == 'parallel': parameters['NF'] = nf else: parameters['STACK'] = nf c.addNMOSArray(n_col, n_row, 0, None, ports, **parameters) c.gen_data(run_drc=True) if c.drc.num_errors > 0 or len(c.rd.opens) > 0 or len(c.rd.shorts) > 0: export_to_viewer(get_test_id(), c) assert False, f'{get_test_id()} DRC ports:{ports} type:{device_type} nf:{nf}, n_col:{n_col} n_row:{n_row}'
def test_unit_validate_array(): mg = MOSGenerator() assert (1, 1) == mg.validate_array(1, 1, 1) assert (1, 2) == mg.validate_array(2, 1, 2) assert (1, 2) == mg.validate_array(2, 2, 2)
def test_unit_interleave_pattern(): mg = MOSGenerator() assert [1, 2] == mg.interleave_pattern(1, 2) assert [1, 2, 2, 1] == mg.interleave_pattern(2, 2) assert [1, 2, 1, 2, 1, 2] == mg.interleave_pattern(2, 3)