First version with unconnected SRAM block
diff --git a/doitcode/generate.py b/doitcode/generate.py
index 05075ea..4c677a4 100644
--- a/doitcode/generate.py
+++ b/doitcode/generate.py
@@ -2,18 +2,19 @@
# PDKMaster & co. don't put a license requirement on the generated files.
# The generated gds files in this project are released under the LGPL 2.0 or later license.
from pathlib import Path
-from typing import Dict, Any, cast
+from typing import Any, cast
import pya as _pya
# Disable type checking
pya = cast(Any, _pya)
+from pdkmaster.technology import geometry as _geo
from pdkmaster.design import library as _lib
from pdkmaster.io.klayout import export as _klexp
from c4m.pdk import sky130
-from . import frame as _frm
+from . import frame as _frm, sram as _ram
__all__ = ["gen_gds"]
@@ -64,6 +65,11 @@
ckt = top.new_circuit()
layouter = top.new_circuitlayouter()
+ # Add the SRAM
+ sram_cell = _ram.ConnectedSRAM(lib=lib)
+ sram_inst = ckt.instantiate(sram_cell, name="sramtop")
+ layouter.place(sram_inst, origin=_geo.origin)
+
# Add circuit and
layouter.layout.boundary = _frm.boundary
diff --git a/doitcode/sram.py b/doitcode/sram.py
new file mode 100644
index 0000000..83dd44f
--- /dev/null
+++ b/doitcode/sram.py
@@ -0,0 +1,63 @@
+# 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
diff --git a/gds/user_analog_project_wrapper.gds.gz b/gds/user_analog_project_wrapper.gds.gz
index f4c3333..87aa811 100644
--- a/gds/user_analog_project_wrapper.gds.gz
+++ b/gds/user_analog_project_wrapper.gds.gz
Binary files differ