-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1507 from vhda/verilog/enum
Verilog/enum
- Loading branch information
Showing
7 changed files
with
381 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 46 additions & 8 deletions
54
Units/parser-verilog.r/systemverilog-typedef.d/expected.tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,46 @@ | ||
myType input.sv /^} myType;$/;" T | ||
myType2 input.sv /^typedef classname#(paramvalue) myType2;$/;" T | ||
type_class input.sv /^typedef class type_class;$/;" Q | ||
type_enum input.sv /^typedef enum type_enum;$/;" T | ||
type_interface_class input.sv /^typedef interface class type_interface_class;$/;" T | ||
type_struct input.sv /^typedef struct type_struct;$/;" T | ||
type_union input.sv /^typedef union type_union;$/;" T | ||
type_unnamed input.sv /^typedef type_unnamed;$/;" T | ||
A input.sv /^ A = 2'b00,$/;" c typedef:type_enum_bit_bus_defined_values | ||
B input.sv /^ B = 2'b01,$/;" c typedef:type_enum_bit_bus_defined_values | ||
C input.sv /^ C = 2'b10,$/;" c typedef:type_enum_bit_bus_defined_values | ||
D input.sv /^ D = {1'b1, 1'b1}$/;" c typedef:type_enum_bit_bus_defined_values | ||
W input.sv /^typedef enum bit {W, X} type_enum_bit;$/;" c typedef:type_enum_bit | ||
X input.sv /^typedef enum bit {W, X} type_enum_bit;$/;" c typedef:type_enum_bit | ||
Y input.sv /^typedef enum bit [1:0] {Y, Z} type_enum_bit2;$/;" c typedef:type_enum_bit2 | ||
Z input.sv /^typedef enum bit [1:0] {Y, Z} type_enum_bit2;$/;" c typedef:type_enum_bit2 | ||
cond0 input.sv /^ cond0 = 0, cond1 = 1, cond2 = 2$/;" c typedef:type_int_unsigned | ||
cond1 input.sv /^ cond0 = 0, cond1 = 1, cond2 = 2$/;" c typedef:type_int_unsigned | ||
cond2 input.sv /^ cond0 = 0, cond1 = 1, cond2 = 2$/;" c typedef:type_int_unsigned | ||
fwd_type input.sv /^typedef fwd_type;$/;" Q | ||
fwd_type_class input.sv /^typedef class fwd_type_class;$/;" Q | ||
fwd_type_enum input.sv /^typedef enum fwd_type_enum;$/;" Q | ||
fwd_type_interface_class input.sv /^typedef interface class fwd_type_interface_class;$/;" Q | ||
fwd_type_struct input.sv /^typedef struct fwd_type_struct;$/;" Q | ||
fwd_type_union input.sv /^typedef union fwd_type_union;$/;" Q | ||
no input.sv /^typedef enum {no, yes} type_enum;$/;" c typedef:type_enum | ||
type_bit input.sv /^typedef bit type_bit;$/;" T | ||
type_bit_bus input.sv /^typedef bit [1:0] type_bit_bus;$/;" T | ||
type_bit_bus_array input.sv /^typedef bit [1:0] type_bit_bus_array [2:0];$/;" T | ||
type_class input.sv /^typedef classname#(paramvalue) type_class;$/;" T | ||
type_enum input.sv /^typedef enum {no, yes} type_enum;$/;" T | ||
type_enum.no input.sv /^typedef enum {no, yes} type_enum;$/;" c typedef:type_enum | ||
type_enum.yes input.sv /^typedef enum {no, yes} type_enum;$/;" c typedef:type_enum | ||
type_enum_bit input.sv /^typedef enum bit {W, X} type_enum_bit;$/;" T | ||
type_enum_bit.W input.sv /^typedef enum bit {W, X} type_enum_bit;$/;" c typedef:type_enum_bit | ||
type_enum_bit.X input.sv /^typedef enum bit {W, X} type_enum_bit;$/;" c typedef:type_enum_bit | ||
type_enum_bit2 input.sv /^typedef enum bit [1:0] {Y, Z} type_enum_bit2;$/;" T | ||
type_enum_bit2.Y input.sv /^typedef enum bit [1:0] {Y, Z} type_enum_bit2;$/;" c typedef:type_enum_bit2 | ||
type_enum_bit2.Z input.sv /^typedef enum bit [1:0] {Y, Z} type_enum_bit2;$/;" c typedef:type_enum_bit2 | ||
type_enum_bit_bus_defined_values input.sv /^} type_enum_bit_bus_defined_values;$/;" T | ||
type_enum_bit_bus_defined_values.A input.sv /^ A = 2'b00,$/;" c typedef:type_enum_bit_bus_defined_values | ||
type_enum_bit_bus_defined_values.B input.sv /^ B = 2'b01,$/;" c typedef:type_enum_bit_bus_defined_values | ||
type_enum_bit_bus_defined_values.C input.sv /^ C = 2'b10,$/;" c typedef:type_enum_bit_bus_defined_values | ||
type_enum_bit_bus_defined_values.D input.sv /^ D = {1'b1, 1'b1}$/;" c typedef:type_enum_bit_bus_defined_values | ||
type_int_unsigned input.sv /^ } type_int_unsigned;$/;" T | ||
type_int_unsigned.cond0 input.sv /^ cond0 = 0, cond1 = 1, cond2 = 2$/;" c typedef:type_int_unsigned | ||
type_int_unsigned.cond1 input.sv /^ cond0 = 0, cond1 = 1, cond2 = 2$/;" c typedef:type_int_unsigned | ||
type_int_unsigned.cond2 input.sv /^ cond0 = 0, cond1 = 1, cond2 = 2$/;" c typedef:type_int_unsigned | ||
type_struct input.sv /^ } type_struct;$/;" T | ||
type_struct_union input.sv /^ } type_struct_union;$/;" T | ||
type_union input.sv /^ } type_union;$/;" T | ||
type_union_packed input.sv /^ } type_union_packed;$/;" T | ||
type_union_tagged input.sv /^ } type_union_tagged;$/;" T | ||
yes input.sv /^typedef enum {no, yes} type_enum;$/;" c typedef:type_enum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,55 @@ | ||
typedef enum type_enum; | ||
typedef struct type_struct; | ||
typedef union type_union; | ||
typedef class type_class; | ||
typedef interface class type_interface_class; | ||
typedef type_unnamed; | ||
typedef enum fwd_type_enum; | ||
typedef struct fwd_type_struct; | ||
typedef union fwd_type_union; | ||
typedef class fwd_type_class; | ||
typedef interface class fwd_type_interface_class; | ||
typedef fwd_type; | ||
|
||
typedef enum {no, yes} type_enum; | ||
typedef enum bit {W, X} type_enum_bit; | ||
typedef enum bit [1:0] {Y, Z} type_enum_bit2; | ||
|
||
typedef struct { | ||
real struct_real; | ||
bit [1:0] struct_bit; | ||
} type_struct; | ||
|
||
typedef union { | ||
real union_real; | ||
bit [1:0] union_bit; | ||
} type_union; | ||
|
||
typedef union packed { | ||
bit [1:0] union_bit1; | ||
bit [1:0] union_bit2; | ||
} type_union_packed; | ||
|
||
typedef union tagged { | ||
void Invalid; | ||
int Valid; | ||
} type_union_tagged; | ||
|
||
typedef struct { | ||
real struct_real; | ||
union { | ||
int i; | ||
bit b; | ||
} struct_union; | ||
} type_struct_union; | ||
|
||
typedef bit type_bit; | ||
typedef bit [1:0] type_bit_bus; | ||
typedef bit [1:0] type_bit_bus_array [2:0]; | ||
|
||
typedef enum int unsigned{ | ||
cond0 = 0, cond1 = 1, cond2 = 2 | ||
} type_int_unsigned; | ||
|
||
typedef enum bit [1:0] { | ||
A = 2'b00, | ||
B = 2'b01, | ||
C = 2'b10, | ||
D = 2'b11 | ||
} myType; | ||
D = {1'b1, 1'b1} | ||
} type_enum_bit_bus_defined_values; | ||
|
||
typedef classname#(paramvalue) myType2; | ||
typedef classname#(paramvalue) type_class; |
Oops, something went wrong.