Class: Udb::AbstractCondition
- Inherits:
-
Object
- Object
- Udb::AbstractCondition
show all
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/udb/condition.rb,
lib/udb/condition.rb
Overview
Base class to represent any condition in the UDB data, and to connect/test them
Conditions constructed from UDB data need context to be evaluated; for example, a condition that requires extension A to be implemented implies that Zaamo and Zalrsc must also be implemented.
We add this implied information in a step called expand. Many methods of AbstractCondition take an optional ‘expand:` argument that, when true, expands the condition before operating on it.
Instance Method Summary
collapse
Instance Method Details
#&(other) ⇒ Object
385
|
# File 'lib/udb/condition.rb', line 385
def &(other); end
|
#-@ ⇒ Object
398
|
# File 'lib/udb/condition.rb', line 398
def -@; end
|
#always_implies?(other_condition) ⇒ Boolean
290
291
292
|
# File 'lib/udb/condition.rb', line 290
def always_implies?(other_condition)
other_condition.covered_by?(self)
end
|
#compatible?(other) ⇒ Boolean
216
217
218
|
# File 'lib/udb/condition.rb', line 216
def compatible?(other)
(self & other).satisfiable?
end
|
#could_be_satisfied_by_cfg_arch?(cfg_arch) ⇒ Boolean
261
262
263
|
# File 'lib/udb/condition.rb', line 261
def could_be_satisfied_by_cfg_arch?(cfg_arch)
satisfied_by_cfg_arch?(cfg_arch) != SatisfiedResult::No
end
|
#covered_by?(other_condition) ⇒ Boolean
275
276
277
278
279
280
281
282
283
284
285
286
287
|
# File 'lib/udb/condition.rb', line 275
def covered_by?(other_condition)
contradiction = LogicNode.new(
LogicNodeType::And,
[
other_condition.to_logic_tree(expand: true),
LogicNode.new(LogicNodeType::Not, [to_logic_tree(expand: true)])
]
)
!contradiction.satisfiable?(@cfg_arch)
end
|
#empty? ⇒ Boolean
132
|
# File 'lib/udb/condition.rb', line 132
def empty?; end
|
#equivalent?(other) ⇒ Boolean
269
270
271
272
|
# File 'lib/udb/condition.rb', line 269
def equivalent?(other)
contradition = -(self.implies(other) & other.implies(self))
contradition.unsatisfiable?
end
|
#ext_req_terms(expand:) ⇒ Object
190
191
192
193
194
195
196
197
198
|
# File 'lib/udb/condition.rb', line 190
def ext_req_terms(expand:)
if expand
@expanded_ext_req_terms ||=
to_logic_tree(expand:).terms.grep(ExtensionTerm).map { |term| term.to_ext_req(@cfg_arch) }
else
@unexpanded_ext_req_terms ||=
to_logic_tree(expand:).terms.grep(ExtensionTerm).map { |term| term.to_ext_req(@cfg_arch) }
end
end
|
#failing_conjuncts(cfg_arch, expand:) ⇒ Object
338
|
# File 'lib/udb/condition.rb', line 338
def failing_conjuncts(cfg_arch, expand:); end
|
#has_extension_requirement? ⇒ Boolean
300
|
# File 'lib/udb/condition.rb', line 300
def has_extension_requirement?; end
|
#has_param? ⇒ Boolean
296
|
# File 'lib/udb/condition.rb', line 296
def has_param?; end
|
#implied_extension_conflicts(expand: true) ⇒ Object
381
|
# File 'lib/udb/condition.rb', line 381
def implied_extension_conflicts(expand: true); end
|
#implied_extension_requirements(expand: true) ⇒ Object
377
|
# File 'lib/udb/condition.rb', line 377
def implied_extension_requirements(expand: true); end
|
#implies(other) ⇒ Object
406
407
408
|
# File 'lib/udb/condition.rb', line 406
def implies(other)
-self | other
end
|
#mentions?(term, expand: true) ⇒ Boolean
#mentions_xlen?(expand: true) ⇒ Boolean
166
167
168
169
170
|
# File 'lib/udb/condition.rb', line 166
def mentions_xlen?(expand: true)
to_logic_tree(expand:).terms.any? do |t|
t.is_a?(XlenTerm)
end
end
|
#minimize(expand: true) ⇒ Object
306
|
# File 'lib/udb/condition.rb', line 306
def minimize(expand: true); end
|
#param_terms(expand:) ⇒ Object
204
205
206
207
208
209
210
211
212
|
# File 'lib/udb/condition.rb', line 204
def param_terms(expand:)
if expand
@expanded_param_terms ||=
to_logic_tree(expand:).terms.grep(ParameterTerm).map { |term| @cfg_arch.param(term.name) }
else
@unexpanded_param_terms ||=
to_logic_tree(expand:).terms.grep(ParameterTerm).map { |term| @cfg_arch.param(term.name) }
end
end
|
#partial_eval(ext_reqs: [], expand: true) ⇒ Object
241
|
# File 'lib/udb/condition.rb', line 241
def partial_eval(ext_reqs: [], expand: true); end
|
#partially_evaluate_for_params(cfg_arch, expand:) ⇒ Object
246
|
# File 'lib/udb/condition.rb', line 246
def partially_evaluate_for_params(cfg_arch, expand:); end
|
#satisfiability_depends_on_ext_req?(_ext_req, include_requirements: false) ⇒ Boolean
257
|
# File 'lib/udb/condition.rb', line 257
def satisfiability_depends_on_ext_req?(_ext_req, include_requirements: false); end
|
#satisfiable? ⇒ Boolean
144
|
# File 'lib/udb/condition.rb', line 144
def satisfiable?; end
|
#satisfiable_by_arch?(cfg_arch) ⇒ Boolean
230
|
# File 'lib/udb/condition.rb', line 230
def satisfiable_by_arch?(cfg_arch); end
|
#satisfiable_by_cfg_arch?(cfg_arch) ⇒ Boolean
222
|
# File 'lib/udb/condition.rb', line 222
def satisfiable_by_cfg_arch?(cfg_arch); end
|
#satisfied_by_cfg_arch?(_cfg_arch) ⇒ Boolean
238
|
# File 'lib/udb/condition.rb', line 238
def satisfied_by_cfg_arch?(_cfg_arch); end
|
#satisfied_by_ext_req?(ext_req, include_requirements: false) ⇒ Boolean
252
|
# File 'lib/udb/condition.rb', line 252
def satisfied_by_ext_req?(ext_req, include_requirements: false); end
|
#to_asciidoc ⇒ Object
342
|
# File 'lib/udb/condition.rb', line 342
def to_asciidoc; end
|
#to_h ⇒ Object
310
|
# File 'lib/udb/condition.rb', line 310
def to_h; end
|
#to_idl(cfg_arch) ⇒ Object
320
|
# File 'lib/udb/condition.rb', line 320
def to_idl(cfg_arch); end
|
#to_logic_tree(expand:) ⇒ Object
136
|
# File 'lib/udb/condition.rb', line 136
def to_logic_tree(expand:); end
|
#to_logic_tree_internal ⇒ Object
140
|
# File 'lib/udb/condition.rb', line 140
def to_logic_tree_internal; end
|
#to_s(expand: false) ⇒ Object
325
|
# File 'lib/udb/condition.rb', line 325
def to_s(expand: false); end
|
#to_s_pretty ⇒ Object
329
|
# File 'lib/udb/condition.rb', line 329
def to_s_pretty; end
|
#to_s_with_value(cfg_arch, expand:) ⇒ Object
334
|
# File 'lib/udb/condition.rb', line 334
def to_s_with_value(cfg_arch, expand:); end
|
#to_yaml ⇒ Object
314
315
316
|
# File 'lib/udb/condition.rb', line 314
def to_yaml
YAML.dump(to_h)
end
|
#unsatisfiable? ⇒ Boolean
148
|
# File 'lib/udb/condition.rb', line 148
def unsatisfiable?; end
|
#unsatisfiable_by_arch?(cfg_arch) ⇒ Boolean
234
|
# File 'lib/udb/condition.rb', line 234
def unsatisfiable_by_arch?(cfg_arch); end
|
#unsatisfiable_by_cfg_arch?(cfg_arch) ⇒ Boolean
226
|
# File 'lib/udb/condition.rb', line 226
def unsatisfiable_by_cfg_arch?(cfg_arch); end
|
#|(other) ⇒ Object
389
|
# File 'lib/udb/condition.rb', line 389
def |(other); end
|