verilator/test_regress/t/t_package_enum.v

37 lines
725 B
Systemverilog
Raw Normal View History

2013-02-02 20:11:50 +01:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2013 Wilson Snyder
// SPDX-License-Identifier: CC0-1.0
2013-02-02 20:11:50 +01:00
package pkg;
2026-03-10 02:38:29 +01:00
typedef enum bit [1:0] {
E__NOT = 2'b00,
E__VAL = 2'b11
} E_t;
2013-02-02 20:11:50 +01:00
endpackage
module t;
2026-03-10 02:38:29 +01:00
reg [1:0] ttype;
reg m;
2013-02-02 20:11:50 +01:00
2026-03-10 02:38:29 +01:00
enum bit [1:0] {LOCAL} l;
2013-02-02 20:37:18 +01:00
2026-03-10 02:38:29 +01:00
always @(m or 1'b0 or LOCAL) begin
// Don't complain about constants in sensitivity lists
end
2013-02-02 20:37:18 +01:00
2026-03-10 02:38:29 +01:00
initial begin
ttype = pkg::E__NOT;
m = (ttype == pkg::E__VAL);
if (m != 1'b0) $stop;
2013-02-02 20:11:50 +01:00
2026-03-10 02:38:29 +01:00
ttype = pkg::E__VAL;
m = (ttype == pkg::E__VAL);
if (m != 1'b1) $stop;
2013-02-02 20:11:50 +01:00
2026-03-10 02:38:29 +01:00
$write("*-* All Finished *-*\n");
$finish;
end
2013-02-02 20:11:50 +01:00
endmodule