Commit 6ddf7823 by Zachary Snow

drop timeunit and timescale (closes #31)

parent 295ac649
...@@ -85,6 +85,13 @@ $decimalDigit = [0-9] ...@@ -85,6 +85,13 @@ $decimalDigit = [0-9]
@string = \" (\\\"|[^\"\r\n])* \" @string = \" (\\\"|[^\"\r\n])* \"
-- Times
@timeUnit = s | ms | us | ns | ps | fs
@time
= @unsignedNumber @timeUnit
| @fixedPointNumber @timeUnit
-- Identifiers -- Identifiers
@escapedIdentifier = "\" ($printable # $white)+ $white @escapedIdentifier = "\" ($printable # $white)+ $white
...@@ -364,6 +371,7 @@ tokens :- ...@@ -364,6 +371,7 @@ tokens :-
@number { tok Lit_number } @number { tok Lit_number }
@string { tok Lit_string } @string { tok Lit_string }
@time { tok Lit_time }
"(" { tok Sym_paren_l } "(" { tok Sym_paren_l }
")" { tok Sym_paren_r } ")" { tok Sym_paren_r }
......
...@@ -281,6 +281,7 @@ escapedIdentifier { Token Id_escaped _ _ } ...@@ -281,6 +281,7 @@ escapedIdentifier { Token Id_escaped _ _ }
systemIdentifier { Token Id_system _ _ } systemIdentifier { Token Id_system _ _ }
number { Token Lit_number _ _ } number { Token Lit_number _ _ }
string { Token Lit_string _ _ } string { Token Lit_string _ _ }
time { Token Lit_time _ _ }
"(" { Token Sym_paren_l _ _ } "(" { Token Sym_paren_l _ _ }
")" { Token Sym_paren_r _ _ } ")" { Token Sym_paren_r _ _ }
...@@ -738,10 +739,15 @@ NonDeclPackageItem :: { [PackageItem] } ...@@ -738,10 +739,15 @@ NonDeclPackageItem :: { [PackageItem] }
| "export" PackageImportItems ";" { map (Export . Just) $2 } | "export" PackageImportItems ";" { map (Export . Just) $2 }
| "export" "*" "::" "*" ";" { [Export Nothing] } -- "Nothing" being no restrictions | "export" "*" "::" "*" ";" { [Export Nothing] } -- "Nothing" being no restrictions
| ForwardTypedef ";" { $1 } | ForwardTypedef ";" { $1 }
| TimeunitsDeclaration { $1 }
ForwardTypedef :: { [PackageItem] } ForwardTypedef :: { [PackageItem] }
: "typedef" "enum" Identifier { [] } : "typedef" "enum" Identifier { [] }
| "typedef" "struct" Identifier { [] } | "typedef" "struct" Identifier { [] }
| "typedef" "union" Identifier { [] } | "typedef" "union" Identifier { [] }
TimeunitsDeclaration :: { [PackageItem] }
: "timeunit" Time ";" { [] }
| "timeunit" Time "/" Time ";" { [] }
| "timeprecision" Time ";" { [] }
PackageImportItems :: { [(Identifier, Maybe Identifier)] } PackageImportItems :: { [(Identifier, Maybe Identifier)] }
: PackageImportItem { [$1] } : PackageImportItem { [$1] }
...@@ -970,6 +976,9 @@ Number :: { String } ...@@ -970,6 +976,9 @@ Number :: { String }
String :: { String } String :: { String }
: string { tail $ init $ tokenString $1 } : string { tail $ init $ tokenString $1 }
Time :: { String }
: time { tokenString $1 }
CallArgs :: { Args } CallArgs :: { Args }
: {- empty -} { Args [ ] [] } : {- empty -} { Args [ ] [] }
| NamedCallArgsFollow { Args [ ] $1 } | NamedCallArgsFollow { Args [ ] $1 }
......
...@@ -281,9 +281,9 @@ data TokenName ...@@ -281,9 +281,9 @@ data TokenName
| Id_simple | Id_simple
| Id_escaped | Id_escaped
| Id_system | Id_system
| Lit_number_unsigned
| Lit_number | Lit_number
| Lit_string | Lit_string
| Lit_time
| Sym_paren_l | Sym_paren_l
| Sym_paren_r | Sym_paren_r
| Sym_brack_l | 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