|
29 | 29 | from cocotbext.ofm.utils.servicer import Servicer
|
30 | 30 | from cocotbext.ofm.utils.device import get_dtb
|
31 | 31 | from cocotbext.ofm.utils.math import ceildiv
|
| 32 | +from cocotbext.ofm.mvb.transaction import MvbTrClassic |
32 | 33 |
|
33 | 34 | import itertools
|
34 | 35 | from math import log2
|
@@ -117,7 +118,7 @@ def load_file(self, path: str, params: dict) -> (dict, list, list, dict):
|
117 | 118 | out_keys.append(mvb_key)
|
118 | 119 | out_data[mvb_key] = data
|
119 | 120 |
|
120 |
| - table.append([h, (mvb_key << (self.stream_out._item_width * 8 + 1)) + ((data << 1) + 1)]) |
| 121 | + table.append([h, (mvb_key << ((self.stream_out.item_widths["data"] // 8) * 8 + 1)) + ((data << 1) + 1)]) |
121 | 122 |
|
122 | 123 | out_config.append(table)
|
123 | 124 |
|
@@ -175,9 +176,9 @@ async def run_test(dut, config_file: str = "test_configs/test_config_1B.yaml", c
|
175 | 176 | cocotb.log.debug(f"TABLE_CAPACITY: {table_capacity}")
|
176 | 177 |
|
177 | 178 | """Asserting that the read configuration match configuration of the drivers connected to the component."""
|
178 |
| - assert mvb_items == tb.stream_in._items |
179 |
| - assert mvb_key_width_bytes == tb.stream_in._item_width |
180 |
| - assert data_out_width_bytes == tb.stream_out._item_width |
| 179 | + assert mvb_items == tb.stream_in.items |
| 180 | + assert mvb_key_width_bytes == tb.stream_in.item_widths["data"] // 8 # FIXME |
| 181 | + assert data_out_width_bytes == tb.stream_out.item_widths["data"] // 8 # FIXME |
181 | 182 | assert hash_width == log2(table_capacity)
|
182 | 183 |
|
183 | 184 | """Loading configuration from a config file"""
|
@@ -237,10 +238,14 @@ async def run_test(dut, config_file: str = "test_configs/test_config_1B.yaml", c
|
237 | 238 | for transaction in random_packets(item_width, item_width, pkt_count):
|
238 | 239 | int_transaction = int.from_bytes(transaction, "little")
|
239 | 240 |
|
| 241 | + mvb_tr = MvbTrClassic() |
240 | 242 | if int_transaction in model_keys:
|
241 |
| - tb.model((model_data[int_transaction].to_bytes(data_out_width_bytes, 'little'), 1)) |
| 243 | + mvb_tr.data = model_data[int_transaction] |
| 244 | + vld = 1 |
242 | 245 | else:
|
243 |
| - tb.model(((0).to_bytes(data_out_width_bytes, 'little'), 0)) |
| 246 | + mvb_tr.data = 0 |
| 247 | + vld = 0 |
| 248 | + tb.model((mvb_tr, vld)) |
244 | 249 |
|
245 | 250 | cocotb.log.info(f"generated transaction: {transaction.hex()}")
|
246 | 251 | tb.stream_in.append(transaction)
|
|
0 commit comments