-- GHDL Run Time (GRT) - VHDL files subprograms. -- Copyright (C) 2002 - 2014 Tristan Gingold -- -- GHDL is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free -- Software Foundation; either version 2, or (at your option) any later -- version. -- -- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY -- WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- -- You should have received a copy of the GNU General Public License -- along with GCC; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. -- -- As a special exception, if other files instantiate generics from this -- unit, or you link this unit with other files to produce an executable, -- this unit does not by itself cause the resulting executable to be -- covered by the GNU General Public License. This exception does not -- however invalidate any other reasons why the executable file might be -- covered by the GNU Public License. with Grt.Errors; use Grt.Errors; with Grt.Stdio; use Grt.Stdio; with Grt.C; use Grt.C; with Grt.Table; with Grt.Options; with System; use System; pragma Elaborate_All (Grt.Table); package body Grt.Files is subtype C_Files is Grt.Stdio.FILEs; Auto_Flush : constant Boolean := False; type File_Entry_Type is record Stream : C_Files; Signature : Ghdl_C_String; Is_Text : Boolean; Is_Alive : Boolean; end record; package Files_Table is new Grt.Table (Table_Component_Type => File_Entry_Type, Table_Index_Type => Ghdl_File_Index, Table_Low_Bound => 1, Table_Initial => 2); function Get_File (Index : Ghdl_File_Index) return C_Files is begin if Index not in Files_Table.First .. Files_Table.Last then Internal_Error ("get_file: bad file index"); end if; return Files_Table.Table (Index).Stream; end Get_File; procedure Check_File_Mode (Index : Ghdl_File_Index; Is_Text : Boolean) is begin if Files_Table.Table (Index).Is_Text /= Is_Text then Internal_Error ("check_file_mode: bad file mode"); end if; end Check_File_Mode; function Create_File (Is_Text : Boolean; Sig : Ghdl_C_String) return Ghdl_File_Index is begin Files_Table.Append ((Stream => NULL_Stream, Signature => Sig, Is_Text => Is_Text, Is_Alive => True)); return Files_Table.Last; end Create_File; procedure Destroy_File (Is_Text : Boolean; Index : Ghdl_File_Index) is begin if Get_File (Index) /= NULL_Stream then Internal_Error ("destroy_file"); end if; Check_File_Mode (Index, Is_Text); Files_Table.Table (Index).Is_Alive := False; if Index = Files_Table.Last then while Files_Table.Last >= Files_Table.First and then Files_Table.Table (Files_Table.Last).Is_Alive = False loop Files_Table.Decrement_Last; end loop; end if; end Destroy_File; procedure File_Error (File : Ghdl_File_Index) is pragma Unreferenced (File); begin Internal_Error ("file: IO error"); end File_Error; function Ghdl_Text_File_Elaborate return Ghdl_File_Index is begin return Create_File (True, null); end Ghdl_Text_File_Elaborate; function Ghdl_File_Elaborate (Sig : Ghdl_C_String) re
#!/usr/bin/env bash
set -e
{
echo "all::"
for x in *.ys; do
echo "all:: run-$x"
echo "run-$x:"
echo " @echo 'Running $x..'"
echo " @../../yosys -ql ${x%.ys}.log $x"
done
for s in *.sh; do
if [ "$s" != "run-test.sh" ]; then
echo "all:: run-$s"
echo "run-$s:"
echo " @echo 'Running $s..'"
echo " @bash $s > ${s%.sh}.log 2>&1"
fi
done
} > run-test.mk
exec ${MAKE:-make} -f run-test.mk