Skip to content

Python chokes on simulated memories of depth greater than ~3k #359

Closed
@sjolsen

Description

@sjolsen

With Python 3.7.3 (shipped with Debian stable) and 3.8.2 (via pyenv), I encountered the following error when simulating a design with a couple of memory banks:

  File "/path/to/nmigen/back/pysim.py", line 765, in __call__
    exec(emitter.flush(), exec_locals)
RecursionError: maximum recursion depth exceeded during compilation

Here's a minimal reproduction:

import unittest

from nmigen import *
from nmigen.back.pysim import *

class MemTest(unittest.TestCase):

    def test_mem(self):
        m = Module()
        mem = Memory(width=1, depth=0xC00)
        m.submodules.rport = mem.read_port()
        m.submodules.wport = mem.write_port()
        sim = Simulator(m)
        sim.run()

Reducing the depth of the memory (width doesn't seem to matter) makes the failure go away. For the time being that workaround works for me, but it would be nice to use the same design parameters for simulation and synthesis.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions