diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 4aac843c..95c39fad 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -15,9 +15,8 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install PyYAML + - name: Install Coverage run: | - pip3 install -r requirements.txt pip3 install coverage - name: Run pre-commit run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a30716ac..0eb0c898 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,9 +15,8 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install PyYAML + - name: Install Coverage run: | - pip3 install -r requirements.txt pip3 install coverage - name: Test error outputs run: coverage run -m unittest -b diff --git a/.gitignore b/.gitignore index 4ddba6b5..13806158 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,6 @@ priv-instr-table.tex inst.rs inst.spinalhdl inst.sverilog -instr_dict.yaml +instr_dict.json __pycache__/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cca4b3b9..61540b13 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,13 +26,9 @@ repos: # rev: v3.3.1 # hooks: # - id: pylint - # additional_dependencies: - # - "pyyaml==6.0.2" # TODO: Enable this when types are added. # - repo: https://github.com/RobertCraigie/pyright-python # rev: v1.1.383 # hooks: # - id: pyright - # additional_dependencies: - # - "pyyaml==6.0.2" diff --git a/README.md b/README.md index e6702ed6..e7a988cc 100644 --- a/README.md +++ b/README.md @@ -126,9 +126,11 @@ of extensions are being processed such that the *base-instruction* is not includ The following artifacts can be generated using parse.py: -- instr\_dict.yaml : This is file generated always by parse.py and contains the - entire main dictionary `instr\_dict` in YAML format. Note, in this yaml the - *dots* in an instruction are replaced with *underscores* +- instr\_dict.json : This is always generated by parse.py and contains the + entire main dictionary `instr\_dict` in JSON format. Note, in this file the + *dots* in an instruction are replaced with *underscores*. In previous + versions of this project the generated file was instr\_dict.yaml. Note that + JSON is a subset of YAML so the file can still be read by any YAML parser. - encoding.out.h : this is the header file that is used by tools like spike, pk, etc - instr-table.tex : the latex table of instructions used in the riscv-unpriv spec - priv-instr-table.tex : the latex table of instruction used in the riscv-priv spec @@ -138,14 +140,6 @@ The following artifacts can be generated using parse.py: - inst.spinalhdl : spinalhdl code to decode instructions - inst.go : go code to decode instructions -Make sure you install the required python pre-requisites are installed by executing the following -command: - -``` -sudo apt-get install python-pip3 -pip3 install -r requirements.txt -``` - To generate all the above artifacts for all instructions currently checked in, simply run `make` from the root-directory. This should print the following log on the command-line: ``` @@ -220,6 +214,6 @@ DEBUG:: Processing line: bne bimm12hi rs1 rs2 bimm12lo 14..12=1 6..2=0x ## How do I find where an instruction is defined? You can use `grep "^\s*" rv* unratified/rv*` OR run `make` and open -`instr_dict.yaml` and search of the instruction you are looking for. Within that -instruction the `extension` field will indicate which file the instruction was -picked from. +`instr_dict.json` and search for the instruction you are looking for. Within +that instruction the `extension` field will indicate which file the +instruction was picked from. diff --git a/c_utils.py b/c_utils.py index cff33dd8..d2e2775d 100644 --- a/c_utils.py +++ b/c_utils.py @@ -6,8 +6,6 @@ import re import sys -import yaml - # from shared_utils import overlaps, overlap_allowed, extension_overlap_allowed, instruction_overlap_allowed, process_enc_line, same_base_isa, add_segmented_vls_insn, expand_nf_field from shared_utils import * diff --git a/chisel_utils.py b/chisel_utils.py index 957e4f8a..f9c66f6d 100644 --- a/chisel_utils.py +++ b/chisel_utils.py @@ -7,8 +7,6 @@ import re import sys -import yaml - from constants import * # from shared_utils import overlaps, overlap_allowed, extension_overlap_allowed, instruction_overlap_allowed, process_enc_line, same_base_isa, add_segmented_vls_insn, expand_nf_field diff --git a/go_utils.py b/go_utils.py index 1f4c94bb..af952eab 100644 --- a/go_utils.py +++ b/go_utils.py @@ -6,8 +6,6 @@ import re import sys -import yaml - # from shared_utils import overlaps, overlap_allowed, extension_overlap_allowed, instruction_overlap_allowed, process_enc_line, same_base_isa, add_segmented_vls_insn, expand_nf_field from shared_utils import * diff --git a/latex_utils.py b/latex_utils.py index ab5f6f92..be009019 100644 --- a/latex_utils.py +++ b/latex_utils.py @@ -7,8 +7,6 @@ import re import sys -import yaml - from constants import * from shared_utils import * diff --git a/parse.py b/parse.py index 9677ed6d..4152fe06 100755 --- a/parse.py +++ b/parse.py @@ -1,11 +1,10 @@ #!/usr/bin/env python3 import collections +import json import logging import pprint import sys -import yaml - from c_utils import * from chisel_utils import * from constants import * @@ -44,8 +43,8 @@ instr_dict = create_inst_dict(extensions, include_pseudo) - with open("instr_dict.yaml", "w") as outfile: - yaml.dump(add_segmented_vls_insn(instr_dict), outfile, default_flow_style=False) + with open("instr_dict.json", "w") as outfile: + json.dump(add_segmented_vls_insn(instr_dict), outfile, indent=2) instr_dict = collections.OrderedDict(sorted(instr_dict.items())) if "-c" in sys.argv[1:]: diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c3726e8b..00000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -pyyaml diff --git a/rust_utils.py b/rust_utils.py index 19a47b95..4a0c1286 100644 --- a/rust_utils.py +++ b/rust_utils.py @@ -7,8 +7,6 @@ import re import sys -import yaml - from constants import * # from shared_utils import overlaps, overlap_allowed, extension_overlap_allowed, instruction_overlap_allowed, process_enc_line, same_base_isa, add_segmented_vls_insn, expand_nf_field diff --git a/sverilog_utils.py b/sverilog_utils.py index 1fe20680..afe04d4d 100644 --- a/sverilog_utils.py +++ b/sverilog_utils.py @@ -6,8 +6,6 @@ import re import sys -import yaml - # from shared_utils import overlaps, overlap_allowed, extension_overlap_allowed, instruction_overlap_allowed, process_enc_line, same_base_isa, add_segmented_vls_insn, expand_nf_field from shared_utils import *