1-- GHDL Run Time (GRT) - SDF parser. 2-- Copyright (C) 2002 - 2014 Tristan Gingold 3-- 4-- This program is free software: you can redistribute it and/or modify 5-- it under the terms of the GNU General Public License as published by 6-- the Free Software Foundation, either version 2 of the License, or 7-- (at your option) any later version. 8-- 9-- This program is distributed in the hope that it will be useful, 10-- but WITHOUT ANY WARRANTY; without even the implied warranty of 11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12-- GNU General Public License for more details. 13-- 14-- You should have received a copy of the GNU General Public License 15-- along with this program. If not, see <gnu.org/licenses>. 16-- 17-- As a special exception, if other files instantiate generics from this 18-- unit, or you link this unit with other files to produce an executable, 19-- this unit does not by itself cause the resulting executable to be 20-- covered by the GNU General Public License. This exception does not 21-- however invalidate any other reasons why the executable file might be 22-- covered by the GNU Public License. 23with Grt.Types; use Grt.Types; 24 25package Grt.Sdf is 26 type Edge_Type is 27 ( 28 Edge_Error, 29 Edge_None, 30 Edge_Posedge, 31 Edge_Negedge, 32 Edge_01, 33 Edge_10, 34 Edge_0z, 35 Edge_Z1, 36 Edge_1z, 37 Edge_Z0 38 ); 39 40 type Timing_Generic_Kind is 41 ( 42 Delay_Port, 43 --Delay_Interconnect, 44 --Delay_Device, 45 46 -- Simple condition 47 Delay_Iopath, 48 Timingcheck_Width, 49 Timingcheck_Period, 50 51 -- Full condition 52 Timingcheck_Setup, 53 Timingcheck_Hold, 54 Timingcheck_Recovery, 55 Timingcheck_Removal, 56 Timingcheck_Skew, 57 Timingcheck_Nochange, 58 Timingcheck_Setuphold 59 ); 60 61 subtype Timing_Generic_Simple_Condition is Timing_Generic_Kind 62 range Delay_Iopath .. Timingcheck_Period; 63 64 subtype Timing_Generic_Full_Condition is Timing_Generic_Kind 65 range Timingcheck_Setup .. Timingcheck_Setuphold; 66 67 type Sdf_Version_Type is 68 ( 69 Sdf_2_1, 70 Sdf_Version_Unknown, 71 Sdf_Version_Bad 72 ); 73 74 Read_Size : constant Natural := 4096; 75 Buf_Size : constant Natural := Read_Size + 1024 + 1; 76 77 Invalid_Dnumber : constant Ghdl_I32 := -1; 78 79 type Port_Spec_Type is record 80 -- Port identifier. 81 Name : String (1 .. 128); 82 Name_Len : Natural; 83 84 -- Left and Right range. 85 -- If L = R = Invalid_Dnumber, this is a simple scalar port. 86 -- If R = Invalid_Dnumber, this is a scalar port (from a vector) 87 -- Otherwise, this is a bus port. 88 L, R : Ghdl_I32; 89 90 -- Cond : String (1 .. 1024); 91 -- Cond_Len : Natural; 92 93 Edge : Edge_Type; 94 end record; 95 96 type Port_Spec_Array_Type is array (Natural range <>) of Port_Spec_Type; 97 98 type Ghdl_I64_Array is array (1 .. 12) of Ghdl_I64; 99 type Boolean_Array is array (1 .. 12) of Boolean; 100 101 type Sdf_Context_Type is record 102 -- Version of the SDF file. 103 Version : Sdf_Version_Type; 104 105 -- Timescale; 1 corresponds to 1 ps. 106 -- Default is 1000 (1 ns). 107 Timescale : Natural; 108 109 Kind : Timing_Generic_Kind; 110 111 -- Cell type. 112 Celltype : String (1 .. 128); 113 Celltype_Len : Natural; 114 115 -- Current port. 116 Port_Num : Natural; 117 Ports : Port_Spec_Array_Type (1 .. 2); 118 119 -- timing spec. 120 Timing : Ghdl_I64_Array; 121 Timing_Set : Boolean_Array; 122 Timing_Nbr : Natural; 123 end record; 124 125 -- Which value is extracted. 126 type Mtm_Type is (Minimum, Typical, Maximum); 127 Sdf_Mtm : Mtm_Type := Typical; 128 129 function Parse_Sdf_File (Filename : String) return Boolean; 130end Grt.Sdf; 131