sv_parser_syntaxtree/declarations/
net_and_variable_types.rs

1use crate::*;
2
3// -----------------------------------------------------------------------------
4
5#[derive(Clone, Debug, PartialEq, Node)]
6pub enum CastingType {
7    SimpleType(Box<SimpleType>),
8    ConstantPrimary(Box<ConstantPrimary>),
9    Signing(Box<Signing>),
10    String(Box<Keyword>),
11    Const(Box<Keyword>),
12}
13
14#[derive(Clone, Debug, PartialEq, Node)]
15pub enum DataType {
16    Vector(Box<DataTypeVector>),
17    Atom(Box<DataTypeAtom>),
18    NonIntegerType(Box<NonIntegerType>),
19    StructUnion(Box<DataTypeStructUnion>),
20    Enum(Box<DataTypeEnum>),
21    String(Box<Keyword>),
22    Chandle(Box<Keyword>),
23    Virtual(Box<DataTypeVirtual>),
24    Type(Box<DataTypeType>),
25    ClassType(Box<ClassType>),
26    Event(Box<Keyword>),
27    PsCovergroupIdentifier(Box<PsCovergroupIdentifier>),
28    TypeReference(Box<TypeReference>),
29}
30
31#[derive(Clone, Debug, PartialEq, Node)]
32pub struct DataTypeVector {
33    pub nodes: (IntegerVectorType, Option<Signing>, Vec<PackedDimension>),
34}
35
36#[derive(Clone, Debug, PartialEq, Node)]
37pub struct DataTypeAtom {
38    pub nodes: (IntegerAtomType, Option<Signing>),
39}
40
41#[derive(Clone, Debug, PartialEq, Node)]
42pub struct DataTypeStructUnion {
43    pub nodes: (
44        StructUnion,
45        Option<(Packed, Option<Signing>)>,
46        Brace<(StructUnionMember, Vec<StructUnionMember>)>,
47        Vec<PackedDimension>,
48    ),
49}
50
51#[derive(Clone, Debug, PartialEq, Node)]
52pub struct Packed {
53    pub nodes: (Keyword,),
54}
55
56#[derive(Clone, Debug, PartialEq, Node)]
57pub struct DataTypeEnum {
58    pub nodes: (
59        Keyword,
60        Option<EnumBaseType>,
61        Brace<List<Symbol, EnumNameDeclaration>>,
62        Vec<PackedDimension>,
63    ),
64}
65
66#[derive(Clone, Debug, PartialEq, Node)]
67pub struct DataTypeVirtual {
68    pub nodes: (
69        Keyword,
70        Option<Interface>,
71        InterfaceIdentifier,
72        Option<ParameterValueAssignment>,
73        Option<(Symbol, ModportIdentifier)>,
74    ),
75}
76
77#[derive(Clone, Debug, PartialEq, Node)]
78pub struct Interface {
79    pub nodes: (Keyword,),
80}
81
82#[derive(Clone, Debug, PartialEq, Node)]
83pub struct DataTypeType {
84    pub nodes: (
85        Option<PackageScopeOrClassScope>,
86        TypeIdentifier,
87        Vec<PackedDimension>,
88    ),
89}
90
91#[derive(Clone, Debug, PartialEq, Node)]
92pub enum DataTypeOrImplicit {
93    DataType(Box<DataType>),
94    ImplicitDataType(Box<ImplicitDataType>),
95}
96
97#[derive(Clone, Debug, PartialEq, Node)]
98pub struct ImplicitDataType {
99    pub nodes: (Option<Signing>, Vec<PackedDimension>),
100}
101
102#[derive(Clone, Debug, PartialEq, Node)]
103pub enum EnumBaseType {
104    Atom(Box<EnumBaseTypeAtom>),
105    Vector(Box<EnumBaseTypeVector>),
106    Type(Box<EnumBaseTypeType>),
107}
108
109#[derive(Clone, Debug, PartialEq, Node)]
110pub struct EnumBaseTypeAtom {
111    pub nodes: (IntegerAtomType, Option<Signing>),
112}
113
114#[derive(Clone, Debug, PartialEq, Node)]
115pub struct EnumBaseTypeVector {
116    pub nodes: (IntegerVectorType, Option<Signing>, Option<PackedDimension>),
117}
118
119#[derive(Clone, Debug, PartialEq, Node)]
120pub struct EnumBaseTypeType {
121    pub nodes: (TypeIdentifier, Option<PackedDimension>),
122}
123
124#[derive(Clone, Debug, PartialEq, Node)]
125pub struct EnumNameDeclaration {
126    pub nodes: (
127        EnumIdentifier,
128        Option<Bracket<(IntegralNumber, Option<(Symbol, IntegralNumber)>)>>,
129        Option<(Symbol, ConstantExpression)>,
130    ),
131}
132
133#[derive(Clone, Debug, PartialEq, Node)]
134pub struct ClassScope {
135    pub nodes: (ClassType, Symbol),
136}
137
138#[derive(Clone, Debug, PartialEq, Node)]
139pub struct ClassType {
140    pub nodes: (
141        PsClassIdentifier,
142        Option<ParameterValueAssignment>,
143        Vec<(Symbol, ClassIdentifier, Option<ParameterValueAssignment>)>,
144    ),
145}
146
147#[derive(Clone, Debug, PartialEq, Node)]
148pub enum IntegerType {
149    IntegerVectorType(Box<IntegerVectorType>),
150    IntegerAtomType(Box<IntegerAtomType>),
151}
152
153#[derive(Clone, Debug, PartialEq, Node)]
154pub enum IntegerAtomType {
155    Byte(Box<Keyword>),
156    Shortint(Box<Keyword>),
157    Int(Box<Keyword>),
158    Longint(Box<Keyword>),
159    Integer(Box<Keyword>),
160    Time(Box<Keyword>),
161}
162
163#[derive(Clone, Debug, PartialEq, Node)]
164pub enum IntegerVectorType {
165    Bit(Box<Keyword>),
166    Logic(Box<Keyword>),
167    Reg(Box<Keyword>),
168}
169
170#[derive(Clone, Debug, PartialEq, Node)]
171pub enum NonIntegerType {
172    Shortreal(Box<Keyword>),
173    Real(Box<Keyword>),
174    Realtime(Box<Keyword>),
175}
176
177#[derive(Clone, Debug, PartialEq, Node)]
178pub enum NetType {
179    Supply0(Box<Keyword>),
180    Supply1(Box<Keyword>),
181    Tri(Box<Keyword>),
182    Triand(Box<Keyword>),
183    Trior(Box<Keyword>),
184    Trireg(Box<Keyword>),
185    Tri0(Box<Keyword>),
186    Tri1(Box<Keyword>),
187    Uwire(Box<Keyword>),
188    Wire(Box<Keyword>),
189    Wand(Box<Keyword>),
190    Wor(Box<Keyword>),
191}
192
193#[derive(Clone, Debug, PartialEq, Node)]
194pub enum NetPortType {
195    DataType(Box<NetPortTypeDataType>),
196    NetTypeIdentifier(Box<NetTypeIdentifier>),
197    Interconnect(Box<NetPortTypeInterconnect>),
198}
199
200#[derive(Clone, Debug, PartialEq, Node)]
201pub struct NetPortTypeDataType {
202    pub nodes: (Option<NetType>, DataTypeOrImplicit),
203}
204
205#[derive(Clone, Debug, PartialEq, Node)]
206pub struct NetPortTypeInterconnect {
207    pub nodes: (Keyword, ImplicitDataType),
208}
209
210#[derive(Clone, Debug, PartialEq, Node)]
211pub struct VariablePortType {
212    pub nodes: (VarDataType,),
213}
214
215#[derive(Clone, Debug, PartialEq, Node)]
216pub enum VarDataType {
217    DataType(Box<DataType>),
218    Var(Box<VarDataTypeVar>),
219}
220
221#[derive(Clone, Debug, PartialEq, Node)]
222pub struct VarDataTypeVar {
223    pub nodes: (Keyword, DataTypeOrImplicit),
224}
225
226#[derive(Clone, Debug, PartialEq, Node)]
227pub enum Signing {
228    Signed(Box<Keyword>),
229    Unsigned(Box<Keyword>),
230}
231
232#[derive(Clone, Debug, PartialEq, Node)]
233pub enum SimpleType {
234    IntegerType(Box<IntegerType>),
235    NonIntegerType(Box<NonIntegerType>),
236    PsTypeIdentifier(Box<PsTypeIdentifier>),
237    PsParameterIdentifier(Box<PsParameterIdentifier>),
238}
239
240#[derive(Clone, Debug, PartialEq, Node)]
241pub struct StructUnionMember {
242    pub nodes: (
243        Vec<AttributeInstance>,
244        Option<RandomQualifier>,
245        DataTypeOrVoid,
246        ListOfVariableDeclAssignments,
247        Symbol,
248    ),
249}
250
251#[derive(Clone, Debug, PartialEq, Node)]
252pub enum DataTypeOrVoid {
253    DataType(Box<DataType>),
254    Void(Box<Keyword>),
255}
256
257#[derive(Clone, Debug, PartialEq, Node)]
258pub enum StructUnion {
259    Struct(Box<Keyword>),
260    Union(Box<Keyword>),
261    UnionTagged(Box<(Keyword, Keyword)>),
262}
263
264#[derive(Clone, Debug, PartialEq, Node)]
265pub enum TypeReference {
266    Expression(Box<TypeReferenceExpression>),
267    DataType(Box<TypeReferenceDataType>),
268}
269
270#[derive(Clone, Debug, PartialEq, Node)]
271pub struct TypeReferenceExpression {
272    pub nodes: (Keyword, Paren<Expression>),
273}
274
275#[derive(Clone, Debug, PartialEq, Node)]
276pub struct TypeReferenceDataType {
277    pub nodes: (Keyword, Paren<DataType>),
278}