diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-11-14 07:56:43 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-11-14 07:56:43 +0100 |
commit | ea76787585564f7ebb113d3989f87d34d0a4e7f7 (patch) | |
tree | 9ed67775d9e73e975200f4ce1c65c0f83feb3d52 /src | |
parent | 559c6166f3c639330502f714babddb0bd6d986b4 (diff) | |
download | ghdl-ea76787585564f7ebb113d3989f87d34d0a4e7f7.tar.gz ghdl-ea76787585564f7ebb113d3989f87d34d0a4e7f7.tar.bz2 ghdl-ea76787585564f7ebb113d3989f87d34d0a4e7f7.zip |
synth: preliminary work to support intrinsic procedures.
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-stmts.adb | 23 | ||||
-rw-r--r-- | src/vhdl/translate/trans_be.adb | 21 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 5 |
3 files changed, 39 insertions, 10 deletions
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index e969cf11a..393d415b5 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -1586,16 +1586,19 @@ package body Synth.Stmts is Imp : constant Node := Get_Implementation (Call); Res : Value_Acc; begin - if Get_Implicit_Definition (Imp) in Iir_Predefined_Implicit then - Error_Msg_Synth (+Stmt, "call to implicit %n is not supported", +Imp); - return; - elsif Get_Foreign_Flag (Imp) then - Error_Msg_Synth (+Stmt, "call to foreign %n is not supported", +Imp); - return; - end if; - - Res := Synth_Subprogram_Call (Syn_Inst, Call); - pragma Assert (Res = null); + case Get_Implicit_Definition (Imp) is + when Iir_Predefined_None => + if Get_Foreign_Flag (Imp) then + Error_Msg_Synth + (+Stmt, "call to foreign %n is not supported", +Imp); + else + Res := Synth_Subprogram_Call (Syn_Inst, Call); + pragma Assert (Res = null); + end if; + when others => + Error_Msg_Synth + (+Stmt, "call to implicit %n is not supported", +Imp); + end case; end Synth_Procedure_Call; function In_Range (Rng : Discrete_Range_Type; V : Int64) return Boolean is diff --git a/src/vhdl/translate/trans_be.adb b/src/vhdl/translate/trans_be.adb index d4002cbcf..4092243ac 100644 --- a/src/vhdl/translate/trans_be.adb +++ b/src/vhdl/translate/trans_be.adb @@ -17,6 +17,7 @@ -- 02111-1307, USA. with Simple_IO; +with Std_Names; with Vhdl.Errors; use Vhdl.Errors; with Vhdl.Back_End; @@ -38,6 +39,26 @@ package body Trans_Be is -- Let it generate error messages. Fi := Translate_Foreign_Id (Decl); + if Fi.Kind = Foreign_Intrinsic then + pragma Assert (Get_Implicit_Definition (Decl) = Iir_Predefined_None); + declare + use Std_Names; + Predefined : Iir_Predefined_Functions; + begin + case Get_Identifier (Decl) is + when Name_Untruncated_Text_Read => + Predefined := Iir_Predefined_Foreign_Untruncated_Text_Read; + when Name_Textio_Read_Real => + Predefined := Iir_Predefined_Foreign_Textio_Read_Real; + when Name_Textio_Write_Real => + Predefined := Iir_Predefined_Foreign_Textio_Write_Real; + when others => + Predefined := Iir_Predefined_None; + end case; + Set_Implicit_Definition (Decl, Predefined); + end; + end if; + if Sem_Foreign_Hook /= null then Sem_Foreign_Hook.all (Decl, Fi); end if; diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 57b0675ff..10ad3d853 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -4892,6 +4892,11 @@ package Vhdl.Nodes is -- A not predefined and not known function. User function. Iir_Predefined_None, + -- Intrinsic foreign subprograms. + Iir_Predefined_Foreign_Untruncated_Text_Read, + Iir_Predefined_Foreign_Textio_Read_Real, + Iir_Predefined_Foreign_Textio_Write_Real, + -- Defined in package ieee.std_logic_1164 -- Std_Ulogic operations. |