Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a base class for process technologies. #25

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions vlsiffra/tech/asap7.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from amaranth import Elaboratable, Instance, Signal
from amaranth import Instance, Signal
from .base import Process


class ASAP7Process(Elaboratable):
class ASAP7Process(Process):
def _PoweredInstance(self, *args, **kwargs):
if self._powered:
kwargs.update({
Expand Down
89 changes: 89 additions & 0 deletions vlsiffra/tech/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
from amaranth import Elaboratable

# The following shell command can be used to discover the usage;
# grep -R '_generate_' | sed -e's/: */:/' -e's/(.*/(/' | sort | uniq | less


class Process(Elaboratable):
""" Base class for process technologies. """

def _PoweredInstance(self, *args, **kwargs):
pass

# Standard cells used in *both* `adders.py` and `multipliers.py`

def _generate_and(self, a, b, o):
"""2 input AND gate.

Used by both `adders.py` and `multipliers.py`.
"""
raise NotImplementedError()

def _generate_xor(self, a, b, o):
"""2 input XOR gate.

Used by both `adders.py` and `multipliers.py`.
"""
raise NotImplementedError()

def _generate_full_adder(self, a, b, carry_in, sum_out, carry_out, name=None):
"""Full adder.

Used by both `adders.py` and `multipliers.py`.
"""
raise NotImplementedError()

def _generate_half_adder(self, a, b, sum_out, carry_out, name=None):
"""Half adder.

Used by both `adders.py` and `multipliers.py`.
"""
raise NotImplementedError()

# Standard cells used only in adders
def _generate_ao21(self, a1, a2, b1, o):
"""2-input AND into first input of 2-input OR.

Used by `adders.py`.
"""
raise NotImplementedError()

# Standard cells used only in `multipliers.py`
def _generate_inv(self, a, o):
"""1-bit inverter.

Used by `multipliers.py`.
"""
raise NotImplementedError()

def _generate_ao22(self, a1, a2, b1, b2, o):
"""2-input AND into both inputs of 2-input OR.

Used by `multipliers.py`.
"""
raise NotImplementedError()

def _generate_ao32(self, a1, a2):
"""3-input AND into first input, and 2-input AND into 2nd input of 2-input OR.

Used by `multipliers.py`.
"""
raise NotImplementedError()

def _generate_ao33(self, a1, a2, a3, b1, b2, b3, o):
"""3-input AND into both inputs of 2-input OR.

Optional, a `oai33` cell can be provided instead.

Used by `multipliers.py`.
"""
raise AttributeError()

def _generate_oai33(self, a1, a2, a3, b1, b2, b3, o):
"""3-input AND into both inputs of 2-input OR.

Optional, can be provided instead of the `ao33` cell.

Used by `multipliers.py`.
"""
raise AttributeError()
5 changes: 3 additions & 2 deletions vlsiffra/tech/gf180mcu.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from amaranth import Elaboratable, Instance, Signal
from amaranth import Instance, Signal
from .base import Process


class GF180MCUProcess(Elaboratable):
class GF180MCUProcess(Process):
def _PoweredInstance(self, *args, **kwargs):
if self._powered:
kwargs.update({
Expand Down
5 changes: 3 additions & 2 deletions vlsiffra/tech/none.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from amaranth import Elaboratable, Cat
from amaranth import Cat
from .base import Process


class NoneProcess(Elaboratable):
class NoneProcess(Process):
def _generate_and(self, a, b, o):
self.m.d.comb += o.eq(a & b)

Expand Down
6 changes: 4 additions & 2 deletions vlsiffra/tech/sky130.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from amaranth import Elaboratable, Instance
from amaranth import Instance
from .base import Process


"""
Skywater's 130nm process technology with Google open source PDK found at
Expand All @@ -13,7 +15,7 @@
"""


class SKY130Process(Elaboratable):
class SKY130Process(Process):
LIBRARY = None

def _PoweredInstance(self, *args, **kwargs):
Expand Down