Skip to content

Commit c3f3520

Browse files
neelgalapawkslavanyajagansujeettogo
authored
Csr schema update (#17)
* Misa skeleton done. * Done mtvec,mideleg,medeleg,id csrs,mstatus. * fixed alignment and trailing whitespaces * Machine csrs almost done. * changing exists to implemented * removing reset-values from sub-fields * Added defaults and minimized required fields in yaml. * adding isa specific checks * adding max length check for reset-values * adding misa to default setter * misa checks done. * missed adding updated schema for misa-checks * Trimming function done. * Fixed bug in trimming function. * few checks for readonly machine csrs. * example to show trimming doesn't work * Fixed trimming function. * RO reset value check added. * fixed misa reset-val check when misa is not defined by user. * defined types for mtvec fields * specific check for mtvec * removing trailing spaces * adding reset value checks for mtvec * Create csr_template_draft1.yaml * adding support for delegation registers * rv32i * Changes done * Changes done * changes done * Seperate warl class added * Update modes done * support for bitmask done * support for bitmask done * changes done * Changes done * Changes done * Changes done * changes done * Changes done * Changes finalized * Minor bug fixes for erratic check functions. * Function for reset value checking done. * Example update. * updated docs * adding platform yaml docs * updated schemavalidator for ISA checks Close #10 Close #11 Close #12 Close #13 * renaming mcause * adding changelog and removed obsolete files * Added counter registers. * Removed redundant functions and obsolete code. * Example update. * Formatting for wpri fields. * Yapf formatting for files. * Dependency fix. Co-authored-by: dracarys99 <[email protected]> Co-authored-by: lavanyajagan <[email protected]> Co-authored-by: Sujeet <[email protected]>
1 parent acd6701 commit c3f3520

File tree

18 files changed

+14282
-2100
lines changed

18 files changed

+14282
-2100
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
docs/build
2+
docs/source/schema_isa.rst
3+
docs/source/schema_platform.rst
24

35
run.log
46

57
__pycache__/*
68

79
*.pyc
810

9-
riscv_config_work/*
11+
riscv_config_work/*

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## 2.0.0 - 2020-03-25
6+
### Added
7+
- adding support for warl fields and support
8+
- documentation for the warl fields added
9+
- reset-value checks added
10+
### Changed
11+
- using a new common template for defining all csrs
12+
- updated docs with new template
13+
- using special function within conf.py to extract comments from yaml file as docs.
14+
### Fixed
15+
- closed issues #10, #11, #12, #13
16+
517
## 1.0.2 - 2019-08-09
618
### Changed
719
- Log is generated only if specified(for API calls to checker.check_specs).

docs/source/conf.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@
1414
#
1515
import os
1616
import sys
17+
import re
18+
19+
def gen_schema_doc(infile, outfile):
20+
text = open(infile,'r').read()
21+
rst_file = open(outfile,'w')
22+
x = re.findall("^###(?:(?:\r\n|[\r\n]).+$)*",text,re.M|re.U)
23+
for y in x:
24+
y = y.replace('#','')
25+
y = y.lstrip(' ')
26+
rst_file.write(y+'\n')
27+
28+
rst_file.close()
29+
30+
gen_schema_doc('../../riscv_config/schemas/schema_isa.yaml', 'schema_isa.rst')
31+
gen_schema_doc('../../riscv_config/schemas/schema_platform.yaml', 'schema_platform.rst')
1732

1833
sys.path.insert(0, os.path.abspath('../..'))
1934
sys.setrecursionlimit(1500)

docs/source/overview.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ The user is required to provide 2 YAML files as input:
1313
1. **ISA Spec**: This YAML file is meant to capture the ISA related features implemented by the user. Details of this input file can be found here : :ref:`isa_yaml_spec`.
1414
2. **Platform Spec**: This YAML file is meant to capture the platform specific features implemented by the user. Details of this input file can be found here : :ref:`platform_yaml_spec`.
1515

16-
Working:
17-
--------
16+
Working
17+
=======
1818

1919
The ISA and Platform spec are first checked by the validator for any inconsistencies. Checks like 'F' to exist for 'D' are performed by the validator. The validator exits with an error if any illegal configuration for the spec is provided. Once the validator checks pass, two separate standard yaml files are generated, one for each input type. These standard yaml files contain all fields elaborated and additional info for each node. While the user need not specify all the fields in the input yaml files, the validator will assign defaults to those fields and generate a standard exhaustive yaml for both ISA and Platform spec.
2020

docs/source/quickstart.rst

Lines changed: 90 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,103 +2,134 @@
22
Quickstart
33
##########
44

5-
Installation and Setup
6-
^^^^^^^^^^^^^^^^^^^^^^^
7-
1. Install riscv_config
5+
This doc is meant to serve as a quick-guide to setup RISCOF and perform a sample compliance check
6+
between ``spike`` (DUT in this case) and ``riscvOVPsim`` (Golden model in this case).
87

9-
Before proceding further please ensure *pip* and *python (>3.7.0)* is installed and configured.
8+
Install Python Dependencies
9+
===========================
1010

11-
In case you have issues installing python-3.7, we recommend using `pyenv`.
12-
13-
Installing instructions for pyenv:
11+
RISCOF requires `pip` and `python` (>=3.7) to be available on your system. If you have issues, instead of
12+
installing either of these directly on your system, we suggest using a virtual environment
13+
like `pyenv` to make things easy.
14+
15+
Installing Pyenv [optional]
16+
---------------------------
17+
18+
If you are working on Ubuntu/Debian systems make sure you have the following libraries installed:
19+
20+
.. code-block:: bash
1421
15-
.. code-block:: bash
22+
$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
23+
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
24+
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
1625
17-
#!/bin/sh
18-
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
19-
echo "export PATH=\"/home/$USER/.pyenv/bin:$PATH\"" >> ~/.bashrc
20-
pyenv install 3.7.0
21-
pyenv global 3.7.0
22-
pip install --upgrade pip
23-
24-
You can simply use pip and python for 3.7 by default.
26+
Download and install pyenv:
2527

26-
*Support exists for python versions > 3.7.0 only. Please ensure correct version before proceding further.*
28+
.. code-block:: bash
2729
28-
* Install using pip(For users):
30+
$ curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
2931
30-
.. code-block:: bash
32+
Add the following lines to your .bashrc:
3133

32-
pip3 install riscv_config
34+
.. code-block:: bash
3335
36+
$ export PATH="/home/<username>/.pyenv/bin:$PATH"
37+
$ eval "$(pyenv init -)"
38+
$ eval "$(pyenv virtualenv-init -)"
3439
35-
* Clone from git(For developers):
40+
Open a new terminal and create a virtual environment using the following
3641

37-
.. code-block:: bash
42+
.. code-block:: bash
3843
39-
git clone https://github.com/riscv/riscv-config.git
40-
cd riscv_config
41-
pip3 install -r requirements.txt
44+
$ pyenv install 3.7.0
45+
$ pyenv virtualenv 3.7.0 riscof_env
4246
43-
Usage
44-
^^^^^
4547
46-
* For users
48+
Now you can activate this virtual environment using the following command:
4749

4850
.. code-block:: bash
4951
50-
riscv-config [-h] --isa_spec YAML --platform_spec YAML [--verbose]
52+
$ pyenv activate riscof_env
53+
$ python ==version
5154
52-
RISC-V Configuration Validator
53-
54-
optional arguments:
55-
--isa_spec YAML, -ispec YAML
56-
The YAML which contains the ISA specs.
57-
--platform_spec YAML, -pspec YAML
58-
The YAML which contains the Platfrorm specs.
59-
--verbose debug | info | warning | error
60-
-h, --help show this help message and exit
55+
Install via PIP [users]
56+
=======================
57+
58+
**NOTE**: If you are using `pyenv` as mentioned above, make sure to enable that environment before
59+
performing the following steps.
6160

61+
.. code-block:: bash
6262
63+
$ pip install riscv_config
6364
64-
* For developers
65+
To update an already installed version of RISCOF to the latest version:
6566

6667
.. code-block:: bash
6768
68-
cd riscv_config/
69+
$ pip install -U riscv_config
6970
70-
python3 -m riscv_config.main -h
71-
usage: [-h] --isa_spec YAML --platform_spec YAML [--verbose]
71+
To checkout a specific version of riscof:
7272

73-
RISC-V Configuration Validator
73+
.. code-block:: bash
74+
75+
$ pip install riscv_config==1.x.x
76+
77+
Once you have RISCV_CONFIG installed, executing ``riscv_config ==help`` should print the following on the terminal:
78+
79+
.. code-block:: bash
80+
81+
riscv-config [-h] ==isa_spec YAML ==platform_spec YAML [==verbose]
7482
83+
RISC-V Configuration Validator
84+
7585
optional arguments:
76-
--isa_spec YAML, -ispec YAML
86+
==isa_spec YAML, -ispec YAML
7787
The YAML which contains the ISA specs.
78-
--platform_spec YAML, -pspec YAML
88+
==platform_spec YAML, -pspec YAML
7989
The YAML which contains the Platfrorm specs.
80-
--verbose debug | info | warning | error
81-
-h, --help show this help message and exit
90+
==verbose debug | info | warning | error
91+
-h, ==help show this help message and exit
8292
8393
8494
85-
Example
86-
^^^^^^^
95+
RISCV_CONFIG for Developers
96+
===========================
8797

88-
* For users
98+
Clone the repository from git and install required dependencies. Note, you will still need
99+
python-3.7.0 and pip. If you are using `pyenv` as mentioned above, make sure to enable that environment before
100+
performing the following steps.
89101

90-
.. code-block:: bash
102+
.. code-block:: bash
91103
92-
git clone https://github.com/riscv/riscv-config.git
104+
$ git clone https://github.com/riscv/riscv-config.git
105+
$ cd riscv_config
106+
$ pip3 install -r requirements.txt
93107
94-
cd riscv_config/
108+
Executing ``python -m riscv_config.main ==help`` should display the same help message as above.
95109

96-
riscv-config -ispec ./examples/template_isa.yaml -pspec ./examples/template_platform.yaml
110+
Usage Example
111+
=============
97112

98-
* For developers
99-
100-
.. code-block:: bash
113+
.. code-block:: bash
114+
115+
$ riscv_config -ispec examples/rv32i_isa.yaml -pspec examples/rv32i_platform.yaml
116+
117+
Executing the above command should display the following on the terminal:
118+
119+
.. code-block:: bash
101120
102-
cd riscv_config/
121+
[INFO] : Input-ISA file
122+
[INFO] : Loading input file: /scratch/git-repo/github/riscv-config/examples/rv32i_isa.yaml
123+
[INFO] : Load Schema /scratch/git-repo/github/riscv-config/riscv_config/schemas/schema_isa.yaml
124+
[INFO] : Initiating Validation
125+
[INFO] : No Syntax errors in Input ISA Yaml. :)
126+
[INFO] : Initiating post processing and reset value checks.
127+
[INFO] : Dumping out Normalized Checked YAML: /scratch/git-repo/github/riscv-config/riscv_config_work/rv32i_isa_checked.yaml
128+
[INFO] : Input-Platform file
129+
[INFO] : Loading input file: /scratch/git-repo/github/riscv-config/examples/rv32i_platform.yaml
130+
[INFO] : Load Schema /scratch/git-repo/github/riscv-config/riscv_config/schemas/schema_platform.yaml
131+
[INFO] : Initiating Validation
132+
[INFO] : No Syntax errors in Input Platform Yaml. :)
133+
[INFO] : Dumping out Normalized Checked YAML: /scratch/git-repo/github/riscv-config/riscv_config_work/rv32i_platform_checked.yaml
134+
103135
104-
python3 -m riscv_config.main -ispec ./examples/template_isa.yaml -pspec ./examples/template_platform.yaml

0 commit comments

Comments
 (0)