Skip to content

Commit 9c4aa81

Browse files
committed
fix for index-based dependency checks in warl string.
1 parent 138c69e commit 9c4aa81

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

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

5+
## [2.14.0] - 2022-05-13
6+
7+
- fix for index-based dependency checks in warl string.
8+
59
## [2.13.1] - 2022-03-23
6-
- Added setup.cfg to automate bumpversion
7-
- Fix wording for legal strings in dependency warl fields.
10+
11+
- Added setup.cfg to automate bumpversion
12+
- Fix wording for legal strings in dependency warl fields.
813

914
## [2.13.0] - 2022-03-09
1015
- add support for detection of svnapot in ISA string

riscv_config/warl.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import logging
44
import riscv_config.utils as utils
5+
import textwrap
56

67
logger = logging.getLogger(__name__)
78

@@ -27,7 +28,8 @@ def prevsum(self, i, k):
2728
def islegal(self, value, dependency_vals=[]):
2829
is_legal = False
2930
logger.debug('Checking for isLegal for WARL: \n' +
30-
utils.pretty_print_yaml(self.warl) + '\n With following args:'\
31+
textwrap.indent(utils.pretty_print_yaml(self.warl),' ')
32+
+ '\n With following args:'
3133
+ 'val : ' + str(value) + ' dep_vals :'+
3234
str(dependency_vals))
3335
if not self.dependencies: # no dependencies in the warl
@@ -77,9 +79,15 @@ def islegal(self, value, dependency_vals=[]):
7779
dep_search = self.exp.search(dep_str)
7880
if csr_search is None or dep_search is None:
7981
logger.error('Warl legal string is wrong :\n\t' + legal_str)
80-
raise SystemExit
82+
raise SystemExit(1)
8183
dep_csr = dep_search.group('csr')
8284
dep_ind = dep_search.group('csr_ind')
85+
if ':' in dep_ind:
86+
msb = int(dep_ind.split(':')[0],0)
87+
lsb = int(dep_ind.split(':')[1],0)
88+
else:
89+
lsb = int(dep_ind,0)
90+
msb = lsb
8391
dep_vals = dep_search.group('csr_vals')
8492
dep_bitmask = True if 'bitmask' in legal_str.split('->')[0] else False
8593

@@ -90,6 +98,7 @@ def islegal(self, value, dependency_vals=[]):
9098
raise SystemExit
9199
dep_satified = False
92100
recvd_val = dependency_vals[leaf_dependencies.index(dep_csr)]
101+
recvd_val = (recvd_val >> lsb) & ((1<<(msb-lsb))-1)
93102

94103
# check if the dependency value is satisfied.
95104
if ":" in dep_vals: # range is specified

0 commit comments

Comments
 (0)