Skip to content

Commit

Permalink
Number SDF tokens from the last defined token. (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blebowski committed Sep 26, 2024
1 parent 157b0f6 commit c5c56d4
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 79 deletions.
30 changes: 11 additions & 19 deletions src/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,24 +197,6 @@ const char *token_str(token_t tok)
buf[0] = tok;
return buf;
}
// TODO: When SDF tokens are appended behind rest of tokens, this special case
// shall be removed!
else if (tok > 499) {
static const char *sdf_token_strs[] = {
"delay file", "sdf version", "design", "date", "vendor", "program",
"version", "divider", "voltage", "temperature", "cell", "celltype",
"instance", "delay", "timing check", "timing env", "path pulse",
"path pulse percent", "IO path", "retain", "cond", "condelse",
"interconnect", "net delay", "device", "setup", "hold", "setuphold",
"recovery", "removal", "recrem", "skew", "bidirectional skew", "width",
"period", "nochange", "cond", "scond", "ccond", "path constraint",
"period constraint", "sum", "diff", "skew constraint", "exception",
"name", "arrival", "departure", "slack", "waveform", "increment",
"absolute", "~&", "~|", "~^",
};
if (tok >= 500 && tok - 500 < ARRAY_LEN(sdf_token_strs))
return sdf_token_strs[tok - 500];
}
else {
static const char *token_strs[] = {
"identifier", "entity", "is", "end", "generic", "port", "constant",
Expand Down Expand Up @@ -250,7 +232,17 @@ const char *token_str(token_t tok)
"(*", "*)", "number", "forever", "[[", "]]", "specify", "endspecify",
"primitive", "endprimitive", "table", "endtable", "assign",
"level symbol", "edge symbol", "edge indicator", "buf", "||",
"scalar constant (0)", "scalar constant (1)"
"scalar constant (0)", "scalar constant (1)", "delay file",
"sdf version", "design", "date", "vendor", "program", "version",
"divider", "voltage", "temperature", "cell", "celltype", "instance",
"delay", "timing check", "timing env", "path pulse",
"path pulse percent", "IO path", "retain", "cond", "condelse",
"interconnect", "net delay", "device", "setup", "hold", "setuphold",
"recovery", "removal", "recrem", "skew", "bidirectional skew", "width",
"period", "nochange", "cond", "scond", "ccond", "path constraint",
"period constraint", "sum", "diff", "skew constraint", "exception",
"name", "arrival", "departure", "slack", "waveform", "increment",
"absolute", "~&", "~|", "~^"
};

if (tok >= 200 && tok - 200 < ARRAY_LEN(token_strs))
Expand Down
115 changes: 55 additions & 60 deletions src/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,65 +325,60 @@ bool is_scanned_as_psl(void);
#define tLOGOR 425
#define tSCALARZERO 426
#define tSCALARONE 427

// SDF only keywords - separated for better maintainability
// during implementation of SDF annotation.
// TODO: Once finally merged, this can be appended to the last
// defined token!
#define tDELAYFILE 500
#define tSDFVERSION 501
#define tDESIGN 502
#define tDATE 503
#define tVENDOR 504
#define tPROGRAM 505
#define tVERSION 506
#define tDIVIDER 507
#define tVOLTAGE 508
#define tTEMPERATURE 509
#define tCELL 510
#define tCELLTYPE 511
#define tINSTANCE 512
#define tDELAY 513
#define tTIMINGCHECK 514
#define tTIMINGENV 515
#define tPATHPULSE 516
#define tPATHPULSEP 517
#define tIOPATH 518
#define tRETAIN 519
#define tSDFCOND 520
#define tSDFCONDELSE 521
#define tINTERCONNECT 522
#define tNETDELAY 523
#define tDEVICE 524
#define tSETUP 525
#define tHOLD 526
#define tSETUPHOLD 527
#define tRECOVERY 528
#define tREMOVAL 529
#define tRECREM 530
#define tSKEW 531
#define tBIDIRSKEW 532
#define tWIDTH 533
#define tPERIOD 534
#define tNOCHANGE 535
#define tCOND 536
#define tSCOND 537
#define tCCOND 538
#define tPATHCONSTR 539
#define tPERIODCONSTR 540
#define tSUM 541
#define tDIFF 542
#define tSKEWCONSTR 543
#define tEXCEPTION 544
#define tNAME 545
#define tARRIVAL 546
#define tDEPARTURE 547
#define tSLACK 548
#define tWAVEFORM 549
#define tINCREMENT 550
#define tABSOLUTE 551
#define tTILDEAMP 552
#define tTILDEBAR 553
#define tTILDECARET 554
#define tDELAYFILE 428
#define tSDFVERSION 429
#define tDESIGN 430
#define tDATE 431
#define tVENDOR 432
#define tPROGRAM 433
#define tVERSION 434
#define tDIVIDER 435
#define tVOLTAGE 436
#define tTEMPERATURE 437
#define tCELL 438
#define tCELLTYPE 439
#define tINSTANCE 440
#define tDELAY 441
#define tTIMINGCHECK 442
#define tTIMINGENV 443
#define tPATHPULSE 444
#define tPATHPULSEP 445
#define tIOPATH 446
#define tRETAIN 447
#define tSDFCOND 448
#define tSDFCONDELSE 449
#define tINTERCONNECT 450
#define tNETDELAY 451
#define tDEVICE 452
#define tSETUP 453
#define tHOLD 454
#define tSETUPHOLD 455
#define tRECOVERY 456
#define tREMOVAL 457
#define tRECREM 458
#define tSKEW 459
#define tBIDIRSKEW 460
#define tWIDTH 461
#define tPERIOD 462
#define tNOCHANGE 463
#define tCOND 464
#define tSCOND 465
#define tCCOND 466
#define tPATHCONSTR 467
#define tPERIODCONSTR 468
#define tSUM 469
#define tDIFF 470
#define tSKEWCONSTR 471
#define tEXCEPTION 472
#define tNAME 473
#define tARRIVAL 474
#define tDEPARTURE 475
#define tSLACK 476
#define tWAVEFORM 477
#define tINCREMENT 478
#define tABSOLUTE 479
#define tTILDEAMP 480
#define tTILDEBAR 481
#define tTILDECARET 482

#endif // _SCAN_H

0 comments on commit c5c56d4

Please sign in to comment.