-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ISA Extension Manager class #30
base: main
Are you sure you want to change the base?
Conversation
and automatically create a Mavis instance with the relevant ISA JSONs
- Still need to add constraints to most of them
- Break larger extensions into individual components where possible
Fix some ISA JSON errors
Now using a single ISA spec JSON for specifying relationships between extensions and ISA JSONs
- Needed to support extensions that don't have opcodes associated with them (e.g. sstc)
warnings, or ignored
- These need double-checking, I'm not sure I have them all categorized correctly
Add config extension concept - Used to define extensions that don't enable ISA JSONs but indicate some sort of architectural config (e.g. zvl128b)
Make it possible to reuse an ExtensionManager by resetting the ISA string
json/riscv_isa_spec.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the ISA specification JSON. The rest of the JSONs were reorganized so that there was a 1:1 correspondence between each ISA extension and its Mavis JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This header contains all of the RISC-V specific features, including the ISA string parser and the ELF ISA parser.
mavis/ExtensionManager.hpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This header handles processing the ISA spec JSON and setting up all of the dependencies between the ISA extensions.
Hey @bdutro are there missing files? I don't see a use of ELFIO... |
Buckle up, this one is a doozy...
Per sparcians/atlas#5, we want Mavis to have the ability to parse an ISA string and query what extensions it enables. This PR adds two major classes:
ExtensionManager
: Implements the ISA-independent logic necessary to wrangle dependencies between extensionsRISCVExtensionManager
: Provides a RISC-V implementation ofExtensionManager
that extracts enabled ISA extensions from RISC-V ISA strings (either directly or from an ELF file)After a
ExtensionManager
object has been initialized with an ISA string, you can call theconstructMavis
method to construct a Mavis instance with all of the relevant opcode JSONs automatically specified.ISA extension dependencies are defined in an ISA specification JSON (
json/riscv_isa_spec.json
). This will need to be updated whenever a new extension is added to Mavis in order for the extension manager to handle it.There are 3 types of extensions:
meta_extensions
: These are extensions that are defined as a collection of other extensions, but provide no unique opcodes or configs of their own. Examples in RISC-V includeg
,v
,b
, etc.config_extensions
: These are extensions that indicate an architectural configuration but provide no opcodes (e.g.,zvl32b
,zvl128b
, etc.)extensions
: These are ISA extensions that provide opcodes. Each extension should map to a Mavis opcode JSON file.Each extension type key maps to an array of JSON objects describing the extensions:
Required Fields
extension
: The extension name (e.g."i"
,"zbb"
, etc.)xlen
: This is either a single int or an array of ints that specifies which XLENs the extension applies to.json
: Every non-meta, non-config extension must specify. Points to the Mavis JSON containing the opcodes for the extension.Optional Fields (allowed for any type)
meta_extension
: Either a single string or an array of strings. Specifies which meta extensions contain the current extension.Optional Fields (only allowed for
meta_extensions
andextensions
types)is_base_extension
: Bool (defaults to false). If true, defines this extension as a RISC-V base extension. Only used for validating the ISA string.Optional Fields (only allowed for
extension
type)requires
: String or array of strings. Specifies one or more extensions that must be explicitly enabled when this extension is enabled.enabled_by
: Array of arrays of strings. Specifies combinations of other extensions that automatically enable this extension.enables
: String or array of strings. Specifies extensions that should be implicitly enabled when this extension is enabled.conflicts
: String or array of strings. Specifies extensions that must not be present when this extension is enabled.If the implementation of an extension changes based on the XLEN, it should be specified multiple times with different JSONs like so: