diff options
author | gingold | 2012-12-11 02:38:52 +0000 |
---|---|---|
committer | gingold | 2012-12-11 02:38:52 +0000 |
commit | a47d1d61881e53c05ad9acf375f8b929da5c20e7 (patch) | |
tree | fd1d341f791b3587132aae9f27801fea403edf0a | |
parent | 92d0ab4e50abbf6048d6e70e2e34a93bae2b5f9e (diff) | |
download | ghdl-a47d1d61881e53c05ad9acf375f8b929da5c20e7.tar.gz ghdl-a47d1d61881e53c05ad9acf375f8b929da5c20e7.tar.bz2 ghdl-a47d1d61881e53c05ad9acf375f8b929da5c20e7.zip |
Create grtlink to share references to grt.
-rw-r--r-- | translate/ghdldrv/ghdlrun.adb | 27 | ||||
-rw-r--r-- | translate/ghdldrv/ghdlsimul.adb | 23 | ||||
-rw-r--r-- | translate/ghdldrv/grtlink.ads | 39 |
3 files changed, 64 insertions, 25 deletions
diff --git a/translate/ghdldrv/ghdlrun.adb b/translate/ghdldrv/ghdlrun.adb index edc33e2..34b5edc 100644 --- a/translate/ghdldrv/ghdlrun.adb +++ b/translate/ghdldrv/ghdlrun.adb @@ -62,6 +62,7 @@ with Grt.Names; with Ghdlcomp; with Foreigns; +with Grtlink; package body Ghdlrun is procedure Foreign_Hook (Decl : Iir; @@ -136,10 +137,6 @@ package body Ghdlrun is end loop; end Set_Run_Options; - -- Toplevel function, defined by grt. - Flag_String : String (1 .. 5); - pragma Export (C, Flag_String, "__ghdl_flag_string"); - procedure Ghdl_Elaborate; pragma Export (C, Ghdl_Elaborate, "__ghdl_ELABORATE"); @@ -153,20 +150,6 @@ package body Ghdlrun is Elaborate_Proc.all; end Ghdl_Elaborate; - Std_Standard_Bit_RTI_Ptr : Address := Null_Address; - - Std_Standard_Boolean_RTI_Ptr : Address := Null_Address; - - pragma Export (C, Std_Standard_Bit_RTI_Ptr, - "std__standard__bit__RTI_ptr"); - - pragma Export (C, Std_Standard_Boolean_RTI_Ptr, - "std__standard__boolean__RTI_ptr"); - - Ieee_Std_Logic_1164_Resolved_Resolv_Ptr : Address := Null_Address; - pragma Export (C, Ieee_Std_Logic_1164_Resolved_Resolv_Ptr, - "ieee__std_logic_1164__resolved_RESOLV_ptr"); - function Find_Untruncated_Text_Read return O_Dnode is use Types; @@ -553,20 +536,20 @@ package body Ghdlrun is raise Compile_Error; end if; - Std_Standard_Boolean_RTI_Ptr := + Grtlink.Std_Standard_Boolean_RTI_Ptr := Ortho_Jit.Get_Address (Trans_Decls.Std_Standard_Boolean_Rti); - Std_Standard_Bit_RTI_Ptr := + Grtlink.Std_Standard_Bit_RTI_Ptr := Ortho_Jit.Get_Address (Trans_Decls.Std_Standard_Bit_Rti); if Ieee.Std_Logic_1164.Resolved /= Null_Iir then Decl := Translation.Get_Resolv_Ortho_Decl (Ieee.Std_Logic_1164.Resolved); if Decl /= O_Dnode_Null then - Ieee_Std_Logic_1164_Resolved_Resolv_Ptr := + Grtlink.Ieee_Std_Logic_1164_Resolved_Resolv_Ptr := Ortho_Jit.Get_Address (Decl); end if; end if; - Flag_String := Flags.Flag_String; + Grtlink.Flag_String := Flags.Flag_String; Elaborate_Proc := Conv (Ortho_Jit.Get_Address (Trans_Decls.Ghdl_Elaborate)); diff --git a/translate/ghdldrv/ghdlsimul.adb b/translate/ghdldrv/ghdlsimul.adb index abeb7bb..6dffefe 100644 --- a/translate/ghdldrv/ghdlsimul.adb +++ b/translate/ghdldrv/ghdlsimul.adb @@ -15,6 +15,9 @@ -- 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. + +with Ada.Text_IO; + with Ghdllocal; use Ghdllocal; with GNAT.OS_Lib; use GNAT.OS_Lib; @@ -35,6 +38,10 @@ with Simulation; with Ghdlcomp; +with Grt.Vpi; +pragma Unreferenced (Grt.Vpi); +with Grtlink; + package body Ghdlsimul is Flag_Expect_Failure : Boolean := False; @@ -111,21 +118,31 @@ package body Ghdlsimul is Sec_Id := Get_Identifier (Sec_Name.all); end if; Top_Conf := Configuration.Configure (First_Id, Sec_Id); + if Top_Conf = Null_Iir then + raise Compilation_Error; + end if; + + Grtlink.Flag_String := Flags.Flag_String; Simulation.Simulation_Entity (Top_Conf); end Run; function Decode_Option (Option : String) return Boolean is - pragma Unreferenced (Option); begin - return False; + if Option = "--debug" then + Simulation.Flag_Debugger := True; + else + return False; + end if; + return True; end Decode_Option; procedure Disp_Long_Help is + use Ada.Text_IO; begin - null; + Put_Line (" --debug Run with debugger"); end Disp_Long_Help; diff --git a/translate/ghdldrv/grtlink.ads b/translate/ghdldrv/grtlink.ads new file mode 100644 index 0000000..4b3951e --- /dev/null +++ b/translate/ghdldrv/grtlink.ads @@ -0,0 +1,39 @@ +-- GHDL driver - shared variables with grt. +-- Copyright (C) 2011 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. +with System; use System; + +package Grtlink is + + Flag_String : String (1 .. 5); + pragma Export (C, Flag_String, "__ghdl_flag_string"); + + Std_Standard_Bit_RTI_Ptr : Address := Null_Address; + + Std_Standard_Boolean_RTI_Ptr : Address := Null_Address; + + pragma Export (C, Std_Standard_Bit_RTI_Ptr, + "std__standard__bit__RTI_ptr"); + + pragma Export (C, Std_Standard_Boolean_RTI_Ptr, + "std__standard__boolean__RTI_ptr"); + + Ieee_Std_Logic_1164_Resolved_Resolv_Ptr : Address := Null_Address; + pragma Export (C, Ieee_Std_Logic_1164_Resolved_Resolv_Ptr, + "ieee__std_logic_1164__resolved_RESOLV_ptr"); + +end Grtlink; |