# Auto generated Python source file from Ada sources # Call 'make' in 'src/vhdl' to regenerate: # from enum import IntEnum, unique from pydecor import export from pyGHDL.libghdl._decorator import BindToLibGHDL from typing import TypeVar from ctypes import c_int32 from pyGHDL.libghdl._types import ( Iir, IirKind, LocationType, FileChecksumId, TimeStampId, SourceFileEntry, NameId, TriStateType, SourcePtr, Int32, Int64, Fp64, String8Id, Boolean, DirectionType, PSLNode, PSLNFA, ) from pyGHDL.libghdl.vhdl.tokens import Tok Null_Iir = 0 Null_Iir_List = 0 Iir_List_All = 1 Null_Iir_Flist = 0 Iir_Flist_Others = 1 Iir_Flist_All = 2 DateType = TypeVar("DateType", bound=c_int32) @export @unique class Iir_Kind(IntEnum): Unused = 0 Error = 1 Design_File = 2 Design_Unit = 3 Foreign_Module = 4 Library_Clause = 5 Use_Clause = 6 Context_Reference = 7 Integer_Literal = 8 Floating_Point_Literal = 9 Null_Literal = 10 String_Literal8 = 11 Physical_Int_Literal = 12 Physical_Fp_Literal = 13 Simple_Aggregate = 14 Overflow_Literal = 15 Unaffected_Waveform = 16 Waveform_Element = 17 Conditional_Waveform = 18 Conditional_Expression = 19 Association_Element_By_Expression = 20 Association_Element_By_Individual = 21 Association_Element_Open = 22 Association_Element_Package = 23 Association_Element_Type = 24 Association_Element_Subprogram = 25 Association_Element_Terminal = 26 Choice_By_Range = 27 Choice_By_Expression = 28 Choice_By_Others = 29 Choice_By_None = 30 Choice_By_Name = 31 Entity_Aspect_Entity = 32 Entity_Aspect_Configuration = 33 Entity_Aspect_Open = 34 Psl_Hierarchical_Name = 35 Block_Configuration = 36 Block_Header = 37 Component_Configuration = 38 Binding_Indication = 39 Entity_Class = 40 Attribute_Value = 41 Signature = 42 Aggregate_Info = 43 Procedure_Call = 44 Record_Element_Constraint = 45 Array_Element_Resolution = 46 Record_Resolution = 47 Record_Element_Resolution = 48 Break_Element = 49 Attribute_Specification = 50 Disconnection_Specification = 51 Step_Limit_Specification = 52 Configuration_Specification = 53 Access_Type_Definition = 54 Incomplete_Type_Definition = 55 Interface_Type_Definition = 56 File_Type_Definition = 57 Protected_Type_Declaration = 58 Record_Type_Definition = 59 Array_Type_Definition = 60 Array_Subtype_Definition = 61 Record_Subtype_Definition = 62 Access_Subtype_Definition = 63 Physical_Subtype_Definition = 64 Floating_Subtype_Definition = 65 Integer_Subtype_Definition = 66 Enumeration_Subtype_Definition = 67 Enumeration_Type_Definition = 68 Integer_Type_Definition = 69 Floating_Type_Definition = 70 Physical_Type_Definition = 71 Range_Expression = 72 Protected_Type_Body = 73 Wildcard_Type_Definition = 74 Subtype_Definition = 75 Scalar_Nature_Definition = 76 Record_Nature_Definition = 77 Array_Nature_Definition = 78 Array_Subnature_Definition = 79 Overload_List = 80 Entity_Declaration = 81 Configuration_Declaration = 82 Context_Declaration = 83 Package_Declaration = 84 Package_Instantiation_Declaration = 85 Vmode_Declaration = 86 Vprop_Declaration = 87 Vunit_Declaration = 88 Package_Body = 89 Architecture_Body = 90 Type_Declaration = 91 Anonymous_Type_Declaration = 92 Subtype_Declaration = 93 Nature_Declaration = 94 Subnature_Declaration = 95 Package_Header = 96 Unit_Declaration = 97 Library_Declaration = 98 Component_Declaration = 99 Attribute_Declaration = 100 Group_Template_Declaration = 101 Group_Declaration = 102 Element_Declaration = 103 Nature_Element_Declaration = 104 Non_Object_Alias_Declaration = 105 Psl_Declaration = 106 Psl_Endpoint_Declaration = 107 Enumeration_Literal = 108 Function_Declaration = 109 Procedure_Declaration = 110 Function_Body = 111 Procedure_Body = 112 Function_Instantiation_Declaration = 113 Procedure_Instantiation_Declaration = 114 Terminal_Declaration = 115 Object_Alias_Declaration = 116 Free_Quantity_Declaration = 117 Spectrum_Quantity_Declaration = 118 Noise_Quantity_Declaration = 119 Across_Quantity_Declaration = 120 Through_Quantity_Declaration = 121 File_Declaration = 122 Guard_Signal_Declaration = 123 Signal_Declaration = 124 Variable_Declaration = 125 Constant_Declaration = 126 Iterator_Declaration = 127 Interface_Constant_Declaration = 128 Interface_Variable_Declaration = 129 Interface_Signal_Declaration = 130 Interface_File_Declaration = 131 Interface_Quantity_Declaration = 132 Interface_Terminal_Declaration = 133 Interface_Type_Declaration = 134 Interface_Package_Declaration = 135 Interface_Function_Declaration = 136 Interface_Procedure_Declaration = 137 Anonymous_Signal_Declaration = 138 Signal_Attribute_Declaration = 139 Identity_Operator = 140 Negation_Operator = 141 Absolute_Operator = 142 Not_Operator = 143 Implicit_Condition_Operator = 144 Condition_Operator = 145 Reduction_And_Operator = 146 Reduction_Or_Operator = 147 Reduction_Nand_Operator = 148 Reduction_Nor_Operator = 149 Reduction_Xor_Operator = 150 Reduction_Xnor_Operator = 151 And_Operator = 152 Or_Operator = 153 Nand_Operator = 154 Nor_Operator = 155 Xor_Operator = 156 Xnor_Operator = 157 Equality_Operator = 158 Inequality_Operator = 159 Less_Than_Operator = 160 Less_Than_Or_Equal_Operator = 161 Greater_Than_Operator = 162 Greater_Than_Or_Equal_Operator = 163 Match_Equality_Operator = 164 Match_Inequality_Operator = 165 Match_Less_Than_Operator = 166 Match_Less_Than_Or_Equal_Operator = 167 Match_Greater_Than_Operator = 168 Match_Greater_Than_Or_Equal_Operator = 169 Sll_Operator = 170 Sla_Operator = 171 Srl_Operator = 172 Sra_Operator = 173 Rol_Operator = 174 Ror_Operator = 175 Addition_Operator = 176 Substraction_Operator = 177 Concatenation_Operator = 178 Multiplication_Operator = 179 Division_Operator = 180 Modulus_Operator = 181 Remainder_Operator = 182 Exponentiation_Operator = 183 Function_Call = 184 Aggregate = 185 Parenthesis_Expression = 186 Qualified_Expression = 187 Type_Conversion = 188 Allocator_By_Expression = 189 Allocator_By_Subtype = 190 Selected_Element = 191 Dereference = 192 Implicit_Dereference = 193 Slice_Name = 194 Indexed_Name = 195 Psl_Prev = 196 Psl_Stable = 197 Psl_Rose = 198 Psl_Fell = 199 Psl_Onehot = 200 Psl_Onehot0 = 201 Psl_Expression = 202 Sensitized_Process_Statement = 203 Process_Statement = 204 Concurrent_Simple_Signal_Assignment = 205 Concurrent_Conditional_Signal_Assignment = 206 Concurrent_Selected_Signal_Assignment = 207 Concurrent_Assertion_Statement = 208 Concurrent_Procedure_Call_Statement = 209 Concurrent_Break_Statement = 210 Psl_Assert_Directive = 211 Psl_Assume_Directive = 212 Psl_Cover_Directive = 213 Psl_Restrict_Directive = 214 Block_Statement = 215 If_Generate_Statement = 216 Case_Generate_Statement = 217 For_Generate_Statement = 218 Component_Instantiation_Statement = 219 Psl_Default_Clock = 220 Generate_Statement_Body = 221 If_Generate_Else_Clause = 222 Simple_Simultaneous_Statement = 223 Simultaneous_Null_Statement = 224 Simultaneous_Procedural_Statement = 225 Simultaneous_Case_Statement = 226 Simultaneous_If_Statement = 227 Simultaneous_Elsif = 228 Simple_Signal_Assignment_Statement = 229 Conditional_Signal_Assignment_Statement = 230 Selected_Waveform_Assignment_Statement = 231 Signal_Force_Assignment_Statement = 232 Signal_Release_Assignment_Statement = 233 Null_Statement = 234 Assertion_Statement = 235 Report_Statement = 236 Wait_Statement = 237 Variable_Assignment_Statement = 238 Conditional_Variable_Assignment_Statement = 239 Return_Statement = 240 For_Loop_Statement = 241 While_Loop_Statement = 242 Next_Statement = 243 Exit_Statement = 244 Case_Statement = 245 Procedure_Call_Statement = 246 Break_Statement = 247 If_Statement = 248 Elsif = 249 Character_Literal = 250 Simple_Name = 251 Selected_Name = 252 Operator_Symbol = 253 Reference_Name = 254 External_Constant_Name = 255 External_Signal_Name = 256 External_Variable_Name = 257 Selected_By_All_Name = 258 Parenthesis_Name = 259 Package_Pathname = 260 Absolute_Pathname = 261 Relative_Pathname = 262 Pathname_Element = 263 Base_Attribute = 264 Subtype_Attribute = 265 Element_Attribute = 266 Across_Attribute = 267 Through_Attribute = 268 Nature_Reference_Attribute = 269 Left_Type_Attribute = 270 Right_Type_Attribute = 271 High_Type_Attribute = 272 Low_Type_Attribute = 273 Ascending_Type_Attribute = 274 Image_Attribute = 275 Value_Attribute = 276 Pos_Attribute = 277 Val_Attribute = 278 Succ_Attribute = 279 Pred_Attribute = 280 Leftof_Attribute = 281 Rightof_Attribute = 282 Signal_Slew_Attribute = 283 Quantity_Slew_Attribute = 284 Ramp_Attribute = 285 Zoh_Attribute = 286 Ltf_Attribute = 287 Ztf_Attribute = 288 Dot_Attribute = 289 Integ_Attribute = 290 Above_Attribute = 291 Quantity_Delayed_Attribute = 292 Delayed_Attribute = 293 Stable_Attribute = 294 Quiet_Attribute = 295 Transaction_Attribute = 296 Event_Attribute = 297 Active_Attribute = 298 Last_Event_Attribute = 299 Last_Active_Attribute = 300 Last_Value_Attribute = 301 Driving_Attribute = 302 Driving_Value_Attribute = 303 Behavior_Attribute = 304 Structure_Attribute = 305 Simple_Name_Attribute = 306 Instance_Name_Attribute = 307 Path_Name_Attribute = 308 Left_Array_Attribute = 309 Right_Array_Attribute = 310 High_Array_Attribute = 311 Low_Array_Attribute = 312 Length_Array_Attribute = 313 Ascending_Array_Attribute = 314 Range_Array_Attribute = 315 Reverse_Range_Array_Attribute = 316 Attribute_Name = 317 @export class Iir_Kinds: Library_Unit = [ Iir_Kind.Entity_Declaration, Iir_Kind.Configuration_Declaration, Iir_Kind.Context_Declaration, Iir_Kind.Package_Declaration, Iir_Kind.Package_Instantiation_Declaration, Iir_Kind.Vmode_Declaration, Iir_Kind.Vprop_Declaration, Iir_Kind.Vunit_Declaration, Iir_Kind.Package_Body, Iir_Kind.Architecture_Body, ] Design_Unit = [ Iir_Kind.Design_Unit, Iir_Kind.Foreign_Module, ] Primary_Unit = [ Iir_Kind.Entity_Declaration, Iir_Kind.Configuration_Declaration, Iir_Kind.Context_Declaration, Iir_Kind.Package_Declaration, Iir_Kind.Package_Instantiation_Declaration, Iir_Kind.Vmode_Declaration, Iir_Kind.Vprop_Declaration, Iir_Kind.Vunit_Declaration, ] Secondary_Unit = [ Iir_Kind.Package_Body, Iir_Kind.Architecture_Body, ] Package_Declaration = [ Iir_Kind.Package_Declaration, Iir_Kind.Package_Instantiation_Declaration, ] Verification_Unit = [ Iir_Kind.Vmode_Declaration, Iir_Kind.Vprop_Declaration, Iir_Kind.Vunit_Declaration, ] Literal = [ Iir_Kind.Integer_Literal, Iir_Kind.Floating_Point_Literal, Iir_Kind.Null_Literal, Iir_Kind.String_Literal8, Iir_Kind.Physical_Int_Literal, Iir_Kind.Physical_Fp_Literal, ] Physical_Literal = [ Iir_Kind.Physical_Int_Literal, Iir_Kind.Physical_Fp_Literal, ] Array_Type_Definition = [ Iir_Kind.Array_Type_Definition, Iir_Kind.Array_Subtype_Definition, ] Type_And_Subtype_Definition = [ Iir_Kind.Access_Type_Definition, Iir_Kind.Incomplete_Type_Definition, Iir_Kind.Interface_Type_Definition, Iir_Kind.File_Type_Definition, Iir_Kind.Protected_Type_Declaration, Iir_Kind.Record_Type_Definition, Iir_Kind.Array_Type_Definition, Iir_Kind.Array_Subtype_Definition, Iir_Kind.Record_Subtype_Definition, Iir_Kind.Access_Subtype_Definition, Iir_Kind.Physical_Subtype_Definition, Iir_Kind.Floating_Subtype_Definition, Iir_Kind.Integer_Subtype_Definition, Iir_Kind.Enumeration_Subtype_Definition, Iir_Kind.Enumeration_Type_Definition, Iir_Kind.Integer_Type_Definition, Iir_Kind.Floating_Type_Definition, Iir_Kind.Physical_Type_Definition, ] Subtype_Definition = [ Iir_Kind.Array_Subtype_Definition, Iir_Kind.Record_Subtype_Definition, Iir_Kind.Access_Subtype_Definition, Iir_Kind.Physical_Subtype_Definition, Iir_Kind.Floating_Subtype_Definition, Iir_Kind.Integer_Subtype_Definition, Iir_Kind.Enumeration_Subtype_Definition, ] Scalar_Subtype_Definition = [ Iir_Kind.Physical_Subtype_Definition, Iir_Kind.Floating_Subtype_Definition, Iir_Kind.Integer_Subtype_Definition, Iir_Kind.Enumeration_Subtype_Definition, ] Scalar_Type_And_Subtype_Definition = [ Iir_Kind.Physical_Subtype_Definition, Iir_Kind.Floating_Subtype_Definition, Iir_Kind.Integer_Subtype_Definition, Iir_Kind.Enumeration_Subtype_Definition, Iir_Kind.Enumeration_Type_Definition, Iir_Kind.Integer_Type_Definition, Iir_Kind.Floating_Type_Definition, Iir_Kind.Physical_Type_Definition, ] Range_Type_Definition = [ Iir_Kind.Physical_Subtype_Definition, Iir_Kind.Floating_Subtype_Definition, Iir_Kind.Integer_Subtype_Definition, Iir_Kind.Enumeration_Subtype_Definition, Iir_Kind.Enumeration_Type_Definition, ] Discrete_Type_Definition = [ Iir_Kind.Integer_Subtype_Definition, Iir_Kind.Enumeration_Subtype_Definition, Iir_Kind.Enumeration_Type_Definition, Iir_Kind.Integer_Type_Definition, ] Composite_Type_Definition = [ Iir_Kind.Record_Type_Definition, Iir_Kind.Array_Type_Definition, Iir_Kind.Array_Subtype_Definition, Iir_Kind.Record_Subtype_Definition, ] Composite_Subtype_Definition = [ Iir_Kind.Array_Subtype_Definition, Iir_Kind.Record_Subtype_Definition, ] Type_Declaration = [ Iir_Kind.Type_Declaration, Iir_Kind.Anonymous_Type_Declaration, Iir_Kind.Subtype_Declaration, ] Nature_Definition = [ Iir_Kind.Scalar_Nature_Definition, Iir_Kind.Record_Nature_Definition, Iir_Kind.Array_Nature_Definition, ] Subnature_Definition = [ Iir_Kind.Array_Subnature_Definition, ] Nature_Indication = [ Iir_Kind.Scalar_Nature_Definition, Iir_Kind.Record_Nature_Definition, Iir_Kind.Array_Nature_Definition, Iir_Kind.Array_Subnature_Definition, ] Nonoverloadable_Declaration = [ Iir_Kind.Type_Declaration, Iir_Kind.Anonymous_Type_Declaration, Iir_Kind.Subtype_Declaration, Iir_Kind.Nature_Declaration, Iir_Kind.Subnature_Declaration, Iir_Kind.Package_Header, Iir_Kind.Unit_Declaration, Iir_Kind.Library_Declaration, Iir_Kind.Component_Declaration, Iir_Kind.Attribute_Declaration, Iir_Kind.Group_Template_Declaration, Iir_Kind.Group_Declaration, Iir_Kind.Element_Declaration, Iir_Kind.Nature_Element_Declaration, ] Monadic_Operator = [ Iir_Kind.Identity_Operator, Iir_Kind.Negation_Operator, Iir_Kind.Absolute_Operator, Iir_Kind.Not_Operator, Iir_Kind.Implicit_Condition_Operator, Iir_Kind.Condition_Operator, Iir_Kind.Reduction_And_Operator, Iir_Kind.Reduction_Or_Operator, Iir_Kind.Reduction_Nand_Operator, Iir_Kind.Reduction_Nor_Operator, Iir_Kind.Reduction_Xor_Operator, Iir_Kind.Reduction_Xnor_Operator, ] Dyadic_Operator = [ Iir_Kind.And_Operator, Iir_Kind.Or_Operator, Iir_Kind.Nand_Operator, Iir_Kind.Nor_Operator, Iir_Kind.Xor_Operator, Iir_Kind.Xnor_Operator, Iir_Kind.Equality_Operator, Iir_Kind.Inequality_Operator, Iir_Kind.Less_Than_Operator, Iir_Kind.Less_Than_Or_Equal_Operator, Iir_Kind.Greater_Than_Operator, Iir_Kind.Greater_Than_Or_Equal_Operator, Iir_Kind.Match_Equality_Operator, Iir_Kind.Match_Inequality_Operator, Iir_Kind.Match_Less_Than_Operator, Iir_Kind.Match_Less_Than_Or_Equal_Operator, Iir_Kind.Match_Greater_Than_Operator, Iir_Kind.Match_Greater_Than_Or_Equal_Operator, Iir_Kind.Sll_Operator, Iir_Kind.Sla_Operator, Iir_Kind.Srl_Operator, Iir_Kind.Sra_Operator, Iir_Kind.Rol_Operator, Iir_Kind.Ror_Operator, Iir_Kind.Addition_Operator, Iir_Kind.Substraction_Operator, Iir_Kind.Concatenation_Operator, Iir_Kind.Multiplication_Operator, Iir_Kind.Division_Operator, Iir_Kind.Modulus_Operator, Iir_Kind.Remainder_Operator, Iir_Kind.Exponentiation_Operator, ] Psl_Builtin = [ Iir_Kind.Psl_Prev, Iir_Kind.Psl_Stable, Iir_Kind.Psl_Rose, Iir_Kind.Psl_Fell, Iir_Kind.Psl_Onehot, Iir_Kind.Psl_Onehot0, ] Functions_And_Literals = [ Iir_Kind.Enumeration_Literal, Iir_Kind.Function_Declaration, ] Subprogram_Declaration = [ Iir_Kind.Function_Declaration, Iir_Kind.Procedure_Declaration, ] Subprogram_Body = [ Iir_Kind.Function_Body, Iir_Kind.Procedure_Body, ] Process_Statement = [ Iir_Kind.Sensitized_Process_Statement, Iir_Kind.Process_Statement, ] Interface_Object_Declaration = [ Iir_Kind.Interface_Constant_Declaration, Iir_Kind.Interface_Variable_Declaration, Iir_Kind.Interface_Signal_Declaration, Iir_Kind.Interface_File_Declaration, Iir_Kind.Interface_Quantity_Declaration, ] Interface_Subprogram_Declaration = [ Iir_Kind.Interface_Function_Declaration, Iir_Kind.Interface_Procedure_Declaration, ] Interface_Declaration = [ Iir_Kind.Interface_Constant_Declaration, Iir_Kind.Interface_Variable_Declaration, Iir_Kind.Interface_Signal_Declaration, Iir_Kind.Interface_File_Declaration, Iir_Kind.Interface_Quantity_Declaration, Iir_Kind.Interface_Terminal_Declaration, Iir_Kind.Interface_Type_Declaration, Iir_Kind.Interface_Package_Declaration, Iir_Kind.Interface_Function_Declaration, Iir_Kind.Interface_Procedure_Declaration, ] Object_Declaration = [ Iir_Kind.Object_Alias_Declaration, Iir_Kind.Free_Quantity_Declaration, Iir_Kind.Spectrum_Quantity_Declaration, Iir_Kind.Noise_Quantity_Declaration, Iir_Kind.Across_Quantity_Declaration, Iir_Kind.Through_Quantity_Declaration, Iir_Kind.File_Declaration, Iir_Kind.Guard_Signal_Declaration, Iir_Kind.Signal_Declaration, Iir_Kind.Variable_Declaration, Iir_Kind.Constant_Declaration, Iir_Kind.Iterator_Declaration, Iir_Kind.Interface_Constant_Declaration, Iir_Kind.Interface_Variable_Declaration, Iir_Kind.Interface_Signal_Declaration, Iir_Kind.Interface_File_Declaration, Iir_Kind.Interface_Quantity_Declaration, ] Branch_Quantity_Declaration = [ Iir_Kind.Across_Quantity_Declaration, Iir_Kind.Through_Quantity_Declaration, ] Source_Quantity_Declaration = [ Iir_Kind.Spectrum_Quantity_Declaration, Iir_Kind.Noise_Quantity_Declaration, ] Quantity_Declaration = [ Iir_Kind.Free_Quantity_Declaration, Iir_Kind.Spectrum_Quantity_Declaration, Iir_Kind.Noise_Quantity_Declaration, Iir_Kind.Across_Quantity_Declaration, Iir_Kind.Through_Quantity_Declaration, ] Non_Alias_Object_Declaration = [ Iir_Kind.File_Declaration, Iir_Kind.Guard_Signal_Declaration, Iir_Kind.Signal_Declaration, Iir_Kind.Variable_Declaration, Iir_Kind.Constant_Declaration, Iir_Kind.Iterator_Declaration, Iir_Kind.Interface_Constant_Declaration, Iir_Kind.Interface_Variable_Declaration, Iir_Kind.Interface_Signal_Declaration, Iir_Kind.Interface_File_Declaration, ] Association_Element_Parameters = [ Iir_Kind.Association_Element_By_Expression, Iir_Kind.Association_Element_By_Individual, Iir_Kind.Association_Element_Open, ] Association_Element = [ Iir_Kind.Association_Element_By_Expression, Iir_Kind.Association_Element_By_Individual, Iir_Kind.Association_Element_Open, Iir_Kind.Association_Element_Package, Iir_Kind.Association_Element_Type, Iir_Kind.Association_Element_Subprogram, Iir_Kind.Association_Element_Terminal, ] Choice = [ Iir_Kind.Choice_By_Range, Iir_Kind.Choice_By_Expression, Iir_Kind.Choice_By_Others, Iir_Kind.Choice_By_None, Iir_Kind.Choice_By_Name, ] Case_Choice = [ Iir_Kind.Choice_By_Range, Iir_Kind.Choice_By_Expression, Iir_Kind.Choice_By_Others, ] Array_Choice = [ Iir_Kind.Choice_By_Range, Iir_Kind.Choice_By_Expression, Iir_Kind.Choice_By_Others, Iir_Kind.Choice_By_None, ] Record_Choice = [ Iir_Kind.Choice_By_Others, Iir_Kind.Choice_By_None, Iir_Kind.Choice_By_Name, ] Entity_Aspect = [ Iir_Kind.Entity_Aspect_Entity, Iir_Kind.Entity_Aspect_Configuration, Iir_Kind.Entity_Aspect_Open, ] Denoting_Name = [ Iir_Kind.Character_Literal, Iir_Kind.Simple_Name, Iir_Kind.Selected_Name, Iir_Kind.Operator_Symbol, Iir_Kind.Reference_Name, ] Denoting_And_External_Name = [ Iir_Kind.Character_Literal, Iir_Kind.Simple_Name, Iir_Kind.Selected_Name, Iir_Kind.Operator_Symbol, Iir_Kind.Reference_Name, Iir_Kind.External_Constant_Name, Iir_Kind.External_Signal_Name, Iir_Kind.External_Variable_Name, ] Name = [ Iir_Kind.Character_Literal, Iir_Kind.Simple_Name, Iir_Kind.Selected_Name, Iir_Kind.Operator_Symbol, Iir_Kind.Reference_Name, Iir_Kind.External_Constant_Name, Iir_Kind.External_Signal_Name, Iir_Kind.External_Variable_Name, Iir_Kind.Selected_By_All_Name, Iir_Kind.Parenthesis_Name, ] Dereference = [ Iir_Kind.Dereference, Iir_Kind.Implicit_Dereference, ] External_Name = [ Iir_Kind.External_Constant_Name, Iir_Kind.External_Signal_Name, Iir_Kind.External_Variable_Name, ] Expression_Attribute = [ Iir_Kind.Left_Type_Attribute, Iir_Kind.Right_Type_Attribute, Iir_Kind.High_Type_Attribute, Iir_Kind.Low_Type_Attribute, Iir_Kind.Ascending_Type_Attribute, Iir_Kind.Image_Attribute, Iir_Kind.Value_Attribute, Iir_Kind.Pos_Attribute, Iir_Kind.Val_Attribute, Iir_Kind.Succ_Attribute, Iir_Kind.Pred_Attribute, Iir_Kind.Leftof_Attribute, Iir_Kind.Rightof_Attribute, Iir_Kind.Signal_Slew_Attribute, Iir_Kind.Quantity_Slew_Attribute, Iir_Kind.Ramp_Attribute, Iir_Kind.Zoh_Attribute, Iir_Kind.Ltf_Attribute, Iir_Kind.Ztf_Attribute, Iir_Kind.Dot_Attribute, Iir_Kind.Integ_Attribute, Iir_Kind.Above_Attribute, Iir_Kind.Quantity_Delayed_Attribute, Iir_Kind.Delayed_Attribute, Iir_Kind.Stable_Attribute, Iir_Kind.Quiet_Attribute, Iir_Kind.Transaction_Attribute, Iir_Kind.Event_Attribute, Iir_Kind.Active_Attribute, Iir_Kind.Last_Event_Attribute, Iir_Kind.Last_Active_Attribute, Iir_Kind.Last_Value_Attribute, Iir_Kind.Driving_Attribute, Iir_Kind.Driving_Value_Attribute, Iir_Kind.Behavior_Attribute, Iir_Kind.Structure_Attribute, Iir_Kind.Simple_Name_Attribute, Iir_Kind.Instance_Name_Attribute, Iir_Kind.Path_Name_Attribute, Iir_Kind.Left_Array_Attribute, Iir_Kind.Right_Array_Attribute, Iir_Kind.High_Array_Attribute, Iir_Kind.Low_Array_Attribute, Iir_Kind.Length_Array_Attribute, Iir_Kind.Ascending_Array_Attribute, ] Attribute = [ Iir_Kind.Base_Attribute, Iir_Kind.Subtype_Attribute, Iir_Kind.Element_Attribute, Iir_Kind.Across_Attribute, Iir_Kind.Through_Attribute, Iir_Kind.Nature_Reference_Attribute, Iir_Kind.Left_Type_Attribute, Iir_Kind.Right_Type_Attribute, Iir_Kind.High_Type_Attribute, Iir_Kind.Low_Type_Attribute, Iir_Kind.Ascending_Type_Attribute, Iir_Kind.Image_Attribute, Iir_Kind.Value_Attribute, Iir_Kind.Pos_Attribute, Iir_Kind.Val_Attribute, Iir_Kind.Succ_Attribute, Iir_Kind.Pred_Attribute, Iir_Kind.Leftof_Attribute, Iir_Kind.Rightof_Attribute, Iir_Kind.Signal_Slew_Attribute, Iir_Kind.Quantity_Slew_Attribute, Iir_Kind.Ramp_Attribute, Iir_Kind.Zoh_Attribute, Iir_Kind.Ltf_Attribute, Iir_Kind.Ztf_Attribute, Iir_Kind.Dot_Attribute, Iir_Kind.Integ_Attribute, Iir_Kind.Above_Attribute, Iir_Kind.Quantity_Delayed_Attribute, Iir_Kind.Delayed_Attribute, Iir_Kind.Stable_Attribute, Iir_Kind.Quiet_Attribute, Iir_Kind.Transaction_Attribute, Iir_Kind.Event_Attribute, Iir_Kind.Active_Attribute, Iir_Kind.Last_Event_Attribute, Iir_Kind.Last_Active_Attribute, Iir_Kind.Last_Value_Attribute,
/*
* Revision Control Information
*
* $Source$
* $Author$
* $Revision$
* $Date$
*
*/
/*
module: expand.c
purpose: Perform the Espresso-II Expansion Step
The idea is to take each nonprime cube of the on-set and expand it
into a prime implicant such that we can cover as many other cubes
of the on-set. If no cube of the on-set can be covered, then we
expand each cube into a large prime implicant by transforming the
problem into a minimum covering problem which is solved by the
heuristics of minimum_cover.
These routines revolve around having a representation of the
OFF-set. (In contrast to the Espresso-II manuscript, we do NOT
require an "unwrapped" version of the OFF-set).
Some conventions on variable names:
SUPER_CUBE is the supercube of all cubes which can be covered
by an expansion of the cube being expanded
OVEREXPANDED_CUBE is the cube which would result from expanding
all parts which can expand individually of the cube being expanded
RAISE is the current expansion of the current cube
FREESET is the set of parts which haven't been raised or lowered yet.
INIT_LOWER is a set of parts to be removed from the free parts before
starting the expansion
*/
#include "espresso.h"
/*
expand -- expand each nonprime cube of F into a prime implicant
If nonsparse is true, only the non-sparse variables will be expanded;
this is done by forcing all of the sparse variables out of the free set.
*/
pcover expand(F, R, nonsparse)
INOUT pcover F;
IN pcover R;
IN bool nonsparse; /* expand non-sparse variables only */
{
register pcube last, p;
pcube RAISE, FREESET, INIT_LOWER, SUPER_CUBE, OVEREXPANDED_CUBE;
int var, num_covered;
bool change;
/* Order the cubes according to "chewing-away from the edges" of mini */
if (use_random_order)
F = random_order(F);
else
F = mini_sort(F, ascend);
/* Allocate memory for variables needed by expand1() */
RAISE = new_cube();
FREESET = new_cube();
INIT_LOWER = new_cube();
SUPER_CUBE = new_cube();
OVEREXPANDED_CUBE = new_cube();
/* Setup the initial lowering set (differs only for nonsparse) */
if (nonsparse)
for(var = 0; var < cube.num_vars; var++)
if (cube.sparse[var])
(void) set_or(INIT_LOWER, INIT_LOWER, cube.var_mask[var]);
/* Mark all cubes as not covered, and maybe essential */
foreach_set(F, last, p) {
RESET(p, COVERED);
RESET(p, NONESSEN);
}
/* Try to expand each nonprime and noncovered cube */
foreach_set(F, last, p) {
/* do not expand if PRIME or if covered by previous expansion */
if (! TESTP(p, PRIME) && ! TESTP(p, COVERED)) {
/* expand the cube p, result is RAISE */
expand1(R, F, RAISE, FREESET, OVEREXPANDED_CUBE, SUPER_CUBE,
INIT_LOWER, &num_covered, p);
if (debug & EXPAND)
printf("EXPAND: %s (covered %d)\n", pc1(p), num_covered);
(void) set_copy(p, RAISE);
SET(p, PRIME);
RESET(p, COVERED); /* not really necessary */
/* See if we generated an inessential prime */
if (num_covered == 0 && ! setp_equal(p, OVEREXPANDED_CUBE)) {
SET(p, NONESSEN);
}
}
}
/* Delete any cubes of F which became covered during the expansion */
F->active_count = 0;
change = FALSE;
foreach_set(F, last, p) {
if (TESTP(p, COVERED)) {
RESET(p, ACTIVE);
change = TRUE;
} else {
SET(p, ACTIVE);
F->active_count++;
}
}
if (change)
F = sf_inactive(F);
free_cube(RAISE);
free_cube(FREESET);
free_cube(INIT_LOWER);
free_cube(SUPER_CUBE);
free_cube(OVEREXPANDED_CUBE);
return F;
}
/*
expand1 -- Expand a single cube against the OFF-set
*/
void expand1(BB, CC, RAISE, FREESET, OVEREXPANDED_CUBE, SUPER_CUBE,
INIT_LOWER, num_covered, c)
pcover BB; /* Blocking matrix (OFF-set) */
pcover CC; /* Covering matrix (ON-set) */
pcube RAISE; /* The current parts which have been raised */
pcube FREESET; /* The current parts which are free */
pcube OVEREXPANDED_CUBE; /* Overexpanded cube of c */
pcube SUPER_CUBE; /* Supercube of all cubes of CC we cover */
pcube INIT_LOWER; /* Parts to initially remove from FREESET */
int *num_covered; /* Number of cubes of CC which are covered */
pcube c; /* The cube to be expanded */
{
int bestindex;
if (debug & EXPAND1)
printf("\nEXPAND1: \t%s\n", pc1(c));
/* initialize BB and CC */
SET(c, PRIME); /* don't try to cover ourself */
setup_BB_CC(BB, CC);
/* initialize count of # cubes covered, and the supercube of them */
*num_covered = 0;
(void) set_copy(SUPER_CUBE, c);
/* Initialize the lowering, raising and unassigned sets */
(void) set_copy(RAISE, c);
(void) set_diff(FREESET, cube.fullset, RAISE);
/* If some parts are forced into lowering set, remove them */
if (! setp_empty(INIT_LOWER)) {
(void) set_diff(FREESET, FREESET, INIT_LOWER);
elim_lowering(BB, CC, RAISE, FREESET);
}
/* Determine what can be raised, and return the over-expanded cube */
essen_parts(BB, CC, RAISE, FREESET);
(void) set_or(OVEREXPANDED_CUBE, RAISE, FREESET);
/* While there are still cubes which can be covered, cover them ! */
if (CC->active_count > 0) {
select_feasible(BB, CC, RAISE, FREESET, SUPER_CUBE, num_covered);
}
/* While there are still cubes covered by the overexpanded cube ... */
while (CC->active_count > 0) {
bestindex = most_frequent(CC, FREESET);
set_insert(RAISE, bestindex);
set_remove(FREESET, bestindex);
essen_parts(BB, CC, RAISE, FREESET);
}
/* Finally, when all else fails, choose the largest possible prime */
/* We will loop only if we decide unravelling OFF-set is too expensive */
while (BB->active_count > 0) {
mincov(BB, RAISE, FREESET);
}
/* Raise any remaining free coordinates */
(void) set_or(RAISE, RAISE, FREESET);
}
/*
essen_parts -- determine which parts are forced into the lowering
set to insure that the cube be orthognal to the OFF-set.
If any cube of the OFF-set is distance 1 from the raising cube,
then we must lower all parts of the conflicting variable. (If the
cube is distance 0, we detect this error here.)
If there are essentially lowered parts, we can remove from consideration
any cubes of the OFF-set which are more than distance 1 from the
overexpanded cube of RAISE.
*/
void essen_parts(BB, CC, RAISE, FREESET)
pcover BB, CC;
pcube RAISE, FREESET;
{
register pcube p, r = RAISE;
pcube lastp, xlower = cube.temp[0];
int dist;
(void) set_copy(xlower, cube.emptyset);
foreach_active_set(BB, lastp, p) {
#ifdef NO_INLINE
if ((dist = cdist01(p, r)) > 1) goto exit_if;
#else
{register int w,last;register unsigned int x;dist=0;if((last=cube.inword)!=-1)
{x=p[last]&r[last];if((x=~(x|x>>1)&cube.inmask))if((dist=count_ones(x))>1)goto
exit_if;for(w=1;w<last;w++){x=p[w]&r[w];if((x=~(x|x>>1)&DISJOINT))if(dist==1||(
dist+=count_ones(x))>1)goto exit_if;}}}{register int w,var,last;register pcube
mask;for(var=cube.num_binary_vars;var<cube.num_vars;var++){mask=cube.var_mask[
var];last=cube.last_word[var];for(w=cube.first_word[var];w<=last;w++)if(p[w]&r[
w]&mask[w])goto nextvar;if(++dist>1)goto exit_if;nextvar:;}}
#endif
if (dist == 0) {
fatal("ON-set and OFF-set are not orthogonal");
} else {
(void) force_lower(xlower, p, r);
BB->active_count--;
RESET(p, ACTIVE);
}
exit_if: ;
}
if (! setp_empty(xlower)) {
(void) set_diff(FREESET, FREESET, xlower);/* remove from free set */
elim_lowering(BB, CC, RAISE, FREESET);
}
if (debug & EXPAND1)
printf("ESSEN_PARTS:\tRAISE=%s FREESET=%s\n", pc1(RAISE), pc2(FREESET));
}
/*
essen_raising -- determine which parts may always be added to
the raising set without restricting further expansions
General rule: if some part is not blocked by any cube of BB, then
this part can always be raised.
*/
void essen_raising(BB, RAISE, FREESET)
register pcover BB;
pcube RAISE, FREESET;
{
register pcube last, p, xraise = cube.temp[0];
/* Form union of all cubes of BB, and then take complement wrt FREESET */
(void) set_copy(xraise, cube.emptyset);
foreach_active_set(BB, last, p)
INLINEset_or(xraise, xraise, p);
(void) set_diff(xraise, FREESET, xraise);
(void) set_or(RAISE, RAISE, xraise); /* add to raising set */
(void) set_diff(FREESET, FREESET, xraise); /* remove from free set */
if (debug & EXPAND1)
printf("ESSEN_RAISING:\tRAISE=%s FREESET=%s\n",
pc1(RAISE), pc2(FREESET));
}
/*
elim_lowering -- after removing parts from FREESET, we can reduce the
size of both BB and CC.
We mark as inactive any cube of BB which does not intersect the
overexpanded cube (i.e., RAISE + FREESET). Likewise, we remove
from CC any cube which is not covered by the overexpanded cube.
*/
void elim_lowering(BB, CC, RAISE, FREESET)
pcover BB, CC;
pcube RAISE, FREESET;
{
register pcube p, r = set_or(cube.temp[0], RAISE, FREESET);
pcube last;
/*
* Remove sets of BB which are orthogonal to future expansions
*/
foreach_active_set(BB, last, p) {
#ifdef NO_INLINE
if (! cdist0(p, r))
#else
{register int w,lastw;register unsigned int x;if((lastw=cube.inword)!=-1){x=p[
lastw]&r[lastw];if(~(x|x>>1)&cube.inmask)goto false;for(w=1;w<lastw;w++){x=p[w]
&r[w];if(~(x|x>>1)&DISJOINT)goto false;}}}{register int w,var,lastw;register
pcube mask;for(var=cube.num_binary_vars;var<cube.num_vars;var++){mask=cube.
var_mask[var];lastw=cube.last_word[var];for(w=cube.first_word[var];w<=lastw;w++)
if(p[w]&r[w]&mask[w])goto nextvar;goto false;nextvar:;}}continue;false:
#endif
BB->active_count--, RESET(p, ACTIVE);
}
/*
* Remove sets of CC which cannot be covered by future expansions
*/
if (CC != (pcover) NULL) {
foreach_active_set(CC, last, p) {
#ifdef NO_INLINE
if (! setp_implies(p, r))
#else
INLINEsetp_implies(p, r, /* when false => */ goto false1);
/* when true => go to end of loop */ continue;
false1:
#endif
CC->active_count--, RESET(p, ACTIVE);
}
}
}
/*
most_frequent -- When all else fails, select a reasonable part to raise
The active cubes of CC are the cubes which are covered by the
overexpanded cube of the original cube (however, we know that none
of them can actually be covered by a feasible expansion of the
original cube). We resort to the MINI strategy of selecting to
raise the part which will cover the same part in the most cubes of CC.
*/
int most_frequent(CC, FREESET)
pcover CC;
pcube FREESET;
{
register int i, best_part, best_count, *count;
register pset p, last;
/* Count occurences of each variable */
count = ALLOC(int, cube.size);
for(i = 0; i < cube.size; i++)
count[i] = 0;
if (CC != (pcover) NULL)
foreach_active_set(CC, last, p)
set_adjcnt(p, count, 1);
/* Now find which free part occurs most often */
best_count = best_part = -1;
for(i = 0; i < cube.size; i++)
if (is_in_set(FREESET,i) && count[i] > best_count) {
best_part = i;
best_count = count[i];
}
FREE(count);
if (debug & EXPAND1)
printf("MOST_FREQUENT:\tbest=%d FREESET=%s\n", best_part, pc2(FREESET));
return best_part;
}
/*
setup_BB_CC -- set up the blocking and covering set families;
Note that the blocking family is merely the set of cubes of R, and
that CC is the set of cubes of F which might possibly be covered
(i.e., nonprime cubes, and cubes not already covered)
*/
void setup_BB_CC(BB, CC)
register pcover BB, CC;
{
register pcube p, last;
/* Create the block and cover set families */
BB->active_count = BB->count;
foreach_set(BB, last, p)
SET(p, ACTIVE);
if (CC != (pcover) NULL) {
CC->active_count = CC->count;
foreach_set(CC, last, p)
if (TESTP(p, COVERED) || TESTP(p, PRIME))
CC->active_count--, RESET(p, ACTIVE);
else
SET(p, ACTIVE);
}
}
/*
select_feasible -- Determine if there are cubes which can be covered,
and if so, raise those parts necessary to cover as many as possible.
We really don't check to maximize the number that can be covered;
instead, we check, for each fcc, how many other fcc remain fcc
after expanding to cover the fcc. (Essentially one-level lookahead).
*/
void select_feasible(BB, CC, RAISE, FREESET, SUPER_CUBE, num_covered)
pcover BB, CC;
pcube RAISE, FREESET, SUPER_CUBE;
int *num_covered;
{
register pcube p, last;
register pcube bestfeas = NULL; // Suppress "might be used uninitialized"
register pcube *feas;
register int i, j;
pcube *feas_new_lower;
int bestcount, bestsize, count, size, numfeas, lastfeas;
pcover new_lower;
/* Start out with all cubes covered by the over-expanded cube as
* the "possibly" feasibly-covered cubes (pfcc)
*/
feas = ALLOC(pcube, CC->active_count);
numfeas = 0;
foreach_active_set(CC, last, p)
feas[numfeas++] = p;
/* Setup extra cubes to record parts forced low after a covering */
feas_new_lower = ALLOC(pcube, CC->active_count);
new_lower = new_cover(numfeas);
for(i = 0; i < numfeas; i++)
feas_new_lower[i] = GETSET(new_lower, i);
loop:
/* Find the essentially raised parts -- this might cover some cubes
for us, without having to find out if they are fcc or not
*/
essen_raising(BB, RAISE, FREESET);
/* Now check all "possibly" feasibly covered cubes to check feasibility */
lastfeas = numfeas;
numfeas = 0;
for(i = 0; i < lastfeas; i++) {
p = feas[i];
/* Check active because essen_parts might have removed it */
if (TESTP(p, ACTIVE)) {
/* See if the cube is already covered by RAISE --
* this can happen because of essen_raising() or because of
* the previous "loop"
*/
if (setp_implies(p, RAISE)) {
(*num_covered) += 1;
(void) set_or(SUPER_CUBE, SUPER_CUBE, p);
CC->active_count--;
RESET(p, ACTIVE);
SET(p, COVERED);
/* otherwise, test if it is feasibly covered */
} else if (feasibly_covered(BB,p,RAISE,feas_new_lower[numfeas])) {
feas[numfeas] = p; /* save the fcc */
numfeas++;
}
}
}
if (debug & EXPAND1)
printf("SELECT_FEASIBLE: started with %d pfcc, ended with %d fcc\n",
lastfeas, numfeas);
/* Exit here if there are no feasibly covered cubes */
if (numfeas == 0) {
FREE(feas);
FREE(feas_new_lower);
free_cover(new_lower);
return;
}
/* Now find which is the best feasibly covered cube */
bestcount = 0;
bestsize = 9999;
for(i = 0; i < numfeas; i++) {
size = set_dist(feas[i], FREESET); /* # of newly raised parts */
count = 0; /* # of other cubes which remain fcc after raising */
#define NEW
#ifdef NEW
for(j = 0; j < numfeas; j++)
if (setp_disjoint(feas_new_lower[i], feas[j]))
count++;
#else
for(j = 0; j < numfeas; j++)
if (setp_implies(feas[j], feas[i]))
count++;
#endif
if (count > bestcount) {
bestcount = count;
bestfeas = feas[i];
bestsize = size;
} else if (count == bestcount && size < bestsize) {
bestfeas = feas[i];
bestsize = size;
}
}
/* Add the necessary parts to the raising set */
(void) set_or(RAISE, RAISE, bestfeas);
(void) set_diff(FREESET, FREESET, RAISE);
if (debug & EXPAND1)
printf("FEASIBLE: \tRAISE=%s FREESET=%s\n", pc1(RAISE), pc2(FREESET));
essen_parts(BB, CC, RAISE, FREESET);
goto loop;
/* NOTREACHED */
}
/*
feasibly_covered -- determine if the cube c is feasibly covered
(i.e., if it is possible to raise all of the necessary variables
while still insuring orthogonality with R). Also, if c is feasibly
covered, then compute the new set of parts which are forced into
the lowering set.
*/
bool feasibly_covered(BB, c, RAISE, new_lower)
pcover BB;
pcube c, RAISE, new_lower;
{
register pcube p, r = set_or(cube.temp[0], RAISE, c);
int dist;
pcube lastp;
set_copy(new_lower, cube.emptyset);
foreach_active_set(BB, lastp, p) {
#ifdef NO_INLINE
if ((dist = cdist01(p, r)) > 1) goto exit_if;
#else
{register int w,last;register unsigned int x;dist=0;if((last=cube.inword)!=-1)
{x=p[last]&r[last];if((x=~(x|x>>1)&cube.inmask))if((dist=count_ones(x))>1)goto
exit_if;for(w=1;w<last;w++){x=p[w]&r[w];if((x=~(x|x>>1)&DISJOINT))if(dist==1||(
dist+=count_ones(x))>1)goto exit_if;}}}{register int w,var,last;register pcube
mask;for(var=cube.num_binary_vars;var<cube.num_vars;var++){mask=cube.var_mask[
var];last=cube.last_word[var];for(w=cube.first_word[var];w<=last;w++)if(p[w]&r[
w]&mask[w])goto nextvar;if(++dist>1)goto exit_if;nextvar:;}}
#endif
if (dist == 0)
return FALSE;
else
(void) force_lower(new_lower, p, r);
exit_if: ;
}
return TRUE;
}
/*
mincov -- transform the problem of expanding a cube to a maximally-
large prime implicant into the problem of selecting a minimum
cardinality cover over a family of sets.
When we get to this point, we must unravel the remaining off-set.
This may be painful.
*/
void mincov(BB, RAISE, FREESET)
pcover BB;
pcube RAISE, FREESET;
{
int expansion, nset, var, dist;
pset_family B;
register pcube xraise=cube.temp[0], xlower, p, last, plower;
#ifdef RANDOM_MINCOV
#if defined(_POSIX_SOURCE) || defined(__SVR4)
dist = rand() % set_ord(FREESET);
#else
dist = random() % set_ord(FREESET);
#endif
for(var = 0; var < cube.size && dist >= 0; var++) {
if (is_in_set(FREESET, var)) {
dist--;
}
}
set_insert(RAISE, var);
set_remove(FREESET, var);
(void) essen_parts(BB, /*CC*/ (pcover) NULL, RAISE, FREESET);
#else
/* Create B which are those cubes which we must avoid intersecting */
B = new_cover(BB->active_count);
foreach_active_set(BB, last, p) {
plower = set_copy(GETSET(B, B->count++), cube.emptyset);
(void) force_lower(plower, p, RAISE);
}
/* Determine how many sets it will blow up into after the unravel */
nset = 0;
foreach_set(B, last, p) {
expansion = 1;
for(var = cube.num_binary_vars; var < cube.num_vars; var++) {
if ((dist=set_dist(p, cube.var_mask[var])) > 1) {
expansion *= dist;
if (expansion > 500) goto heuristic_mincov;
}
}
nset += expansion;
if (nset > 500) goto heuristic_mincov;
}
B = unravel(B, cube.num_binary_vars);
xlower = do_sm_minimum_cover(B);
/* Add any remaining free parts to the raising set */
(void) set_or(RAISE, RAISE, set_diff(xraise, FREESET, xlower));
(void) set_copy(FREESET, cube.emptyset); /* free set is empty */
BB->active_count = 0; /* BB satisfied */
if (debug & EXPAND1) {
printf("MINCOV: \tRAISE=%s FREESET=%s\n", pc1(RAISE), pc2(FREESET));
}
sf_free(B);
set_free(xlower);
return;
heuristic_mincov:
sf_free(B);
/* most_frequent will pick first free part */
set_insert(RAISE, most_frequent(/*CC*/ (pcover) NULL, FREESET));
(void) set_diff(FREESET, FREESET, RAISE);
essen_parts(BB, /*CC*/ (pcover) NULL, RAISE, FREESET);
return;
#endif
}
/*
find_all_primes -- find all of the primes which cover the
currently reduced BB
*/
pcover find_all_primes(BB, RAISE, FREESET)
pcover BB;
register pcube RAISE, FREESET;
{
register pset last, p, plower;
pset_family B, B1;
if (BB->active_count == 0) {
B1 = new_cover(1);
p = GETSET(B1, B1->count++);
(void) set_copy(p, RAISE);
SET(p, PRIME);
} else {
B = new_cover(BB->active_count);
foreach_active_set(BB, last, p) {
plower = set_copy(GETSET(B, B->count++), cube.emptyset);
(void) force_lower(plower, p, RAISE);
}
B = sf_rev_contain(unravel(B, cube.num_binary_vars));
B1 = exact_minimum_cover(B);
foreach_set(B1, last, p) {
INLINEset_diff(p, FREESET, p);
INLINEset_or(p, p, RAISE);
SET(p, PRIME);
}
free_cover(B);
}
return B1;
}
/*
all_primes -- foreach cube in F, generate all of the primes
which cover the cube.
*/
pcover all_primes(F, R)
pcover F, R;
{
register pcube last, p, RAISE, FREESET;
pcover Fall_primes, B1;
FREESET = new_cube();
RAISE = new_cube();
Fall_primes = new_cover(F->count);
foreach_set(F, last, p) {
if (TESTP(p, PRIME)) {
Fall_primes = sf_addset(Fall_primes, p);
} else {
/* Setup for call to essential parts */
(void) set_copy(RAISE, p);
(void) set_diff(FREESET, cube.fullset, RAISE);
setup_BB_CC(R, /* CC */ (pcover) NULL);
essen_parts(R, /* CC */ (pcover) NULL, RAISE, FREESET);
/* Find all of the primes, and add them to the prime set */
B1 = find_all_primes(R, RAISE, FREESET);
Fall_primes = sf_append(Fall_primes, B1);
}
}
set_free(RAISE);
set_free(FREESET);
return Fall_primes;
}