Skip to content

Commit ec8e3d4

Browse files
Adding comments, debug messages, fixing spelling
1 parent f6dc761 commit ec8e3d4

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

cert_flow.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bootstrap_cert_model = bootstrap_cfg_arch.cert_model(cert_model_name = "MC100-32
2020
@cfg_arch = arch # rv32 (nil if Architecture object provided)
2121
@specification = arch # rv32
2222
cfg_arch = bootstrap_cert_model.to_cfg_arch # In Portfolio class
23-
Creates hash with mandatory extensions (with version requirement) and params
23+
Creates hash with mandatory extensions (with version requirement) and fully-constrained params (single_value?)
2424
Uses in_scope_ext_reqs() and all_in_scope_ext_params() in Portfolio
2525
Writes hash to yaml file in /tmp/.../MC100-32/cfg.yaml
2626
Passes yaml file to ConfiguredArchitecture.new()
@@ -47,7 +47,7 @@ mandatory_extensions:
4747
- name: "Sm"
4848
version: ">= 0"
4949
===============================================================================================
50-
Example of /tmp/.../MC100-32/cfg.yaml
50+
Bootstrap /tmp/.../MC100-32/cfg.yaml
5151
---
5252
"$schema": config_schema.json
5353
type: partially configured

lib/architecture.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Contains the "database" of RISC-V standards including extensions, instructions,
44
# CSRs, Profiles, and Certificates. Could be either the standard spec (defined by RISC-V International)
5-
# of a custom spec (defined as an arch_overlay in cfgs/).
5+
# of a custom spec (defined as an arch_overlay in /cfgs dir).
66
#
77
# Creates Ruby functions at runtime (see generate_obj_methods() and OBJS array).
88
# 1) Function to return Array<klass> (every klass in database)
@@ -22,7 +22,7 @@
2222
# Manual manuals() manual_hash() manual(name)
2323
# ManualVersion manual_versions() manual_version_hash() manual_version(name)
2424
#
25-
# Statically created Ruby functions:
25+
# Normal Ruby functions:
2626
#
2727
# klass Array<klass> Hash<String name,klass> Klass func(String name)
2828
# ================== ================== ======================= =========================

lib/config.rb

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ def configured? = @data["type"] != "unconfigured"
6363
def type = @data["type"]
6464
end
6565

66-
# this class represents a configuration file (e.g., cfgs/*/cfg.yaml) that is "unconfigured"
67-
# (i.e., we don't know any implemented/mandatory extensions or parameter values)
66+
#################################################################
67+
# This class represents a configuration that is "unconfigured". #
68+
# It doesn't know anything about extensions or parameters. #
69+
#################################################################
6870
class Unconfig < Config
6971
attr_reader :param_values
7072

@@ -76,15 +78,15 @@ def initialize(cfg_file_path, data)
7678

7779
def mxlen = nil
7880

79-
def implemented_extensions = raise "implemented_extensions is only availabe for a FullConfig"
80-
def mandatory_extensions = raise "mandatory_extensions is only availabe for a PartialConfig"
81-
def prohibited_extensions = raise "prohibited_extensions is only availabe for a PartialConfig"
81+
def implemented_extensions = raise "implemented_extensions is only available for a FullConfig"
82+
def mandatory_extensions = raise "mandatory_extensions is only available for a PartialConfig"
83+
def prohibited_extensions = raise "prohibited_extensions is only available for a PartialConfig"
8284
end
8385

84-
# this class represents a configuration file (e.g., cfgs/*/cfg.yaml) that is "partially configured"
85-
# (i.e., we have a list of mandatory/prohibited extensions and a paritial list of parameter values)
86-
#
87-
# This would, for example, represent a Profile or configurable IP
86+
##############################################################################################################
87+
# This class represents a configuration that is "partially-configured" (e.g., portfolio or configurable IP). #
88+
# It only lists mandatory & prohibited extensions and fully-constrained parameters (single value).
89+
##############################################################################################################
8890
class PartialConfig < Config
8991
attr_reader :param_values, :mxlen
9092

@@ -99,15 +101,16 @@ def initialize(cfg_file_path, data)
99101
@mxlen.freeze
100102
end
101103

102-
def implemented_extensions = raise "implemented_extensions is only availabe for a FullConfig"
104+
def implemented_extensions = raise "implemented_extensions is only available for a FullConfig"
103105

104106
# @return [Array<Hash{String => String,Array<String}>]
105107
# List of all extensions that must be implemented, as specified in the config file
106108
# The first entry in the nested array is an Extension name.
107109
# The second entry in the nested array is an Extension version requirement
108110
#
109111
# @example
110-
# partial_config.mandatory_extensions #=> [{ "name" => "A", "version" => ["~> 2.0"] }, { "name" => "B", "version" => ["~> 1.0"] }, ...]
112+
# partial_config.mandatory_extensions =>
113+
# [{ "name" => "A", "version" => ["~> 2.0"] }, { "name" => "B", "version" => ["~> 1.0"] }, ...]
111114
def mandatory_extensions
112115
@mandatory_extensions ||=
113116
if @data["mandatory_extensions"].nil?
@@ -126,7 +129,8 @@ def mandatory_extensions
126129
# The second entry in the nested array is an Extension version requirement.
127130
#
128131
# @example
129-
# partial_config.prohibited_extensions #=> [{ "name" => "F", "version" => [">= 2.0"] }, { "name" => "Zfa", "version" => ["> = 1.0"] }, ...]
132+
# partial_config.prohibited_extensions =>
133+
# [{ "name" => "F", "version" => [">= 2.0"] }, { "name" => "Zfa", "version" => ["> = 1.0"] }, ...]
130134
def prohibited_extensions
131135
@prohibited_extensions ||=
132136
if @data["prohibited_extensions"].nil?
@@ -144,10 +148,10 @@ def prohibited_extensions
144148
# def ext?(ext_name, cfg_arch) = mandatory_extensions(cfg_arch).any? { |e| e.name == ext_name.to_s }
145149
end
146150

147-
# this class represents a configuration file (e.g., cfgs/*/cfg.yaml) that is "fully configured"
148-
# (i.e., we have a complete list of implemented extensions and a complete list of parameter values)
149-
#
150-
# This would, for example, represent a specific silicon tapeout/SKU
151+
################################################################################################################
152+
# This class represents a configuration that is "fully-configured" (e.g., SoC tapeout or fully-configured IP). #
153+
# It has a complete list of extensions and parameters (all are a single value at this point). #
154+
################################################################################################################
151155
class FullConfig < Config
152156
attr_reader :param_values, :mxlen
153157

@@ -176,8 +180,8 @@ def implemented_extensions
176180
end
177181
end
178182

179-
def mandatory_extensions = raise "mandatory_extensions is only availabe for a PartialConfig"
180-
def prohibited_extensions = raise "prohibited_extensions is only availabe for a PartialConfig"
183+
def mandatory_extensions = raise "mandatory_extensions is only available for a PartialConfig"
184+
def prohibited_extensions = raise "prohibited_extensions is only available for a PartialConfig"
181185

182186
# def prohibited_ext?(ext_name, cfg_arch) = !ext?(ext_name, cfg_arch)
183187
# def ext?(ext_name, cfg_arch) = implemented_extensions(cfg_arch).any? { |e| e.name == ext_name.to_s }

0 commit comments

Comments
 (0)