From 4aa6f8e07914cb1aa8cde5da5e3512c0f717f737 Mon Sep 17 00:00:00 2001 From: Rodrigo Alejandro Melo Date: Fri, 1 Dec 2017 13:33:48 -0300 Subject: Fixed scientific notation when the sign of the exponent is used Removed the testcase of todo.vhd. --- examples/Scientific.vhd | 4 +++- examples/todo.vhd | 1 - src/vhd2vl.l | 4 ++-- translated_examples/Scientific.v | 2 ++ 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; -- cgit v1.2.1