# SPDX-License-Identifier: Apache-2.0
# Copyright 2019 Blue Cheetah Analog Design Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Dict, Any, List, Tuple
import pkg_resources
from pathlib import Path
from bag.design.module import Module
from bag.design.database import ModuleDB
from bag.util.immutable import Param
# noinspection PyPep8Naming
[docs]class bag3_analog__diffamp_self_biased(Module):
"""Module for library bag3_analog cell diffamp_self_biased.
Fill in high level description here.
"""
[docs] yaml_file = pkg_resources.resource_filename(__name__,
str(Path('netlist_info',
'diffamp_self_biased.yaml')))
def __init__(self, database: ModuleDB, params: Param, **kwargs: Any) -> None:
Module.__init__(self, self.yaml_file, database, params, **kwargs)
@classmethod
[docs] def get_params_info(cls) -> Dict[str, str]:
"""Returns a dictionary from parameter names to descriptions.
Returns
-------
param_info : Optional[Dict[str, str]]
dictionary from parameter names to descriptions.
"""
return dict(
seg_dict='Dict of segments for different devices.',
lch='Channel length.',
w_dict='Dict of widths for different devices.',
th_dict='Dict of intents for different devices.',
dum_info='Dummy devices information.',
)
@classmethod
[docs] def get_default_param_values(cls) -> Dict[str, Any]:
return dict(
dum_info=None,
)
[docs] def design(self, seg_dict: Dict[str, int], lch: int, w_dict: Dict[str, int],
th_dict: Dict[str, str], dum_info: List[Tuple[Any]]) -> None:
"""To be overridden by subclasses to design this module.
This method should fill in values for all parameters in
self.parameters. To design instances of this module, you can
call their design() method or any other ways you coded.
To modify schematic structure, call:
rename_pin()
delete_instance()
replace_instance_master()
reconnect_instance_terminal()
restore_instance()
array_instance()
"""
for _name, _str in zip(['XGMn_left', 'XGMn_right', 'XTailn'], ['gm_n', 'gm_n', 'tail_n']):
self.design_transistor(_name, w_dict[_str], lch, seg_dict[_str], th_dict[_str], m='')
for _name, _str in zip(['XGMp_left', 'XGMp_right', 'XTailp'], ['gm_p', 'gm_p', 'tail_p']):
self.design_transistor(_name, w_dict[_str], lch, seg_dict[_str], th_dict[_str], m='')
self.design_dummy_transistors(dum_info, 'XDUM', 'VDD', 'VSS')