diff options
author | Tristan Gingold <tgingold@free.fr> | 2015-03-31 20:44:40 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2015-03-31 20:44:40 +0200 |
commit | 1469686228b35ca0793ed28d1614d41a01e9cdb5 (patch) | |
tree | 6a082e12c961cac0f2fea48b82a2ca213d5cef63 | |
parent | d43f982a3168b554fd0745c23c59f94503c0a211 (diff) | |
download | ghdl-1469686228b35ca0793ed28d1614d41a01e9cdb5.tar.gz ghdl-1469686228b35ca0793ed28d1614d41a01e9cdb5.tar.bz2 ghdl-1469686228b35ca0793ed28d1614d41a01e9cdb5.zip |
Fix entity instantiation with extended identifier.
From a patch by Ole Myren Rohne.
-rw-r--r-- | src/vhdl/translate/trans-chap9.adb | 8 | ||||
-rw-r--r-- | src/vhdl/translate/trans.adb | 8 | ||||
-rw-r--r-- | src/vhdl/translate/trans.ads | 8 | ||||
-rw-r--r-- | testsuite/gna/bug12/demo.vhd | 14 | ||||
-rwxr-xr-x | testsuite/gna/bug12/testsuite.sh | 10 |
5 files changed, 44 insertions, 4 deletions
diff --git a/src/vhdl/translate/trans-chap9.adb b/src/vhdl/translate/trans-chap9.adb index f6ee22bbc..146bb818a 100644 --- a/src/vhdl/translate/trans-chap9.adb +++ b/src/vhdl/translate/trans-chap9.adb @@ -1420,15 +1420,17 @@ package body Trans.Chap9 is function Get_Arch_Name return String is begin if Arch /= Null_Iir then - return "ARCH__" & Image_Identifier (Arch); + return "ARCH__" & Identifier_To_String (Arch); else return "LASTARCH"; end if; end Get_Arch_Name; + Entity_Library : constant Iir := + Get_Library (Get_Design_File (Entity_Unit)); Str : constant String := - Image_Identifier (Get_Library (Get_Design_File (Entity_Unit))) - & "__" & Image_Identifier (Entity) & "__" + Identifier_To_String (Entity_Library) & "__" + & Identifier_To_String (Entity) & "__" & Get_Arch_Name & "__"; Sub_Inter : O_Inter_List; Arg : O_Dnode; diff --git a/src/vhdl/translate/trans.adb b/src/vhdl/translate/trans.adb index a79898c48..dbf16969c 100644 --- a/src/vhdl/translate/trans.adb +++ b/src/vhdl/translate/trans.adb @@ -733,6 +733,14 @@ package body Trans is Nam_Length := N_Len + 2; end Name_Id_To_String; + function Identifier_To_String (N : Iir) return String + is + use Name_Table; + begin + Name_Id_To_String (Get_Identifier (N)); + return Nam_Buffer (1 .. Nam_Length); + end Identifier_To_String; + procedure Add_Name (Len : in out Natural; Name : Name_Id) is use Name_Table; diff --git a/src/vhdl/translate/trans.ads b/src/vhdl/translate/trans.ads index dd1e508e6..a97dcf706 100644 --- a/src/vhdl/translate/trans.ads +++ b/src/vhdl/translate/trans.ads @@ -408,7 +408,13 @@ package Trans is -- Create a copy of SCOPE using instantiated scope (if needed). function Instantiate_Var_Scope (Scope : Var_Scope_Type) - return Var_Scope_Type; + return Var_Scope_Type; + + -- Utility function: convert identifier of N to a string, encoding + -- extended characters in extended identifiers (this is different from + -- image_identifier that simply returns the identifier, without special + -- handling of extended identifiers). + function Identifier_To_String (N : Iir) return String; private type Local_Identifier_Type is new Natural; type Id_Mark_Type is record diff --git a/testsuite/gna/bug12/demo.vhd b/testsuite/gna/bug12/demo.vhd new file mode 100644 index 000000000..2b97782f6 --- /dev/null +++ b/testsuite/gna/bug12/demo.vhd @@ -0,0 +1,14 @@ +entity bar is +end entity bar; +entity \foo\ is + port (test : in bit); +end entity \foo\; +architecture structural of \foo\ is +begin -- architecture structural +end architecture structural; +architecture structural of bar is + signal test : bit; +begin -- architecture structural + foo_1: entity work.\foo\ + port map (test => test); +end architecture structural; diff --git a/testsuite/gna/bug12/testsuite.sh b/testsuite/gna/bug12/testsuite.sh new file mode 100755 index 000000000..9b3d98c20 --- /dev/null +++ b/testsuite/gna/bug12/testsuite.sh @@ -0,0 +1,10 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze demo.vhd +elab_simulate bar structural + +clean + +echo "Test successful" |