sv_parser_syntaxtree/declarations/
assertion_declarations.rs

1use crate::*;
2
3// -----------------------------------------------------------------------------
4
5#[derive(Clone, Debug, PartialEq, Node)]
6pub enum ConcurrentAssertionItem {
7    Statement(Box<ConcurrentAssertionItemStatement>),
8    CheckerInstantiation(Box<CheckerInstantiation>),
9}
10
11#[derive(Clone, Debug, PartialEq, Node)]
12pub struct ConcurrentAssertionItemStatement {
13    pub nodes: (
14        Option<(BlockIdentifier, Symbol)>,
15        ConcurrentAssertionStatement,
16    ),
17}
18
19#[derive(Clone, Debug, PartialEq, Node)]
20pub enum ConcurrentAssertionStatement {
21    AssertPropertyStatement(Box<AssertPropertyStatement>),
22    AssumePropertyStatement(Box<AssumePropertyStatement>),
23    CoverPropertyStatement(Box<CoverPropertyStatement>),
24    CoverSequenceStatement(Box<CoverSequenceStatement>),
25    RestrictPropertyStatement(Box<RestrictPropertyStatement>),
26}
27
28#[derive(Clone, Debug, PartialEq, Node)]
29pub struct AssertPropertyStatement {
30    pub nodes: (Keyword, Keyword, Paren<PropertySpec>, ActionBlock),
31}
32
33#[derive(Clone, Debug, PartialEq, Node)]
34pub struct AssumePropertyStatement {
35    pub nodes: (Keyword, Keyword, Paren<PropertySpec>, ActionBlock),
36}
37
38#[derive(Clone, Debug, PartialEq, Node)]
39pub struct CoverPropertyStatement {
40    pub nodes: (Keyword, Keyword, Paren<PropertySpec>, StatementOrNull),
41}
42
43#[derive(Clone, Debug, PartialEq, Node)]
44pub struct ExpectPropertyStatement {
45    pub nodes: (Keyword, Paren<PropertySpec>, ActionBlock),
46}
47
48#[derive(Clone, Debug, PartialEq, Node)]
49pub struct CoverSequenceStatement {
50    pub nodes: (
51        Keyword,
52        Keyword,
53        Paren<(
54            Option<ClockingEvent>,
55            Option<(Keyword, Keyword, Paren<ExpressionOrDist>)>,
56            SequenceExpr,
57        )>,
58        StatementOrNull,
59    ),
60}
61
62#[derive(Clone, Debug, PartialEq, Node)]
63pub struct RestrictPropertyStatement {
64    pub nodes: (Keyword, Keyword, Paren<PropertySpec>, Symbol),
65}
66
67#[derive(Clone, Debug, PartialEq, Node)]
68pub struct PropertyInstance {
69    pub nodes: (
70        PsOrHierarchicalPropertyIdentifier,
71        Option<Paren<Option<PropertyListOfArguments>>>,
72    ),
73}
74
75#[derive(Clone, Debug, PartialEq, Node)]
76pub enum PropertyListOfArguments {
77    Ordered(Box<PropertyListOfArgumentsOrdered>),
78    Named(Box<PropertyListOfArgumentsNamed>),
79}
80
81#[derive(Clone, Debug, PartialEq, Node)]
82pub struct PropertyListOfArgumentsOrdered {
83    pub nodes: (
84        List<Symbol, Option<PropertyActualArg>>,
85        Vec<(Symbol, Symbol, Identifier, Paren<Option<PropertyActualArg>>)>,
86    ),
87}
88
89#[derive(Clone, Debug, PartialEq, Node)]
90pub struct PropertyListOfArgumentsNamed {
91    pub nodes: (List<Symbol, (Symbol, Identifier, Paren<Option<PropertyActualArg>>)>,),
92}
93
94#[derive(Clone, Debug, PartialEq, Node)]
95pub enum PropertyActualArg {
96    PropertyExpr(Box<PropertyExpr>),
97    SequenceActualArg(Box<SequenceActualArg>),
98}
99
100#[derive(Clone, Debug, PartialEq, Node)]
101pub enum AssertionItemDeclaration {
102    PropertyDeclaration(Box<PropertyDeclaration>),
103    SequenceDeclaration(Box<SequenceDeclaration>),
104    LetDeclaration(Box<LetDeclaration>),
105}
106
107#[derive(Clone, Debug, PartialEq, Node)]
108pub struct PropertyDeclaration {
109    pub nodes: (
110        Keyword,
111        PropertyIdentifier,
112        Option<Paren<Option<PropertyPortList>>>,
113        Symbol,
114        Vec<AssertionVariableDeclaration>,
115        PropertySpec,
116        Option<Symbol>,
117        Keyword,
118        Option<(Symbol, PropertyIdentifier)>,
119    ),
120}
121
122#[derive(Clone, Debug, PartialEq, Node)]
123pub struct PropertyPortList {
124    pub nodes: (List<Symbol, PropertyPortItem>,),
125}
126
127#[derive(Clone, Debug, PartialEq, Node)]
128pub struct PropertyPortItem {
129    pub nodes: (
130        Vec<AttributeInstance>,
131        Option<(Keyword, Option<PropertyLvarPortDirection>)>,
132        PropertyFormalType,
133        FormalPortIdentifier,
134        Vec<VariableDimension>,
135        Option<(Symbol, PropertyActualArg)>,
136    ),
137}
138
139#[derive(Clone, Debug, PartialEq, Node)]
140pub enum PropertyLvarPortDirection {
141    Input(Box<Keyword>),
142}
143
144#[derive(Clone, Debug, PartialEq, Node)]
145pub enum PropertyFormalType {
146    SequenceFormalType(Box<SequenceFormalType>),
147    Property(Box<Keyword>),
148}
149
150#[derive(Clone, Debug, PartialEq, Node)]
151pub struct PropertySpec {
152    pub nodes: (
153        Option<ClockingEvent>,
154        Option<(Keyword, Keyword, Paren<ExpressionOrDist>)>,
155        PropertyExpr,
156    ),
157}
158
159#[derive(Clone, Debug, PartialEq, Node)]
160pub enum PropertyExpr {
161    SequenceExpr(Box<SequenceExpr>),
162    Strong(Box<PropertyExprStrong>),
163    Weak(Box<PropertyExprWeak>),
164    Paren(Box<PropertyExprParen>),
165    Not(Box<PropertyExprNot>),
166    BinaryProperty(Box<PropertyExprBinaryProperty>),
167    BinarySequence(Box<PropertyExprBinarySequence>),
168    If(Box<PropertyExprIf>),
169    Case(Box<PropertyExprCase>),
170    Nexttime(Box<PropertyExprNexttime>),
171    SNexttime(Box<PropertyExprSNexttime>),
172    Always(Box<PropertyExprAlways>),
173    SAlways(Box<PropertyExprSAlways>),
174    Eventually(Box<PropertyExprEventually>),
175    SEventually(Box<PropertyExprSEventually>),
176    AcceptOn(Box<PropertyExprAcceptOn>),
177    RejectOn(Box<PropertyExprRejectOn>),
178    SyncAcceptOn(Box<PropertyExprSyncAcceptOn>),
179    SyncRejectOn(Box<PropertyExprSyncRejectOn>),
180    PropertyInstance(Box<PropertyInstance>),
181    ClockingEvent(Box<PropertyExprClockingEvent>),
182}
183
184#[derive(Clone, Debug, PartialEq, Node)]
185pub struct PropertyExprStrong {
186    pub nodes: (Keyword, Paren<SequenceExpr>),
187}
188
189#[derive(Clone, Debug, PartialEq, Node)]
190pub struct PropertyExprWeak {
191    pub nodes: (Keyword, Paren<SequenceExpr>),
192}
193
194#[derive(Clone, Debug, PartialEq, Node)]
195pub struct PropertyExprParen {
196    pub nodes: (Paren<PropertyExpr>,),
197}
198
199#[derive(Clone, Debug, PartialEq, Node)]
200pub struct PropertyExprNot {
201    pub nodes: (Keyword, PropertyExpr),
202}
203
204#[derive(Clone, Debug, PartialEq, Node)]
205pub struct PropertyExprBinaryProperty {
206    pub nodes: (PropertyExpr, Keyword, PropertyExpr),
207}
208
209#[derive(Clone, Debug, PartialEq, Node)]
210pub struct PropertyExprBinarySequence {
211    pub nodes: (SequenceExpr, Symbol, PropertyExpr),
212}
213
214#[derive(Clone, Debug, PartialEq, Node)]
215pub struct PropertyExprIf {
216    pub nodes: (
217        Keyword,
218        Paren<ExpressionOrDist>,
219        PropertyExpr,
220        Option<(Keyword, PropertyExpr)>,
221    ),
222}
223
224#[derive(Clone, Debug, PartialEq, Node)]
225pub struct PropertyExprCase {
226    pub nodes: (
227        Keyword,
228        Paren<ExpressionOrDist>,
229        PropertyCaseItem,
230        Vec<PropertyCaseItem>,
231        Keyword,
232    ),
233}
234
235#[derive(Clone, Debug, PartialEq, Node)]
236pub struct PropertyExprNexttime {
237    pub nodes: (Keyword, Option<Bracket<ConstantExpression>>, PropertyExpr),
238}
239
240#[derive(Clone, Debug, PartialEq, Node)]
241pub struct PropertyExprSNexttime {
242    pub nodes: (Keyword, Option<Bracket<ConstantExpression>>, PropertyExpr),
243}
244
245#[derive(Clone, Debug, PartialEq, Node)]
246pub struct PropertyExprAlways {
247    pub nodes: (
248        Keyword,
249        Option<Bracket<CycleDelayConstRangeExpression>>,
250        PropertyExpr,
251    ),
252}
253
254#[derive(Clone, Debug, PartialEq, Node)]
255pub struct PropertyExprSAlways {
256    pub nodes: (
257        Keyword,
258        Bracket<CycleDelayConstRangeExpression>,
259        PropertyExpr,
260    ),
261}
262
263#[derive(Clone, Debug, PartialEq, Node)]
264pub struct PropertyExprEventually {
265    pub nodes: (Keyword, Bracket<ConstantRange>, PropertyExpr),
266}
267
268#[derive(Clone, Debug, PartialEq, Node)]
269pub struct PropertyExprSEventually {
270    pub nodes: (
271        Keyword,
272        Option<Bracket<CycleDelayConstRangeExpression>>,
273        PropertyExpr,
274    ),
275}
276
277#[derive(Clone, Debug, PartialEq, Node)]
278pub struct PropertyExprAcceptOn {
279    pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr),
280}
281
282#[derive(Clone, Debug, PartialEq, Node)]
283pub struct PropertyExprRejectOn {
284    pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr),
285}
286
287#[derive(Clone, Debug, PartialEq, Node)]
288pub struct PropertyExprSyncAcceptOn {
289    pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr),
290}
291
292#[derive(Clone, Debug, PartialEq, Node)]
293pub struct PropertyExprSyncRejectOn {
294    pub nodes: (Keyword, Paren<ExpressionOrDist>, PropertyExpr),
295}
296
297#[derive(Clone, Debug, PartialEq, Node)]
298pub struct PropertyExprClockingEvent {
299    pub nodes: (ClockingEvent, PropertyExpr),
300}
301
302#[derive(Clone, Debug, PartialEq, Node)]
303pub enum PropertyCaseItem {
304    Nondefault(Box<PropertyCaseItemNondefault>),
305    Default(Box<PropertyCaseItemDefault>),
306}
307
308#[derive(Clone, Debug, PartialEq, Node)]
309pub struct PropertyCaseItemNondefault {
310    pub nodes: (List<Symbol, ExpressionOrDist>, Symbol, PropertyExpr, Symbol),
311}
312
313#[derive(Clone, Debug, PartialEq, Node)]
314pub struct PropertyCaseItemDefault {
315    pub nodes: (Keyword, Option<Symbol>, PropertyExpr, Symbol),
316}
317
318#[derive(Clone, Debug, PartialEq, Node)]
319pub struct SequenceDeclaration {
320    pub nodes: (
321        Keyword,
322        SequenceIdentifier,
323        Option<Paren<Option<SequencePortList>>>,
324        Symbol,
325        Vec<AssertionVariableDeclaration>,
326        SequenceExpr,
327        Option<Symbol>,
328        Keyword,
329        Option<(Symbol, SequenceIdentifier)>,
330    ),
331}
332
333#[derive(Clone, Debug, PartialEq, Node)]
334pub struct SequencePortList {
335    pub nodes: (List<Symbol, SequencePortItem>,),
336}
337
338#[derive(Clone, Debug, PartialEq, Node)]
339pub struct SequencePortItem {
340    pub nodes: (
341        Vec<AttributeInstance>,
342        Option<(Keyword, Option<SequenceLvarPortDirection>)>,
343        SequenceFormalType,
344        FormalPortIdentifier,
345        Vec<VariableDimension>,
346        Option<(Symbol, SequenceActualArg)>,
347    ),
348}
349
350#[derive(Clone, Debug, PartialEq, Node)]
351pub enum SequenceLvarPortDirection {
352    Input(Box<Keyword>),
353    Inout(Box<Keyword>),
354    Output(Box<Keyword>),
355}
356
357#[derive(Clone, Debug, PartialEq, Node)]
358pub enum SequenceFormalType {
359    DataTypeOrImplicit(Box<DataTypeOrImplicit>),
360    Sequence(Box<Keyword>),
361    Untyped(Box<Keyword>),
362}
363
364#[derive(Clone, Debug, PartialEq, Node)]
365pub enum SequenceExpr {
366    CycleDelayExpr(Box<SequenceExprCycleDelayExpr>),
367    ExprCycleDelayExpr(Box<SequenceExprExprCycleDelayExpr>),
368    Expression(Box<SequenceExprExpression>),
369    Instance(Box<SequenceExprInstance>),
370    Paren(Box<SequenceExprParen>),
371    Binary(Box<SequenceExprBinary>),
372    FirstMatch(Box<SequenceExprFirstMatch>),
373    Throughout(Box<SequenceExprThroughout>),
374    ClockingEvent(Box<SequenceExprClockingEvent>),
375}
376
377#[derive(Clone, Debug, PartialEq, Node)]
378pub struct SequenceExprCycleDelayExpr {
379    pub nodes: (
380        CycleDelayRange,
381        SequenceExpr,
382        Vec<(CycleDelayRange, SequenceExpr)>,
383    ),
384}
385
386#[derive(Clone, Debug, PartialEq, Node)]
387pub struct SequenceExprExprCycleDelayExpr {
388    pub nodes: (
389        SequenceExpr,
390        CycleDelayRange,
391        SequenceExpr,
392        Vec<(CycleDelayRange, SequenceExpr)>,
393    ),
394}
395
396#[derive(Clone, Debug, PartialEq, Node)]
397pub struct SequenceExprExpression {
398    pub nodes: (ExpressionOrDist, Option<BooleanAbbrev>),
399}
400
401#[derive(Clone, Debug, PartialEq, Node)]
402pub struct SequenceExprInstance {
403    pub nodes: (SequenceInstance, Option<SequenceAbbrev>),
404}
405
406#[derive(Clone, Debug, PartialEq, Node)]
407pub struct SequenceExprParen {
408    pub nodes: (
409        Paren<(SequenceExpr, Vec<(Symbol, SequenceMatchItem)>)>,
410        Option<SequenceAbbrev>,
411    ),
412}
413
414#[derive(Clone, Debug, PartialEq, Node)]
415pub struct SequenceExprBinary {
416    pub nodes: (SequenceExpr, Keyword, SequenceExpr),
417}
418
419#[derive(Clone, Debug, PartialEq, Node)]
420pub struct SequenceExprFirstMatch {
421    pub nodes: (
422        Keyword,
423        Paren<(SequenceExpr, Vec<(Symbol, SequenceMatchItem)>)>,
424    ),
425}
426
427#[derive(Clone, Debug, PartialEq, Node)]
428pub struct SequenceExprThroughout {
429    pub nodes: (ExpressionOrDist, Keyword, SequenceExpr),
430}
431
432#[derive(Clone, Debug, PartialEq, Node)]
433pub struct SequenceExprClockingEvent {
434    pub nodes: (ClockingEvent, SequenceExpr),
435}
436
437#[derive(Clone, Debug, PartialEq, Node)]
438pub enum CycleDelayRange {
439    Primary(Box<CycleDelayRangePrimary>),
440    Expression(Box<CycleDelayRangeExpression>),
441    Asterisk(Box<CycleDelayRangeAsterisk>),
442    Plus(Box<CycleDelayRangePlus>),
443}
444
445#[derive(Clone, Debug, PartialEq, Node)]
446pub struct CycleDelayRangePrimary {
447    pub nodes: (Symbol, ConstantPrimary),
448}
449
450#[derive(Clone, Debug, PartialEq, Node)]
451pub struct CycleDelayRangeExpression {
452    pub nodes: (Symbol, Bracket<CycleDelayConstRangeExpression>),
453}
454
455#[derive(Clone, Debug, PartialEq, Node)]
456pub struct CycleDelayRangeAsterisk {
457    pub nodes: (Symbol, Bracket<Symbol>),
458}
459
460#[derive(Clone, Debug, PartialEq, Node)]
461pub struct CycleDelayRangePlus {
462    pub nodes: (Symbol, Bracket<Symbol>),
463}
464
465#[derive(Clone, Debug, PartialEq, Node)]
466pub struct SequenceMethodCall {
467    pub nodes: (SequenceInstance, Symbol, MethodIdentifier),
468}
469
470#[derive(Clone, Debug, PartialEq, Node)]
471pub enum SequenceMatchItem {
472    OperatorAssignment(Box<OperatorAssignment>),
473    IncOrDecExpression(Box<IncOrDecExpression>),
474    SubroutineCall(Box<SubroutineCall>),
475}
476
477#[derive(Clone, Debug, PartialEq, Node)]
478pub struct SequenceInstance {
479    pub nodes: (
480        PsOrHierarchicalSequenceIdentifier,
481        Option<Paren<Option<SequenceListOfArguments>>>,
482    ),
483}
484
485#[derive(Clone, Debug, PartialEq, Node)]
486pub enum SequenceListOfArguments {
487    Ordered(Box<SequenceListOfArgumentsOrdered>),
488    Named(Box<SequenceListOfArgumentsNamed>),
489}
490
491#[derive(Clone, Debug, PartialEq, Node)]
492pub struct SequenceListOfArgumentsOrdered {
493    pub nodes: (
494        List<Symbol, Option<SequenceActualArg>>,
495        Vec<(Symbol, Symbol, Identifier, Paren<Option<SequenceActualArg>>)>,
496    ),
497}
498
499#[derive(Clone, Debug, PartialEq, Node)]
500pub struct SequenceListOfArgumentsNamed {
501    pub nodes: (List<Symbol, (Symbol, Identifier, Paren<Option<SequenceActualArg>>)>,),
502}
503
504#[derive(Clone, Debug, PartialEq, Node)]
505pub enum SequenceActualArg {
506    EventExpression(Box<EventExpression>),
507    SequenceExpr(Box<SequenceExpr>),
508}
509
510#[derive(Clone, Debug, PartialEq, Node)]
511pub enum BooleanAbbrev {
512    ConsecutiveRepetition(Box<ConsecutiveRepetition>),
513    NonConsecutiveRepetition(Box<NonConsecutiveRepetition>),
514    GotoRepetition(Box<GotoRepetition>),
515}
516
517#[derive(Clone, Debug, PartialEq, Node)]
518pub struct SequenceAbbrev {
519    pub nodes: (ConsecutiveRepetition,),
520}
521
522#[derive(Clone, Debug, PartialEq, Node)]
523pub enum ConsecutiveRepetition {
524    Expression(Box<ConsecutiveRepetitionExpression>),
525    Asterisk(Box<ConsecutiveRepetitionAsterisk>),
526    Plus(Box<ConsecutiveRepetitionPlus>),
527}
528
529#[derive(Clone, Debug, PartialEq, Node)]
530pub struct ConsecutiveRepetitionExpression {
531    pub nodes: (Bracket<(Symbol, ConstOrRangeExpression)>,),
532}
533
534#[derive(Clone, Debug, PartialEq, Node)]
535pub struct ConsecutiveRepetitionAsterisk {
536    pub nodes: (Bracket<Symbol>,),
537}
538
539#[derive(Clone, Debug, PartialEq, Node)]
540pub struct ConsecutiveRepetitionPlus {
541    pub nodes: (Bracket<Symbol>,),
542}
543
544#[derive(Clone, Debug, PartialEq, Node)]
545pub struct NonConsecutiveRepetition {
546    pub nodes: (Bracket<(Symbol, ConstOrRangeExpression)>,),
547}
548
549#[derive(Clone, Debug, PartialEq, Node)]
550pub struct GotoRepetition {
551    pub nodes: (Bracket<(Symbol, ConstOrRangeExpression)>,),
552}
553
554#[derive(Clone, Debug, PartialEq, Node)]
555pub enum ConstOrRangeExpression {
556    ConstantExpression(Box<ConstantExpression>),
557    CycleDelayConstRangeExpression(Box<CycleDelayConstRangeExpression>),
558}
559
560#[derive(Clone, Debug, PartialEq, Node)]
561pub enum CycleDelayConstRangeExpression {
562    Binary(Box<CycleDelayConstRangeExpressionBinary>),
563    Dollar(Box<CycleDelayConstRangeExpressionDollar>),
564}
565
566#[derive(Clone, Debug, PartialEq, Node)]
567pub struct CycleDelayConstRangeExpressionBinary {
568    pub nodes: (ConstantExpression, Symbol, ConstantExpression),
569}
570
571#[derive(Clone, Debug, PartialEq, Node)]
572pub struct CycleDelayConstRangeExpressionDollar {
573    pub nodes: (ConstantExpression, Symbol, Symbol),
574}
575
576#[derive(Clone, Debug, PartialEq, Node)]
577pub struct ExpressionOrDist {
578    pub nodes: (Expression, Option<(Keyword, Brace<DistList>)>),
579}
580
581#[derive(Clone, Debug, PartialEq, Node)]
582pub struct AssertionVariableDeclaration {
583    pub nodes: (VarDataType, ListOfVariableDeclAssignments, Symbol),
584}