-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
160dbc6
commit 9174134
Showing
5 changed files
with
122 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from uvm.seq import UVMSequence | ||
from uvm.macros.uvm_object_defines import uvm_object_utils | ||
from uvm.macros.uvm_message_defines import uvm_fatal | ||
from uvm.base.uvm_config_db import UVMConfigDb | ||
from EF_UVM.bus_env.bus_seq_lib.bus_seq_base import bus_seq_base | ||
from cocotb.triggers import Timer | ||
from uvm.macros.uvm_sequence_defines import uvm_do_with, uvm_do | ||
from i2c_seq_lib.i2c_bus_seq_base import i2c_bus_seq_base | ||
import random | ||
from uvm.macros import uvm_component_utils, uvm_info, uvm_error, uvm_warning | ||
from uvm.base.uvm_object_globals import UVM_HIGH, UVM_LOW, UVM_MEDIUM | ||
|
||
|
||
class i2c_write_mul_seq(i2c_bus_seq_base): | ||
# use this sequence write or read from register by the bus interface | ||
# this sequence should be connected to the bus sequencer in the testbench | ||
# you should create as many sequences as you need not only this one | ||
def __init__(self, name="i2c_write_mul_seq"): | ||
super().__init__(name) | ||
|
||
async def body(self): | ||
await super().body() | ||
address = random.randint(0, 8191) | ||
data = [random.randint(0, 255) for i in range(random.randint(1, 10))] | ||
for i in range(10): | ||
if random.random() > 0.5: | ||
slave_address = self.slave0.slave_address | ||
else: | ||
slave_address = self.slave1.slave_address | ||
await self.write_multiple(slave_address, address, data) | ||
await self.read_address(slave_address, address, len(data)) | ||
# read rx fifo | ||
for i in range(len(data)): | ||
await self.wait_data_rx_not_empty() | ||
await self.send_req(is_write=False, reg="Data") # read all so the fifo will not get full | ||
|
||
|
||
uvm_object_utils(i2c_write_mul_seq) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters