Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions lib/arch_obj_models/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,28 @@ def csrs
@csrs = arch_def.csrs.select { |csr| csr.defined_by?(ExtensionVersion.new(name, max_version)) }
end

# @return [Array<Csr>] the list of CSRs implemented by this extension (may be empty)
def implemented_csrs(archdef)
raise "should only be called with a fully configured arch def" unless archdef.fully_configured?

return @implemented_csrs unless @implemented_csrs.nil?

@implemented_csrs = archdef.implemented_csrs.select do |csr|
versions.any? { |ver| csr.defined_by?(ExtensionVersion.new(name, ver["version"])) }
end
end

# @return [Array<Csr>] the list of CSRs implemented by this extension (may be empty)
def implemented_instructions(archdef)
raise "should only be called with a fully configured arch def" unless archdef.fully_configured?

return @implemented_instructions unless @implemented_instructions.nil?

@implemented_instructions = archdef.implemented_instructions.select do |inst|
versions.any? { |ver| inst.defined_by?(ExtensionVersion.new(name, ver["version"])) }
end
end

# return the set of reachable functions from any of this extensions's CSRs or instructions in the given evaluation context
#
# @param symtab [Idl::SymbolTable] The evaluation context
Expand Down Expand Up @@ -329,6 +351,28 @@ def <=>(other)
@version <=> other.version
end
end

# @return [Array<Csr>] the list of CSRs implemented by this extension version (may be empty)
def implemented_csrs(archdef)
raise "should only be called with a fully configured arch def" unless archdef.fully_configured?

return @implemented_csrs unless @implemented_csrs.nil?

@implemented_csrs = archdef.implemented_csrs.select do |csr|
csr.defined_by?(self)
end
end

# @return [Array<Csr>] the list of CSRs implemented by this extension version (may be empty)
def implemented_instructions(archdef)
raise "should only be called with a fully configured arch def" unless archdef.fully_configured?

return @implemented_instructions unless @implemented_instructions.nil?

@implemented_instructions = archdef.implemented_instructions.select do |inst|
inst.defined_by?(self)
end
end
end

# Represents an extension requirement, that is an extension name paired with version requirement(s)
Expand Down
Loading