Internal coverage improvements

This commit is contained in:
Wilson Snyder 2021-01-13 20:01:10 -05:00
parent ab5d4bd51d
commit 3bb8fbe73b
7 changed files with 46 additions and 5 deletions

View File

@ -1343,8 +1343,6 @@ void VL_FCLOSE_I(IData fdi) VL_MT_SAFE {
VerilatedImp::fdClose(fdi);
}
void VL_FFLUSH_ALL() VL_MT_SAFE { fflush(stdout); }
void VL_SFORMAT_X(int obits, CData& destr, const char* formatp, ...) VL_MT_SAFE {
static VL_THREAD_LOCAL std::string t_output; // static only for speed
t_output = "";

View File

@ -92,8 +92,8 @@ def test():
if re.search(regexp, dat):
# Remove .gcda/.gcno for files we don't care about before we slowly
# read them
os.unlink(dat)
os.unlink(gcno)
unlink_ok(dat)
unlink_ok(gcno)
del dats[dat]
break
@ -315,6 +315,13 @@ def run(command):
raise Exception("%Error: Command failed " + command + ", stopped")
def unlink_ok(filename):
try:
os.unlink(filename)
except OSError:
pass
def ci_fold_start(action):
print("::group::" + action, flush=True)

View File

@ -161,6 +161,22 @@ void _dpii_all(int c, int p, int u, const svOpenArrayHandle i, const svOpenArray
CHECK_RESULT_HEX(svSize(i, d), 7);
}
}
#ifdef VERILATOR
// Check out-of-bounds read doesn't access bad memory (when sanitizer used)
(void)svLeft(i, -1);
(void)svRight(i, -1);
(void)svLow(i, -1);
(void)svHigh(i, -1);
(void)svIncrement(i, -1);
(void)svSize(i, -1);
//
(void)svLeft(i, 99);
(void)svRight(i, 99);
(void)svLow(i, 99);
(void)svHigh(i, 99);
(void)svIncrement(i, 99);
(void)svSize(i, 99);
#endif
if (c == 2 && p == 1 && u == 3) {
for (int a = svLow(i, 1); a <= svHigh(i, 1); ++a) {

View File

@ -12,6 +12,8 @@
#include "Vt_enum_public_p3.h"
#include "Vt_enum_public_p62.h"
double sc_time_stamp() { return 0; }
int main(int argc, char* argv[]) {
Vt_enum_public* topp = new Vt_enum_public;

View File

@ -15,6 +15,10 @@ module t (/*AUTOARG*/
integer cyc=0;
reg [1*8:1] vstr1;
reg [2*8:1] vstr2;
reg [6*8:1] vstr6;
reg [4*8:1] vstr;
const string s = "a"; // Check static assignment
string s2;
@ -29,6 +33,15 @@ module t (/*AUTOARG*/
// a.itoa, a.hextoa, a.octoa, a.bintoa, a.realtoa
initial begin
$sformat(vstr1, "%s", s);
`checks(vstr1, "a");
$sformat(vstr2, "=%s", s);
`checks(vstr2, "=a");
$sformat(vstr6, "--a=%s", s);
`checks(vstr6, "--a=a");
$sformat(vstr, "s=%s", s);
`checks(vstr, "s=a");
`checks(string'(vstr), "s=a");

View File

@ -16,7 +16,7 @@ compile(
execute(
check_finished => 1,
all_run_flags => ['+PLUS +INT=1234 +STRSTR +REAL=1.2345'],
all_run_flags => ['+PLUS +INT=1234 +STRSTR +REAL=1.2345 +IP%P101'],
);
ok(1);

View File

@ -89,6 +89,11 @@ module t;
$display("str='%s'",sv_str);
if (sv_str != "T=1234") $stop;
sv_str = "none";
if ($value$plusargs("IP%%P%b", p_i)!==1) $stop;
$display("str='%s'",sv_str);
if (p_i != 'b101) $stop;
sv_in = "INT=%d";
`ifdef VERILATOR
if ($c1(0)) sv_in = "NEVER"; // Prevent constant propagation