aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2014-05-07 05:23:35 +0200
committerTristan Gingold <tgingold@free.fr>2014-05-07 05:23:35 +0200
commit77d6e8dba756da993707baa2deac4b235bb78992 (patch)
tree64a1f36a12c9a796437f139cea3a0be3673c8288
parentebfb88265397a6443dea3e2a6386ca1bc4608e43 (diff)
downloadghdl-77d6e8dba756da993707baa2deac4b235bb78992.tar.gz
ghdl-77d6e8dba756da993707baa2deac4b235bb78992.tar.bz2
ghdl-77d6e8dba756da993707baa2deac4b235bb78992.zip
Files_Map: add Create_Source_File_From_String
Std_Names: Add new predefined names.
-rw-r--r--files_map.adb29
-rw-r--r--files_map.ads5
-rw-r--r--std_names.adb67
-rw-r--r--std_names.ads111
4 files changed, 193 insertions, 19 deletions
diff --git a/files_map.adb b/files_map.adb
index bc0f4c8ea..f4927e8db 100644
--- a/files_map.adb
+++ b/files_map.adb
@@ -610,24 +610,37 @@ package body Files_Map is
return Res;
end Create_Source_File_Entry;
- function Create_Virtual_Source_File (Name: Name_Id)
- return Source_File_Entry
+ function Create_Source_File_From_String (Name: Name_Id; Content : String)
+ return Source_File_Entry
is
Res : Source_File_Entry;
Buffer: File_Buffer_Acc;
+ Len : constant Source_Ptr := Source_Ptr (Content'Length);
begin
Res := Create_Source_File_Entry (Null_Identifier, Name);
- Buffer := new File_Buffer (Source_Ptr_Org .. Source_Ptr_Org + 1);
+ Buffer := new File_Buffer
+ (Source_Ptr_Org .. Source_Ptr_Org + Len + 1);
- Buffer (Source_Ptr_Org) := EOT;
- Buffer (Source_Ptr_Org + 1) := EOT;
+ Buffer (Source_Ptr_Org .. Source_Ptr_Org + Len - 1) :=
+ File_Buffer (Content);
+ Buffer (Source_Ptr_Org + Len) := EOT;
+ Buffer (Source_Ptr_Org + Len + 1) := EOT;
- Source_Files.Table (Res).Last_Location := Next_Location + 1;
- Next_Location := Next_Location + 2;
+ Source_Files.Table (Res).Last_Location :=
+ Next_Location + Location_Type (Len) + 1;
+ Next_Location := Source_Files.Table (Res).Last_Location + 1;
Source_Files.Table (Res).Source := Buffer;
- Source_Files.Table (Res).File_Length := 0;
+ Source_Files.Table (Res).File_Length := Natural (Len);
+
return Res;
+ end Create_Source_File_From_String;
+
+ function Create_Virtual_Source_File (Name: Name_Id)
+ return Source_File_Entry
+ is
+ begin
+ return Create_Source_File_From_String (Name, "");
end Create_Virtual_Source_File;
-- Return an entry for a filename.
diff --git a/files_map.ads b/files_map.ads
index 999e23d5d..c360995c3 100644
--- a/files_map.ads
+++ b/files_map.ads
@@ -46,6 +46,11 @@ package Files_Map is
function Create_Virtual_Source_File (Name: Name_Id)
return Source_File_Entry;
+ -- Create a Source_File for a possible virtual file NAME using CONTENT
+ -- as content of the file. The file must not already exist.
+ function Create_Source_File_From_String (Name: Name_Id; Content : String)
+ return Source_File_Entry;
+
-- Return a buffer (access to the contents of the file) for a file entry.
function Get_File_Source (File: Source_File_Entry)
return File_Buffer_Acc;
diff --git a/std_names.adb b/std_names.adb
index 083e4ef9f..05f0f8cd7 100644
--- a/std_names.adb
+++ b/std_names.adb
@@ -355,9 +355,76 @@ package body Std_Names is
Def ("timescale", Name_Timescale);
Def ("undef", Name_Undef);
+ -- Verilog system tasks
Def ("display", Name_Display);
Def ("finish", Name_Finish);
+ -- BSV keywords
+ Def ("Action", Name_uAction);
+ Def ("ActionValue", Name_uActionValue);
+ Def ("BVI", Name_BVI);
+ Def ("C", Name_uC);
+ Def ("CF", Name_uCF);
+ Def ("E", Name_uE);
+ Def ("SB", Name_uSB);
+ Def ("SBR", Name_uSBR);
+ Def ("action", Name_Action);
+ Def ("endaction", Name_Endaction);
+ Def ("actionvalue", Name_Actionvalue);
+ Def ("endactionvalue", Name_Endactionvalue);
+ Def ("ancestor", Name_Ancestor);
+ Def ("clocked_by", Name_Clocked_By);
+ Def ("continue", Name_Continue);
+ Def ("default_clock", Name_Default_Clock);
+ Def ("default_reset", Name_Default_Reset);
+ Def ("dependencies", Name_Dependencies);
+ Def ("deriving", Name_Deriving);
+ Def ("determines", Name_Determines);
+ Def ("enable", Name_Enable);
+ Def ("enum", Name_Enum);
+ Def ("export", Name_Export);
+ Def ("ifc_inout", Name_Ifc_Inout);
+ Def ("import", Name_Import);
+ Def ("input_clock", Name_Input_Clock);
+ Def ("input_reset", Name_Input_Reset);
+ Def ("instance", Name_Instance);
+ Def ("endinstance", Name_Endinstance);
+ Def ("interface", Name_Interface);
+ Def ("endinterface", Name_Endinterface);
+ Def ("let", Name_Let);
+ Def ("match", Name_Match);
+ Def ("matches", Name_Matches);
+ Def ("method", Name_Method);
+ Def ("endmethod", Name_Endmethod);
+ Def ("numeric", Name_Numeric);
+ Def ("output_clock", Name_Output_Clock);
+ Def ("output_reset", Name_Output_Reset);
+ Def ("endpackage", Name_Endpackage);
+ Def ("par", Name_Par);
+ Def ("endpar", Name_Endpar);
+ Def ("path", Name_Path);
+ Def ("provisos", Name_Provisos);
+ Def ("ready", Name_Ready);
+ Def ("reset_by", Name_Reset_By);
+ Def ("rule", Name_Rule);
+ Def ("endrule", Name_Endrule);
+ Def ("rules", Name_Rules);
+ Def ("endrules", Name_Endrules);
+ Def ("same_family", Name_Same_Family);
+ Def ("schedule", Name_Schedule);
+ Def ("seq", Name_Seq);
+ Def ("endseq", Name_Endseq);
+ Def ("struct", Name_Struct);
+ Def ("tagged", Name_Tagged);
+ Def ("typeclass", Name_Typeclass);
+ Def ("endtypeclass", Name_Endtypeclass);
+ Def ("typedef", Name_Typedef);
+ Def ("union", Name_Union);
+ Def ("valueof", Name_Valueof);
+ Def ("valueOf", Name_uValueof);
+ Def ("void", Name_Void);
+
+ -- VHDL special comments
Def ("psl", Name_Psl);
Def ("pragma", Name_Pragma);
diff --git a/std_names.ads b/std_names.ads
index 11761f207..4081508a3 100644
--- a/std_names.ads
+++ b/std_names.ads
@@ -562,7 +562,96 @@ package Std_Names is
Name_Finish : constant Name_Id := Name_First_Systask + 01;
Name_Last_Systask : constant Name_Id := Name_Finish;
- Name_First_Comment : constant Name_Id := Name_Last_Systask + 1;
+ -- BSV names
+ Name_First_BSV : constant Name_Id := Name_Last_Systask + 1;
+ Name_uAction : constant Name_Id := Name_First_BSV + 0;
+ Name_uActionValue : constant Name_Id := Name_First_BSV + 1;
+ Name_BVI : constant Name_Id := Name_First_BSV + 2;
+ Name_uC : constant Name_Id := Name_First_BSV + 3;
+ Name_uCF : constant Name_Id := Name_First_BSV + 4;
+ Name_uE : constant Name_Id := Name_First_BSV + 5;
+ Name_uSB : constant Name_Id := Name_First_BSV + 6;
+ Name_uSBR : constant Name_Id := Name_First_BSV + 7;
+ Name_Action : constant Name_Id := Name_First_BSV + 8;
+ Name_Endaction : constant Name_Id := Name_First_BSV + 9;
+ Name_Actionvalue : constant Name_Id := Name_First_BSV + 10;
+ Name_Endactionvalue : constant Name_Id := Name_First_BSV + 11;
+ Name_Ancestor : constant Name_Id := Name_First_BSV + 12;
+ -- begin
+ -- bit
+ -- case
+ -- endcase
+ Name_Clocked_By : constant Name_Id := Name_First_BSV + 13;
+ Name_Continue : constant Name_Id := Name_First_BSV + 14;
+ -- default
+ Name_Default_Clock : constant Name_Id := Name_First_BSV + 15;
+ Name_Default_Reset : constant Name_Id := Name_First_BSV + 16;
+ Name_Dependencies : constant Name_Id := Name_First_BSV + 17;
+ Name_Deriving : constant Name_Id := Name_First_BSV + 18;
+ Name_Determines : constant Name_Id := Name_First_BSV + 19;
+ -- e
+ -- else
+ Name_Enable : constant Name_Id := Name_First_BSV + 20;
+ -- end
+ Name_Enum : constant Name_Id := Name_First_BSV + 21;
+ Name_Export : constant Name_Id := Name_First_BSV + 22;
+ -- for
+ -- function
+ -- endfunction
+ -- if
+ Name_Ifc_Inout : constant Name_Id := Name_First_BSV + 23;
+ Name_Import : constant Name_Id := Name_First_BSV + 24;
+ -- inout
+ Name_Input_Clock : constant Name_Id := Name_First_BSV + 25;
+ Name_Input_Reset : constant Name_Id := Name_First_BSV + 26;
+ Name_Instance : constant Name_Id := Name_First_BSV + 27;
+ Name_Endinstance : constant Name_Id := Name_First_BSV + 28;
+ Name_Interface : constant Name_Id := Name_First_BSV + 29;
+ Name_Endinterface : constant Name_Id := Name_First_BSV + 30;
+ Name_Let : constant Name_Id := Name_First_BSV + 31;
+ Name_Match : constant Name_Id := Name_First_BSV + 32;
+ Name_Matches : constant Name_Id := Name_First_BSV + 33;
+ Name_Method : constant Name_Id := Name_First_BSV + 34;
+ Name_Endmethod : constant Name_Id := Name_First_BSV + 35;
+ -- module
+ -- endmodule
+ Name_Numeric : constant Name_Id := Name_First_BSV + 36;
+ Name_Output_Clock : constant Name_Id := Name_First_BSV + 37;
+ Name_Output_Reset : constant Name_Id := Name_First_BSV + 38;
+ -- package
+ Name_Endpackage : constant Name_Id := Name_First_BSV + 39;
+ -- parameter
+ Name_Par : constant Name_Id := Name_First_BSV + 40;
+ Name_Endpar : constant Name_Id := Name_First_BSV + 41;
+ Name_Path : constant Name_Id := Name_First_BSV + 42;
+ -- port
+ Name_Provisos : constant Name_Id := Name_First_BSV + 43;
+ Name_Ready : constant Name_Id := Name_First_BSV + 44;
+ Name_Reset_By : constant Name_Id := Name_First_BSV + 45;
+ -- return
+ Name_Rule : constant Name_Id := Name_First_BSV + 46;
+ Name_Endrule : constant Name_Id := Name_First_BSV + 47;
+ Name_Rules : constant Name_Id := Name_First_BSV + 48;
+ Name_Endrules : constant Name_Id := Name_First_BSV + 49;
+ Name_Same_Family : constant Name_Id := Name_First_BSV + 50;
+ Name_Schedule : constant Name_Id := Name_First_BSV + 51;
+ Name_Seq : constant Name_Id := Name_First_BSV + 52;
+ Name_Endseq : constant Name_Id := Name_First_BSV + 53;
+ Name_Struct : constant Name_Id := Name_First_BSV + 54;
+ Name_Tagged : constant Name_Id := Name_First_BSV + 55;
+ -- type
+ Name_Typeclass : constant Name_Id := Name_First_BSV + 56;
+ Name_Endtypeclass : constant Name_Id := Name_First_BSV + 57;
+ Name_Typedef : constant Name_Id := Name_First_BSV + 58;
+ Name_Union : constant Name_Id := Name_First_BSV + 59;
+ Name_Valueof : constant Name_Id := Name_First_BSV + 60;
+ Name_uValueof : constant Name_Id := Name_First_BSV + 61;
+ Name_Void : constant Name_Id := Name_First_BSV + 62;
+ -- while
+ Name_Last_BSV : constant Name_Id := Name_First_BSV + 62;
+
+ -- VHDL special comments
+ Name_First_Comment : constant Name_Id := Name_Last_BSV + 1;
Name_Psl : constant Name_Id := Name_First_Comment + 0;
Name_Pragma : constant Name_Id := Name_First_Comment + 1;
Name_Last_Comment : constant Name_Id := Name_First_Comment + 1;
@@ -614,16 +703,16 @@ package Std_Names is
Name_Rose : constant Name_Id := Name_First_PSL + 33;
Name_Sequence : constant Name_Id := Name_First_PSL + 34;
Name_Strong : constant Name_Id := Name_First_PSL + 35;
- Name_Union : constant Name_Id := Name_First_PSL + 36;
- -- Name_Until
- Name_Vmode : constant Name_Id := Name_First_PSL + 37;
- Name_Vprop : constant Name_Id := Name_First_PSL + 38;
- Name_Vunit : constant Name_Id := Name_First_PSL + 39;
- Name_W : constant Name_Id := Name_First_PSL + 40;
- Name_Whilenot : constant Name_Id := Name_First_PSL + 41;
- Name_Within : constant Name_Id := Name_First_PSL + 42;
- Name_X : constant Name_Id := Name_First_PSL + 43;
- Name_Last_PSL : constant Name_Id := Name_X;
+ -- union
+ -- until
+ Name_Vmode : constant Name_Id := Name_First_PSL + 36;
+ Name_Vprop : constant Name_Id := Name_First_PSL + 37;
+ Name_Vunit : constant Name_Id := Name_First_PSL + 38;
+ Name_W : constant Name_Id := Name_First_PSL + 39;
+ Name_Whilenot : constant Name_Id := Name_First_PSL + 40;
+ Name_Within : constant Name_Id := Name_First_PSL + 41;
+ Name_X : constant Name_Id := Name_First_PSL + 42;
+ Name_Last_PSL : constant Name_Id := Name_First_PSL + 42;
subtype Name_Id_PSL_Keywords is
Name_Id range Name_First_PSL .. Name_Last_PSL;