def test_wrong_memtype(self):
with self.assertRaisesRegex(ValueError,
- r"Unsupported DRAM type, must be one of \"DDR2\", \"DDR3\" or \"DDR4\", "
- r"not 'foo'"):
+ r"Unsupported DRAM type, must be one of \"SDR\", \"DDR\", \"LPDDR\", \"DDR2\", "
+ r"\"DDR3\" or \"DDR4\", not 'foo'"):
cfg = DummyConfig(
memtype = "foo",
module_name = "MT41K256M16",
self.assertEqual(core.user_port.memory_map.addr_width, 29)
self.assertEqual(core.user_port.memory_map.data_width, 8)
- def test_name_force(self):
- core_1 = litedram.Core(self._cfg, name="core")
- core_2 = litedram.Core(self._cfg, name="core", name_force=True)
- self.assertEqual(core_1.name, "core")
- self.assertEqual(core_2.name, "core")
-
def test_ctrl_bus_not_ready(self):
core = litedram.Core(self._cfg)
with self.assertRaisesRegex(AttributeError,
from nmigen import *
from nmigen.back.pysim import *
+from nmigen_soc.memory import MemoryMap
+
from .utils.wishbone import *
from ..periph.base import Peripheral, CSRBank, PeripheralBridge
class CSRBankTestCase(unittest.TestCase):
- def test_csr_name(self):
- bank = CSRBank(name_prefix="foo")
- bar = bank.csr(1, "r")
- self.assertEqual(bar.name, "foo_bar")
+ def test_bank_name(self):
+ bank = CSRBank(name="foo")
+ self.assertEqual(bank.name, "foo")
+
+ def test_bank_name_wrong(self):
+ with self.assertRaisesRegex(TypeError,
+ r"Name must be a string, not 2"):
+ bank = CSRBank(name=2)
def test_csr_name_wrong(self):
bank = CSRBank()
self.win_0 = self.window(addr_width=1, data_width=8, sparse=True, addr=0x000)
self.win_1 = self.window(addr_width=1, data_width=32, granularity=8, addr=0x200)
+ self.win_0.memory_map = MemoryMap(addr_width=1, data_width=8)
+ self.win_1.memory_map = MemoryMap(addr_width=3, data_width=8)
self._bridge = self.bridge(data_width=32, granularity=8, alignment=2)
self.bus = self._bridge.bus
from nmigen.lib.io import pin_layout
from nmigen.back.pysim import *
+from nmigen_stdio.serial import AsyncSerial
+
from .utils.wishbone import *
from ..periph.serial import AsyncSerialPeripheral
def test_loopback(self):
pins = Record([("rx", pin_layout(1, dir="i")),
("tx", pin_layout(1, dir="o"))])
- dut = AsyncSerialPeripheral(divisor=5, pins=pins)
+
+ core = AsyncSerial(divisor=5, pins=pins)
+ dut = AsyncSerialPeripheral(core=core)
m = Module()
m.submodules.serial = dut
m.d.comb += pins.rx.i.eq(pins.tx.o)