You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gp.set_address(0x0011_2233_4455_7788);
gp.set_write();
gp.set_data(bytes);
gp.set_data_length(16);
gp.set_streaming_width(1);
gp.set_byte_enable(bytes); // TECHNICALLY, byte_enables elements should be 00 or FF, nothing else
gp.set_byte_enable_length(16);
gp.set_dmi_allowed(1);
gp.set_response_status(UVM_TLM_BYTE_ENABLE_ERROR_RESPONSE);
import uvm;
import esdl;
import std.stdio;
class test: uvm_test{
bool pass = 1;
mixin uvm_component_utils;
this(string name, uvm_component parent = null){
super(name, parent);
}
void strip_id(ref string s){
bool in_id = 0;
int i = 0;
bool p;
}
void filter(ref string s1, ref string s2){
strip_id(s1);
strip_id(s2);
}
override void run_phase(uvm_phase phase){
uvm_tlm_gp obj1 = new uvm_tlm_gp("obj1"),
uvm_tlm_gp obj2 = new uvm_tlm_gp("obj2");
obj2.copy(obj1);
if(!obj1.compare(obj2))
uvm_fatal("MISCOMPARE",$sformatf("MISCOMPARE detected on generic payload!"));
{
string s1,s2;
s1 = obj1.sprint(uvm_default_tree_printer);
s2 = obj2.sprint(uvm_default_tree_printer);
filter(s1,s2);
if (s1 != s2)
uvm_fatal("MISCOMPARE",{"Sprint tree:\nobj1=\n",s1,"\nobj2=\n",s2});
s1 = obj1.sprint(uvm_default_line_printer);
s2 = obj2.sprint(uvm_default_line_printer);
filter(s1,s2);
if (s1 != s2)
uvm_fatal("MISCOMPARE",{"Sprint line:\nobj1=\n",s1,"\nobj2=\n",s2});
}
uvm_default_packer.use_metadata = 1;
uvm_default_packer.big_endian = i % 2;
uvm_info("TEST", format("Testing pack/unpack using %0s endian...", uvm_default_packer.big_endian) ? "big" : "little"), UVM_NONE)
obj2 = new obj("obj2");
np = obj1.pack(bits);
nu = obj2.unpack(bits);
if (!obj1.compare(obj2)) {
uvm_error("TEST", "pack/unpack MISCOMPARE");
obj1.print();
obj2.print();
}
if (np != nu) {
uvm_error("TEST", $sformatf("pack_bytes() packed %0d bits but unpacked %0d bits", np, nu))
}
void(obj1.begin_tr()){
obj1.m_data[i] = i;
obj1.end_tr();
}
uvm_info("TEST", "Checking content of packed byte stream...", UVM_LOW)
{
uvm_tlm_gp gp = new uvm_tlm_gp();
bytes = [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae
];
gp.set_address(0x0011_2233_4455_7788);
gp.set_write();
gp.set_data(bytes);
gp.set_data_length(16);
gp.set_streaming_width(1);
gp.set_byte_enable(bytes); // TECHNICALLY, byte_enables elements should be 00 or FF, nothing else
gp.set_byte_enable_length(16);
gp.set_dmi_allowed(1);
gp.set_response_status(UVM_TLM_BYTE_ENABLE_ERROR_RESPONSE);
uvm_default_packer.big_endian = 0;
void(gp.pack_bytes(bytes));
writeln("};\n");
The text was updated successfully, but these errors were encountered: