1-- EDIF nodes. 2-- Copyright (C) 2019 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 17with Types; use Types; 18 19package Edif.Nodes is 20 21 type Nkind is 22 ( 23 N_Error, 24 25 -- Generic nodes. 26 N_Keyword, 27 N_Symbol, 28 N_Number, 29 N_String, 30 N_Chain, 31 32 -- Edif 2.0.0 nodes 33 N_Edif, 34 N_External, 35 N_Cell, 36 N_View, 37 N_Port, 38 N_Library, 39 N_Interface, 40 N_Instance, 41 N_Net, 42 N_Design, 43 N_Port_Ref, 44 N_Cell_Ref, 45 N_View_Ref, 46 N_Member, 47 N_Property, 48 N_Userdata, 49 N_Port_Instance, 50 51 N_Array, 52 N_Rename, 53 N_Boolean 54 55 ); 56 57 type Node is new Nat32; 58 for Node'Size use 32; 59 60 Null_Node : constant Node := 0; 61 62 type Dir_Type is 63 ( 64 Dir_Input, 65 Dir_Output, 66 Dir_Inout 67 ); 68 69 -- The next line marks the start of the node description. 70 -- Start of Nkind. 71 72 -- N_Error (X1) 73 74 -- N_Keyword (X1) 75 -- Get/Set_Keyword (Field1) 76 -- 77 -- Get/Set_CDR (Field2) 78 79 -- N_Chain (X1) 80 -- Get/Set_CAR (Field1) 81 -- 82 -- Get/Set_CDR (Field2) 83 84 -- N_Symbol (X1) 85 -- Get/Set_Symbol (Field1) 86 87 -- N_Number (X1) 88 -- Get/Set_Number (Field1) 89 90 -- N_String (X1) 91 -- Get/Set_String_Id (Field1) 92 -- 93 -- Get/Set_String_Len (Field2) 94 95 -- N_Edif (X4) 96 -- Get/Set_Name (Field1) 97 -- 98 -- Get/Set_Edif_Version (Field3) 99 -- 100 -- Get/Set_Edif_Level (Field2) 101 -- 102 -- Get/Set_Keyword_Map (Field4) 103 -- 104 -- Get/Set_Status (Field5) 105 -- 106 -- Get/Set_External_Chain (Field6) 107 -- 108 -- Get/Set_Library_Chain (Field7) 109 -- 110 -- Get/Set_Design (Field8) 111 112 -- N_External (X2) 113 -- N_Library (X2) 114 -- Get/Set_Name (Field1) 115 -- 116 -- Get/Set_Edif_Level (Field2) 117 -- 118 -- Get/Set_Technology (Field3) 119 -- 120 -- Get/Set_Cells_Chain (Field4) 121 -- 122 -- Get/Set_Chain (Field5) 123 124 -- N_Cell (X2) 125 -- Get/Set_Name (Field1) 126 -- 127 -- Get/Set_Cell_Type (Field2) 128 -- 129 -- Get/Set_Properties_Chain (Field3) 130 -- 131 -- Get/Set_View (Field4) 132 -- 133 -- Get/Set_Chain (Field5) 134 135 -- N_Interface (X2) 136 -- Get/Set_Ports_Chain (Field2) 137 -- 138 -- Get/Set_Properties_Chain (Field3) 139 -- 140 -- Get/Set_Designator (Field4) 141 142 -- N_View (X4) 143 -- Get/Set_Name (Field1) 144 -- 145 -- Get/Set_View_Type (Field2) 146 -- 147 -- Get/Set_Interface (Field6) 148 -- 149 -- Get/Set_Properties_Chain (Field3) 150 -- 151 -- Instances and nets. 152 -- Get/Set_Contents_Chain (Field4) 153 -- 154 -- Get/Set_Chain (Field5) 155 156 -- N_Port (X2) 157 -- Get/Set_Name (Field1) 158 -- 159 -- Get/Set_Direction (State1) 160 -- 161 -- Get/Set_Properties_Chain (Field3) 162 -- 163 -- Get/Set_Designator (Field4) 164 -- 165 -- Get/Set_Chain (Field5) 166 167 -- N_Property (X2) 168 -- Get/Set_Name (Field1) 169 -- 170 -- Get/Set_Value (Field2) 171 -- 172 -- Get/Set_Owner (Field3) 173 -- 174 -- Get/Set_Unit (Field4) 175 -- 176 -- Get/Set_Chain (Field5) 177 178 -- N_Userdata (X2) 179 -- Get/Set_Name (Field1) 180 -- 181 -- Get/Set_CDR (Field2) 182 -- 183 -- Get/Set_Chain (Field5) 184 185 -- N_Instance (X2) 186 -- Get/Set_Name (Field1) 187 -- 188 -- Get/Set_Instance_Ref (Field2) 189 -- 190 -- Get/Set_Port_Instances_Chain (Field4) 191 -- 192 -- Get/Set_Properties_Chain (Field3) 193 -- 194 -- Get/Set_Chain (Field5) 195 196 -- N_Net (X2) 197 -- Get/Set_Name (Field1) 198 -- 199 -- Get/Set_Joined_Chain (Field2) 200 -- 201 -- Get/Set_Properties_Chain (Field3) 202 -- 203 -- Get/Set_Chain (Field5) 204 205 -- N_Design (X2) 206 -- Get/Set_Name (Field1) 207 -- 208 -- Get/Set_Cell_Ref (Field2) 209 -- 210 -- Get/Set_Properties_Chain (Field3) 211 212 -- N_Port_Ref (X2) 213 -- Get/Set_Port (Field1) 214 -- 215 -- Get/Set_Instance_Ref (Field2) 216 -- 217 -- Get/Set_Chain (Field5) 218 219 -- N_View_Ref (X1) 220 -- 221 -- Get/Set_Name (Field1) 222 -- 223 -- Get/Set_Cell_Ref (Field2) 224 225 -- N_Cell_Ref (X1) 226 -- Get/Set_Name (Field1) 227 -- 228 -- Get/Set_Library_Ref (Field2) 229 230 -- N_Port_Instance (X2) 231 -- Get/Set_Name (Field1) 232 -- 233 -- Get/Set_Properties_Chain (Field3) 234 -- 235 -- Get/Set_Chain (Field5) 236 237 -- N_Member (X1) 238 -- Get/Set_Name (Field1) 239 -- 240 -- Get/Set_Index (Field2) 241 242 -- N_Array (X1) 243 -- Get/Set_Name (Field1) 244 -- 245 -- Get/Set_Array_Length (Field2) 246 247 -- N_Rename (X1) 248 -- Get/Set_Name (Field1) 249 -- 250 -- Get/Set_String (Field2) 251 252 -- N_Boolean (X1) 253 -- Get/Set_Boolean (Flag1) 254 255 -- End of Nkind. 256 257 -- General methods. 258 259 function Create_Node (Kind : Nkind) return Node; 260 procedure Free_Node (N : Node); 261 262 -- Note: use Field0 263 function Get_Location (N : Node) return Location_Type; 264 procedure Set_Location (N : Node; Loc : Location_Type); 265 266 function Get_Kind (N : Node) return Nkind; 267 268 -- Field: Field1 269 function Get_CAR (N : Node) return Node; 270 procedure Set_CAR (N : Node; V : Node); 271 272 -- Field: Field2 273 function Get_CDR (N : Node) return Node; 274 procedure Set_CDR (N : Node; V : Node); 275 276 -- Field: Field1 (pos) 277 function Get_Symbol (N : Node) return Name_Id; 278 procedure Set_Symbol (N : Node; Id : Name_Id); 279 280 -- Field: Field1 (pos) 281 function Get_Keyword (N : Node) return Name_Id; 282 procedure Set_Keyword (N : Node; Id : Name_Id); 283 284 -- Field: Field1 (uc) 285 function Get_Number (N : Node) return Int32; 286 procedure Set_Number (N : Node; Val : Int32); 287 288 -- Field: Field1 (pos) 289 function Get_String_Id (N : Node) return String8_Id; 290 procedure Set_String_Id (N : Node; Id : String8_Id); 291 292 -- Field: Field2 (uc) 293 function Get_String_Len (N : Node) return Uns32; 294 procedure Set_String_Len (N : Node; Bn : Uns32); 295 296 297 -- Field: Field1 298 function Get_Name (N : Node) return Node; 299 procedure Set_Name (N : Node; Name : Node); 300 301 -- Field: Field2 (uc) 302 function Get_Edif_Level (N : Node) return Int32; 303 procedure Set_Edif_Level (N : Node; Level : Int32); 304 305 -- Major*100 + Minor*10 + Release 306 -- Field: Field3 (uc) 307 function Get_Edif_Version (N : Node) return Int32; 308 procedure Set_Edif_Version (N : Node; Version : Int32); 309 310 -- Field: Field4 311 function Get_Keyword_Map (N : Node) return Node; 312 procedure Set_Keyword_Map (N : Node; Map : Node); 313 314 -- Field: Field5 315 function Get_Status (N : Node) return Node; 316 procedure Set_Status (N : Node; Status : Node); 317 318 -- Field: Field5 Chain_Next 319 function Get_Chain (N : Node) return Node; 320 procedure Set_Chain (N : Node; Chain : Node); 321 322 -- Field: Field6 Chain 323 function Get_External_Chain (N : Node) return Node; 324 procedure Set_External_Chain (N : Node; Chain : Node); 325 326 -- Field: Field7 Chain 327 function Get_Library_Chain (N : Node) return Node; 328 procedure Set_Library_Chain (N : Node; Chain : Node); 329 330 -- Field: Field4 Chain 331 function Get_Cells_Chain (N : Node) return Node; 332 procedure Set_Cells_Chain (N : Node; Chain : Node); 333 334 -- Field: Field2 Chain 335 function Get_Ports_Chain (N : Node) return Node; 336 procedure Set_Ports_Chain (N : Node; Chain : Node); 337 338 -- Field: Field4 Chain 339 function Get_Contents_Chain (N : Node) return Node; 340 procedure Set_Contents_Chain (N : Node; Chain : Node); 341 342 -- Field: Field3 Chain 343 function Get_Properties_Chain (N : Node) return Node; 344 procedure Set_Properties_Chain (N : Node; Chain : Node); 345 346 -- Field: Field4 Chain 347 function Get_Port_Instances_Chain (N : Node) return Node; 348 procedure Set_Port_Instances_Chain (N : Node; Chain : Node); 349 350 -- Field: Field2 Chain 351 function Get_Joined_Chain (N : Node) return Node; 352 procedure Set_Joined_Chain (N : Node; Chain : Node); 353 354 -- Field: Field8 355 function Get_Design (N : Node) return Node; 356 procedure Set_Design (N : Node; Design : Node); 357 358 -- Field: Field4 359 function Get_Designator (N : Node) return Node; 360 procedure Set_Designator (N : Node; Id : Node); 361 362 -- Field: Field3 363 function Get_Technology (N : Node) return Node; 364 procedure Set_Technology (N : Node; Design : Node); 365 366 -- Field: Field2 (pos) 367 function Get_Cell_Type (N : Node) return Name_Id; 368 procedure Set_Cell_Type (N : Node; Ctype : Name_Id); 369 370 -- Field: Field2 (pos) 371 function Get_View_Type (N : Node) return Name_Id; 372 procedure Set_View_Type (N : Node; Vtype : Name_Id); 373 374 -- Field: Field6 375 function Get_Interface (N : Node) return Node; 376 procedure Set_Interface (N : Node; Inter : Node); 377 378 -- Field: Field1 (pos) 379 function Get_View_Ref (N : Node) return Name_Id; 380 procedure Set_View_Ref (N : Node; Ref : Name_Id); 381 382 -- Field: Field2 383 function Get_Cell_Ref (N : Node) return Node; 384 procedure Set_Cell_Ref (N : Node; Ref : Node); 385 386 -- Field: Field2 387 function Get_Library_Ref (N : Node) return Node; 388 procedure Set_Library_Ref (N : Node; Ref : Node); 389 390 -- Field: Field4 391 function Get_View (N : Node) return Node; 392 procedure Set_View (N : Node; View : Node); 393 394 -- Field: State1 (uc) 395 function Get_Direction (N : Node) return Dir_Type; 396 procedure Set_Direction (N : Node; Dir : Dir_Type); 397 398 -- Field: Flag1 399 function Get_Boolean (N : Node) return Boolean; 400 procedure Set_Boolean (N : Node; Val : Boolean); 401 402 -- Field: Field2 403 function Get_Value (N : Node) return Node; 404 procedure Set_Value (N : Node; Val : Node); 405 406 -- Field: Field3 407 function Get_Owner (N : Node) return Node; 408 procedure Set_Owner (N : Node; Owner : Node); 409 410 -- Field: Field2 411 function Get_Instance_Ref (N : Node) return Node; 412 procedure Set_Instance_Ref (N : Node; Ref : Node); 413 414 -- Field: Field1 415 function Get_Port (N : Node) return Node; 416 procedure Set_Port (N : Node; Port : Node); 417 418 -- Field: Field2 (uc) 419 function Get_Index (N : Node) return Int32; 420 procedure Set_Index (N : Node; Idx : Int32); 421 422 -- Field: Field2 (uc) 423 function Get_Array_Length (N : Node) return Int32; 424 procedure Set_Array_Length (N : Node; Len : Int32); 425 426 -- Field: Field4 (pos) 427 function Get_Unit (N : Node) return Name_Id; 428 procedure Set_Unit (N : Node; Unit : Name_Id); 429 430 -- Field: Field2 431 function Get_String (N : Node) return Node; 432 procedure Set_String (N : Node; Str : Node); 433 434end Edif.Nodes; 435