29 custom =
_Bundle(
"read_write", {
"size": 0x1203})
31 table, manifest_loc = ChannelMMIO.build_table(
_Bundles(default, custom))
33 assert list(table) == [0x100, 0x2000]
34 assert default.records == [{
"offset": 0x100,
"size": 0x100,
"type":
"ro"}]
35 assert custom.records == [{
"offset": 0x2000,
"size": 0x2000,
"type":
"rw"}]
38 assert manifest_loc == 0x4000
42 """The manifest window must not be a fixed reservation: it follows whatever
43 the clients actually use so the BAR stays as small as possible."""
46 _, small_loc = ChannelMMIO.build_table(
_Bundles(small))
47 assert small_loc == 0x200
49 big =
_Bundle(
"read", {
"size": 1 << 20})
50 _, big_loc = ChannelMMIO.build_table(
_Bundles(big))
51 assert big_loc == 1 << 21
55 table, manifest_loc = ChannelMMIO.build_table(
57 last_base = list(table)[-1]
58 last_size = table[last_base][0]
60 assert manifest_loc >= last_base + last_size
63 assert manifest_loc & (manifest_loc - 1) == 0
66@pytest.mark.parametrize("size", [True, 1.5, "256", 0, -8])
68 with pytest.raises(ValueError, match=
"option 'size'"):
73 monkeypatch.setattr(ChannelMMIO,
"initial_offset", 0xFFFF_FFF8)
74 with pytest.raises(ValueError, match=
"exceeds the 32-bit space"):
static StringAttr append(StringAttr base, const Twine &suffix)
Return a attribute with the specified suffix appended.
add_record(self, details)
__init__(self, port, options=None)
test_channel_mmio_manifest_tracks_client_space()
test_channel_mmio_places_manifest_after_clients()
test_channel_mmio_rejects_address_overflow(monkeypatch)
test_channel_mmio_allocations()
test_channel_mmio_rejects_invalid_size(size)