Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs in Instruction.exists_in_design? method (was called exists_in_cfg). #387

Open
james-ball-qualcomm opened this issue Jan 2, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@james-ball-qualcomm
Copy link
Collaborator

See the comments I added to this code:

 # @param design [Design] The design
  # @return [Boolean] whether or not the instruction is implemented given the supplied design
  #
  # TODO: Does this function actually work for a partially configured design? 
  #       It is calling DatabaseObject.defined_by? with ExtensionRequirement objects
  #       returned from Design.prohibited_ext_reqs() and Design.mandatory_ext_reqs()
  #       but only accepts an ExtensionVersion object.
  def exists_in_design?(design)
    if design.fully_configured?
      (@data["base"].nil? || (design.possible_xlens.include?(@data["base"]))) &&
        design.implemented_ext_vers.any? { |ext_ver| defined_by?(ext_ver) } &&
        design.implemented_ext_vers.none? { |ext_ver| excluded_by?(ext_ver) }
    else
      raise "unexpected design type" unless design.partially_configured?

      (@data["base"].nil? || (design.possible_xlens.include?(@data["base"]))) &&
        design.prohibited_ext_reqs.none? { |ext_req| defined_by?(ext_req) } &&
        design.mandatory_ext_reqs.none? { |ext_req| excluded_by?(ext_req) }
    end
  end

Should probably look more like this code from CSR field:

@param possible_xlens [Array] List of xlens that be used in any implemented mode

@param extensions [Array] List of extensions implemented

@return [Boolean] whether or not the instruction is implemented given the supplies config options

def exists_in_design?(design)
if design.fully_configured?
parent.exists_in_design?(design) &&
(@DaTa["base"].nil? || design.possible_xlens.include?(@DaTa["base"])) &&
(@DaTa["definedBy"].nil? || design.transitive_implemented_ext_vers.any? { |ext_ver| defined_by?(ext_ver) })
else
raise "unexpected type" unless design.partially_configured?

  parent.exists_in_design?(design) &&
    (@data["base"].nil? || design.possible_xlens.include?(@data["base"])) &&
    (@data["definedBy"].nil? || design.prohibited_ext_reqs.none? { |ext_req| ext_req.satisfying_versions.any? { |ext_ver| defined_by?(ext_ver) } })
end

end

@james-ball-qualcomm james-ball-qualcomm added the bug Something isn't working label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants