forked from github/verilator
Fix test
This commit is contained in:
parent
e931c6230a
commit
5eded789aa
@ -1,142 +1,261 @@
|
||||
module Vt_debug_emitv___024root;
|
||||
module Vt_debug_emitv_t;
|
||||
input logic clk;
|
||||
input logic in;
|
||||
signed int [31:0] t.array[0:2];
|
||||
logic [15:0] t.pubflat;
|
||||
logic [15:0] t.pubflat_r;
|
||||
signed int [31:0] t.fd;
|
||||
signed int [31:0] t.i;
|
||||
signed int [31:0] t.cyc;
|
||||
signed int [31:0] t.fo;
|
||||
signed int [31:0] t.sum;
|
||||
signed real t.r;
|
||||
string t.str;
|
||||
signed int [31:0] t._Vpast_0_0;
|
||||
signed int [31:0] t._Vpast_1_0;
|
||||
signed int [31:0] t.unnamedblk3.i;
|
||||
@(*)@([settle])@([initial])@(posedge clk)@(negedge
|
||||
clk)always @(
|
||||
*)@(
|
||||
[settle])@(
|
||||
[initial])@(
|
||||
posedge
|
||||
clk)@(
|
||||
negedge
|
||||
clk) begin
|
||||
$display("stmt");
|
||||
end
|
||||
always @([settle])@([initial])@(posedge clk)@(negedge
|
||||
clk) begin
|
||||
$display("stmt");
|
||||
end
|
||||
initial begin
|
||||
// Function: f
|
||||
$write("stmt\nstmt 0 99\n");
|
||||
// Function: t
|
||||
$display("stmt");
|
||||
// Function: f
|
||||
$write("stmt\nstmt 1 -1\n");
|
||||
// Function: t
|
||||
$display("stmt");
|
||||
// Function: f
|
||||
$display("stmt");
|
||||
$display("stmt 2 -2");
|
||||
// Function: t
|
||||
$display("stmt");
|
||||
$display("stmt");
|
||||
end
|
||||
typedef
|
||||
???? // ENUMDTYPE 't.e_t'
|
||||
|
||||
???? // CFUNC '_final_TOP'
|
||||
???? // ENUMITEM 'ZERO'
|
||||
32'h0
|
||||
???? // ENUMITEM 'ONE'
|
||||
'sh1
|
||||
???? // REFDTYPE 'e_t'
|
||||
struct packed
|
||||
{
|
||||
???? // REFDTYPE 'e_t'
|
||||
a}signed logic [2:0] struct
|
||||
{signed logic [2:0] a}logicunion
|
||||
{logic a}
|
||||
???? // REFDTYPE 'ps_t'
|
||||
bit [31:0] const
|
||||
???? // REFDTYPE 'ps_t'
|
||||
const
|
||||
???? // REFDTYPE 'ps_t'
|
||||
[0:2]
|
||||
???? // REFDTYPE 'us_t'
|
||||
|
||||
???? // REFDTYPE 'union_t'
|
||||
signed int [31:0] signed int [31:0] [0:2]logic [15:0] logic [15:0] logic [15:0] signed int [31:0] signed int [31:0] signed int [31:0]
|
||||
???? // QUEUEDTYPE
|
||||
signed int [31:0] string
|
||||
???? // ASSOCARRAYDTYPE
|
||||
signed int [31:0]
|
||||
???? // UNSIZEDARRAYDTYPE
|
||||
|
||||
???? // DYNARRAYDTYPE
|
||||
signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed realstringIData [31:0] signed logic [31:0] signed int [31:0] logic [2:0] logic [0:0] e_t;
|
||||
typedef struct packed
|
||||
{
|
||||
???? // REFDTYPE 'e_t'
|
||||
a}signed logic [2:0] struct
|
||||
{signed logic [2:0] a}logicunion
|
||||
{logic a}
|
||||
???? // REFDTYPE 'ps_t'
|
||||
bit [31:0] const
|
||||
???? // REFDTYPE 'ps_t'
|
||||
const
|
||||
???? // REFDTYPE 'ps_t'
|
||||
[0:2]
|
||||
???? // REFDTYPE 'us_t'
|
||||
|
||||
???? // REFDTYPE 'union_t'
|
||||
signed int [31:0] signed int [31:0] [0:2]logic [15:0] logic [15:0] logic [15:0] signed int [31:0] signed int [31:0] signed int [31:0]
|
||||
???? // QUEUEDTYPE
|
||||
signed int [31:0] string
|
||||
???? // ASSOCARRAYDTYPE
|
||||
signed int [31:0]
|
||||
???? // UNSIZEDARRAYDTYPE
|
||||
|
||||
???? // DYNARRAYDTYPE
|
||||
signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed realstringIData [31:0] signed logic [31:0] signed int [31:0] logic [2:0] logic [0:0] ps_t;
|
||||
typedef struct
|
||||
{signed logic [2:0] a}logicunion
|
||||
{logic a}
|
||||
???? // REFDTYPE 'ps_t'
|
||||
bit [31:0] const
|
||||
???? // REFDTYPE 'ps_t'
|
||||
const
|
||||
???? // REFDTYPE 'ps_t'
|
||||
[0:2]
|
||||
???? // REFDTYPE 'us_t'
|
||||
|
||||
???? // REFDTYPE 'union_t'
|
||||
signed int [31:0] signed int [31:0] [0:2]logic [15:0] logic [15:0] logic [15:0] signed int [31:0] signed int [31:0] signed int [31:0]
|
||||
???? // QUEUEDTYPE
|
||||
signed int [31:0] string
|
||||
???? // ASSOCARRAYDTYPE
|
||||
signed int [31:0]
|
||||
???? // UNSIZEDARRAYDTYPE
|
||||
|
||||
???? // DYNARRAYDTYPE
|
||||
signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed realstringIData [31:0] signed logic [31:0] signed int [31:0] logic [2:0] logic [0:0] us_t;
|
||||
typedef union
|
||||
{logic a}
|
||||
???? // REFDTYPE 'ps_t'
|
||||
bit [31:0] const
|
||||
???? // REFDTYPE 'ps_t'
|
||||
const
|
||||
???? // REFDTYPE 'ps_t'
|
||||
[0:2]
|
||||
???? // REFDTYPE 'us_t'
|
||||
|
||||
???? // REFDTYPE 'union_t'
|
||||
signed int [31:0] signed int [31:0] [0:2]logic [15:0] logic [15:0] logic [15:0] signed int [31:0] signed int [31:0] signed int [31:0]
|
||||
???? // QUEUEDTYPE
|
||||
signed int [31:0] string
|
||||
???? // ASSOCARRAYDTYPE
|
||||
signed int [31:0]
|
||||
???? // UNSIZEDARRAYDTYPE
|
||||
|
||||
???? // DYNARRAYDTYPE
|
||||
signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed int [31:0] signed realstringIData [31:0] signed logic [31:0] signed int [31:0] logic [2:0] logic [0:0] union_t;
|
||||
struct packed
|
||||
{
|
||||
???? // REFDTYPE 'e_t'
|
||||
a} ps[0:2];
|
||||
struct
|
||||
{signed logic [2:0] a} us;
|
||||
union
|
||||
{logic a} unu;
|
||||
signed int [31:0] array[0:2];
|
||||
initial begin
|
||||
array = '{0:32'sh1, 1:32'sh2, 2:32'sh3};
|
||||
end
|
||||
logic [15:0] pubflat;
|
||||
logic [15:0] pubflat_r;
|
||||
logic [15:0] pubflat_w;
|
||||
assign pubflat_w = pubflat;
|
||||
signed int [31:0] fd;
|
||||
signed int [31:0] i;
|
||||
|
||||
???? // QUEUEDTYPE
|
||||
q;
|
||||
|
||||
???? // ASSOCARRAYDTYPE
|
||||
assoc;
|
||||
|
||||
???? // DYNARRAYDTYPE
|
||||
dyn;
|
||||
task t;
|
||||
$display("stmt");
|
||||
always @(posedge clk)@(negedge clk) begin
|
||||
endtask
|
||||
function f;
|
||||
input signed int [31:0] v;
|
||||
begin : label0
|
||||
$display("stmt");
|
||||
f = ((v == 'sh0) ? 'sh63 : ((~ v) + 'sh1));
|
||||
disable label0;
|
||||
end
|
||||
endfunction
|
||||
initial begin
|
||||
begin : unnamedblk1
|
||||
signed int [31:0] other;
|
||||
begin
|
||||
begin : unnamedblk2
|
||||
signed int [31:0] i;
|
||||
i = 'sh0;
|
||||
while ((i < 'sh3)) begin
|
||||
begin
|
||||
other = f(i);
|
||||
$display("stmt %~ %~",
|
||||
iother, other);
|
||||
t()end
|
||||
i = (i + 'h1);
|
||||
end
|
||||
end
|
||||
end
|
||||
begin : named
|
||||
$display("stmt");
|
||||
end
|
||||
end
|
||||
end
|
||||
final begin
|
||||
begin
|
||||
$display("stmt");
|
||||
end
|
||||
end
|
||||
always @([any] in) begin
|
||||
begin
|
||||
$display("stmt");
|
||||
end
|
||||
end
|
||||
always @(posedge clk) begin
|
||||
begin
|
||||
$display("posedge clk");
|
||||
end
|
||||
always @(posedge clk)@(negedge clk) begin
|
||||
__Vdly__t.pubflat_r <= t.pubflat;
|
||||
end
|
||||
always @(posedge clk)@(negedge clk) begin
|
||||
__Vdly__t.cyc <= (32'sh1 + t.cyc);
|
||||
__Vdly__t.r <= (0.01 + t.r);
|
||||
t.fo = t.cyc;
|
||||
// Function: inc
|
||||
__Vtask_t.sub.inc__2__i = t.fo;
|
||||
__Vtask_t.sub.inc__2__o = (32'h1 + __Vtask_t.sub.inc__2__i[31:1]);
|
||||
t.sum = __Vtask_t.sub.inc__2__o;
|
||||
// Function: f
|
||||
__Vfunc_t.sub.f__3__v = t.sum;
|
||||
begin : label0
|
||||
begin : label0
|
||||
if ((32'sh0 == __Vfunc_t.sub.f__3__v)) begin
|
||||
__Vfunc_t.sub.f__3__Vfuncout = 32'sh21;
|
||||
disable label0;
|
||||
end
|
||||
__Vfunc_t.sub.f__3__Vfuncout = (32'h1
|
||||
+ __Vfunc_t.sub.f__3__v[2]);
|
||||
disable label0;
|
||||
pubflat_r <= pubflat_w;
|
||||
end
|
||||
end
|
||||
t.sum = __Vfunc_t.sub.f__3__Vfuncout;
|
||||
$display("[%0t] sum = %~", $timet.sum, t.sum);
|
||||
$display("a?= %d", ($c(32'sh1) ? $c(32'sh14)
|
||||
: $c(32'sh1e)));
|
||||
always @(negedge clk) begin
|
||||
begin
|
||||
$display("negedge clk, pfr = %x", pubflat_r);
|
||||
end
|
||||
end
|
||||
signed int [31:0] cyc;
|
||||
signed int [31:0] fo;
|
||||
signed int [31:0] sum;
|
||||
signed real r;
|
||||
string str;
|
||||
always @(posedge clk) begin
|
||||
begin
|
||||
cyc <= (cyc + 'sh1);
|
||||
r <= (r + 0.01);
|
||||
fo = cyc;
|
||||
sub.inc(fosum)sum = sub.f(sum);
|
||||
$display("[%0t] sum = %~", $timesum, sum);
|
||||
$display("a?= %d", ($c('sh1) ? $c('sh14)
|
||||
: $c('sh1e)));
|
||||
$c(;);
|
||||
$display("%d", $c(0));
|
||||
$fopen(72'h2f6465762f6e756c6c);
|
||||
$fclose(t.fd);
|
||||
$fclose(fd);
|
||||
$fopen(72'h2f6465762f6e756c6c, 8'h72);
|
||||
$fgetc(t.fd);
|
||||
$fflush(t.fd);
|
||||
$fscanf(t.fd, "%d", t.sum);
|
||||
$fgetc(fd);
|
||||
$fflush(fd);
|
||||
$fscanf(fd, "%d", sum);
|
||||
;
|
||||
$fdisplay(32'h69203d20, "%~", t.sum);
|
||||
$fwrite(t.fd, "hello");
|
||||
$readmemh(t.fd, t.array);
|
||||
$readmemh(t.fd, t.array, 32'sh0);
|
||||
$readmemh(t.fd, t.array, 32'sh0, 32'sh0);
|
||||
t.sum = 32'sh0;
|
||||
t.unnamedblk3.i = 32'sh0;
|
||||
$fdisplay(32'h69203d20, "%~", sum);
|
||||
$fwrite(fd, "hello");
|
||||
$readmemh(fd, array);
|
||||
$readmemh(fd, array, 'sh0);
|
||||
$readmemh(fd, array, 'sh0, 'sh0);
|
||||
sum = 'sh0;
|
||||
begin : unnamedblk3
|
||||
signed int [31:0] i;
|
||||
i = 'sh0;
|
||||
begin : label0
|
||||
while ((t.unnamedblk3.i < t.cyc)) begin
|
||||
t.sum = (t.sum + t.unnamedblk3.i);
|
||||
if ((32'sha < t.sum)) begin
|
||||
while ((i < cyc)) begin
|
||||
begin
|
||||
sum = (sum + i);
|
||||
if ((sum > 'sha)) begin
|
||||
disable label0;
|
||||
end
|
||||
else begin
|
||||
t.sum = (32'sh1 + t.sum);
|
||||
end
|
||||
t.unnamedblk3.i = (32'h1 + t.unnamedblk3.i);
|
||||
sum = (sum + 'sh1);
|
||||
end
|
||||
end
|
||||
if ((32'sh63 == t.cyc)) begin
|
||||
i = (i + 'h1);
|
||||
end
|
||||
end
|
||||
end
|
||||
if ((cyc == 'sh63)) begin
|
||||
$finish;
|
||||
end
|
||||
if ((32'sh64 == t.cyc)) begin
|
||||
if ((cyc == 'sh64)) begin
|
||||
$stop;
|
||||
end
|
||||
if (in) begin
|
||||
$display("1");
|
||||
case (in)
|
||||
'sh1: begin $display("1");
|
||||
end
|
||||
else begin
|
||||
$display("default");
|
||||
default: begin $display("default");
|
||||
end
|
||||
if (in) begin
|
||||
$display("1");
|
||||
endcase
|
||||
priority case (in)
|
||||
'sh1: begin $display("1");
|
||||
end
|
||||
else begin
|
||||
$display("default");
|
||||
default: begin $display("default");
|
||||
end
|
||||
if (in) begin
|
||||
$display("1");
|
||||
endcase
|
||||
unique case (in)
|
||||
'sh1: begin $display("1");
|
||||
end
|
||||
else begin
|
||||
$display("default");
|
||||
default: begin $display("default");
|
||||
end
|
||||
if (in) begin
|
||||
$display("1");
|
||||
endcase
|
||||
unique0 case (in)
|
||||
'sh1: begin $display("1");
|
||||
end
|
||||
else begin
|
||||
$display("default");
|
||||
default: begin $display("default");
|
||||
end
|
||||
endcase
|
||||
if (in) begin
|
||||
$display("1");
|
||||
end
|
||||
@ -161,86 +280,89 @@ module Vt_debug_emitv___024root;
|
||||
else begin
|
||||
$display("0");
|
||||
end
|
||||
$display("%~%~", t._Vpast_0_0t._Vpast_1_0,
|
||||
t._Vpast_1_0);
|
||||
t.str = $sformatf("cyc=%~", t.cyc);
|
||||
$display("%~%~", $past(cyc)$past(cyc, 'sh1),
|
||||
$past(cyc, 'sh1));
|
||||
str = $sformatf("cyc=%~", cyc);
|
||||
;
|
||||
$display("str = %@", t.str);
|
||||
$display("%% [%t] [%^] to=%o td=%d", $time$realtime
|
||||
$time$time, $realtime$time$time, $time
|
||||
$time, $time);
|
||||
$sscanf(40'h666f6f3d35, "foo=%d", t.i);
|
||||
$display("str = %@", str);
|
||||
$display("%% [%t] [%^] to=%o td=%d", $time
|
||||
$realtime$time$time, $realtime
|
||||
$time$time, $time$time, $time);
|
||||
$sscanf(40'h666f6f3d35, "foo=%d", i);
|
||||
;
|
||||
$printtimescale;
|
||||
if ((32'sh5 != t.i)) begin
|
||||
if ((i != 'sh5)) begin
|
||||
$stop;
|
||||
end
|
||||
t.sum =
|
||||
sum =
|
||||
???? // RAND
|
||||
32'sha;
|
||||
$display("%g", $log10(t.r));
|
||||
$display("%g", $ln(t.r));
|
||||
$display("%g", $exp(t.r));
|
||||
$display("%g", $sqrt(t.r));
|
||||
$display("%g", $floor(t.r));
|
||||
$display("%g", $ceil(t.r));
|
||||
$display("%g", $sin(t.r));
|
||||
$display("%g", $cos(t.r));
|
||||
$display("%g", $tan(t.r));
|
||||
$display("%g", $asin(t.r));
|
||||
$display("%g", $acos(t.r));
|
||||
$display("%g", $atan(t.r));
|
||||
$display("%g", $sinh(t.r));
|
||||
$display("%g", $cosh(t.r));
|
||||
$display("%g", $tanh(t.r));
|
||||
$display("%g", $asinh(t.r));
|
||||
$display("%g", $acosh(t.r));
|
||||
$display("%g", $atanh(t.r));
|
||||
;
|
||||
sum =
|
||||
???? // RAND
|
||||
'sha;
|
||||
sum =
|
||||
???? // RAND
|
||||
;
|
||||
sum =
|
||||
???? // RAND
|
||||
'sha;
|
||||
if ((PKG_PARAM != 'sh1)) begin
|
||||
$stop;
|
||||
end
|
||||
/*verilator public_flat_rw @(posedge clk)@(negedge
|
||||
clk) t.pubflat*/
|
||||
always @(posedge clk)@(negedge clk) begin
|
||||
__Vdly__t._Vpast_0_0 <= t.cyc;
|
||||
sub.r = 62;
|
||||
$display("%g", $log10(r));
|
||||
$display("%g", $ln(r));
|
||||
$display("%g", $exp(r));
|
||||
$display("%g", $sqrt(r));
|
||||
$display("%g", $floor(r));
|
||||
$display("%g", $ceil(r));
|
||||
$display("%g", $sin(r));
|
||||
$display("%g", $cos(r));
|
||||
$display("%g", $tan(r));
|
||||
$display("%g", $asin(r));
|
||||
$display("%g", $acos(r));
|
||||
$display("%g", $atan(r));
|
||||
$display("%g", $sinh(r));
|
||||
$display("%g", $cosh(r));
|
||||
$display("%g", $tanh(r));
|
||||
$display("%g", $asinh(r));
|
||||
$display("%g", $acosh(r));
|
||||
$display("%g", $atanh(r));
|
||||
end
|
||||
always @(posedge clk)@(negedge clk) begin
|
||||
__Vdly__t._Vpast_1_0 <= t.cyc;
|
||||
end
|
||||
__Vdly__t._Vpast_1_0 = t._Vpast_1_0;
|
||||
t._Vpast_1_0 = __Vdly__t._Vpast_1_0;
|
||||
__Vdly__t._Vpast_0_0 = t._Vpast_0_0;
|
||||
t._Vpast_0_0 = __Vdly__t._Vpast_0_0;
|
||||
__Vdly__t.r = t.r;
|
||||
t.r = __Vdly__t.r;
|
||||
__Vdly__t.cyc = t.cyc;
|
||||
t.cyc = __Vdly__t.cyc;
|
||||
__Vdly__t.pubflat_r = t.pubflat_r;
|
||||
t.pubflat_r = __Vdly__t.pubflat_r;
|
||||
always @(negedge clk) begin
|
||||
$display("negedge clk, pfr = %x", t.pubflat_r);
|
||||
end
|
||||
signed int [31:0] __Vtask_t.sub.inc__2__i;
|
||||
signed int [31:0] __Vtask_t.sub.inc__2__o;
|
||||
signed int [31:0] __Vfunc_t.sub.f__3__Vfuncout;
|
||||
signed int [31:0] __Vfunc_t.sub.f__3__v;
|
||||
logic [15:0] __Vdly__t.pubflat_r;
|
||||
signed int [31:0] __Vdly__t.cyc;
|
||||
signed real __Vdly__t.r;
|
||||
signed int [31:0] __Vdly__t._Vpast_0_0;
|
||||
signed int [31:0] __Vdly__t._Vpast_1_0;
|
||||
/*verilator public_flat_rw @(posedge clk) pubflat*/
|
||||
endmodule
|
||||
package Vt_debug_emitv___024unit;
|
||||
endpackage
|
||||
package Vt_debug_emitv_Pkg;
|
||||
endpackage
|
||||
class Vt_debug_emitv___024unit__03a__03aCls;
|
||||
class Vt_debug_emitv_Cls;
|
||||
signed int [31:0] member;
|
||||
|
||||
???? // CFUNC '__VnoInFunc_method'
|
||||
|
||||
???? // CFUNC 'new'
|
||||
$_CSTMT(_ctor_var_reset(vlSymsp);
|
||||
);
|
||||
$unit::Cls.member = 32'sh1;
|
||||
member = 'sh1;
|
||||
task method;
|
||||
endtask
|
||||
task new;
|
||||
endtask
|
||||
endclass
|
||||
/*class*/package Vt_debug_emitv___024unit__03a__03aCls__Vclpkg;
|
||||
end/*class*/package
|
||||
endpackage
|
||||
module Vt_debug_emitv_sub;
|
||||
task inc;
|
||||
input signed int [31:0] i;
|
||||
output signed int [31:0] o;
|
||||
o = ({32'h1{{1'h0, i[31:1]}}} + 32'h1);
|
||||
endtask
|
||||
function f;
|
||||
input signed int [31:0] v;
|
||||
begin : label0
|
||||
begin : label0
|
||||
if ((v == 'sh0)) begin
|
||||
f = 'sh21;
|
||||
disable label0;
|
||||
end
|
||||
f = ({32'h1{{31'h0, v[2]}}} + 32'h1);
|
||||
disable label0;
|
||||
end
|
||||
end
|
||||
endfunction
|
||||
signed real r;
|
||||
endmodule
|
||||
package Vt_debug_emitv_Pkg;
|
||||
signed logic [31:0] PKG_PARAM;
|
||||
endpackage
|
||||
|
@ -16,7 +16,7 @@ lint(
|
||||
v_flags => ["--lint-only --dump-treei 9 --dump-treei-V3EmitV 9 --debug-emitv"],
|
||||
);
|
||||
|
||||
files_identical("$Self->{obj_dir}/$Self->{VM_PREFIX}__preorder.v", $Self->{golden_filename});
|
||||
files_identical(glob_one("$Self->{obj_dir}/$Self->{VM_PREFIX}_*_width.tree.v"), $Self->{golden_filename});
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user