Add "real" keyword to ilang format
authorClifford Wolf <clifford@clifford.at>
Mon, 6 May 2019 10:00:40 +0000 (12:00 +0200)
committerClifford Wolf <clifford@clifford.at>
Mon, 6 May 2019 10:00:40 +0000 (12:00 +0200)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
backends/ilang/ilang_backend.cc
frontends/ilang/ilang_lexer.l
frontends/ilang/ilang_parser.y

index dc39e5e0838dec6eafde703cad72cf4b32c58fe2..04d1ee311ffa11923d7a043b7c02d8744538c1a6 100644 (file)
@@ -160,7 +160,10 @@ void ILANG_BACKEND::dump_cell(std::ostream &f, std::string indent, const RTLIL::
        }
        f << stringf("%s" "cell %s %s\n", indent.c_str(), cell->type.c_str(), cell->name.c_str());
        for (auto &it : cell->parameters) {
-               f << stringf("%s  parameter%s %s ", indent.c_str(), (it.second.flags & RTLIL::CONST_FLAG_SIGNED) != 0 ? " signed" : "", it.first.c_str());
+               f << stringf("%s  parameter%s%s %s ", indent.c_str(),
+                               (it.second.flags & RTLIL::CONST_FLAG_SIGNED) != 0 ? " signed" : "",
+                               (it.second.flags & RTLIL::CONST_FLAG_REAL) != 0 ? " real" : "",
+                               it.first.c_str());
                dump_const(f, it.second);
                f << stringf("\n");
        }
index d8e01ae4de473be656ca81d23d49b3d7f54c65bb..4fd0ae855a52c3ef15f0b39bee3137b8c80cc92c 100644 (file)
@@ -53,6 +53,7 @@ USING_YOSYS_NAMESPACE
 "attribute"    { return TOK_ATTRIBUTE; }
 "parameter"    { return TOK_PARAMETER; }
 "signed"       { return TOK_SIGNED; }
+"real"         { return TOK_REAL; }
 "wire"         { return TOK_WIRE; }
 "memory"       { return TOK_MEMORY; }
 "width"                { return TOK_WIDTH; }
index f83824088157a775926c03da7a375945157eb5f1..e9961d02aa92342dda1f211407dc868a3f9210bb 100644 (file)
@@ -61,7 +61,7 @@ USING_YOSYS_NAMESPACE
 %token TOK_CELL TOK_CONNECT TOK_SWITCH TOK_CASE TOK_ASSIGN TOK_SYNC
 %token TOK_LOW TOK_HIGH TOK_POSEDGE TOK_NEGEDGE TOK_EDGE TOK_ALWAYS TOK_GLOBAL TOK_INIT
 %token TOK_UPDATE TOK_PROCESS TOK_END TOK_INVALID TOK_EOL TOK_OFFSET
-%token TOK_PARAMETER TOK_ATTRIBUTE TOK_MEMORY TOK_SIZE TOK_SIGNED TOK_UPTO
+%token TOK_PARAMETER TOK_ATTRIBUTE TOK_MEMORY TOK_SIZE TOK_SIGNED TOK_REAL TOK_UPTO
 
 %type <rsigspec> sigspec_list_reversed
 %type <sigspec> sigspec sigspec_list
@@ -241,6 +241,12 @@ cell_body:
                free($4);
                delete $5;
        } |
+       cell_body TOK_PARAMETER TOK_REAL TOK_ID constant EOL {
+               current_cell->parameters[$4] = *$5;
+               current_cell->parameters[$4].flags |= RTLIL::CONST_FLAG_REAL;
+               free($4);
+               delete $5;
+       } |
        cell_body TOK_CONNECT TOK_ID sigspec EOL {
                if (current_cell->hasPort($3))
                        rtlil_frontend_ilang_yyerror(stringf("ilang error: redefinition of cell port %s.", $3).c_str());