Class: Udb::PortfolioDesign
- Inherits:
-
Object
- Object
- Udb::PortfolioDesign
- Extended by:
- Forwardable
- Defined in:
- lib/udb/portfolio_design.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cfg_arch ⇒ ConfiguredArchitecture
readonly
The RISC-V architecture.
-
#name ⇒ String
readonly
Name of design.
-
#portfolio_class ⇒ PortfolioClass
readonly
Portfolio class for all the portfolios in this design.
-
#portfolio_design_type ⇒ String
readonly
Type of design suitable for human readers.
-
#portfolio_kind ⇒ String
readonly
Kind of portfolio for all portfolios in this design.
Class Method Summary collapse
- .portfolio_design_types ⇒ Object
- .proc_crd_type ⇒ Object
- .proc_ctp_type ⇒ Object
-
.profile_release_type ⇒ Object
Class methods.
Instance Method Summary collapse
-
#all_in_scope_exts_with_param(param) ⇒ Array<Extension>
Sorted list of all in-scope extensions that define this parameter in the database and the parameter is in-scope.
-
#all_in_scope_exts_without_param(param) ⇒ Array<Extension>
List of all in-scope extensions that define this parameter in the database but the parameter is out-of-scope.
-
#all_in_scope_params ⇒ Array<InScopeParameter>
Sorted list of parameters specified by any extension in portfolio.
-
#all_out_of_scope_params ⇒ Array<Parameter>
Sorted list of parameters out of scope across all in scope extensions.
-
#arch ⇒ Object
Provided for backwards-compatibility.
-
#csr_presence(csr_name) ⇒ String
Given an CSR
ext_name
, return the presence as a string. -
#erb_env(extra_inputs = {}) ⇒ Hash<String, Object>
Put this in a method so it can be easily overridden by subclasses.
-
#extension_presence(ext_name) ⇒ String
Given an extension
ext_name
, return the presence as a string. -
#fully_configured? ⇒ Boolean
A Portfolio corresponds to a partially-configured design.
- #implemented_ext_vers ⇒ Object
-
#in_scope_csrs ⇒ Array<Csr>
Unsorted list of all CSRs associated with extensions listed as mandatory or optional in portfolio.
-
#in_scope_exception_codes ⇒ Array<ExceptionCode>
Unsorted list of all in-scope exception codes.
-
#in_scope_ext_reqs ⇒ Array<ExtensionRequirement>
List of all mandatory or optional extension requirements referenced by this design.
-
#in_scope_extensions ⇒ Array<Extension>
List of all mandatory or optional extensions referenced by this design.
-
#in_scope_instructions ⇒ Array<Instruction>
Sorted list of all instructions associated with extensions listed as mandatory or optional in portfolio.
-
#in_scope_interrupt_codes ⇒ Array<ExceptionCode>
Unsorted list of all in-scope interrupt codes.
-
#in_scope_params(ext_req) ⇒ Array<InScopeParameter>
Sorted list of extension parameters from portfolio for given extension.
-
#include_erb(template_name, extra_inputs = {}) ⇒ String
Include a partial ERB template into a full ERB template.
-
#init_erb_binding(erb_binding) ⇒ Object
Called from tasks.rake file to add standard set of objects available to ERB templates.
-
#initialize(name, cfg_arch, portfolio_design_type, portfolios, portfolio_class) ⇒ PortfolioDesign
constructor
A new instance of PortfolioDesign.
-
#inspect ⇒ String
Returns a string representation of the object, suitable for debugging.
-
#instruction_presence(inst_name) ⇒ String
Given an instruction
ext_name
, return the presence as a string. -
#mandatory_ext_reqs ⇒ Array<ExtensionRequirement>
List of all mandatory extension requirements.
-
#out_of_scope_params(ext_name) ⇒ Array<Parameter>
Sorted list of parameters that are out of scope for named extension.
-
#param_values ⇒ Hash<String, String>
Fully-constrained parameter values (those with just one possible value for this design).
-
#params_with_value ⇒ Array<ParameterWithValue>
List of all parameters fully-constrained to one specific value.
-
#partially_configured? ⇒ Boolean
True if some parameters aren’t fully-constrained yet in the design.
-
#unconfigured? ⇒ Boolean
True if all parameters aren’t constrained at all in the design.
Constructor Details
#initialize(name, cfg_arch, portfolio_design_type, portfolios, portfolio_class) ⇒ PortfolioDesign
Returns a new instance of PortfolioDesign.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/udb/portfolio_design.rb', line 78 def initialize(name, cfg_arch, portfolio_design_type, portfolios, portfolio_class) raise ArgumentError, "cfg_arch must be an ConfiguredArchitecture but is a #{cfg_arch.class}" unless cfg_arch.is_a?(ConfiguredArchitecture) raise ArgumentError, "portfolio_design_type of #{portfolio_design_type} unknown" unless PortfolioDesign.portfolio_design_types.include?(portfolio_design_type) raise ArgumentError, "portfolios must be an Array<Portfolio> but is a #{portfolios.class}" unless portfolios.is_a?(Array) raise ArgumentError, "portfolio_class must be a PortfolioClass but is a #{portfolio_class.class}" unless portfolio_class.is_a?(PortfolioClass) @name = name.to_s.freeze @name_sym = @name.to_sym.freeze @cfg_arch = cfg_arch @portfolio_design_type = portfolio_design_type # The PortfolioGroup has an Array<Portfolio> inside it and forwards common Array methods to its internal Array. # Can call @portfolio_grp.each or @portfolio_grp.map and they are handled by the normal Array methods. @portfolio_grp = PortfolioGroup.new(name, portfolios) @portfolio_class = portfolio_class @portfolio_kind = portfolios[0].kind end |
Instance Attribute Details
#cfg_arch ⇒ ConfiguredArchitecture (readonly)
Returns The RISC-V architecture.
62 63 64 |
# File 'lib/udb/portfolio_design.rb', line 62 def cfg_arch @cfg_arch end |
#name ⇒ String (readonly)
Returns Name of design.
50 51 52 |
# File 'lib/udb/portfolio_design.rb', line 50 def name @name end |
#portfolio_class ⇒ PortfolioClass (readonly)
Returns Portfolio class for all the portfolios in this design.
53 54 55 |
# File 'lib/udb/portfolio_design.rb', line 53 def portfolio_class @portfolio_class end |
#portfolio_design_type ⇒ String (readonly)
Returns Type of design suitable for human readers.
59 60 61 |
# File 'lib/udb/portfolio_design.rb', line 59 def portfolio_design_type @portfolio_design_type end |
#portfolio_kind ⇒ String (readonly)
Returns Kind of portfolio for all portfolios in this design.
56 57 58 |
# File 'lib/udb/portfolio_design.rb', line 56 def portfolio_kind @portfolio_kind end |
Class Method Details
.portfolio_design_types ⇒ Object
71 |
# File 'lib/udb/portfolio_design.rb', line 71 def self.portfolio_design_types = [profile_release_type, proc_crd_type, proc_ctp_type] |
.proc_crd_type ⇒ Object
69 |
# File 'lib/udb/portfolio_design.rb', line 69 def self.proc_crd_type = "Certification Requirements Document" |
.proc_ctp_type ⇒ Object
70 |
# File 'lib/udb/portfolio_design.rb', line 70 def self.proc_ctp_type = "Certification Test Plan" |
.profile_release_type ⇒ Object
Class methods
68 |
# File 'lib/udb/portfolio_design.rb', line 68 def self.profile_release_type = "Profile Release" |
Instance Method Details
#all_in_scope_exts_with_param(param) ⇒ Array<Extension>
Returns Sorted list of all in-scope extensions that define this parameter in the database and the parameter is in-scope.
206 |
# File 'lib/udb/portfolio_design.rb', line 206 def all_in_scope_exts_with_param(param) = @portfolio_grp.all_in_scope_exts_with_param(param) |
#all_in_scope_exts_without_param(param) ⇒ Array<Extension>
Returns List of all in-scope extensions that define this parameter in the database but the parameter is out-of-scope.
211 |
# File 'lib/udb/portfolio_design.rb', line 211 def all_in_scope_exts_without_param(param) = @portfolio_grp.all_in_scope_exts_without_param(param) |
#all_in_scope_params ⇒ Array<InScopeParameter>
Returns Sorted list of parameters specified by any extension in portfolio.
190 |
# File 'lib/udb/portfolio_design.rb', line 190 def all_in_scope_params = @portfolio_grp.all_in_scope_params |
#all_out_of_scope_params ⇒ Array<Parameter>
Returns Sorted list of parameters out of scope across all in scope extensions.
197 |
# File 'lib/udb/portfolio_design.rb', line 197 def all_out_of_scope_params = @portfolio_grp.all_out_of_scope_params |
#arch ⇒ Object
Provided for backwards-compatibility
65 |
# File 'lib/udb/portfolio_design.rb', line 65 def arch = @cfg_arch |
#csr_presence(csr_name) ⇒ String
Given an CSR ext_name
, return the presence as a string. Returns the greatest presence string across all portfolios in this design. If the CSR name isn’t found in this design, return “-”.
187 |
# File 'lib/udb/portfolio_design.rb', line 187 def csr_presence(csr_name) = @portfolio_grp.csr_presence(csr_name) |
#erb_env(extra_inputs = {}) ⇒ Hash<String, Object>
Put this in a method so it can be easily overridden by subclasses.
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/udb/portfolio_design.rb', line 221 def erb_env(extra_inputs = {}) raise ArgumentError, "extra_inputs must be an Hash but is a #{extra_inputs.class}" unless extra_inputs.is_a?(Hash) h = { arch: cfg_arch, design: self, portfolio_design: self, portfolio_design_type: @portfolio_design_type, portfolio_class: @portfolio_class, portfolio_kind: @portfolio_kind, portfolios: @portfolio_grp.portfolios } h.merge!(extra_inputs) end |
#extension_presence(ext_name) ⇒ String
Given an extension ext_name
, return the presence as a string. Returns the greatest presence string across all portfolios in this design. If the extension name isn’t found in this design, return “-”.
177 |
# File 'lib/udb/portfolio_design.rb', line 177 def extension_presence(ext_name) = @portfolio_grp.extension_presence(ext_name) |
#fully_configured? ⇒ Boolean
A Portfolio corresponds to a partially-configured design. See the AbstractConfig class for details.
132 |
# File 'lib/udb/portfolio_design.rb', line 132 def fully_configured? = false |
#implemented_ext_vers ⇒ Object
122 123 124 125 126 |
# File 'lib/udb/portfolio_design.rb', line 122 def implemented_ext_vers # Only supported by fully-configured configurations and a portfolio corresponds to a # partially-configured configuration. See the AbstractConfig class for details. raise "Not supported for portfolio #{name}" end |
#in_scope_csrs ⇒ Array<Csr>
Returns Unsorted list of all CSRs associated with extensions listed as mandatory or optional in portfolio. Uses CSRs provided by the minimum version of the extension that meets the extension requirement. Factors in things like XLEN in design.
166 |
# File 'lib/udb/portfolio_design.rb', line 166 def in_scope_csrs = @portfolio_grp.in_scope_csrs(self) |
#in_scope_exception_codes ⇒ Array<ExceptionCode>
Returns Unsorted list of all in-scope exception codes.
169 |
# File 'lib/udb/portfolio_design.rb', line 169 def in_scope_exception_codes = @portfolio_grp.in_scope_exception_codes(self) |
#in_scope_ext_reqs ⇒ Array<ExtensionRequirement>
Returns List of all mandatory or optional extension requirements referenced by this design.
154 |
# File 'lib/udb/portfolio_design.rb', line 154 def in_scope_ext_reqs = @portfolio_grp.in_scope_ext_reqs |
#in_scope_extensions ⇒ Array<Extension>
Returns List of all mandatory or optional extensions referenced by this design.
151 |
# File 'lib/udb/portfolio_design.rb', line 151 def in_scope_extensions = @portfolio_grp.in_scope_extensions |
#in_scope_instructions ⇒ Array<Instruction>
Returns Sorted list of all instructions associated with extensions listed as mandatory or optional in portfolio. Uses instructions provided by the minimum version of the extension that meets the extension requirement. Factors in things like XLEN in design.
160 |
# File 'lib/udb/portfolio_design.rb', line 160 def in_scope_instructions = @portfolio_grp.in_scope_instructions(self) |
#in_scope_interrupt_codes ⇒ Array<ExceptionCode>
Returns Unsorted list of all in-scope interrupt codes.
172 |
# File 'lib/udb/portfolio_design.rb', line 172 def in_scope_interrupt_codes = @portfolio_grp.in_scope_interrupt_codes(self) |
#in_scope_params(ext_req) ⇒ Array<InScopeParameter>
Returns Sorted list of extension parameters from portfolio for given extension.
194 |
# File 'lib/udb/portfolio_design.rb', line 194 def in_scope_params(ext_req) = @portfolio_grp.in_scope_params(ext_req) |
#include_erb(template_name, extra_inputs = {}) ⇒ String
Include a partial ERB template into a full ERB template.
251 252 253 254 |
# File 'lib/udb/portfolio_design.rb', line 251 def include_erb(template_name, extra_inputs = {}) template_pname = "portfolio/templates/#{template_name}" partial(template_pname, erb_env(extra_inputs)) end |
#init_erb_binding(erb_binding) ⇒ Object
Called from tasks.rake file to add standard set of objects available to ERB templates.
238 239 240 241 242 243 244 |
# File 'lib/udb/portfolio_design.rb', line 238 def init_erb_binding(erb_binding) raise ArgumentError, "Expected Binding object but got #{erb_binding.class}" unless erb_binding.is_a?(Binding) erb_env.each do |key, obj| erb_binding.local_variable_set(key, obj) end end |
#inspect ⇒ String
Returns a string representation of the object, suitable for debugging.
99 |
# File 'lib/udb/portfolio_design.rb', line 99 def inspect = "PortfolioDesign##{name}" |
#instruction_presence(inst_name) ⇒ String
Given an instruction ext_name
, return the presence as a string. Returns the greatest presence string across all portfolios in this design. If the instruction name isn’t found in this design, return “-”.
182 |
# File 'lib/udb/portfolio_design.rb', line 182 def instruction_presence(inst_name) = @portfolio_grp.instruction_presence(inst_name) |
#mandatory_ext_reqs ⇒ Array<ExtensionRequirement>
Returns List of all mandatory extension requirements.
145 |
# File 'lib/udb/portfolio_design.rb', line 145 def mandatory_ext_reqs = @portfolio_grp.mandatory_ext_reqs |
#out_of_scope_params(ext_name) ⇒ Array<Parameter>
Returns Sorted list of parameters that are out of scope for named extension.
201 |
# File 'lib/udb/portfolio_design.rb', line 201 def out_of_scope_params(ext_name) = @portfolio_grp.out_of_scope_params(ext_name) |
#param_values ⇒ Hash<String, String>
Returns Fully-constrained parameter values (those with just one possible value for this design).
148 |
# File 'lib/udb/portfolio_design.rb', line 148 def param_values = @portfolio_grp.param_values |
#params_with_value ⇒ Array<ParameterWithValue>
Returns List of all parameters fully-constrained to one specific value.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/udb/portfolio_design.rb', line 106 def params_with_value return @params_with_value unless @params_with_value.nil? @params_with_value = [] in_scope_ext_reqs.each do |ext_req| ext_req.extension.params.each do |param| next unless param_values.key?(param.name) @params_with_value << ParameterWithValue.new(param, param_values[param.name]) end end @params_with_value end |
#partially_configured? ⇒ Boolean
Returns True if some parameters aren’t fully-constrained yet in the design.
135 |
# File 'lib/udb/portfolio_design.rb', line 135 def partially_configured? = true |
#unconfigured? ⇒ Boolean
Returns True if all parameters aren’t constrained at all in the design.
138 |
# File 'lib/udb/portfolio_design.rb', line 138 def unconfigured? = false |