summaryrefslogtreecommitdiffstats
path: root/src/vhd2vl.l
diff options
context:
space:
mode:
authorRodrigo Alejandro Melo <rodrigomelo9@gmail.com>2017-02-09 23:39:08 -0300
committerRodrigo Alejandro Melo <rodrigomelo9@gmail.com>2017-02-09 23:39:08 -0300
commitfd94b98a5c5f7ec819511445bdcf4bbe34338b7b (patch)
treea579584f72c499974942cbf00814b5be5a384f18 /src/vhd2vl.l
parent4a0c6c57511eabbb32031d468ec09ce7987cc680 (diff)
downloadvhdl2vl-fd94b98a5c5f7ec819511445bdcf4bbe34338b7b.tar.gz
vhdl2vl-fd94b98a5c5f7ec819511445bdcf4bbe34338b7b.zip
Added scientific notation supports for integers and floats
Also support was added for real numbers especially thinking in generics. Files called scientific.vhd and scientific.v were added for test.
Diffstat (limited to 'src/vhd2vl.l')
-rw-r--r--src/vhd2vl.l8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vhd2vl.l b/src/vhd2vl.l
index 661824f..e7419de 100644
--- a/src/vhd2vl.l
+++ b/src/vhd2vl.l
@@ -84,6 +84,7 @@ void getbasedstring(unsigned skip);
"unsigned" |
"std_logic_vector" |
"std_ulogic_vector" { return BITVECT; }
+"real" { return REAL; }
"downto" { return DOWNTO; }
"to" { return TO; }
"type" {return TYPE; }
@@ -148,6 +149,13 @@ void getbasedstring(unsigned skip);
return NATURAL;
}
+[0-9]+e[0-9]+ |
+[0-9]+\.[0-9]+e[0-9]+ {
+ yylval.txt=malloc(strlen(yytext)+1);
+ strcpy(yylval.txt, yytext);
+ return SCIENTIFIC;
+}
+
[0-9]+\.[0-9]+ {
getstring(0);
return FLOAT;
OpenPOWER on IntegriCloud