From 6b1d775e9f1f254d421a62cd6de608cc5660d5a3 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 27 Jan 2012 16:53:34 +0100 Subject: [PATCH] fhdl/structure: memory description --- migen/fhdl/structure.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/migen/fhdl/structure.py b/migen/fhdl/structure.py index 0ac9b5250..b52f4539b 100644 --- a/migen/fhdl/structure.py +++ b/migen/fhdl/structure.py @@ -228,18 +228,38 @@ class Instance: def __hash__(self): return id(self) +class MemoryPort: + def __init__(self, adr, dat_r, we=None, dat_w=None, async_read=False, re=None, we_granularity=0): + self.adr = adr + self.dat_r = dat_r + self.we = we + self.dat_w = dat_w + self.async_read = async_read + self.re = re + self.we_granularity = we_granularity + +class Memory: + def __init__(self, width, depth, *ports, init=None): + self.width = width + self.depth = depth + self.ports = ports + self.init = init + class Fragment: - def __init__(self, comb=None, sync=None, instances=None, pads=set()): + def __init__(self, comb=None, sync=None, instances=None, memories=None, pads=set()): if comb is None: comb = [] if sync is None: sync = [] if instances is None: instances = [] + if memories is None: memories = [] self.comb = _sl(comb) self.sync = _sl(sync) self.instances = instances + self.memories = memories self.pads = pads def __add__(self, other): return Fragment(self.comb.l + other.comb.l, self.sync.l + other.sync.l, self.instances + other.instances, + self.memories + other.memories, self.pads | other.pads)