From Python to silicon
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

users:cfelton:projects:zpu_iram [2010/01/14 04:07] (current)
cfelton created
Line 1: Line 1:
  
 +zpu_iram.py
 +
 +<code myhdl>
 +from myhdl import *
 +
 +def RAM(dout, din, addr, we, clk, WORD_SZ=8, DEPTH=16384):
 +    """
 +    
 +    """
 +
 +    mem = [Signal(intbv(0)[WORD_SZ:]) for i in range(DEPTH)]
 +
 +    @always(clk.posedge)
 +    def write():
 +        if we:
 +            mem[int(addr)].next = din
 +
 +    @always_comb
 +    def read():
 +        dout.next = mem[int(addr)]
 +
 +    return write, read
 +
 +</code>
users/cfelton/projects/zpu_iram.txt ยท Last modified: 2010/01/14 04:07 by cfelton
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki