("w_stb", 1),
]))
- def test_layout_0_rw(self): # degenerate but legal case
+ def test_layout_0_rw(self): # degenerate but legal case
elem = Element(0, access=Element.Access.RW)
self.assertEqual(elem.width, 0)
self.assertEqual(elem.access, Element.Access.RW)
def test_access_wrong(self):
with self.assertRaisesRegex(ValueError,
- r"Access mode must be one of \"r\", \"w\", or \"rw\", not 'wo'"):
+ r"Access mode must be one of \"r\", \"w\", "
+ r"or \"rw\", not 'wo'"):
Element(1, "wo")
self.assertEqual(iface.addr_width, 12)
self.assertEqual(iface.data_width, 8)
self.assertEqual(iface.layout, Layout.cast([
- ("addr", 12),
- ("r_data", 8),
- ("r_stb", 1),
- ("w_data", 8),
- ("w_stb", 1),
+ ("addr", 12),
+ ("r_data", 8),
+ ("r_stb", 1),
+ ("w_data", 8),
+ ("w_stb", 1),
]))
def test_wrong_addr_width(self):
self.assertEqual((yield elem_4_r.r_stb), 0)
self.assertEqual((yield elem_16_rw.r_stb), 1)
yield
- yield bus.addr.eq(3) # pipeline a read
+ yield bus.addr.eq(3) # pipeline a read
self.assertEqual((yield bus.r_data), 0xa5)
yield bus.r_stb.eq(1)
yield bus.w_stb.eq(1)
yield
yield bus.w_stb.eq(0)
- yield bus.addr.eq(2) # change address
+ yield bus.addr.eq(2) # change address
yield
self.assertEqual((yield elem_8_w.w_stb), 1)
self.assertEqual((yield elem_8_w.w_data), 0x3d)
yield
self.assertEqual((yield elem_8_w.w_stb), 0)
self.assertEqual((yield elem_16_rw.w_stb), 0)
- yield bus.addr.eq(3) # pipeline a write
+ yield bus.addr.eq(3) # pipeline a write
yield bus.w_data.eq(0xaa)
yield
self.assertEqual((yield elem_8_w.w_stb), 0)
def test_add_wrong_sub_bus(self):
with self.assertRaisesRegex(TypeError,
- r"Subordinate bus must be an instance of csr\.Interface, not 1"):
+ r"Subordinate bus must be an instance of "
+ r"csr\.Interface, not 1"):
self.dut.add(1)
def test_add_wrong_data_width(self):
mux = Multiplexer(addr_width=10, data_width=16)
- Fragment.get(mux, platform=None) # silence UnusedElaboratable
+ Fragment.get(mux, platform=None) # silence UnusedElaboratable
with self.assertRaisesRegex(ValueError,
r"Subordinate bus has data width 16, which is not the same as "
self.dut.add(mux.bus)
def test_sim(self):
- mux_1 = Multiplexer(addr_width=10, data_width=8)
+ mux_1 = Multiplexer(addr_width=10, data_width=8)
self.dut.add(mux_1.bus)
elem_1 = Element(8, "rw")
mux_1.add(elem_1)
- mux_2 = Multiplexer(addr_width=10, data_width=8)
+ mux_2 = Multiplexer(addr_width=10, data_width=8)
self.dut.add(mux_2.bus)
elem_2 = Element(8, "rw")
mux_2.add(elem_2, addr=2)