Improve $specrule interface
authorClifford Wolf <clifford@clifford.at>
Tue, 23 Apr 2019 20:18:04 +0000 (22:18 +0200)
committerClifford Wolf <clifford@clifford.at>
Tue, 23 Apr 2019 20:18:04 +0000 (22:18 +0200)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
frontends/verilog/verilog_parser.y
kernel/rtlil.cc
techlibs/common/simlib.v

index 0a41ba58168bd69bd1444935d0ae875e2aa2ec60..13ff1d38b29afeefa4a79f67e17c6af339d55377 100644 (file)
@@ -817,12 +817,7 @@ specify_item:
                delete timing;
        } |
        TOK_ID '(' specify_edge expr specify_condition ',' specify_edge expr specify_condition ',' expr ')' ';' {
-               bool limit_gt = false;
-               if (*$1 == "$setup" || *$1 == "$hold")
-                       limit_gt = true;
-               else if (*$1 == "$skew")
-                       limit_gt = false;
-               else
+               if (*$1 != "$setup" && *$1 != "$hold" && *$1 != "$skew")
                        frontend_verilog_yyerror("Unsupported specify rule type: %s\n", $1->c_str());
 
                AstNode *src_pen = AstNode::mkconst_int($3 != 0, false, 1);
@@ -841,11 +836,14 @@ specify_item:
                cell->children.push_back(new AstNode(AST_CELLTYPE));
                cell->children.back()->str = "$specrule";
 
-               cell->children.push_back(new AstNode(AST_ARGUMENT, src_en));
-               cell->children.back()->str = "\\SRC_EN";
+               cell->children.push_back(new AstNode(AST_PARASET, AstNode::mkconst_int(*$1 == "$skew", false, 1)));
+               cell->children.back()->str = "\\SKEW";
 
-               cell->children.push_back(new AstNode(AST_ARGUMENT, src_expr));
-               cell->children.back()->str = "\\SRC";
+               cell->children.push_back(new AstNode(AST_PARASET, AstNode::mkconst_int(*$1 == "$hold", false, 1)));
+               cell->children.back()->str = "\\HOLD";
+
+               cell->children.push_back(new AstNode(AST_PARASET, limit));
+               cell->children.back()->str = "\\T_LIMIT";
 
                cell->children.push_back(new AstNode(AST_PARASET, src_pen));
                cell->children.back()->str = "\\SRC_PEN";
@@ -853,23 +851,23 @@ specify_item:
                cell->children.push_back(new AstNode(AST_PARASET, src_pol));
                cell->children.back()->str = "\\SRC_POL";
 
-               cell->children.push_back(new AstNode(AST_ARGUMENT, dst_en));
-               cell->children.back()->str = "\\DST_EN";
-
-               cell->children.push_back(new AstNode(AST_ARGUMENT, dst_expr));
-               cell->children.back()->str = "\\DST";
-
                cell->children.push_back(new AstNode(AST_PARASET, dst_pen));
                cell->children.back()->str = "\\DST_PEN";
 
                cell->children.push_back(new AstNode(AST_PARASET, dst_pol));
                cell->children.back()->str = "\\DST_POL";
 
-               cell->children.push_back(new AstNode(AST_PARASET, AstNode::mkconst_int(limit_gt, false, 1)));
-               cell->children.back()->str = "\\LIMIT_GT";
+               cell->children.push_back(new AstNode(AST_ARGUMENT, src_en));
+               cell->children.back()->str = "\\SRC_EN";
 
-               cell->children.push_back(new AstNode(AST_PARASET, limit));
-               cell->children.back()->str = "\\T_LIMIT";
+               cell->children.push_back(new AstNode(AST_ARGUMENT, src_expr));
+               cell->children.back()->str = "\\SRC";
+
+               cell->children.push_back(new AstNode(AST_ARGUMENT, dst_en));
+               cell->children.back()->str = "\\DST_EN";
+
+               cell->children.push_back(new AstNode(AST_ARGUMENT, dst_expr));
+               cell->children.back()->str = "\\DST";
 
                delete $1;
        };
index dae3698a997fb7b7e85bbb2fc492151b84a045b1..3dd18c29638a0282206c48feeef5002445862669 100644 (file)
@@ -1223,7 +1223,8 @@ namespace {
                                param_bool("\\SRC_POL");
                                param_bool("\\DST_PEN");
                                param_bool("\\DST_POL");
-                               param_bool("\\LIMIT_GT");
+                               param_bool("\\SKEW");
+                               param_bool("\\HOLD");
                                param("\\T_LIMIT");
                                port("\\SRC_EN", 1);
                                port("\\DST_EN", 1);
index facecd9a440155bcc76c284f97401011f867eb02..965242cdcbf9dc7285213fb5de217eef28c8124d 100644 (file)
@@ -1419,6 +1419,10 @@ endmodule
 
 module \$specrule (EN_SRC, EN_DST, SRC, DST);
 
+parameter SKEW = 0;
+parameter HOLD = 0;
+parameter T_LIMIT = 0;
+
 parameter SRC_WIDTH = 1;
 parameter DST_WIDTH = 1;
 
@@ -1428,9 +1432,6 @@ parameter SRC_POL = 0;
 parameter DST_PEN = 0;
 parameter DST_POL = 0;
 
-parameter LIMIT_GT = 0;
-parameter T_LIMIT = 0;
-
 input EN_SRC, EN_DST;
 input [SRC_WIDTH-1:0] SRC;
 input [DST_WIDTH-1:0] DST;