Commit 6ddf7823 by Zachary Snow

drop timeunit and timescale (closes #31)

parent 295ac649
......@@ -85,6 +85,13 @@ $decimalDigit = [0-9]
@string = \" (\\\"|[^\"\r\n])* \"
-- Times
@timeUnit = s | ms | us | ns | ps | fs
@time
= @unsignedNumber @timeUnit
| @fixedPointNumber @timeUnit
-- Identifiers
@escapedIdentifier = "\" ($printable # $white)+ $white
......@@ -364,6 +371,7 @@ tokens :-
@number { tok Lit_number }
@string { tok Lit_string }
@time { tok Lit_time }
"(" { tok Sym_paren_l }
")" { tok Sym_paren_r }
......
......@@ -281,6 +281,7 @@ escapedIdentifier { Token Id_escaped _ _ }
systemIdentifier { Token Id_system _ _ }
number { Token Lit_number _ _ }
string { Token Lit_string _ _ }
time { Token Lit_time _ _ }
"(" { Token Sym_paren_l _ _ }
")" { Token Sym_paren_r _ _ }
......@@ -738,10 +739,15 @@ NonDeclPackageItem :: { [PackageItem] }
| "export" PackageImportItems ";" { map (Export . Just) $2 }
| "export" "*" "::" "*" ";" { [Export Nothing] } -- "Nothing" being no restrictions
| ForwardTypedef ";" { $1 }
| TimeunitsDeclaration { $1 }
ForwardTypedef :: { [PackageItem] }
: "typedef" "enum" Identifier { [] }
| "typedef" "struct" Identifier { [] }
| "typedef" "union" Identifier { [] }
TimeunitsDeclaration :: { [PackageItem] }
: "timeunit" Time ";" { [] }
| "timeunit" Time "/" Time ";" { [] }
| "timeprecision" Time ";" { [] }
PackageImportItems :: { [(Identifier, Maybe Identifier)] }
: PackageImportItem { [$1] }
......@@ -970,6 +976,9 @@ Number :: { String }
String :: { String }
: string { tail $ init $ tokenString $1 }
Time :: { String }
: time { tokenString $1 }
CallArgs :: { Args }
: {- empty -} { Args [ ] [] }
| NamedCallArgsFollow { Args [ ] $1 }
......
......@@ -281,9 +281,9 @@ data TokenName
| Id_simple
| Id_escaped
| Id_system
| Lit_number_unsigned
| Lit_number
| Lit_string
| Lit_time
| Sym_paren_l
| Sym_paren_r
| Sym_brack_l
......
`timescale 1ns / 10ps
timeunit 100ps;
timeprecision 1ps;
module top_1;
`timescale 1ns / 10ps
timeunit 1ps;
timeprecision 1ps;
endmodule
module top_2;
timeunit 100ps / 10fs;
endmodule
module top_3;
timeunit 10.0ps / 10fs;
endmodule
module top_4;
timeunit 100ps;
timeprecision 10fs;
endmodule
module top;
initial $display("Hello!");
endmodule
module top;
initial $display("Hello!");
endmodule
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment