diff --git a/arch/crd/MC-1.yaml b/arch/crd/MC-1.yaml index c7d3d9980d..05d7ce6990 100644 --- a/arch/crd/MC-1.yaml +++ b/arch/crd/MC-1.yaml @@ -4,6 +4,9 @@ MC-1: name: MC-1 long_name: LONG NAME family: Microcontroller + + mandatory_priv_modes: + - M # semantic version within the CRD family version: "1.0" diff --git a/arch/crd/MockCRD-1.yaml b/arch/crd/MockCRD-1.yaml index 3d70427125..3d81a4855f 100644 --- a/arch/crd/MockCRD-1.yaml +++ b/arch/crd/MockCRD-1.yaml @@ -5,6 +5,9 @@ MockCRD-1: long_name: Mock CRD Long Name family: MockCRDFamily + + mandatory_priv_modes: + - M,U # XLEN used by rakefile base: 64 diff --git a/arch/crd_family/Microcontroller.yaml b/arch/crd_family/Microcontroller.yaml index 3dba4f9af7..d2e0b12536 100644 --- a/arch/crd_family/Microcontroller.yaml +++ b/arch/crd_family/Microcontroller.yaml @@ -76,7 +76,4 @@ Microcontroller: ** A release only provides specification clarifications and doesn’t change requirements. The initial minor release has an implicit patch release value of “.0” so the first update to a minor release has a patch release of “.1”. ** For example, the first release of MC is MC-1 (can omit the implicit “.0” minor release), its first minor release is MC-1.1, a patch release of this minor release is MC-1.1.1 and the next major release is MC-2. * \<-MODE> is -Unpriv, -Priv, or -Debug. If \<-MODE> is omitted, the reference applies equally to all modes. - * \<-XLEN> is -32 for 32-bit microcontrollers and -64 for 64-bit microcontrollers. If \<-XLEN> is omitted, the reference applies equally to 32-bit and 64-bit microcontrollers. The term MXLEN used in the Priv ISA Manual is always equal to XLEN for MC. - - mandatory_priv_modes: - - M + * \<-XLEN> is -32 for 32-bit microcontrollers and -64 for 64-bit microcontrollers. If \<-XLEN> is omitted, the reference applies equally to 32-bit and 64-bit microcontrollers. The term MXLEN used in the Priv ISA Manual is always equal to XLEN for MC. \ No newline at end of file diff --git a/arch/crd_family/MockCRDFamily.yaml b/arch/crd_family/MockCRDFamily.yaml index d2a2bdeca7..370949eeb2 100644 --- a/arch/crd_family/MockCRDFamily.yaml +++ b/arch/crd_family/MockCRDFamily.yaml @@ -15,7 +15,4 @@ MockCRDFamily: Here's the Mock CRD Family's introduction. naming_scheme: | - Here's the Mock CRD Family's naming scheme. - - mandatory_priv_modes: - - M \ No newline at end of file + Here's the Mock CRD Family's naming scheme. \ No newline at end of file diff --git a/backends/crd_doc/templates/crd.adoc.erb b/backends/crd_doc/templates/crd.adoc.erb index e17221661a..da3c5c1889 100644 --- a/backends/crd_doc/templates/crd.adoc.erb +++ b/backends/crd_doc/templates/crd.adoc.erb @@ -42,13 +42,15 @@ a| <% rev.changes.each do |change| %> CSR field colors:: -* Grey fields are reserved (WPRI) -* Green fields are present -* Red fields are defined by the RISC-V ISA but not present +* [green]#Green fields# are present in the associated CRD. +* [red]#Red fields# are defined by the RISC-V ISA but not required in the associated CRD. +* [silver]#Grey fields# are reserved for future use by RISC-V (AKA WPRI). Software should ignore the values read from +these fields and should preserve the values held in these fields when writing values to other fields. +For forward compatibility, implementations that do not furnish these fields must make them read-only zero. CSR field types:: -[%autowidth] +[cols="1,6"] |=== | Abbreviation | Description @@ -83,16 +85,16 @@ CSR field types:: | <%= crd.debug_manual_revision %> |=== -=== Privileged Modes +=== <%= crd.name %> Privileged Modes |=== | M | S | U | VS | VU -| <% if crd.family.mandatory_priv_modes.include?('M') -%> MANDATORY <% else -%> OUT-OF-SCOPE <% end -%> -| <% if crd.family.mandatory_priv_modes.include?('S') -%> MANDATORY <% else -%> OUT-OF-SCOPE <% end -%> -| <% if crd.family.mandatory_priv_modes.include?('U') -%> MANDATORY <% else -%> OUT-OF-SCOPE <% end -%> -| <% if crd.family.mandatory_priv_modes.include?('VS') -%> MANDATORY <% else -%> OUT-OF-SCOPE <% end -%> -| <% if crd.family.mandatory_priv_modes.include?('VU') -%> MANDATORY <% else -%> OUT-OF-SCOPE <% end -%> +| <% if crd.m_mode? -%> MANDATORY <% else -%> OUT-OF-SCOPE <% end -%> +| <% if crd.s_mode? -%> MANDATORY <% else -%> OUT-OF-SCOPE <% end -%> +| <% if crd.u_mode? -%> MANDATORY <% else -%> OUT-OF-SCOPE <% end -%> +| <% if crd.vs_mode? -%> MANDATORY <% else -%> OUT-OF-SCOPE <% end -%> +| <% if crd.vu_mode? -%> MANDATORY <% else -%> OUT-OF-SCOPE <% end -%> |=== diff --git a/lib/arch_obj_models/crd.rb b/lib/arch_obj_models/crd.rb index a83abd998e..1b1106f363 100644 --- a/lib/arch_obj_models/crd.rb +++ b/lib/arch_obj_models/crd.rb @@ -63,8 +63,6 @@ def initialize(data, arch_def) @arch_def = arch_def end - def mandatory_priv_modes = @data["mandatory_priv_modes"] - def revisions return @revisions unless @revisions.nil? @@ -118,6 +116,33 @@ def family @family = fam end + def mandatory_priv_modes = @data["mandatory_priv_modes"] + + # @return [true/false] + def m_mode? + mandatory_priv_modes.include?('M') + end + + # @return [true/false] + def s_mode? + mandatory_priv_modes.include?('S') + end + + # @return [true/false] + def u_mode? + mandatory_priv_modes.include?('U') + end + + # @return [true/false] + def vs_mode? + mandatory_priv_modes.include?('VS') + end + + # @return [true/false] + def vu_mode? + mandatory_priv_modes.include?('VU') + end + def tsc_profile return nil if @data["tsc_profile"].nil?