summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorTristan Gingold2014-12-21 21:34:48 +0100
committerTristan Gingold2014-12-21 21:34:48 +0100
commit4c3181e8d52b654b9ca1112b272f53803c7f5dc1 (patch)
treeba92f927e5b20cd3d0f70c83d7fc45bbcf73ea6b /dist
parentcc8c7684219e99a4cea75ff4c7757de27b78c572 (diff)
downloadghdl-4c3181e8d52b654b9ca1112b272f53803c7f5dc1.tar.gz
ghdl-4c3181e8d52b654b9ca1112b272f53803c7f5dc1.tar.bz2
ghdl-4c3181e8d52b654b9ca1112b272f53803c7f5dc1.zip
Backport from ghdl 0.32: update libraries and ghdlfilter.
From Brian Davis.
Diffstat (limited to 'dist')
-rw-r--r--dist/mcode/windows/complib.bat93
-rw-r--r--dist/mcode/windows/ghdlfilter.adb65
2 files changed, 137 insertions, 21 deletions
diff --git a/dist/mcode/windows/complib.bat b/dist/mcode/windows/complib.bat
index 88a43ce..e19ac7f 100644
--- a/dist/mcode/windows/complib.bat
+++ b/dist/mcode/windows/complib.bat
@@ -6,63 +6,116 @@ cd ..
set REL=..\..\..
set LIBSRC=%REL%\..\..\libraries
-set STD_SRCS=textio textio_body
-set IEEE_SRCS=std_logic_1164 std_logic_1164_body numeric_std numeric_std-body numeric_bit numeric_bit-body
-set VITAL95_SRCS=vital_timing vital_timing_body vital_primitives vital_primitives_body
-set VITAL2000_SRCS=timing_p timing_b prmtvs_p prmtvs_b memory_p memory_b
-set SYNOPSYS_SRCS=std_logic_arith std_logic_textio std_logic_unsigned std_logic_signed std_logic_misc std_logic_misc-body
+::
+:: library sources
+::
+set STD_SRCS= textio textio_body
+set IEEE_SRCS= std_logic_1164 std_logic_1164_body numeric_std numeric_std-body numeric_bit numeric_bit-body
+set MATH_SRCS= math_real math_real-body math_complex math_complex-body
+
+set STD08_SRCS= textio textio_body env env_body
+set IEEE08_SRCS= std_logic_1164 std_logic_1164-body std_logic_textio math_real math_real-body math_complex math_complex-body numeric_bit numeric_bit-body numeric_bit_unsigned numeric_bit_unsigned-body numeric_std numeric_std-body numeric_std_unsigned numeric_std_unsigned-body fixed_float_types fixed_generic_pkg fixed_generic_pkg-body fixed_pkg float_generic_pkg float_generic_pkg-body float_pkg
+
+set VITAL95_SRCS= vital_timing vital_timing_body vital_primitives vital_primitives_body
+set VITAL2000_SRCS= timing_p timing_b prmtvs_p prmtvs_b memory_p memory_b
+
+set SYNOPSYS_SRCS= std_logic_arith std_logic_textio std_logic_unsigned std_logic_signed std_logic_misc std_logic_misc-body
+set MENTOR_SRCS= std_logic_arith std_logic_arith_body
+
mkdir lib
cd lib
+:::::::::::::::::
+echo v87 libraries...
+
mkdir v87
cd v87
+echo std
mkdir std
cd std
-for %%F in (%STD_SRCS%) do %REL%\build\ghdlfilter -v87 < %LIBSRC%\std\%%F.vhdl > %%F.v87 && %REL%\build\%GHDL% -a --std=87 --bootstrap --work=std %%F.v87
+for %%F in (%STD_SRCS%) do %REL%\build\ghdlfilter -v87 < %LIBSRC%\std\%%F.vhdl > %%F.v87 && %REL%\build\%GHDL% -a --std=87 --bootstrap --work=std %%F.v87
cd ..
+echo ieee
mkdir ieee
cd ieee
-rem Base ieee
-for %%F in (%IEEE_SRCS%) do %REL%\build\ghdlfilter -v87 < %LIBSRC%\ieee\%%F.vhdl > %%F.v87 && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.v87
-rem Vital 95
-for %%F in (%VITAL95_SRCS%) do copy %LIBSRC%\vital95\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.vhd
+for %%F in (%IEEE_SRCS%) do %REL%\build\ghdlfilter -v87 < %LIBSRC%\ieee\%%F.vhdl > %%F.v87 && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.v87
+for %%F in (%VITAL95_SRCS%) do copy %LIBSRC%\vital95\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.vhd
cd ..
+echo synopsys
mkdir synopsys
cd synopsys
-for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee ..\ieee\%%F.v87
-for %%F in (%VITAL95_SRCS%) do %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee ..\ieee\%%F.vhd
-for %%F in (%SYNOPSYS_SRCS%) do copy %LIBSRC%\synopsys\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.vhd
+for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee ..\ieee\%%F.v87
+for %%F in (%VITAL95_SRCS%) do %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee ..\ieee\%%F.vhd
+for %%F in (%SYNOPSYS_SRCS%) do copy %LIBSRC%\synopsys\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=87 -P..\std --work=ieee %%F.vhd
cd ..
cd ..
+
+:::::::::::::::::
+echo v93 libraries...
+
mkdir v93
cd v93
+echo std
mkdir std
cd std
-for %%F in (%STD_SRCS%) do %REL%\build\ghdlfilter -v93 < %LIBSRC%\std\%%F.vhdl > %%F.v93 && %REL%\build\%GHDL% -a --std=93 --bootstrap --work=std %%F.v93
+for %%F in (%STD_SRCS%) do %REL%\build\ghdlfilter -v93 < %LIBSRC%\std\%%F.vhdl > %%F.v93 && %REL%\build\%GHDL% -a --std=93 --bootstrap --work=std %%F.v93
cd ..
+echo ieee
mkdir ieee
cd ieee
-echo Base ieee
-for %%F in (%IEEE_SRCS%) do %REL%\build\ghdlfilter -v93 < %LIBSRC%\ieee\%%F.vhdl > %%F.v93 && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.v93
-echo Vital 2000
-for %%F in (%VITAL2000_SRCS%) do copy %LIBSRC%\vital2000\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.vhd
+for %%F in (%IEEE_SRCS%) do %REL%\build\ghdlfilter -v93 < %LIBSRC%\ieee\%%F.vhdl > %%F.v93 && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.v93
+for %%F in (%VITAL2000_SRCS%) do copy %LIBSRC%\vital2000\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.vhd
+for %%F in (%MATH_SRCS%) do copy %LIBSRC%\ieee\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.vhd
cd ..
+echo synopsys
mkdir synopsys
cd synopsys
-for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.v93
+for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.v93
for %%F in (%VITAL2000_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
-for %%F in (%SYNOPSYS_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\..\v87\synopsys\%%F.vhd
+for %%F in (%MATH_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
+for %%F in (%SYNOPSYS_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\..\v87\synopsys\%%F.vhd
cd ..
+echo mentor
+mkdir mentor
+cd mentor
+for %%F in (%IEEE_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.v93
+for %%F in (%VITAL2000_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
+for %%F in (%MATH_SRCS%) do %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee ..\ieee\%%F.vhd
+for %%F in (%MENTOR_SRCS%) do copy %LIBSRC%\mentor\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=93 -P..\std --work=ieee %%F.vhd
cd ..
cd ..
+
+:::::::::::::::::
+echo v08 libraries...
+
+mkdir v08
+cd v08
+
+echo std
+mkdir std
+cd std
+for %%F in (%STD08_SRCS%) do %REL%\build\ghdlfilter -v08 < %LIBSRC%\std\%%F.vhdl > %%F.v08 && %REL%\build\%GHDL% -a --std=08 --bootstrap --work=std %%F.v08
+cd ..
+
+echo ieee
+mkdir ieee
+cd ieee
+for %%F in (%IEEE08_SRCS%) do %REL%\build\ghdlfilter -v08 < %LIBSRC%\ieee2008\%%F.vhdl > %%F.v08 && %REL%\build\%GHDL% -a --std=08 -P..\std --work=ieee %%F.v08
+for %%F in (%VITAL2000_SRCS%) do copy %LIBSRC%\vital2000\%%F.vhdl %%F.vhd && %REL%\build\%GHDL% -a --std=08 -P..\std --work=ieee %%F.vhd
+cd ..
+
+
+:::::::::::::::::
+
+cd ..\..
diff --git a/dist/mcode/windows/ghdlfilter.adb b/dist/mcode/windows/ghdlfilter.adb
index 681d404..d75526d 100644
--- a/dist/mcode/windows/ghdlfilter.adb
+++ b/dist/mcode/windows/ghdlfilter.adb
@@ -1,3 +1,29 @@
+--
+-- Preprocessor to handle library source metacomments
+--
+-- Limitations:
+-- - line metacomments must occur at end of line with no trailing space before the line break
+-- - block metacomments must start in column 1
+--
+-- Supported line metacomments:
+--
+-- --!V87
+-- --V87
+-- --V93
+-- --V08
+--
+-- Supported block metacomments:
+--
+-- --START-!V87
+-- --END-!V87
+--
+-- --START-V93
+-- --END-V93
+--
+-- --START-V08
+-- --END-V08
+--
+--
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
@@ -35,14 +61,39 @@ begin
Comment := Block_Comment;
+ --
+ -- look for line metacomments
+ --
+ if Len > 6 then
+
+ if Mode = Mode_87 and ( Line (Len - 5 .. Len) = "--!V87" ) then
+ Comment := True;
+ end if;
+
+ end if;
+
+
if Len > 5 then
- if Mode = Mode_87 and ( (Line (Len - 4 .. Len) = "--V93") or (Line (Len - 4 .. Len) = "--V08") ) then
+
+ if Mode = Mode_87 and ( (Line (Len - 4 .. Len) = "--V93") or (Line (Len - 4 .. Len) = "--V08") ) then
Comment := True;
+
elsif Mode = Mode_93 and ( (Line (Len - 4 .. Len) = "--V87") or (Line (Len - 4 .. Len) = "--V08") ) then
Comment := True;
+
elsif Mode = Mode_08 and ( (Line (Len - 4 .. Len) = "--V87") or (Line (Len - 4 .. Len) = "--V93") ) then
Comment := True;
end if;
+
+ end if;
+
+ --
+ -- look for block metacomment start
+ --
+ if Len = 12
+ and then Mode /= Mode_93
+ and then Line (1 .. 12) = "--START-!V87" then
+ Block_Comment := True;
end if;
if Len = 11
@@ -57,13 +108,25 @@ begin
Block_Comment := True;
end if;
+ --
+ -- look for block metacomment end
+ --
if Len = 9 and then ( (Line (1 .. 9) = "--END-V93") or (Line (1 .. 9) = "--END-V08") ) then
Block_Comment := False;
end if;
+ if Len = 10 and then ( Line (1 .. 10) = "--END-!V87" ) then
+ Block_Comment := False;
+ end if;
+
+ --
+ -- comment output lines as needed
+ --
if Comment then
Put ("-- ");
end if;
+
Put_Line (Line (1 .. Len));
+
end loop;
end Ghdlfilter;