summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Alejandro Melo <rmelo@inti.gob.ar>2017-12-01 13:33:48 -0300
committerRodrigo Alejandro Melo <rmelo@inti.gob.ar>2017-12-01 13:33:48 -0300
commit4aa6f8e07914cb1aa8cde5da5e3512c0f717f737 (patch)
treef9d23d9d42f4a8b22dcd272715af11c962097c15
parent5ac1f1eba35fec83789c635b7b145474a77a5fde (diff)
downloadvhdl2vl-4aa6f8e07914cb1aa8cde5da5e3512c0f717f737.zip
vhdl2vl-4aa6f8e07914cb1aa8cde5da5e3512c0f717f737.tar.gz
Fixed scientific notation when the sign of the exponent is used
Removed the testcase of todo.vhd.
-rw-r--r--examples/Scientific.vhd4
-rw-r--r--examples/todo.vhd1
-rw-r--r--src/vhd2vl.l4
-rw-r--r--translated_examples/Scientific.v2
4 files changed, 7 insertions, 4 deletions
diff --git a/examples/Scientific.vhd b/examples/Scientific.vhd
index d71e55d..3d6655a 100644
--- a/examples/Scientific.vhd
+++ b/examples/Scientific.vhd
@@ -5,7 +5,9 @@ entity Scientific is
generic (
exp1: integer := 25e6;
exp2: integer := 25E6;
- exp3: real := 25.0e6
+ exp3: real := 25.0e6;
+ exp4: real := 50.0e+3;
+ exp5: real := 50.0e-3
);
port(
clk : in std_logic
diff --git a/examples/todo.vhd b/examples/todo.vhd
index bd9e81f..a5d4de5 100644
--- a/examples/todo.vhd
+++ b/examples/todo.vhd
@@ -5,7 +5,6 @@ use IEEE.numeric_std.all;
entity todo is
generic(
INBYLEVEL : boolean:=FALSE
- --DEB_TIME : real:=50.0e-3 -- unexpected NAME, expecting ')' at "e"
);
port (
clk_i : in std_logic;
diff --git a/src/vhd2vl.l b/src/vhd2vl.l
index ab3c0d0..9719206 100644
--- a/src/vhd2vl.l
+++ b/src/vhd2vl.l
@@ -163,8 +163,8 @@ int scan_int(char *s);
return NATURAL;
}
-[0-9]+e[0-9]+ |
-[0-9]+\.[0-9]+e[0-9]+ {
+[0-9]+e[-+]?[0-9]+ |
+[0-9]+\.[0-9]+e[-+]?[0-9]+ {
yylval.txt=malloc(strlen(yytext)+1);
strcpy(yylval.txt, yytext);
return SCIENTIFIC;
diff --git a/translated_examples/Scientific.v b/translated_examples/Scientific.v
index 9cd85a2..9f725ab 100644
--- a/translated_examples/Scientific.v
+++ b/translated_examples/Scientific.v
@@ -6,6 +6,8 @@ input wire clk
parameter [31:0] exp1=25e6;
parameter [31:0] exp2=25E6;
parameter exp3=25.0e6;
+parameter exp4=50.0e+3;
+parameter exp5=50.0e-3;
OpenPOWER on IntegriCloud