-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- (#191) - Fix from @alwilson to ensure proper priority of dist vs soft constraints - (exp) - Add experimental covergroup callback Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
- Loading branch information
Showing
7 changed files
with
184 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Read the Docs configuration file for Sphinx projects | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the OS, Python version and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.11" | ||
# You can also specify other tool versions: | ||
# nodejs: "20" | ||
# rust: "1.70" | ||
# golang: "1.20" | ||
|
||
# Build documentation in the "docs/" directory with Sphinx | ||
sphinx: | ||
configuration: docs/conf.py | ||
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs | ||
# builder: "dirhtml" | ||
# Fail on all warnings to avoid broken references | ||
# fail_on_warning: true | ||
|
||
# Optionally build your docs in additional formats such as PDF and ePub | ||
# formats: | ||
# - epub | ||
|
||
# Optional but recommended, declare the Python requirements required | ||
# to build your documentation | ||
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html | ||
# python: | ||
# install: | ||
# - requirements: docs/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
name=pyvsc | ||
version=0.8.5 | ||
version=0.8.6 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#**************************************************************************** | ||
#* init.py | ||
#* | ||
#* Copyright 2022 Matthew Ballance and Contributors | ||
#* | ||
#* Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
#* not use this file except in compliance with the License. | ||
#* You may obtain a copy of the License at: | ||
#* | ||
#* http://www.apache.org/licenses/LICENSE-2.0 | ||
#* | ||
#* Unless required by applicable law or agreed to in writing, software | ||
#* distributed under the License is distributed on an "AS IS" BASIS, | ||
#* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
#* See the License for the specific language governing permissions and | ||
#* limitations under the License. | ||
#* | ||
#* Created on: | ||
#* Author: | ||
#* | ||
#**************************************************************************** | ||
|
||
from .covergroup_callback_base import CovergroupCallbackBase | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#**************************************************************************** | ||
#* covergroup_callback_base.py | ||
#* | ||
#* Copyright 2022 Matthew Ballance and Contributors | ||
#* | ||
#* Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
#* not use this file except in compliance with the License. | ||
#* You may obtain a copy of the License at: | ||
#* | ||
#* http://www.apache.org/licenses/LICENSE-2.0 | ||
#* | ||
#* Unless required by applicable law or agreed to in writing, software | ||
#* distributed under the License is distributed on an "AS IS" BASIS, | ||
#* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
#* See the License for the specific language governing permissions and | ||
#* limitations under the License. | ||
#* | ||
#* Created on: | ||
#* Author: | ||
#* | ||
#**************************************************************************** | ||
|
||
from ..model.covergroup_model import CovergroupModel | ||
from ..model.coverpoint_model import CoverpointModel | ||
from ..model.coverpoint_cross_model import CoverpointCrossModel | ||
|
||
class CovergroupCallbackBase(object): | ||
|
||
def __init__(self): | ||
self._hit_m = {} | ||
self._cb = None | ||
|
||
def set_cb(self, cb): | ||
self._cb = cb | ||
|
||
def sample_cb(self, *args, **kwargs): | ||
# Call the 'real' sample method | ||
self.sample(*args, **kwargs) | ||
|
||
self.call_callbacks() | ||
|
||
def call_callbacks(self): | ||
model : CovergroupModel = self.get_model() | ||
for cp in model.coverpoint_l: | ||
self.process_coverpoint(cp) | ||
for cr in model.cross_l: | ||
self.process_cross(cr) | ||
|
||
def process_coverpoint(self, cp : CoverpointModel): | ||
for bi in range(cp.get_n_bins()): | ||
name = cp.name + "." + cp.get_bin_name(bi) | ||
if name not in self._hit_m.keys(): | ||
self._hit_m[name] = 0 | ||
hits = cp.get_bin_hits(bi) | ||
if self._hit_m[name] != hits: | ||
self._hit_m[name] = hits | ||
self._cb(name, hits) | ||
|
||
def process_cross(self, cp : CoverpointCrossModel): | ||
for bi in range(cp.get_n_bins()): | ||
name = cp.name + "." + cp.get_bin_name(bi) | ||
if name not in self._hit_m.keys(): | ||
self._hit_m[name] = 0 | ||
hits = cp.get_bin_hits(bi) | ||
if self._hit_m[name] != hits: | ||
self._hit_m[name] = hits | ||
self._cb(name, hits) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters