Skip to content

Commit 443eb30

Browse files
radek-isajakubcabal
authored andcommitted
fix(uvm): add address when address number is less that two in sequence_flowtest
When there is less address then flowtest generator crash
1 parent 039d981 commit 443eb30

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

comp/uvm/packet_generators/sequence_flowtest.sv

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,25 @@ class sequence_flowtest #(int unsigned ITEM_WIDTH) extends uvm_common::sequence_
177177
ipv4 = ipv4.unique() with (item.address);
178178
ipv6 = ipv6.unique() with (item.address);
179179
mac = mac .unique() with (item.address);
180+
181+
// Tool doesnt support less address that 2
182+
while (ipv4.size() < 2) begin
183+
ipv4 = new[ipv4.size()+1](ipv4);
184+
std::randomize(ipv4[ipv4.size()-1].address);
185+
std::randomize(ipv4[ipv4.size()-1].mask) with { ipv4[ipv4.size()-1].mask <= 32;};
186+
end
187+
188+
while (ipv6.size() < 2) begin
189+
ipv6 = new[ipv6.size()+1](ipv6);
190+
std::randomize(ipv6[ipv6.size()-1].address);
191+
std::randomize(ipv6[ipv6.size()-1].mask) with { ipv6[ipv6.size()-1].mask <= 128;};
192+
end
193+
194+
while (mac.size() < 2) begin
195+
mac = new[mac.size()+1](mac);
196+
std::randomize(mac[mac.size()-1].address);
197+
std::randomize(mac[mac.size()-1].mask) with { mac[mac.size()-1].mask <= 128;};
198+
end
180199
endfunction
181200

182201
function string get_ipv4_addresses();

0 commit comments

Comments
 (0)