Re: Dual port ram, mixed width byte enables.
Samuele Disegna <[email protected]> Tue, 19 Apr 2016 21:31:07 +0200
| Newsgroups | gmane.comp.python.myhdl |
|---|---|
| Message-ID | <CADXD_DbwMJgFzg0fw8GLYzZM9cjLabjGFyTT5ADmTy42dy0rtQ@mail.gmail.com> |
Hi, Ok this is what the model looks like now, I will try the user coded
part when I need it and have time:
Thanks
class ram_port():
def __init__(self,WIDTH,DEPTH):
self.addr = Signal(intbv(0,min=0,max=DEPTH))
self.we = Signal(False)
self.din = Signal(intbv(0)[WIDTH:])
self.dout = Signal(intbv(0)[WIDTH:])
self.WIDTH = WIDTH
self.DEPTH = DEPTH
@block
def ram_dual_port(clk,ram_port1,ram_port2):
if ram_port1.WIDTH * ram_port1.DEPTH != ram_port2.WIDTH *
ram_port2.DEPTH:
raise ValueError("ram_port1 WIDTH*DEPTH != ram_port2 w*D")
if ram_port1.WIDTH < ram_port2.WIDTH:
raise ValueError("ram_port1.WIDTH < ram_port2.WIDTH")
if not (ram_port1.WIDTH / ram_port2.WIDTH).is_integer():
raise ValueError("ports width ratio must be an integer")
mem = [Signal(intbv(0)[ram_port2.WIDTH:]) for i in
range(ram_port2.DEPTH)]
RATIO = ram_port1.WIDTH // ram_port2.WIDTH
@always(clk.posedge)
def wr_port1():
ram_port1.dout.next = concat(*[mem[ram_port1.addr*RATIO+i] for i in
reversed(range(RATIO))])
if ram_port1.we:
for i in range(RATIO):
mem[ram_port1.addr*RATIO+i].next =
ram_port1.din[ram_port1.WIDTH*(i+1):ram_port1.WIDTH*i]
@always(clk.posedge)
def wr_port2():
ram_port2.dout.next = mem[ram_port2.addr]
if ram_port2.we:
mem[ram_port2.addr].next = ram_port2.din
return instances()
On Tue, Apr 19, 2016 at 6:16 PM, Josy Boelen <[email protected]> wrote:
> Christopher Felton <chris.felton <at> gmail.com> writes:
>
> >
> >
> > Josy,
> > I am not 100% sure that it is limited to only multidim, I
> haven'tresearched this but I thought you could build mix port by using a
> model of the BRAM prims (1bit width) and build them from the simple
> model. More of an elaboration / generate approach.
> >
> > If that doesn't work than the user code [1] would be the quickest
> > alternative (as we both stated).
> >
> > I think the Array will take some discussion etc. before it worked
> > in to the base. It is a fairly important feature and I am sure there
> > will be significant feedback from the core devs. It needs a clean
> > MEP etc. for discussion and review. I don't think it is something
> > that can be used in the near-term.
> >
> > Regards,Chris
> >
> > [1] http://docs.myhdl.org/en/stable/manual/conversion.html#user-
> defined-code
>
> Hi Chris,
>
> I am (painfully) aware that the 'Array' needs a lot of care -
> unfortunately I have little free time lately. I'll try better.
>
> Regards,
>
> Josy
>
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications
> Manager
> Applications Manager provides deep performance insights into multiple
> tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> _______________________________________________
> myhdl-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/myhdl-list
>
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
myhdl-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/myhdl-list