From 4ab355b3a349e40468f127c15cbb5c7bd59caab5 Mon Sep 17 00:00:00 2001 From: James Ball Date: Fri, 2 May 2025 17:02:24 +0000 Subject: [PATCH 1/6] fix: avoid Sorbet errors and improve consistency of database to avoid nil --- .sorbet-config | 16 +++---- arch/manual/isa.yaml | 1 + .../isa/20240411/isa_20240411.yaml | 1 + arch/profile/MP-S-64.yaml | 1 + arch/profile/MP-U-64.yaml | 1 + arch/profile/RVA20S64.yaml | 1 + arch/profile/RVA20U64.yaml | 1 + arch/profile/RVA22S64.yaml | 1 + arch/profile/RVA22U64.yaml | 1 + arch/profile/RVA23M64.yaml | 1 + arch/profile/RVA23S64.yaml | 1 + arch/profile/RVA23U64.yaml | 1 + arch/profile/RVB23M64.yaml | 1 + arch/profile/RVB23S64.yaml | 1 + arch/profile/RVB23U64.yaml | 1 + arch/profile/RVI20U32.yaml | 1 + arch/profile/RVI20U64.yaml | 1 + arch/profile_class/Mock.yaml | 1 + arch/profile_class/RVA.yaml | 1 + arch/profile_class/RVB.yaml | 1 + arch/profile_class/RVI.yaml | 1 + arch/profile_release/Mock.yaml | 1 + arch/profile_release/RVA20.yaml | 1 + arch/profile_release/RVA22.yaml | 1 + arch/profile_release/RVA23.yaml | 1 + arch/profile_release/RVB23.yaml | 1 + arch/profile_release/RVI20.yaml | 3 ++ lib/arch_obj_models/cert_test_procedure.rb | 45 ++++++++++++------- lib/arch_obj_models/csr_field.rb | 4 +- lib/arch_obj_models/database_obj.rb | 15 ++++--- schemas/csr_schema.json | 6 +-- schemas/ext_schema.json | 3 +- schemas/inst_schema.json | 3 +- schemas/manual_schema.json | 6 ++- schemas/manual_version_schema.json | 5 +++ schemas/proc_cert_model_schema.json | 2 +- schemas/profile_class_schema.json | 6 ++- schemas/profile_release_schema.json | 6 ++- schemas/profile_schema.json | 6 ++- 39 files changed, 106 insertions(+), 45 deletions(-) diff --git a/.sorbet-config b/.sorbet-config index 99082b0e1..d245bfdc3 100644 --- a/.sorbet-config +++ b/.sorbet-config @@ -1,10 +1,8 @@ --dir -lib ---dir -sorbet/rbi ---file -Rakefile ---file -backends/ext_pdf_doc/idl_lexer.rb ---file -backends/cpp_hart_gen/lib/template_helpers.rb +. +--ignore +ext +--ignore +.home/.gems +--ignore +node_modules diff --git a/arch/manual/isa.yaml b/arch/manual/isa.yaml index 85a85c92e..74ffc773f 100644 --- a/arch/manual/isa.yaml +++ b/arch/manual/isa.yaml @@ -3,6 +3,7 @@ $schema: manual_schema.json# kind: manual name: isa +long_name: Entire RISC-V ISA marketing_name: RISC-V ISA Manual url: https://github.com/riscv/riscv-isa-manual license: diff --git a/arch/manual_version/isa/20240411/isa_20240411.yaml b/arch/manual_version/isa/20240411/isa_20240411.yaml index cf4ad8100..5268a1a6f 100644 --- a/arch/manual_version/isa/20240411/isa_20240411.yaml +++ b/arch/manual_version/isa/20240411/isa_20240411.yaml @@ -5,6 +5,7 @@ kind: manual version manual: { $ref: manual/isa.yaml# } version: "4.0.0-pre" name: "isa_20240411" +long_name: "Release 20240411 of the RISC-V ISA Manuals" marketing_version: "20240411" state: "development" url: https://github.com/riscv/releases/tag/20240411 diff --git a/arch/profile/MP-S-64.yaml b/arch/profile/MP-S-64.yaml index 8311821ef..a8bd360b1 100644 --- a/arch/profile/MP-S-64.yaml +++ b/arch/profile/MP-S-64.yaml @@ -3,6 +3,7 @@ $schema: profile_schema.json# kind: profile name: MP-S-64 +long_name: S-mode extensions for a Mock 64-bit Apps Processor profile marketing_name: MockProfile 64-bit S-mode description: This is the Mock Profile Supervisor Mode description. mode: S diff --git a/arch/profile/MP-U-64.yaml b/arch/profile/MP-U-64.yaml index 8d84a8727..6325feb1a 100644 --- a/arch/profile/MP-U-64.yaml +++ b/arch/profile/MP-U-64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: MP-U-64 +long_name: U-mode extensions for a Mock 64-bit Apps Processor profile marketing_name: MockProfile 64-bit Unpriv mode: Unpriv base: 64 diff --git a/arch/profile/RVA20S64.yaml b/arch/profile/RVA20S64.yaml index 02b650ad3..abd4f5fcd 100644 --- a/arch/profile/RVA20S64.yaml +++ b/arch/profile/RVA20S64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVA20S64 +long_name: S-mode extensions for version 20 of the 64-bit Apps Processor profile marketing_name: RVA20S64 mode: S base: 64 diff --git a/arch/profile/RVA20U64.yaml b/arch/profile/RVA20U64.yaml index ba563e773..e48af20f1 100644 --- a/arch/profile/RVA20U64.yaml +++ b/arch/profile/RVA20U64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVA20U64 +long_name: U-mode extensions for version 20 of the 64-bit Apps Processor profile marketing_name: RVA20U64 mode: Unpriv base: 64 diff --git a/arch/profile/RVA22S64.yaml b/arch/profile/RVA22S64.yaml index 9a94c1682..ac2a70b3a 100644 --- a/arch/profile/RVA22S64.yaml +++ b/arch/profile/RVA22S64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVA22S64 +long_name: S-mode extensions for version 22 of the 64-bit Apps Processor profile marketing_name: RVA22S64 mode: S base: 64 diff --git a/arch/profile/RVA22U64.yaml b/arch/profile/RVA22U64.yaml index 7e3b1c0f0..f3f1a595a 100644 --- a/arch/profile/RVA22U64.yaml +++ b/arch/profile/RVA22U64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVA22U64 +long_name: U-mode extensions for version 22 of the 64-bit Apps Processor profile marketing_name: RVA22U64 mode: Unpriv base: 64 diff --git a/arch/profile/RVA23M64.yaml b/arch/profile/RVA23M64.yaml index 4ef7338aa..daa427054 100644 --- a/arch/profile/RVA23M64.yaml +++ b/arch/profile/RVA23M64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVA23M64 +long_name: M-mode extensions for version 23 of the 64-bit Apps Processor profile (not ratified) marketing_name: RVA23M64 mode: M base: 64 diff --git a/arch/profile/RVA23S64.yaml b/arch/profile/RVA23S64.yaml index 17dbbf6a2..c2029b1e8 100644 --- a/arch/profile/RVA23S64.yaml +++ b/arch/profile/RVA23S64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVA23S64 +long_name: S-mode extensions for version 23 of the 64-bit Apps Processor profile marketing_name: RVA23S64 mode: S base: 64 diff --git a/arch/profile/RVA23U64.yaml b/arch/profile/RVA23U64.yaml index 00c9206bc..37733aef0 100644 --- a/arch/profile/RVA23U64.yaml +++ b/arch/profile/RVA23U64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVA23U64 +long_name: U-mode extensions for version 23 of the 64-bit Apps Processor profile marketing_name: RVA23U64 mode: Unpriv base: 64 diff --git a/arch/profile/RVB23M64.yaml b/arch/profile/RVB23M64.yaml index 37964eb13..f66702335 100644 --- a/arch/profile/RVB23M64.yaml +++ b/arch/profile/RVB23M64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVB23M64 +long_name: M-mode extensions for version 23 of the 64-bit Bespoke Apps Processor profile (not ratified) marketing_name: RVB23M64 mode: M base: 64 diff --git a/arch/profile/RVB23S64.yaml b/arch/profile/RVB23S64.yaml index daec5e7d3..cdaae6ab4 100644 --- a/arch/profile/RVB23S64.yaml +++ b/arch/profile/RVB23S64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVB23S64 +long_name: S-mode extensions for version 23 of the 64-bit Bespoke Apps Processor profile marketing_name: RVB23S64 mode: S base: 64 diff --git a/arch/profile/RVB23U64.yaml b/arch/profile/RVB23U64.yaml index 3cb1631ec..78943641b 100644 --- a/arch/profile/RVB23U64.yaml +++ b/arch/profile/RVB23U64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVB23U64 +long_name: U-mode extensions for version 23 of the 64-bit Bespoke Apps Processor profile marketing_name: RVB23U64 mode: Unpriv base: 64 diff --git a/arch/profile/RVI20U32.yaml b/arch/profile/RVI20U32.yaml index f2e2ea400..73770625b 100644 --- a/arch/profile/RVI20U32.yaml +++ b/arch/profile/RVI20U32.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVI20U32 +long_name: U-mode extensions for version 20 of a 32-bit processor marketing_name: RVI20U32 mode: Unpriv base: 32 diff --git a/arch/profile/RVI20U64.yaml b/arch/profile/RVI20U64.yaml index aa84d2e41..58bd823da 100644 --- a/arch/profile/RVI20U64.yaml +++ b/arch/profile/RVI20U64.yaml @@ -1,6 +1,7 @@ $schema: profile_schema.json# kind: profile name: RVI20U64 +long_name: U-mode extensions for version 20 of a 64-bit processor $inherits: "profile/RVI20U32.yaml#" base: 64 marketing_name: RVI20U64 diff --git a/arch/profile_class/Mock.yaml b/arch/profile_class/Mock.yaml index eb2790990..60e0ae198 100644 --- a/arch/profile_class/Mock.yaml +++ b/arch/profile_class/Mock.yaml @@ -2,6 +2,7 @@ $schema: profile_class_schema.json# kind: profile class processor_kind: Microcontroller name: Mock +long_name: Mock Profile Class marketing_name: Mock Profile Class introduction: Here's the Mock Profile Class introduction. description: | diff --git a/arch/profile_class/RVA.yaml b/arch/profile_class/RVA.yaml index f90ddfe13..0ac2ffccf 100644 --- a/arch/profile_class/RVA.yaml +++ b/arch/profile_class/RVA.yaml @@ -4,6 +4,7 @@ $schema: profile_class_schema.json# kind: profile class processor_kind: Apps Processor name: RVA +long_name: Apps Processor profile class for Rich Operating Systems requiring binary-compatibility marketing_name: RVA introduction: | The RVA profile class targets application processors for markets diff --git a/arch/profile_class/RVB.yaml b/arch/profile_class/RVB.yaml index 3aa2786fd..e73e2f7cb 100644 --- a/arch/profile_class/RVB.yaml +++ b/arch/profile_class/RVB.yaml @@ -2,6 +2,7 @@ $schema: profile_class_schema.json# kind: profile class processor_kind: Apps Processor name: RVB +long_name: Apps Processor profile class for Bespoke Rich Operating System marketing_name: RVB introduction: | The RVB profile class targets application processors for markets diff --git a/arch/profile_class/RVI.yaml b/arch/profile_class/RVI.yaml index 7bcf2aad3..5aa3d7b2f 100644 --- a/arch/profile_class/RVI.yaml +++ b/arch/profile_class/RVI.yaml @@ -2,6 +2,7 @@ $schema: profile_class_schema.json# kind: profile class processor_kind: Generic Unprivileged name: RVI +long_name: Unprivileged nstructions marketing_name: RVI introduction: The RVI profile class documents the initial set of unprivileged instructions. description: | diff --git a/arch/profile_release/Mock.yaml b/arch/profile_release/Mock.yaml index 3c6a6c775..71d1a3d42 100644 --- a/arch/profile_release/Mock.yaml +++ b/arch/profile_release/Mock.yaml @@ -1,6 +1,7 @@ $schema: profile_release_schema.json# kind: profile release name: Mock +long_name: Mock marketing_name: Mock Profile Release Marketing Name class: $ref: profile_class/Mock.yaml# diff --git a/arch/profile_release/RVA20.yaml b/arch/profile_release/RVA20.yaml index 59715da25..a29bc1a44 100644 --- a/arch/profile_release/RVA20.yaml +++ b/arch/profile_release/RVA20.yaml @@ -1,6 +1,7 @@ $schema: profile_release_schema.json# kind: profile release name: RVA20 +long_name: RVA20 marketing_name: RVA20 class: $ref: profile_class/RVA.yaml# diff --git a/arch/profile_release/RVA22.yaml b/arch/profile_release/RVA22.yaml index 7a3350a15..82c5fc3bd 100644 --- a/arch/profile_release/RVA22.yaml +++ b/arch/profile_release/RVA22.yaml @@ -1,6 +1,7 @@ $schema: profile_release_schema.json# kind: profile release name: RVA22 +long_name: RVA22 marketing_name: RVA22 class: $ref: profile_class/RVA.yaml# diff --git a/arch/profile_release/RVA23.yaml b/arch/profile_release/RVA23.yaml index a883d8a8b..11a846558 100644 --- a/arch/profile_release/RVA23.yaml +++ b/arch/profile_release/RVA23.yaml @@ -1,6 +1,7 @@ $schema: profile_release_schema.json# kind: profile release name: RVA23 +long_name: RVA23 marketing_name: RVA23 class: $ref: profile_class/RVA.yaml# diff --git a/arch/profile_release/RVB23.yaml b/arch/profile_release/RVB23.yaml index 53eae651a..8eb2057ce 100644 --- a/arch/profile_release/RVB23.yaml +++ b/arch/profile_release/RVB23.yaml @@ -1,6 +1,7 @@ $schema: profile_release_schema.json# kind: profile release name: RVB23 +long_name: RVB23 marketing_name: RVB23 class: $ref: profile_class/RVB.yaml# diff --git a/arch/profile_release/RVI20.yaml b/arch/profile_release/RVI20.yaml index a1a283f03..9369134b5 100644 --- a/arch/profile_release/RVI20.yaml +++ b/arch/profile_release/RVI20.yaml @@ -1,6 +1,7 @@ $schema: profile_release_schema.json# kind: profile release name: RVI20 +long_name: RVI20 marketing_name: RVI20 class: $ref: profile_class/RVI.yaml# @@ -21,3 +22,5 @@ contributors: profiles: - { $ref: profile/RVI20U32.yaml# } - { $ref: profile/RVI20U64.yaml# } +description: | + This profile release defines the RISC-V base ISA unprivileged instructions. diff --git a/lib/arch_obj_models/cert_test_procedure.rb b/lib/arch_obj_models/cert_test_procedure.rb index d99a5c3ec..a0155edd3 100644 --- a/lib/arch_obj_models/cert_test_procedure.rb +++ b/lib/arch_obj_models/cert_test_procedure.rb @@ -1,28 +1,43 @@ # frozen_string_literal: true +# typed: true + +require "sorbet-runtime" class CertTestProcedure + extend T::Sig + + # @return [String] Unique ID of the test procedure + sig { returns(String) } + attr_reader :id + + # Description of test procedure (could be multiple lines). + sig { returns(String) } + attr_reader :description + + # What kind of database object is this? + sig { returns(String) } + attr_reader :kind + + # Name of test file that implements this test procedure. Could be nil. + sig { returns(T.nilable(String)) } + attr_reader :test_file_name + # @param data [Hash] Data from YAML file # @param db_obj [DatabaseObject] Database object that defines test procedure (Extension, Instruction, CSR, or CSR field) + sig {params(data: T::Hash[String, T.untyped], db_obj: T.any(Extension, Instruction, Csr, CsrField)).void } def initialize(data, db_obj) - raise ArgumentError, "Need Hash but was passed a #{data.class}" unless data.is_a?(Hash) - raise ArgumentError, "Need DatabaseObject but was passed a #{db_obj.class}" unless db_obj.is_a?(DatabaseObject) - @data = data @db_obj = db_obj - raise ArgumentError, "Missing certification test procedure ID for #{db_obj.name} of kind #{db_obj.kind}" if id.nil? - warn "Warning: Missing test_file_name for certification test procedure description for #{db_obj.name} of kind #{db_obj.kind}" if test_file_name.nil? - raise ArgumentError, "Missing certification test procedure description for #{db_obj.name} of kind #{db_obj.kind}" if description.nil? - end - - # @return [String] Unique ID of the test procedure - def id = @data["id"] + @id = T.must_because(data["id"]) { pp data } + @description = T.must_because(data["description"]) { pp data } + @kind = T.must_because(db_obj.kind) { pp db_obj } + @test_file_name = data["test_file_name"] - # @return [String] Name of test file that implements this test procedure. Could be nil. - def test_file_name = @data["test_file_name"] - - # @return [String] Description of test procedure (could be multiple lines) - def description = @data["description"] + if test_file_name.nil? + warn "Warning: Missing test_file_name for certification test procedure description for ID #{id} of kind #{kind}" + end + end # @return [Array] def cert_normative_rules diff --git a/lib/arch_obj_models/csr_field.rb b/lib/arch_obj_models/csr_field.rb index 7c7c6de61..88942279f 100644 --- a/lib/arch_obj_models/csr_field.rb +++ b/lib/arch_obj_models/csr_field.rb @@ -34,8 +34,10 @@ def base # @param field_data [Hash] Field data from the arch spec sig { params(parent_csr: Csr, field_name: String, field_data: T::Hash[String, T.untyped]).void } def initialize(parent_csr, field_name, field_data) + field_data["name"] = field_name + field_data["long_name"] = parent_csr.long_name + " #{field_name} field" + field_data["kind"] = "csr_field" super(field_data, parent_csr.data_path, parent_csr.arch) - @name = field_name @parent = parent_csr end diff --git a/lib/arch_obj_models/database_obj.rb b/lib/arch_obj_models/database_obj.rb index 817d1de35..34b523d28 100644 --- a/lib/arch_obj_models/database_obj.rb +++ b/lib/arch_obj_models/database_obj.rb @@ -114,6 +114,9 @@ class ValidationError < ::StandardError sig { returns(String) } attr_reader :long_name + sig { returns(String) } + attr_reader :kind + # @return [Architecture] If only a specification (no config) is known # @return [ConfiguredArchitecture] If a specification and config is known # @return [nil] If neither is known @@ -132,9 +135,6 @@ def cfg_arch sig { returns(T::Boolean) } def cfg_arch? = !@cfg_arch.nil? - sig { returns(String) } - def kind = @data["kind"] - @@schemas ||= {} @@schema_ref_resolver ||= proc do |pattern| if pattern.to_s =~ /^http/ @@ -299,16 +299,17 @@ def description( # @param data [Hash] Hash with fields to be added # @param data_path [Pathname] Path to the data file - sig { params(data: T::Hash[String, T.untyped], data_path: T.any(String, Pathname), arch: T.nilable(Architecture)).void } + sig { params(data: T::Hash[String, T.untyped], data_path: T.any(String, Pathname), arch: Architecture).void } def initialize(data, data_path, arch) @data = data @data_path = Pathname.new(data_path) if arch.is_a?(ConfiguredArchitecture) @cfg_arch = arch end - @arch = T.must(arch) - @name = data["name"] - @long_name = data["long_name"] + @arch = T.must_because(arch) { pp data } + @name = T.must_because(data["name"]) { pp data } + @long_name = T.must_because(data["long_name"]) { pp data } + @kind = T.must_because(data["kind"]) { pp data } @sem = Concurrent::Semaphore.new(1) @cache = Concurrent::Hash.new diff --git a/schemas/csr_schema.json b/schemas/csr_schema.json index 12874c67b..a43fee099 100644 --- a/schemas/csr_schema.json +++ b/schemas/csr_schema.json @@ -17,8 +17,7 @@ }, "long_name": { "type": "string", - "description": "Long name of the field", - "pattern": ".*[^.!,]$" + "description": "One line description of the CSR field" }, "location": { "$ref": "schema_defs.json#/$defs/field_location", @@ -216,8 +215,7 @@ }, "long_name": { "type": "string", - "description": "Descriptive name for the CSR", - "pattern": ".*[^.!,]$" + "description": "One line description for the CSR" }, "description": { "$ref": "schema_defs.json#/$defs/spec_text", diff --git a/schemas/ext_schema.json b/schemas/ext_schema.json index 7e464c8eb..f064b3a28 100644 --- a/schemas/ext_schema.json +++ b/schemas/ext_schema.json @@ -93,8 +93,7 @@ "name": { "$ref": "schema_defs.json#/$defs/extension_name" }, "long_name": { "type": "string", - "description": "One line description for the extension", - "pattern": ".*[^.!,]$" + "description": "One line description for the extension" }, "description": { "$ref": "schema_defs.json#/$defs/spec_text", diff --git a/schemas/inst_schema.json b/schemas/inst_schema.json index f46b7649f..d2389547e 100644 --- a/schemas/inst_schema.json +++ b/schemas/inst_schema.json @@ -180,8 +180,7 @@ }, "long_name": { "type": "string", - "description": "Short description of the instruction", - "pattern": ".*[^.!,]$" + "description": "One line description of the instruction" }, "description": { "$ref": "schema_defs.json#/$defs/spec_text", diff --git a/schemas/manual_schema.json b/schemas/manual_schema.json index 1bb38be24..0dae88138 100644 --- a/schemas/manual_schema.json +++ b/schemas/manual_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", - "required": ["$schema", "kind", "name"], + "required": ["$schema", "kind", "name", "long_name"], "properties": { "$schema": { "const": "manual_schema.json#" @@ -14,6 +14,10 @@ "type": "string", "description": "Name (database key) of this manual" }, + "long_name": { + "type": "string", + "description": "One line description of the manual" + }, "marketing_name": { "type": "string", "description": "The publicly displayed manual name" diff --git a/schemas/manual_version_schema.json b/schemas/manual_version_schema.json index b329b3bc6..8aa8e50e8 100644 --- a/schemas/manual_version_schema.json +++ b/schemas/manual_version_schema.json @@ -56,6 +56,7 @@ "manual", "version", "name", + "long_name", "marketing_version", "state", "volumes" @@ -71,6 +72,10 @@ "type": "string", "description": "Name (database key) of this version" }, + "long_name": { + "type": "string", + "description": "One line description of the instruction" + }, "manual": { "type": "object", "properties": { diff --git a/schemas/proc_cert_model_schema.json b/schemas/proc_cert_model_schema.json index 83e3b13e7..a489454cb 100644 --- a/schemas/proc_cert_model_schema.json +++ b/schemas/proc_cert_model_schema.json @@ -68,7 +68,7 @@ }, "long_name": { "type": "string", - "description": "Descriptive name of the class" + "description": "One line description of certificate model" }, "class": { "type": "object", diff --git a/schemas/profile_class_schema.json b/schemas/profile_class_schema.json index cf34f223c..65e3c09c3 100644 --- a/schemas/profile_class_schema.json +++ b/schemas/profile_class_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", - "required": ["$schema", "kind", "name"], + "required": ["$schema", "kind", "name", "long_name"], "properties": { "$schema": { "type": "string", @@ -21,6 +21,10 @@ "type": "string", "description": "Name (database key) of this Profile Class" }, + "long_name": { + "type": "string", + "description": "One line description of class" + }, "marketing_name": { "type": "string", "description": "The publicly displayed profile class name" diff --git a/schemas/profile_release_schema.json b/schemas/profile_release_schema.json index 9d784c6d3..0bacc3900 100644 --- a/schemas/profile_release_schema.json +++ b/schemas/profile_release_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", - "required": ["$schema", "kind", "name"], + "required": ["$schema", "kind", "name", "long_name", "description"], "properties": { "$schema": { "type": "string", @@ -15,6 +15,10 @@ "name": { "type": "string", "description": "Name (database key) of this Profile Release" + }, + "long name": { + "type": "string", + "description": "One line description of this Profile Release" } } } diff --git a/schemas/profile_schema.json b/schemas/profile_schema.json index 62c82c971..c7936f491 100644 --- a/schemas/profile_schema.json +++ b/schemas/profile_schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", - "required": ["$schema", "kind", "name", "base"], + "required": ["$schema", "kind", "name", "long_name", "base"], "properties": { "$schema": { "type": "string", @@ -16,6 +16,10 @@ "type": "string", "description": "Name (database key) of this Profile" }, + "long_name": { + "type": "string", + "description": "One line description of profile" + }, "base": { "type": "integer", "description": "32 for RV32I or 64 for RV64I" From 3f94451049b50173197ec02dfb5f95f0a55480b9 Mon Sep 17 00:00:00 2001 From: James Ball Date: Fri, 2 May 2025 17:30:48 +0000 Subject: [PATCH 2/6] fix: testing if PR can avoid listing commits of older PR --- backends/isa_explorer/isa_explorer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/isa_explorer/isa_explorer.rb b/backends/isa_explorer/isa_explorer.rb index fadd487d6..4657d78ff 100644 --- a/backends/isa_explorer/isa_explorer.rb +++ b/backends/isa_explorer/isa_explorer.rb @@ -59,7 +59,7 @@ def arch2ext_table(arch) ext.long_name, ext.compact_priv_type, "UDB Missing", - # See https://github.com/riscv-software-src/riscv-unified-db/issues/597 for the next 2 columns. + # See https://github.com/riscv-software-src/riscv-unified-db/issues/597 for the next 2 columns ext.max_version.implied_by.map(&:name), # ext.max_version.transitive_conflicts.map(&:name), "UDB MISSING", From 21b4cef6e99bc13b1d36d5ae709126cfa11de377 Mon Sep 17 00:00:00 2001 From: James Ball Date: Mon, 5 May 2025 18:41:17 +0000 Subject: [PATCH 3/6] fix: display implied-by and requires columns from UDB & bugs it exposed --- arch/ext/Zve32f.yaml | 14 ++++++++ backends/isa_explorer/isa_explorer.rb | 20 +++++------ lib/arch_obj_models/req_expression.rb | 48 +++++++++++++++------------ 3 files changed, 49 insertions(+), 33 deletions(-) create mode 100644 arch/ext/Zve32f.yaml diff --git a/arch/ext/Zve32f.yaml b/arch/ext/Zve32f.yaml new file mode 100644 index 000000000..a1ecdf9cf --- /dev/null +++ b/arch/ext/Zve32f.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=../../schemas/ext_schema.json + +$schema: "ext_schema.json#" +kind: extension +name: Zve32f +long_name: Vector Extension for Minimal Single-Precision Embedded Floating-Point +description: | + TBD - See GitHub issue 616 +type: unprivileged +versions: + - version: "1.0.0" + state: ratified + ratification_date: null + requires: F diff --git a/backends/isa_explorer/isa_explorer.rb b/backends/isa_explorer/isa_explorer.rb index 4657d78ff..d56d58961 100644 --- a/backends/isa_explorer/isa_explorer.rb +++ b/backends/isa_explorer/isa_explorer.rb @@ -39,9 +39,9 @@ def arch2ext_table(arch) }, {name: "Description", formatter: "textarea", sorter: "alphanum", headerFilter: true}, {name: "IC", formatter: "textarea", sorter: "alphanum", headerFilter: true}, - {name: "Extensions\nIncluded\n(subsets)", formatter: "textarea", sorter: "alphanum"}, - {name: "Implied By\n(and\ntransitives)", formatter: "textarea", sorter: "alphanum"}, - {name: "Incompatible\n(and\ntransitives)", formatter: "textarea", sorter: "alphanum"}, + {name: "Implied By", formatter: "textarea", sorter: "alphanum"}, + {name: "Requires", formatter: "textarea", sorter: "alphanum"}, + {name: "Incompatible", formatter: "textarea", sorter: "alphanum"}, {name: "Ratified", formatter: "textarea", sorter: "boolean", headerFilter: true}, {name: "Ratification\nDate", formatter: "textarea", sorter: "alphanum", headerFilter: true}, sorted_profile_releases.map do |pr| @@ -55,14 +55,12 @@ def arch2ext_table(arch) arch.extensions.sort_by!(&:name).each do |ext| row = [ - ext.name, - ext.long_name, - ext.compact_priv_type, - "UDB Missing", - # See https://github.com/riscv-software-src/riscv-unified-db/issues/597 for the next 2 columns - ext.max_version.implied_by.map(&:name), - # ext.max_version.transitive_conflicts.map(&:name), - "UDB MISSING", + ext.name, # Name + ext.long_name, # Description + ext.compact_priv_type, # IC + ext.max_version.implied_by.map(&:name), # Implied By + ext.max_version.requirement_condition.empty? ? "" : ext.max_version.requirement_condition.to_logic_tree.to_s, # Requires + ext.conflicts_condition.empty? ? "" : ext.conflicts_condition.to_logic_tree.to_s, # Incompatible ext.ratified, if ext.ratified if ext.min_ratified_version.ratification_date.nil? || ext.min_ratified_version.ratification_date.empty? diff --git a/lib/arch_obj_models/req_expression.rb b/lib/arch_obj_models/req_expression.rb index d08d4c0b4..1f2dbc06a 100644 --- a/lib/arch_obj_models/req_expression.rb +++ b/lib/arch_obj_models/req_expression.rb @@ -466,32 +466,36 @@ def to_logic_tree(hsh = @hsh, term_idx: [0], expand: true) when "oneOf" # expand oneOf into AND roots = T.let([], T::Array[LogicNode]) - raise "unexpected" if hsh["oneOf"].size < 2 - - hsh["oneOf"].size.times do |k| - root = - if k.zero? - LogicNode.new(TYPES::And, [to_logic_tree(hsh["oneOf"][0], term_idx:, expand:), LogicNode.new(TYPES::Not, [to_logic_tree(hsh["oneOf"][1], term_idx:, expand:)])]) - elsif k == 1 - LogicNode.new(TYPES::And, [LogicNode.new(TYPES::Not, [to_logic_tree(hsh["oneOf"][0], term_idx:, expand:)]), to_logic_tree(hsh["oneOf"][1], term_idx:, expand:)]) - else - LogicNode.new(TYPES::And, [LogicNode.new(TYPES::Not, [to_logic_tree(hsh["oneOf"][0], term_idx:, expand:)]), LogicNode.new(TYPES::Not, [to_logic_tree(hsh["oneOf"][1], term_idx:, expand:)])]) - end - (2...hsh["oneOf"].size).each do |i| + + if hsh["oneOf"].size < 2 + to_logic_tree(hsh["oneOf"][0], term_idx:, expand:) + else + hsh["oneOf"].size.times do |k| root = - if k == i - LogicNode.new(TYPES::And, [root, to_logic_tree(hsh["oneOf"][i], term_idx:, expand:)]) + if k.zero? + LogicNode.new(TYPES::And, [to_logic_tree(hsh["oneOf"][0], term_idx:, expand:), LogicNode.new(TYPES::Not, [to_logic_tree(hsh["oneOf"][1], term_idx:, expand:)])]) + elsif k == 1 + LogicNode.new(TYPES::And, [LogicNode.new(TYPES::Not, [to_logic_tree(hsh["oneOf"][0], term_idx:, expand:)]), to_logic_tree(hsh["oneOf"][1], term_idx:, expand:)]) else - LogicNode.new(TYPES::And, [root, LogicNode.new(TYPES::Not, [to_logic_tree(hsh["oneOf"][i], term_idx:, expand:)])]) + LogicNode.new(TYPES::And, [LogicNode.new(TYPES::Not, [to_logic_tree(hsh["oneOf"][0], term_idx:, expand:)]), LogicNode.new(TYPES::Not, [to_logic_tree(hsh["oneOf"][1], term_idx:, expand:)])]) end - end - roots << root - end - root = LogicNode.new(TYPES::Or, [T.must(roots[0]), T.must(roots[1])]) - (2...roots.size).each do |i| - root = LogicNode.new(TYPES::Or, [root, T.must(roots[i])]) + (2...hsh["oneOf"].size).each do |i| + root = + if k == i + LogicNode.new(TYPES::And, [root, to_logic_tree(hsh["oneOf"][i], term_idx:, expand:)]) + else + LogicNode.new(TYPES::And, [root, LogicNode.new(TYPES::Not, [to_logic_tree(hsh["oneOf"][i], term_idx:, expand:)])]) + end + end + roots << root + end + + root = LogicNode.new(TYPES::Or, [T.must(roots[0]), T.must(roots[1])]) + (2...roots.size).each do |i| + root = LogicNode.new(TYPES::Or, [root, T.must(roots[i])]) + end + root end - root when "not" LogicNode.new(TYPES::Not, [to_logic_tree(hsh["not"], term_idx:, expand:)]) else From 14a485d353716f6f8b5417f2ee7555994426a69a Mon Sep 17 00:00:00 2001 From: James Ball Date: Wed, 7 May 2025 10:25:19 +0000 Subject: [PATCH 4/6] fix: improved clarity of result logging and fixed bad links to profiles & ISA Explorer spreadsheet --- lib/deploy.sh | 82 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 27 deletions(-) diff --git a/lib/deploy.sh b/lib/deploy.sh index 0044b6ee0..a062fc1d1 100755 --- a/lib/deploy.sh +++ b/lib/deploy.sh @@ -2,8 +2,9 @@ # deploy artifacts to a directory, in preparation for GitHub deployment -# Default to success +# Initialize globals used to track failures. exit_status=0 +declare -a failures # Array ROOT=$(dirname $(dirname $(realpath ${BASH_SOURCE[0]}))) @@ -14,30 +15,45 @@ function deploy_log() { echo "[DEPLOY] $(date) $*" } +# Put "FAIL" between [DEPLOY] and date to make it easier to grep for failures (ie.., "\[DEPLOY\] FAIL" RE does the trick) +# Don't put "FAIL" in [DEPLOY] so that we can first grep for [DEPLOY] and see all messages from this deploy.sh script. +# Record failures but don't exit so that we can see which artifacts pass & fail. +function deploy_fail() { + echo "[DEPLOY] FAIL $(date) $*" + failures+=("$*") # Append to array + exit_status=1 +} + function deploy_mkdir() { [[ $# -ne 1 ]] && { - deploy_log "deploy_mkdir(): Passed $# args but it needs 1" + deploy_fail "deploy_mkdir(): Passed $# args but it needs 1" + + # Exit if args are wrong. exit 1 } local dst_dir="$1" mkdir -p $dst_dir || { - deploy_log "mkdir -p $dst_dir failed" - exit_status=1 + deploy_fail "mkdir -p $dst_dir failed" } } function deploy_do() { - deploy_log "$@" + deploy_log + deploy_log 'vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv' + deploy_log "./do $*" + deploy_log '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^' + deploy_log ./do "$@" || { - deploy_log "./do $* failed" - exit_status=1 + deploy_fail "./do $*" } } function deploy_cp_recursive() { [[ $# -ne 2 ]] && { - deploy_log "deploy_cp_recursive(): Passed $# args but it needs 2" + deploy_fail "deploy_cp_recursive(): Passed $# args but it needs 2" + + # Exit if args are wrong. exit 1 } @@ -45,14 +61,15 @@ function deploy_cp_recursive() { local dst_dir="$2" cp -R ${src_dir} ${dst_dir} || { - deploy_log "cp -R ${src_dir} ${dst_dir} failed" - exit_status=1 + deploy_fail "cp -R ${src_dir} ${dst_dir} failed" } } function deploy_cp() { [[ $# -ne 2 ]] && { - deploy_log "deploy_cp(): Passed $# args but it needs 2" + deploy_fail "deploy_cp(): Passed $# args but it needs 2" + + # Exit if args are wrong. exit 1 } @@ -60,12 +77,13 @@ function deploy_cp() { local dst_dir="$2" cp ${src_file} ${dst_dir} || { - deploy_log "cp ${src_file} ${dst_dir} failed" - exit_status=1 + deploy_fail "cp ${src_file} ${dst_dir} failed" } } -deploy_log "Starting" +deploy_log '***************************************************************' +deploy_log '* DEPLOY STARTING *' +deploy_log '***************************************************************' deploy_mkdir $DEPLOY_DIR deploy_mkdir $DEPLOY_DIR/example_cfg @@ -93,7 +111,7 @@ deploy_log "Copy isa_explorer_spreadsheet" deploy_cp_recursive gen/isa_explorer/spreadsheet $DEPLOY_DIR/isa_explorer deploy_log "Build manual" -deploy_do gen:html_manual MANUAL_NAME=isa VERSIONS=all +deploy_do "gen:html_manual" "MANUAL_NAME=isa" "VERSIONS=all" deploy_log "Copy manual html" deploy_cp_recursive gen/manual/isa/top/all/html $DEPLOY_DIR/manual deploy_log "Build html documentation for example_rv64_with_overlay" @@ -114,11 +132,6 @@ for profile in RVI20 RVA20 RVA22 RVA23 RVB23; do done for crd in AC100 AC200 MC100-32 MC100-64 MC200-32 MC200-64 MC300-32 MC300-64; do - deploy_log "Create $profile Profile Release PDF Spec" - deploy_do "gen:profile_release_pdf[$profile]" - deploy_log "Copy $profile Profile Release PDF Spec" - deploy_cp gen/profile/pdf/${profile}ProfileRelease.pdf $DEPLOY_DIR/pdfs - deploy_log "Create ${crd}-CRD PDF Spec" deploy_do "gen:proc_crd_pdf[$crd]" deploy_log "Copy ${crd}-CRD PDF" @@ -164,17 +177,17 @@ cat <<- EOF > $DEPLOY_DIR/index.html
  • Extensions
  • Instructions
  • CSRs
  • -
  • Excel version (includes Extensions, Instructions, CSRs)
  • +
  • Excel version (includes Extensions, Instructions, CSRs)

  • Profile Releases


    @@ -213,6 +226,21 @@ cat <<- EOF > $DEPLOY_DIR/index.html EOF -deploy_log "Complete" +[[ $exit_status -eq 1 ]] && { + deploy_log + deploy_log '***************************************************************' + deploy_log '* DEPLOY FAILED *' + deploy_log '***************************************************************' + deploy_log + deploy_log "LIST OF FAILURES:" + + # Iterate through each failure array element. + for f in "${failures[@]}"; do + deploy_log " $f" + done +} + +deploy_log +deploy_log "COMPLETE - Overall exit status is $exit_status" exit $exit_status From dfcfb74dc0464096b3564c4e1bfeaa237d078a61 Mon Sep 17 00:00:00 2001 From: James Ball Date: Wed, 7 May 2025 11:06:25 -0700 Subject: [PATCH 5/6] fix: make deploy.sh start & end message consistent --- lib/deploy.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/deploy.sh b/lib/deploy.sh index a062fc1d1..7ae9f63f6 100755 --- a/lib/deploy.sh +++ b/lib/deploy.sh @@ -241,6 +241,11 @@ EOF } deploy_log -deploy_log "COMPLETE - Overall exit status is $exit_status" +deploy_log "Overall exit status is $exit_status" +deploy_log + +deploy_log '***************************************************************' +deploy_log '* DEPLOY COMPLETE *' +deploy_log '***************************************************************' exit $exit_status From 2a8fb7e54a03b862c50058e2ba17a220f57dea77 Mon Sep 17 00:00:00 2001 From: James Ball Date: Mon, 12 May 2025 16:20:13 +0000 Subject: [PATCH 6/6] fix: see that parallel is called to build artifacts to removed redundant builds I added --- lib/deploy.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/deploy.sh b/lib/deploy.sh index 0b578826e..0c5d47ee8 100755 --- a/lib/deploy.sh +++ b/lib/deploy.sh @@ -131,9 +131,6 @@ deploy_cp_recursive gen/isa_explorer/browser $DEPLOY_DIR/isa_explorer deploy_log "Copy isa_explorer_spreadsheet" deploy_cp_recursive gen/isa_explorer/spreadsheet $DEPLOY_DIR/isa_explorer -deploy_log "Build manual" -deploy_do "gen:html_manual" "MANUAL_NAME=isa" "VERSIONS=all" - deploy_log "Copy manual html" deploy_cp_recursive gen/manual/isa/top/all/html $DEPLOY_DIR/manual @@ -148,9 +145,6 @@ for profile in RVI20 RVA20 RVA22 RVA23 RVB23; do done for crd in AC100 AC200 MC100-32 MC100-64 MC200-32 MC200-64 MC300-32 MC300-64; do - deploy_log "Create ${crd}-CRD PDF Spec" - deploy_do "gen:proc_crd_pdf[$crd]" - deploy_log "Copy ${crd}-CRD PDF" deploy_cp gen/proc_crd/pdf/${crd}-CRD.pdf $DEPLOY_DIR/pdfs done