1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
use crate::*;

// -----------------------------------------------------------------------------

#[derive(Clone, Debug, PartialEq, Node)]
pub enum ParameterPortList {
    Assignment(Box<ParameterPortListAssignment>),
    Declaration(Box<ParameterPortListDeclaration>),
    Empty(Box<(Symbol, Symbol, Symbol)>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct ParameterPortListAssignment {
    pub nodes: (
        Symbol,
        Paren<(
            ListOfParamAssignments,
            Vec<(Symbol, ParameterPortDeclaration)>,
        )>,
    ),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct ParameterPortListDeclaration {
    pub nodes: (Symbol, Paren<List<Symbol, ParameterPortDeclaration>>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub enum ParameterPortDeclaration {
    ParameterDeclaration(Box<ParameterDeclaration>),
    LocalParameterDeclaration(Box<LocalParameterDeclaration>),
    ParamList(Box<ParameterPortDeclarationParamList>),
    TypeList(Box<ParameterPortDeclarationTypeList>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct ParameterPortDeclarationParamList {
    pub nodes: (DataType, ListOfParamAssignments),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct ParameterPortDeclarationTypeList {
    pub nodes: (Keyword, ListOfTypeAssignments),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct ListOfPorts {
    pub nodes: (Paren<List<Symbol, Port>>,),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct ListOfPortDeclarations {
    pub nodes: (Paren<Option<List<Symbol, (Vec<AttributeInstance>, AnsiPortDeclaration)>>>,),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub enum PortDeclaration {
    Inout(Box<PortDeclarationInout>),
    Input(Box<PortDeclarationInput>),
    Output(Box<PortDeclarationOutput>),
    Ref(Box<PortDeclarationRef>),
    Interface(Box<PortDeclarationInterface>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct PortDeclarationInout {
    pub nodes: (Vec<AttributeInstance>, InoutDeclaration),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct PortDeclarationInput {
    pub nodes: (Vec<AttributeInstance>, InputDeclaration),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct PortDeclarationOutput {
    pub nodes: (Vec<AttributeInstance>, OutputDeclaration),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct PortDeclarationRef {
    pub nodes: (Vec<AttributeInstance>, RefDeclaration),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct PortDeclarationInterface {
    pub nodes: (Vec<AttributeInstance>, InterfacePortDeclaration),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub enum Port {
    NonNamed(Box<PortNonNamed>),
    Named(Box<PortNamed>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct PortNonNamed {
    pub nodes: (Option<PortExpression>,),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct PortNamed {
    pub nodes: (Symbol, PortIdentifier, Paren<Option<PortExpression>>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub enum PortExpression {
    PortReference(Box<PortReference>),
    Brace(Box<PortExpressionBrace>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct PortExpressionBrace {
    pub nodes: (Brace<List<Symbol, PortReference>>,),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct PortReference {
    pub nodes: (PortIdentifier, ConstantSelect),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub enum PortDirection {
    Input(Box<Keyword>),
    Output(Box<Keyword>),
    Inout(Box<Keyword>),
    Ref(Box<Keyword>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct NetPortHeader {
    pub nodes: (Option<PortDirection>, NetPortType),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct VariablePortHeader {
    pub nodes: (Option<PortDirection>, VariablePortType),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub enum InterfacePortHeader {
    Identifier(Box<InterfacePortHeaderIdentifier>),
    Interface(Box<InterfacePortHeaderInterface>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct InterfacePortHeaderIdentifier {
    pub nodes: (InterfaceIdentifier, Option<(Symbol, ModportIdentifier)>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct InterfacePortHeaderInterface {
    pub nodes: (Keyword, Option<(Symbol, ModportIdentifier)>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub enum NetPortHeaderOrInterfacePortHeader {
    NetPortHeader(Box<NetPortHeader>),
    InterfacePortHeader(Box<InterfacePortHeader>),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub enum AnsiPortDeclaration {
    Net(Box<AnsiPortDeclarationNet>),
    Variable(Box<AnsiPortDeclarationVariable>),
    Paren(Box<AnsiPortDeclarationParen>),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct AnsiPortDeclarationNet {
    pub nodes: (
        Option<NetPortHeaderOrInterfacePortHeader>,
        PortIdentifier,
        Vec<UnpackedDimension>,
        Option<(Symbol, ConstantExpression)>,
    ),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct AnsiPortDeclarationVariable {
    pub nodes: (
        Option<VariablePortHeader>,
        PortIdentifier,
        Vec<VariableDimension>,
        Option<(Symbol, ConstantExpression)>,
    ),
}

#[derive(Clone, Debug, PartialEq, Node)]
pub struct AnsiPortDeclarationParen {
    pub nodes: (
        Option<PortDirection>,
        Symbol,
        PortIdentifier,
        Paren<Option<Expression>>,
    ),
}