blob: 83dd44fcd92249bdcc522757506cc898fb710a86 [file] [log] [blame]
# SPDX-License-Identifier: GPL-2.0-or-later
from pdkmaster.design import circuit as _ckt, library as _lbry
from c4m.pdk import sky130
from . import frame as _frm
__all__ = ["ConnectedSRAM"]
class _io_spec:
def __init__(self, *, io_number: int, sram_signal: str):
self.io_number = io_number
self.sram_signal = sram_signal
io_specs = (
_io_spec(sram_signal="a[8]", io_number=14),
_io_spec(sram_signal="a[7]", io_number=15),
_io_spec(sram_signal="a[6]", io_number=16),
_io_spec(sram_signal="a[5]", io_number=17),
_io_spec(sram_signal="a[4]", io_number=18),
_io_spec(sram_signal="a[3]", io_number=19),
_io_spec(sram_signal="a[2]", io_number=20),
_io_spec(sram_signal="a[1]", io_number=21),
_io_spec(sram_signal="a[0]", io_number=22),
)
io_sig2spec = {
spec.sram_signal: spec
for spec in io_specs
}
class ConnectedSRAM(_lbry._OnDemandCell[_lbry.Library]):
def __init__(self, *, lib: _lbry.Library):
super().__init__(lib=lib, name="ConnectedSRAM")
def _create_circuit(self):
stdcells = sky130.stdcelllib.cells
mem_factory = sky130.Sky130SP6TFactory(lib=self.lib)
sram_cell = mem_factory.block(words=512, word_size=8, we_size=1)
ckt = self.new_circuit()
ckt.instantiate(sram_cell, name="sram")
def _create_layout(self):
ckt = self.circuit
nets = ckt.nets
insts = ckt.instances
layouter = self.new_circuitlayouter()
layout = layouter.layout
_sram_lay = layouter.inst_layout(inst=insts.sram)
_sram_bb = _sram_lay.boundary
assert _sram_bb is not None
layouter.place(_sram_lay, origin=(_frm.boundary.center - _sram_bb.center))
layout.boundary = _frm.boundary