Tests: Cleanup t_uvm_dpi. No test change.
This commit is contained in:
parent
ff3028aca3
commit
2309d52fd6
|
|
@ -55,166 +55,179 @@ module t;
|
||||||
// TODO TEST:
|
// TODO TEST:
|
||||||
// extern const char* uvm_dpi_get_next_arg_c(int init);
|
// extern const char* uvm_dpi_get_next_arg_c(int init);
|
||||||
|
|
||||||
//===== Exports
|
begin : t_exports
|
||||||
uvm_pkg::m__uvm_report_dpi(1, "id", "message", 1, `__FILE__, `__LINE__);
|
uvm_pkg::m__uvm_report_dpi(1, "id", "message", 1, `__FILE__, `__LINE__);
|
||||||
|
end
|
||||||
|
|
||||||
//===== Tool
|
begin : t_tool
|
||||||
s = uvm_dpi_get_tool_name_c();
|
s = uvm_dpi_get_tool_name_c();
|
||||||
$display("uvm_dpi_get_tool_name_c() = %s", s);
|
$display("uvm_dpi_get_tool_name_c() = %s", s);
|
||||||
`checks(s, "Verilator");
|
`checks(s, "Verilator");
|
||||||
|
|
||||||
s = uvm_dpi_get_tool_version_c();
|
s = uvm_dpi_get_tool_version_c();
|
||||||
// - is so doesn't compare in .out file, in case version changes
|
// - is so doesn't compare in .out file, in case version changes
|
||||||
$display("- uvm_dpi_get_tool_version_c() = %s", s);
|
$display("- uvm_dpi_get_tool_version_c() = %s", s);
|
||||||
if (s == "") $stop;
|
if (s == "") $stop;
|
||||||
|
end
|
||||||
|
|
||||||
//===== Regexp
|
begin : t_regexp
|
||||||
$display("= uvm_re");
|
$display("= uvm_re");
|
||||||
h = uvm_dpi_regcomp("a.*b");
|
h = uvm_dpi_regcomp("a.*b");
|
||||||
|
|
||||||
i = uvm_dpi_regexec(h, "__a_b__");
|
i = uvm_dpi_regexec(h, "__a_b__");
|
||||||
`checkh(i, 0);
|
`checkh(i, 0);
|
||||||
i = uvm_dpi_regexec(h, "__a_z__");
|
i = uvm_dpi_regexec(h, "__a_z__");
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
|
uvm_dpi_regfree(h);
|
||||||
|
|
||||||
uvm_dpi_regfree(h);
|
i = uvm_re_match("a.*b", "__a__b__");
|
||||||
|
`checkh(i, 0);
|
||||||
|
i = uvm_re_match("a.*b", "__a__z__");
|
||||||
|
`checkh(i, 1);
|
||||||
|
|
||||||
i = uvm_re_match("a.*b", "__a__b__");
|
s = uvm_glob_to_re("a foo bar");
|
||||||
`checkh(i, 0);
|
`checks(s, "/^a foo bar$/");
|
||||||
|
end
|
||||||
|
|
||||||
i = uvm_re_match("a.*b", "__a__z__");
|
begin : t_hier
|
||||||
`checkh(i, 1);
|
|
||||||
|
|
||||||
s = uvm_glob_to_re("a foo bar");
|
|
||||||
`checks(s, "/^a foo bar$/");
|
|
||||||
|
|
||||||
//===== Hier
|
|
||||||
`ifdef VERILATOR
|
`ifdef VERILATOR
|
||||||
$c("Verilated::lastContextp()->fatalOnVpiError(false);");
|
$c("Verilated::lastContextp()->fatalOnVpiError(false);");
|
||||||
`ifdef TEST_VERBOSE
|
`ifdef TEST_VERBOSE
|
||||||
$c("Verilated::scopesDump();");
|
$c("Verilated::scopesDump();");
|
||||||
`endif
|
`endif
|
||||||
`endif
|
`endif
|
||||||
|
end
|
||||||
|
|
||||||
$display("= uvm_hdl_check_path");
|
begin : t_uvm_hdl_check_path
|
||||||
i = uvm_hdl_check_path("t.__NOT_FOUND");
|
$display("= uvm_hdl_check_path");
|
||||||
`checkh(i, 0);
|
i = uvm_hdl_check_path("t.__NOT_FOUND");
|
||||||
i = uvm_hdl_check_path("t.exposed");
|
`checkh(i, 0);
|
||||||
`checkh(i, 1);
|
i = uvm_hdl_check_path("t.exposed");
|
||||||
i = uvm_hdl_check_path("$root.t.exposed");
|
`checkh(i, 1);
|
||||||
`checkh(i, 1);
|
i = uvm_hdl_check_path("$root.t.exposed");
|
||||||
|
`checkh(i, 1);
|
||||||
|
end
|
||||||
|
|
||||||
$display("= uvm_hdl_read simple variable");
|
begin : t_simple
|
||||||
exposed = 32'hb001;
|
$display("= uvm_hdl_read simple variable");
|
||||||
lval = '0; // Upper bits not cleared by uvm_hdl_read
|
exposed = 32'hb001;
|
||||||
i = uvm_hdl_read("t.exposed", lval);
|
lval = '0; // Upper bits not cleared by uvm_hdl_read
|
||||||
`checkh(i, 1);
|
i = uvm_hdl_read("t.exposed", lval);
|
||||||
`checkh(lval[31:0], exposed);
|
`checkh(i, 1);
|
||||||
|
`checkh(lval[31:0], exposed);
|
||||||
|
|
||||||
$display("= uvm_hdl_deposit simple variable");
|
$display("= uvm_hdl_deposit simple variable");
|
||||||
lval = 1024'hab;
|
lval = 1024'hab;
|
||||||
i = uvm_hdl_deposit("t.exposed", lval);
|
i = uvm_hdl_deposit("t.exposed", lval);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
`checkh(exposed, 32'hab);
|
`checkh(exposed, 32'hab);
|
||||||
|
|
||||||
$display("= uvm_hdl_read single bit");
|
$display("= uvm_hdl_read single bit");
|
||||||
exposed = 32'habcd;
|
exposed = 32'habcd;
|
||||||
lval = '0; // Upper bits not cleared by uvm_hdl_read
|
lval = '0; // Upper bits not cleared by uvm_hdl_read
|
||||||
i = uvm_hdl_read("t.exposed[11]", lval);
|
i = uvm_hdl_read("t.exposed[11]", lval);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
`checkh(lval[0], exposed[11]);
|
`checkh(lval[0], exposed[11]);
|
||||||
|
|
||||||
$display("= uvm_hdl_deposit single bit");
|
$display("= uvm_hdl_deposit single bit");
|
||||||
lval = 1024'h0;
|
lval = 1024'h0;
|
||||||
i = uvm_hdl_deposit("t.exposed[11]", lval);
|
i = uvm_hdl_deposit("t.exposed[11]", lval);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
`checkh(exposed, 32'habc5);
|
`checkh(exposed, 32'habc5);
|
||||||
|
end
|
||||||
|
|
||||||
$display("= uvm_hdl_read multi-bit");
|
begin : t_multibit
|
||||||
exposed = 32'habcd;
|
$display("= uvm_hdl_read multi-bit");
|
||||||
lval = '0; // Upper bits not cleared by uvm_hdl_read
|
exposed = 32'habcd;
|
||||||
i = uvm_hdl_read("t.exposed[19:12]", lval);
|
lval = '0; // Upper bits not cleared by uvm_hdl_read
|
||||||
`checkh(i, 1);
|
i = uvm_hdl_read("t.exposed[19:12]", lval);
|
||||||
`checkh(lval[7:0], exposed[19:12]);
|
`checkh(i, 1);
|
||||||
|
`checkh(lval[7:0], exposed[19:12]);
|
||||||
|
|
||||||
$display("= uvm_hdl_deposit multi-bit");
|
$display("= uvm_hdl_deposit multi-bit");
|
||||||
lval = 1024'h12;
|
lval = 1024'h12;
|
||||||
i = uvm_hdl_deposit("t.exposed[19:12]", lval);
|
i = uvm_hdl_deposit("t.exposed[19:12]", lval);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
`checkh(exposed, 32'ha12d);
|
`checkh(exposed, 32'ha12d);
|
||||||
|
|
||||||
$display("= uvm_hdl_read/deposit wide decending");
|
$display("= uvm_hdl_read/deposit wide decending");
|
||||||
wide_dec = 80'h1234_56789abc_dcba8765;
|
wide_dec = 80'h1234_56789abc_dcba8765;
|
||||||
lval = '0; // Upper bits not cleared by uvm_hdl_read
|
lval = '0; // Upper bits not cleared by uvm_hdl_read
|
||||||
i = uvm_hdl_read("t.wide_dec[79:64]", lval);
|
i = uvm_hdl_read("t.wide_dec[79:64]", lval);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
`checkh(lval[15:0], wide_dec[79:64]);
|
`checkh(lval[15:0], wide_dec[79:64]);
|
||||||
lval = 1024'hffe;
|
lval = 1024'hffe;
|
||||||
i = uvm_hdl_deposit("t.wide_dec[79:64]", lval);
|
i = uvm_hdl_deposit("t.wide_dec[79:64]", lval);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
// .vvv_v......._........
|
// .vvv_v......._........
|
||||||
`checkh(wide_dec, 80'h10ff_e6789abc_dcba8765);
|
`checkh(wide_dec, 80'h10ff_e6789abc_dcba8765);
|
||||||
|
|
||||||
$display("= uvm_hdl_read/deposit wide ascending");
|
$display("= uvm_hdl_read/deposit wide ascending");
|
||||||
wide_asc = 80'h1234_56789abc_dcba8765;
|
wide_asc = 80'h1234_56789abc_dcba8765;
|
||||||
lval = '0; // Upper bits not cleared by uvm_hdl_read
|
lval = '0; // Upper bits not cleared by uvm_hdl_read
|
||||||
i = uvm_hdl_read("t.wide_asc[64:79]", lval);
|
i = uvm_hdl_read("t.wide_asc[64:79]", lval);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
`checkh(lval[15:0], wide_asc[64:79]);
|
`checkh(lval[15:0], wide_asc[64:79]);
|
||||||
lval = 1024'hffe;
|
lval = 1024'hffe;
|
||||||
i = uvm_hdl_deposit("t.wide_asc[64:79]", lval);
|
i = uvm_hdl_deposit("t.wide_asc[64:79]", lval);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
// ...._........_...vvvv.
|
// ...._........_...vvvv.
|
||||||
`checkh(wide_asc, 80'h1234_56789abc_dcb0ffe5);
|
`checkh(wide_asc, 80'h1234_56789abc_dcb0ffe5);
|
||||||
|
end
|
||||||
|
|
||||||
$display("= uvm_hdl_deposit bad ranges");
|
begin : t_deposit_bad
|
||||||
$display("===\nUVM Report expected on next line:");
|
$display("= uvm_hdl_deposit bad ranges");
|
||||||
i = uvm_hdl_deposit("t.exposed[10:3]", lval);
|
$display("===\nUVM Report expected on next line:");
|
||||||
`checkh(i, 0);
|
i = uvm_hdl_deposit("t.exposed[10:3]", lval);
|
||||||
$display("===\nUVM Report expected on next line:");
|
`checkh(i, 0);
|
||||||
i = uvm_hdl_deposit("t.exposed[99:15]", lval);
|
$display("===\nUVM Report expected on next line:");
|
||||||
`checkh(i, 0);
|
i = uvm_hdl_deposit("t.exposed[99:15]", lval);
|
||||||
|
`checkh(i, 0);
|
||||||
|
|
||||||
$display("= uvm_hdl_deposit not found (bad)");
|
$display("= uvm_hdl_deposit not found (bad)");
|
||||||
$display("===\nUVM Report expected on next line:");
|
$display("===\nUVM Report expected on next line:");
|
||||||
i = uvm_hdl_deposit("t.__DEPOSIT_NOT_FOUND", 12);
|
i = uvm_hdl_deposit("t.__DEPOSIT_NOT_FOUND", 12);
|
||||||
`checkh(i, 0);
|
`checkh(i, 0);
|
||||||
|
|
||||||
`ifdef VERILATOR
|
`ifdef VERILATOR
|
||||||
$display("= uvm_hdl_deposit to not exposed (bad)");
|
$display("= uvm_hdl_deposit to not exposed (bad)");
|
||||||
$display("===\nUVM Report expected on next line:");
|
$display("===\nUVM Report expected on next line:");
|
||||||
i = uvm_hdl_deposit("t.not_exposed", 12);
|
i = uvm_hdl_deposit("t.not_exposed", 12);
|
||||||
`checkh(i, 0);
|
`checkh(i, 0);
|
||||||
`endif
|
`endif
|
||||||
|
end
|
||||||
|
|
||||||
// Force-release
|
begin : t_force_release
|
||||||
exposed = 32'h11223344;
|
exposed = 32'h11223344;
|
||||||
i = uvm_hdl_read("t.exposed", lval);
|
i = uvm_hdl_read("t.exposed", lval);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
`checkh(lval[31:0], exposed);
|
`checkh(lval[31:0], exposed);
|
||||||
// UNSUPPORTED: force/release via VPI
|
// UNSUPPORTED: force/release via VPI
|
||||||
// If support, validate or throw unsupported on force/release part-selects
|
// If support, validate or throw unsupported on force/release part-selects
|
||||||
$display("= uvm_hdl_force");
|
$display("= uvm_hdl_force");
|
||||||
i = uvm_hdl_force("t.exposed", 62);
|
i = uvm_hdl_force("t.exposed", 62);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
|
|
||||||
$display("= uvm_hdl_release");
|
$display("= uvm_hdl_release");
|
||||||
i = uvm_hdl_release("t.exposed");
|
i = uvm_hdl_release("t.exposed");
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
|
|
||||||
$display("= uvm_hdl_release_and_read");
|
$display("= uvm_hdl_release_and_read");
|
||||||
i = uvm_hdl_release_and_read("t.exposed", lval);
|
i = uvm_hdl_release_and_read("t.exposed", lval);
|
||||||
`checkh(i, 1);
|
`checkh(i, 1);
|
||||||
|
end
|
||||||
|
|
||||||
$display("= uvm_hdl_force to not exposed (bad)");
|
begin : t_force_expose_bad
|
||||||
$display("===\nUVM Report expected on next line:");
|
$display("= uvm_hdl_force to not exposed (bad)");
|
||||||
i = uvm_hdl_force("t.not_exposed", 12);
|
$display("===\nUVM Report expected on next line:");
|
||||||
`checkh(i, 0);
|
i = uvm_hdl_force("t.not_exposed", 12);
|
||||||
|
`checkh(i, 0);
|
||||||
|
|
||||||
$display("= uvm_hdl_force to not forcable (bad)");
|
$display("= uvm_hdl_force to not forcable (bad)");
|
||||||
$display("===\nUVM Report expected on next line:");
|
$display("===\nUVM Report expected on next line:");
|
||||||
i = uvm_hdl_force("t.exposed_not_forceable", 12);
|
i = uvm_hdl_force("t.exposed_not_forceable", 12);
|
||||||
`checkh(i, 0);
|
`checkh(i, 0);
|
||||||
|
end
|
||||||
|
|
||||||
$write("*-* All Finished *-*\n");
|
$write("*-* All Finished *-*\n");
|
||||||
$finish;
|
$finish;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue