Parse process class, and report runtime errors (#3612)
This commit is contained in:
parent
d67d75282c
commit
13a87e5514
|
|
@ -115,4 +115,45 @@ package std;
|
||||||
return 0;
|
return 0;
|
||||||
endfunction
|
endfunction
|
||||||
endclass
|
endclass
|
||||||
|
|
||||||
|
class process;
|
||||||
|
typedef enum { FINISHED, RUNNING, WAITING, SUSPENDED, KILLED } state;
|
||||||
|
static process _s_global_process;
|
||||||
|
static function process self();
|
||||||
|
// Unsupported, emulating with single process' state
|
||||||
|
if (!_s_global_process) _s_global_process = new;
|
||||||
|
return _s_global_process;
|
||||||
|
endfunction
|
||||||
|
function state status();
|
||||||
|
// Unsupported, emulating with single process' state
|
||||||
|
return RUNNING;
|
||||||
|
endfunction
|
||||||
|
function void kill();
|
||||||
|
$error("std::process::kill() not supported");
|
||||||
|
endfunction
|
||||||
|
task await();
|
||||||
|
$error("std::process::await() not supported");
|
||||||
|
endtask
|
||||||
|
function void suspend();
|
||||||
|
$error("std::process::suspend() not supported");
|
||||||
|
endfunction
|
||||||
|
function void resume();
|
||||||
|
$error("std::process::resume() not supported");
|
||||||
|
endfunction
|
||||||
|
// When really implemented, srandom must operates on the process, but for
|
||||||
|
// now rely on the srandom() that is automatically generated for all
|
||||||
|
// classes.
|
||||||
|
// function void srandom(int seed);
|
||||||
|
// endfunction
|
||||||
|
function string get_randstate();
|
||||||
|
// Could operate on all proceses for now
|
||||||
|
// No error, as harmless until set_randstate is called
|
||||||
|
return "NOT_SUPPORTED";
|
||||||
|
endfunction
|
||||||
|
function void set_randstate(string randstate);
|
||||||
|
$error("std::process::set_randstate() not supported");
|
||||||
|
// Could operate on all proceses for now
|
||||||
|
endfunction
|
||||||
|
endclass
|
||||||
|
|
||||||
endpackage
|
endpackage
|
||||||
|
|
|
||||||
|
|
@ -2227,6 +2227,7 @@ sub files_identical {
|
||||||
$l1[$l] =~ s/CPU Time: +[0-9.]+ seconds[^\n]+/CPU Time: ###/mig;
|
$l1[$l] =~ s/CPU Time: +[0-9.]+ seconds[^\n]+/CPU Time: ###/mig;
|
||||||
$l1[$l] =~ s/\?v=[0-9.]+/?v=latest/mig; # warning URL
|
$l1[$l] =~ s/\?v=[0-9.]+/?v=latest/mig; # warning URL
|
||||||
$l1[$l] =~ s/_h[0-9a-f]{8}_/_h########_/mg;
|
$l1[$l] =~ s/_h[0-9a-f]{8}_/_h########_/mg;
|
||||||
|
$l1[$l] =~ s/ \/[^ ]+\/verilated_std.sv/ verilated_std.sv/mg;
|
||||||
if ($l1[$l] =~ s/Exiting due to.*/Exiting due to/mig) {
|
if ($l1[$l] =~ s/Exiting due to.*/Exiting due to/mig) {
|
||||||
splice @l1, $l+1; # Trunc rest
|
splice @l1, $l+1; # Trunc rest
|
||||||
last;
|
last;
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ foreach my $s (
|
||||||
'Assignment pattern with no members',
|
'Assignment pattern with no members',
|
||||||
'Assignment pattern with too many elements',
|
'Assignment pattern with too many elements',
|
||||||
'Attempted parameter setting of non-parameter: Param ',
|
'Attempted parameter setting of non-parameter: Param ',
|
||||||
|
'Can\'t find typedef: ',
|
||||||
'Can\'t find varpin scope of ',
|
'Can\'t find varpin scope of ',
|
||||||
'Can\'t resolve module reference: \'',
|
'Can\'t resolve module reference: \'',
|
||||||
'Cannot mix DPI import, DPI export, class methods, and/or public ',
|
'Cannot mix DPI import, DPI export, class methods, and/or public ',
|
||||||
|
|
@ -52,6 +53,7 @@ foreach my $s (
|
||||||
'Exceeded limit of ',
|
'Exceeded limit of ',
|
||||||
'Extern declaration\'s scope is not a defined class',
|
'Extern declaration\'s scope is not a defined class',
|
||||||
'Format to $display-like function must have constant format string',
|
'Format to $display-like function must have constant format string',
|
||||||
|
'Forward typedef used as class/package does not resolve to class/package: ',
|
||||||
'Illegal +: or -: select; type already selected, or bad dimension: ',
|
'Illegal +: or -: select; type already selected, or bad dimension: ',
|
||||||
'Illegal bit or array select; type already selected, or bad dimension: ',
|
'Illegal bit or array select; type already selected, or bad dimension: ',
|
||||||
'Illegal range select; type already selected, or bad dimension: ',
|
'Illegal range select; type already selected, or bad dimension: ',
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,3 @@
|
||||||
%Error: t/t_process.v:26:11: Forward typedef used as class/package does not resolve to class/package: 'process'
|
[0] %Error: verilated_std.sv:154: Assertion failed in top.std.process.set_randstate: std::process::set_randstate() not supported
|
||||||
26 | p = process::self();
|
%Error: verilated_std.sv:154: Verilog $stop
|
||||||
| ^~~~~~~
|
Aborting...
|
||||||
%Error: t/t_process.v:27:25: Forward typedef used as class/package does not resolve to class/package: 'process'
|
|
||||||
27 | if (p.status() != process::RUNNING) $stop;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: t/t_process.v:28:25: Forward typedef used as class/package does not resolve to class/package: 'process'
|
|
||||||
28 | if (p.status() == process::WAITING) $stop;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: t/t_process.v:29:25: Forward typedef used as class/package does not resolve to class/package: 'process'
|
|
||||||
29 | if (p.status() == process::SUSPENDED) $stop;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: t/t_process.v:30:25: Forward typedef used as class/package does not resolve to class/package: 'process'
|
|
||||||
30 | if (p.status() == process::KILLED) $stop;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: t/t_process.v:31:25: Forward typedef used as class/package does not resolve to class/package: 'process'
|
|
||||||
31 | if (p.status() == process::FINISHED) $stop;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: t/t_process.v:22:4: Can't find typedef: 'process'
|
|
||||||
22 | process p;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: Internal Error: t/t_process.v:26:11: ../V3LinkDot.cpp:#: Bad package link
|
|
||||||
26 | p = process::self();
|
|
||||||
| ^~~~~~~
|
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
||||||
scenarios(simulator => 1);
|
scenarios(simulator => 1);
|
||||||
|
|
||||||
compile(
|
compile(
|
||||||
fails => $Self->{vlt_all},
|
|
||||||
expect_filename => $Self->{golden_filename},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
execute(
|
execute(
|
||||||
check_finished => 1,
|
fails => $Self->{vlt_all},
|
||||||
) if !$Self->{vlt_all};
|
expect_filename => $Self->{golden_filename},
|
||||||
|
check_finished => !$Self->{vlt_all},
|
||||||
|
);
|
||||||
|
|
||||||
ok(1);
|
ok(1);
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
%Error: t/t_process_bad.v:12:11: Forward typedef used as class/package does not resolve to class/package: 'process'
|
%Error: t/t_process_bad.v:13:13: Class method 'bad_method' not found in class 'process'
|
||||||
12 | p = process::self();
|
: ... In instance t
|
||||||
| ^~~~~~~
|
13 | if (p.bad_method() != 0) $stop;
|
||||||
%Error: t/t_process_bad.v:8:4: Can't find typedef: 'process'
|
| ^~~~~~~~~~
|
||||||
8 | process p;
|
%Error: t/t_process_bad.v:15:9: Class method 'bad_method_2' not found in class 'process'
|
||||||
| ^~~~~~~
|
: ... In instance t
|
||||||
%Error: Internal Error: t/t_process_bad.v:12:11: ../V3LinkDot.cpp:#: Bad package link
|
15 | p.bad_method_2();
|
||||||
12 | p = process::self();
|
| ^~~~~~~~~~~~
|
||||||
| ^~~~~~~
|
%Error: Exiting due to
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,3 @@
|
||||||
%Error: t/t_process.v:26:11: Forward typedef used as class/package does not resolve to class/package: 'process'
|
[0] %Error: verilated_std.sv:154: Assertion failed in top.std.process.set_randstate: std::process::set_randstate() not supported
|
||||||
26 | p = process::self();
|
%Error: verilated_std.sv:154: Verilog $stop
|
||||||
| ^~~~~~~
|
Aborting...
|
||||||
%Error: t/t_process.v:27:25: Forward typedef used as class/package does not resolve to class/package: 'process'
|
|
||||||
27 | if (p.status() != process::RUNNING) $stop;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: t/t_process.v:28:25: Forward typedef used as class/package does not resolve to class/package: 'process'
|
|
||||||
28 | if (p.status() == process::WAITING) $stop;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: t/t_process.v:29:25: Forward typedef used as class/package does not resolve to class/package: 'process'
|
|
||||||
29 | if (p.status() == process::SUSPENDED) $stop;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: t/t_process.v:30:25: Forward typedef used as class/package does not resolve to class/package: 'process'
|
|
||||||
30 | if (p.status() == process::KILLED) $stop;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: t/t_process.v:31:25: Forward typedef used as class/package does not resolve to class/package: 'process'
|
|
||||||
31 | if (p.status() == process::FINISHED) $stop;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: t/t_process.v:22:4: Can't find typedef: 'process'
|
|
||||||
22 | process p;
|
|
||||||
| ^~~~~~~
|
|
||||||
%Error: Internal Error: t/t_process.v:26:11: ../V3LinkDot.cpp:#: Bad package link
|
|
||||||
26 | p = process::self();
|
|
||||||
| ^~~~~~~
|
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,13 @@ top_filename("t/t_process.v");
|
||||||
|
|
||||||
compile(
|
compile(
|
||||||
v_flags2 => ["+define+T_PROCESS+std::process"],
|
v_flags2 => ["+define+T_PROCESS+std::process"],
|
||||||
|
);
|
||||||
|
|
||||||
|
execute(
|
||||||
|
check_finished => !$Self->{vlt_all},
|
||||||
fails => $Self->{vlt_all},
|
fails => $Self->{vlt_all},
|
||||||
expect_filename => $Self->{golden_filename},
|
expect_filename => $Self->{golden_filename},
|
||||||
);
|
);
|
||||||
|
|
||||||
execute(
|
|
||||||
check_finished => 1,
|
|
||||||
) if !$Self->{vlt_all};
|
|
||||||
|
|
||||||
ok(1);
|
ok(1);
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue