1use crate::*;
2
3#[tracable_parser]
6#[packrat_parser]
7pub(crate) fn system_timing_check(s: Span) -> IResult<Span, SystemTimingCheck> {
8 alt((
9 map(setup_timing_check, |x| {
10 SystemTimingCheck::SetupTimingCheck(Box::new(x))
11 }),
12 map(hold_timing_check, |x| {
13 SystemTimingCheck::HoldTimingCheck(Box::new(x))
14 }),
15 map(setuphold_timing_check, |x| {
16 SystemTimingCheck::SetupholdTimingCheck(Box::new(x))
17 }),
18 map(recovery_timing_check, |x| {
19 SystemTimingCheck::RecoveryTimingCheck(Box::new(x))
20 }),
21 map(removal_timing_check, |x| {
22 SystemTimingCheck::RemovalTimingCheck(Box::new(x))
23 }),
24 map(recrem_timing_check, |x| {
25 SystemTimingCheck::RecremTimingCheck(Box::new(x))
26 }),
27 map(skew_timing_check, |x| {
28 SystemTimingCheck::SkewTimingCheck(Box::new(x))
29 }),
30 map(timeskew_timing_check, |x| {
31 SystemTimingCheck::TimeskewTimingCheck(Box::new(x))
32 }),
33 map(fullskew_timing_check, |x| {
34 SystemTimingCheck::FullskewTimingCheck(Box::new(x))
35 }),
36 map(period_timing_check, |x| {
37 SystemTimingCheck::PeriodTimingCheck(Box::new(x))
38 }),
39 map(width_timing_check, |x| {
40 SystemTimingCheck::WidthTimingCheck(Box::new(x))
41 }),
42 map(nochange_timing_check, |x| {
43 SystemTimingCheck::NochangeTimingCheck(Box::new(x))
44 }),
45 ))(s)
46}
47
48#[tracable_parser]
49#[packrat_parser]
50pub(crate) fn setup_timing_check(s: Span) -> IResult<Span, SetupTimingCheck> {
51 let (s, a) = keyword("$setup")(s)?;
52 let (s, b) = paren(tuple((
53 data_event,
54 symbol(","),
55 referecne_event,
56 symbol(","),
57 timing_check_limit,
58 opt(pair(symbol(","), opt(notifier))),
59 )))(s)?;
60 let (s, c) = symbol(";")(s)?;
61 Ok((s, SetupTimingCheck { nodes: (a, b, c) }))
62}
63
64#[tracable_parser]
65#[packrat_parser]
66pub(crate) fn hold_timing_check(s: Span) -> IResult<Span, HoldTimingCheck> {
67 let (s, a) = keyword("$hold")(s)?;
68 let (s, b) = paren(tuple((
69 referecne_event,
70 symbol(","),
71 data_event,
72 symbol(","),
73 timing_check_limit,
74 opt(pair(symbol(","), opt(notifier))),
75 )))(s)?;
76 let (s, c) = symbol(";")(s)?;
77 Ok((s, HoldTimingCheck { nodes: (a, b, c) }))
78}
79
80#[tracable_parser]
81#[packrat_parser]
82pub(crate) fn setuphold_timing_check(s: Span) -> IResult<Span, SetupholdTimingCheck> {
83 let (s, a) = keyword("$setuphold")(s)?;
84 let (s, b) = paren(tuple((
85 referecne_event,
86 symbol(","),
87 data_event,
88 symbol(","),
89 timing_check_limit,
90 symbol(","),
91 timing_check_limit,
92 opt(triple(
93 symbol(","),
94 opt(notifier),
95 opt(triple(
96 symbol(","),
97 opt(timestamp_condition),
98 opt(triple(
99 symbol(","),
100 opt(timecheck_condition),
101 opt(triple(
102 symbol(","),
103 opt(delayed_reference),
104 opt(pair(symbol(","), opt(delayed_data))),
105 )),
106 )),
107 )),
108 )),
109 )))(s)?;
110 let (s, c) = symbol(";")(s)?;
111 Ok((s, SetupholdTimingCheck { nodes: (a, b, c) }))
112}
113
114#[tracable_parser]
115#[packrat_parser]
116pub(crate) fn recovery_timing_check(s: Span) -> IResult<Span, RecoveryTimingCheck> {
117 let (s, a) = keyword("$recovery")(s)?;
118 let (s, b) = paren(tuple((
119 referecne_event,
120 symbol(","),
121 data_event,
122 symbol(","),
123 timing_check_limit,
124 opt(pair(symbol(","), opt(notifier))),
125 )))(s)?;
126 let (s, c) = symbol(";")(s)?;
127 Ok((s, RecoveryTimingCheck { nodes: (a, b, c) }))
128}
129
130#[tracable_parser]
131#[packrat_parser]
132pub(crate) fn removal_timing_check(s: Span) -> IResult<Span, RemovalTimingCheck> {
133 let (s, a) = keyword("$removal")(s)?;
134 let (s, b) = paren(tuple((
135 referecne_event,
136 symbol(","),
137 data_event,
138 symbol(","),
139 timing_check_limit,
140 opt(pair(symbol(","), opt(notifier))),
141 )))(s)?;
142 let (s, c) = symbol(";")(s)?;
143 Ok((s, RemovalTimingCheck { nodes: (a, b, c) }))
144}
145
146#[tracable_parser]
147#[packrat_parser]
148pub(crate) fn recrem_timing_check(s: Span) -> IResult<Span, RecremTimingCheck> {
149 let (s, a) = keyword("$recrem")(s)?;
150 let (s, b) = paren(tuple((
151 referecne_event,
152 symbol(","),
153 data_event,
154 symbol(","),
155 timing_check_limit,
156 symbol(","),
157 timing_check_limit,
158 opt(triple(
159 symbol(","),
160 opt(notifier),
161 opt(triple(
162 symbol(","),
163 opt(timestamp_condition),
164 opt(triple(
165 symbol(","),
166 opt(timecheck_condition),
167 opt(triple(
168 symbol(","),
169 opt(delayed_reference),
170 opt(pair(symbol(","), opt(delayed_data))),
171 )),
172 )),
173 )),
174 )),
175 )))(s)?;
176 let (s, c) = symbol(";")(s)?;
177 Ok((s, RecremTimingCheck { nodes: (a, b, c) }))
178}
179
180#[tracable_parser]
181#[packrat_parser]
182pub(crate) fn skew_timing_check(s: Span) -> IResult<Span, SkewTimingCheck> {
183 let (s, a) = keyword("$skew")(s)?;
184 let (s, b) = paren(tuple((
185 referecne_event,
186 symbol(","),
187 data_event,
188 symbol(","),
189 timing_check_limit,
190 opt(pair(symbol(","), opt(notifier))),
191 )))(s)?;
192 let (s, c) = symbol(";")(s)?;
193 Ok((s, SkewTimingCheck { nodes: (a, b, c) }))
194}
195
196#[tracable_parser]
197#[packrat_parser]
198pub(crate) fn timeskew_timing_check(s: Span) -> IResult<Span, TimeskewTimingCheck> {
199 let (s, a) = keyword("$timeskew")(s)?;
200 let (s, b) = paren(tuple((
201 referecne_event,
202 symbol(","),
203 data_event,
204 symbol(","),
205 timing_check_limit,
206 opt(triple(
207 symbol(","),
208 opt(notifier),
209 opt(triple(
210 symbol(","),
211 opt(event_based_flag),
212 opt(pair(symbol(","), opt(remain_active_flag))),
213 )),
214 )),
215 )))(s)?;
216 let (s, c) = symbol(";")(s)?;
217 Ok((s, TimeskewTimingCheck { nodes: (a, b, c) }))
218}
219
220#[tracable_parser]
221#[packrat_parser]
222pub(crate) fn fullskew_timing_check(s: Span) -> IResult<Span, FullskewTimingCheck> {
223 let (s, a) = keyword("$fullskew")(s)?;
224 let (s, b) = paren(tuple((
225 referecne_event,
226 symbol(","),
227 data_event,
228 symbol(","),
229 timing_check_limit,
230 symbol(","),
231 timing_check_limit,
232 opt(triple(
233 symbol(","),
234 opt(notifier),
235 opt(triple(
236 symbol(","),
237 opt(event_based_flag),
238 opt(pair(symbol(","), opt(remain_active_flag))),
239 )),
240 )),
241 )))(s)?;
242 let (s, c) = symbol(";")(s)?;
243 Ok((s, FullskewTimingCheck { nodes: (a, b, c) }))
244}
245
246#[tracable_parser]
247#[packrat_parser]
248pub(crate) fn period_timing_check(s: Span) -> IResult<Span, PeriodTimingCheck> {
249 let (s, a) = keyword("$period")(s)?;
250 let (s, b) = paren(tuple((
251 controlled_referecne_event,
252 symbol(","),
253 timing_check_limit,
254 opt(pair(symbol(","), opt(notifier))),
255 )))(s)?;
256 let (s, c) = symbol(";")(s)?;
257 Ok((s, PeriodTimingCheck { nodes: (a, b, c) }))
258}
259
260#[tracable_parser]
261#[packrat_parser]
262pub(crate) fn width_timing_check(s: Span) -> IResult<Span, WidthTimingCheck> {
263 let (s, a) = keyword("$width")(s)?;
264 let (s, b) = paren(tuple((
265 controlled_referecne_event,
266 symbol(","),
267 timing_check_limit,
268 symbol(","),
269 threshold,
270 opt(pair(symbol(","), opt(notifier))),
271 )))(s)?;
272 let (s, c) = symbol(";")(s)?;
273 Ok((s, WidthTimingCheck { nodes: (a, b, c) }))
274}
275
276#[tracable_parser]
277#[packrat_parser]
278pub(crate) fn nochange_timing_check(s: Span) -> IResult<Span, NochangeTimingCheck> {
279 let (s, a) = keyword("$nochange")(s)?;
280 let (s, b) = paren(tuple((
281 referecne_event,
282 symbol(","),
283 data_event,
284 symbol(","),
285 start_edge_offset,
286 symbol(","),
287 end_edge_offset,
288 opt(pair(symbol(","), opt(notifier))),
289 )))(s)?;
290 let (s, c) = symbol(";")(s)?;
291 Ok((s, NochangeTimingCheck { nodes: (a, b, c) }))
292}