Hello,
I need to create multiple streams which will generate traffic to incrementing address locations.
I created the following code based on the previous examples seen in this forum =>
initial begin
num_streams = 3;
for (int ii = 0; ii < num_streams; ii++) begin
automatic int mm = ii;
fork
begin: isolating_thread
addr = $random();
addr_offset = $urandom_range(4,1);
num_xactions = $urandom_range(7,3);
for (int jj = 0; jj < num_xactions; jj++) begin: for_loop
automatic int kk = jj;
fork
begin
gen_addr = addr + (kk * addr_offset);
$display("Stream %0d, Loop %0d: Generated Address = %0h\n", mm,kk,gen_addr);
end
join_none
end: for_loop
wait fork;
end // block: isolating_thread
join
end // for (int ii = 0; ii < num_streams; ii++)
end // initial begin
This is the result =>
# Stream 0, Loop 2: Generated Address = 12153528
#
# Stream 0, Loop 1: Generated Address = 12153526
#
# Stream 0, Loop 0: Generated Address = 12153524
#
# Stream 1, Loop 4: Generated Address = fc0895e8d
#
# Stream 1, Loop 3: Generated Address = fc0895e8a
#
# Stream 1, Loop 2: Generated Address = fc0895e87
:
:
# Stream 2, Loop 6: Generated Address = f8484d615
#
# Stream 2, Loop 5: Generated Address = f8484d613
:
I wanted the address across the streams to get mixed together to generate mixed traffic.
For example something like the following transactions =>
# Stream 0, Loop 0: Generated Address = 12153524
# Stream 2, Loop 0: Generated Address = f8484d609
# Stream 2, Loop 1: Generated Address = f8484d60b
# Stream 0, Loop 1: Generated Address = 12153526
# Stream 1, Loop 0: Generated Address = fc0895e81
# Stream 2, Loop 2: Generated Address = f8484d60d
:
:
I don’t want it to generate the transactions for each stream sequentially like how it is happening at present.
Any suggestions?
P.S: I will be replacing the “gen_addr and $display” statements with `uvm_do_on_with() macro to generate traffic once I get the logic working.