2016-06-16 02:46:34 +00:00
// DESCRIPTION: Verilator: Verilog Test module
//
2020-03-21 15:24:24 +00:00
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2014 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
2016-06-16 02:46:34 +00:00
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); $stop; end while(0);
`define checks(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='%s' exp='%s'\n", `__FILE__,`__LINE__, (gotv), (expv)); $stop; end while(0);
module t ( /*AUTOARG*/
// Inputs
clk
) ;
input clk ;
typedef enum {
2022-05-01 14:10:00 +00:00
E01 = 'h1 ,
ELARGE = 'hf00d
} my_t ;
2016-06-16 02:46:34 +00:00
2022-05-01 14:10:00 +00:00
integer cyc = 0 ;
2016-06-16 02:46:34 +00:00
my_t e ;
string all ;
// Check runtime
always @ ( posedge clk ) begin
cyc < = cyc + 1 ;
if ( cyc = = 0 ) begin
2022-05-01 14:10:00 +00:00
// Setup
e < = E01 ;
2016-06-16 02:46:34 +00:00
end
else if ( cyc = = 1 ) begin
2022-05-01 14:10:00 +00:00
`checks ( e . name , " E01 " ) ;
`checkh ( e . next , ELARGE ) ;
e < = ELARGE ;
2016-06-16 02:46:34 +00:00
end
else if ( cyc = = 3 ) begin
2022-05-01 14:10:00 +00:00
`checks ( e . name , " ELARGE " ) ;
`checkh ( e . next , E01 ) ;
`checkh ( e . prev , E01 ) ;
e < = E01 ;
2016-06-16 02:46:34 +00:00
end
else if ( cyc = = 20 ) begin
2022-05-01 14:10:00 +00:00
e < = my_t '(' h11 ) ; // Unknown
2016-06-16 02:46:34 +00:00
end
2021-12-11 16:22:04 +00:00
else if ( cyc = = 21 ) begin
2022-05-01 14:10:00 +00:00
`checks ( e . name , " " ) ; // Unknown
2016-06-16 02:46:34 +00:00
end
else if ( cyc = = 99 ) begin
2022-05-01 14:10:00 +00:00
$write ( " *-* All Finished *-* \n " ) ;
$finish ;
2016-06-16 02:46:34 +00:00
end
end
endmodule