1-- Synthesis. 2-- Copyright (C) 2017 Tristan Gingold 3-- 4-- This file is part of GHDL. 5-- 6-- This program is free software; you can redistribute it and/or modify 7-- it under the terms of the GNU General Public License as published by 8-- the Free Software Foundation; either version 2 of the License, or 9-- (at your option) any later version. 10-- 11-- This program is distributed in the hope that it will be useful, 12-- but WITHOUT ANY WARRANTY; without even the implied warranty of 13-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14-- GNU General Public License for more details. 15-- 16-- You should have received a copy of the GNU General Public License 17-- along with this program; if not, write to the Free Software 18-- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 19-- MA 02110-1301, USA. 20 21with Errorout; use Errorout; 22with Vhdl.Errors; use Vhdl.Errors; 23 24with Synth.Objtypes; 25with Synth.Insts; use Synth.Insts; 26 27with Synth.Environment.Debug; 28pragma Unreferenced (Synth.Environment.Debug); 29with Synth.Values.Debug; 30pragma Unreferenced (Synth.Values.Debug); 31 32package body Synthesis is 33 procedure Synth_Design (Design : Node; 34 Encoding : Name_Encoding; 35 M : out Module; 36 Inst : out Synth_Instance_Acc) 37 is 38 Unit : constant Node := Get_Library_Unit (Design); 39 Arch : Node; 40 Config : Node; 41 Global_Instance : Synth_Instance_Acc; 42 begin 43 -- Extract architecture from design. 44 case Get_Kind (Unit) is 45 when Iir_Kind_Architecture_Body => 46 Arch := Unit; 47 Config := Get_Library_Unit 48 (Get_Default_Configuration_Declaration (Arch)); 49 when Iir_Kind_Configuration_Declaration => 50 Config := Unit; 51 Arch := Get_Named_Entity 52 (Get_Block_Specification (Get_Block_Configuration (Unit))); 53 when others => 54 Error_Kind ("synth_design", Unit); 55 end case; 56 57 Global_Instance := Make_Base_Instance; 58 59 Synth.Objtypes.Init; 60 61 Synth_Top_Entity (Global_Instance, Arch, Config, Encoding, Inst); 62 Synth_All_Instances; 63 if Errorout.Nbr_Errors > 0 then 64 M := No_Module; 65 return; 66 end if; 67 68 M := Get_Top_Module (Global_Instance); 69 end Synth_Design; 70end Synthesis; 71