Age | Commit message (Collapse) | Author | Files | Lines |
|
This is more maintainable and scalable and gives better errors and a nice `--help` message. The interface is compatible with the previous version.
Co-authored-by: Tim Hutt <timothy.hutt@codasip.com>
|
|
If we're sorting the dictionary anyway we may as well output the JSON sorted.
Also since Python 3.6 we can just use `dict()` since the insertion order is preserved.
|
|
* Remove wildcard imports
Use explicit imports rather than wildcards. This is more maintainable.
* Enable Pylint in CI and fix its errors
The main fixes were:
* Specify encoding for all file opens. By default it depends on environment variables which is bad.
* Use `with` to open files. Otherwise they don't necessarily get closed.
There were also a few minor things like using `enumerate`, not using objects as default arguments, etc. In some cases I slightly refactored the code.
|
|
This makes the code easier to understand and navigate, and also detected a few of bugs:
1. Missing brackets on e.upper. (Fixed)
2. Not strictly related to types, but a lot of the regexes were not raw strings and therefore contained invalid escape sequences. Python prints a warning about these in recent versions. (Fixed)
3. Expression in `process_pseudo_instructions()` that is always false. (Not fixed)
4. Missing definition of `log_and_exit()`. (Fixed)
This is validated via pre-commit in CI.
|
|
Previously this generate a `instr_dict.yaml` file, however there is no need to use YAML here. The only advantages of YAML over JSON are that it is (debatably) easier for humans to write, making it suitable as human-edited input files. This is a machine-generated output file so JSON is better.
The main advantages are:
1. It removes the dependency on PyYAML, which is the only external dependency of this project. Python external dependencies are quite a pain - PyYAML is a particularly troublesome one - and having no dependencies is very convenient (no need for venv etc.).
2. It means consumers of the file don't need to depend on PyYAML.
Note this could have been done in an 100% backwards compatible way by keeping the file name unchanged (since JSON is valid YAML), however I figured there probably aren't that many users of this file, and since the only thing they need to change is the filename it's probably better to minimise confusion by renaming it. It also makes it clear that it is guaranteed to be JSON.
|
|
|
|
|
|
|
|
|
|
|
|
Signed-off-by: Jay Dev Jha <jaydev.neuroscitech@gmail.com>
|
|
Signed-off-by: Jay Dev Jha <jaydev.neuroscitech@gmail.com>
|
|
|
|
Because hinval.vvma and hinval.gvma can only be used legally when both Svinval and H
extensions are supported, move them out from rv_svinval to rv_svinval_h.
|
|
|
|
|
|
The global search-and-replace is a bit worrisome.
|
|
|
|
|
|
Modules
|
|
name. (JAL and JALR case)
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
|
|
special field
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
|
|
parse.py has been edited to expand nf field for segmented vector load
store instructions. For backwards compatibility this only applies to
instr_dict.yaml.
|
|
- Added code to extend the extension list of a pseudo instruction
in the YAML output
- This ensures that all the extensions that a pseudo instruction
can belong to are listed
- This is in line with what happens for regular and imported
instructions
- No changes to all other output types
|
|
Fix python script on windows
|
|
Signed-off-by: xyyy1420 <xyyy1420@gmail.com>
|
|
Instead of splitting string by '/' to get filename, use os.path.basename
|
|
Some of the instructions in the V extension encode part of the opcode
in the rs1 field. These values are not currently included in the Go
instruction opcodes - fix this by adding an rs1 field and populating
it with the relevant values.
|
|
Signed-off-by: Patrick Yingxi Pan <patrick-yingxi-pan@users.noreply.github.com>
|
|
A regression introduced a few years ago prevented detecting partially
overlapping encodings; instead, we only detected exact matches. Now, we
detect the partial cases.
We now need to maintain two allowlists (overlapping_extensions and
overlapping_instructions) for the cases that extensions and/or
instructions overlap by design.
|
|
It is highly speculative at this point, but it adds maintenance burden.
|
|
change decode generation part of chisel
|
|
Add encodings for all instructions in the Zvk extensions:
- Zvbb, Vector Bit-manipulation instructions used in Cryptography,
- Zvbc, Vector Carryless Multiplication
- Zvkg, Vector GCM/GMAC instruction for Cryptography,
- Zvkned, NIST Suite: Vector AES Encryption & Decryption (Single
Round),
- Zvknha, Zvknhb, NIST Suite: Vector SHA-2,
- Zvksed, ShangMi Suite: SM4 Block Cipher Instructions
- Zvkssh, ShangMi Suite: SM3 Hash Function Instructions
Add two "shorthand" extensions:
- Zvkn: NIST Suite, imports Zvbb, Zvbc, Zvkned, and Zvknh
- Zvks: ShangMi Suite, imports Zvbb, Zvbc, Zvksed, and Zvksh
Three new fields are listed in constants.py:
- 'zimm5', used to encode round constants (Zvkns, Zvksed, Zvksh),
and 5-bit shift constant (vwsll.vi in Zvbb)
- 'zimm6hi, zimm6lo', used to encode the 6 bits rotate amount
in vror.vi.
The Zvk instructions – with the exception of Zvbb, Zvbc – reside in the
P opcode space. Some encodings conflict with proposed instructions
in the P extension (packed SIMD). Zvk and P are exclusive of each
other, no implementation will implement both. Conflicting P instructions
are marked as pseudo of the Zvk instructions.
The encodings match the current documentation of the specification
at <https://github.com/riscv/riscv-crypto/tree/master/doc/vector>,
at Version v0.9.1, 25 April, 2023 (Freeze Candidate).
Co-authored-by: Eric Gouriou <ego@rivosinc.com>
Co-authored-by: Stanislaw Kardach <kda@semihalf.com>
Co-authored-by: Kornel Duleba <mindal@semihalf.com>
Co-authored-by: Raghav Gupta <rgupta@rivosinc.com>
Signed-off-by: Eric Gouriou <ego@rivosinc.com>
|
|
Fixes generation of 'extension' field for instr_dict.yaml
|
|
|
|
|
|
It's a new year. Make the copyright clause reflect 2023.
|
|
|
|
|
|
|
|
|
|
This PR changes opcodes_dir to the REAL path of parse.py. It helps python
scripts which depends on parse.py can be stored in other place, using PYTHONPAT
or sys.path to import from riscv-opcodes/parse.
|
|
That allows for running the script out-of-tree.
Signed-off-by: Florian Zaruba <florian@zaruba.email>
Signed-off-by: Florian Zaruba <florian@zaruba.email>
|
|
The BSD-3-Clause license mentions a copyright notice that has to
be retained while redistributing the source code.
Copy the copyright notice from LICENSE file to the script, so it
get in the generated file.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
|
|
This removes the language about patents that was added in #133.
Change copyright holder to RISC-V International.
|
|
* fix extension merge and add name and encoding conflict checking
* fix comments
* uniform code's indentation
|
|
Linux kernel coding style requires the SPDX tag to be placed in
the very first line of the generated file. See kernel file
Documentation/process/license-rules.rst
at chapter 'License identifier syntax', '1. Placement:'.
Move the SPDX tag in the python script.
While there, adjust also the style of the multi-line comment.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
|
|
Making a shallow copy of the list prevents updating the final encoding
output when checking for field overlap.
Incorrect:
encoding: 0000000rs2rs2rs2rs2rs2rs1rs1rs1rs1rs1000rdrdrdrdrd0110011
Correct:
encoding: 0000000----------000-----0110011
|
|
specifically done to handle encoding.out.h that is being used by spike
|
|
|