fix integer bounds, move to self-hosted runner
This commit is contained in:
parent
11ad9fb56a
commit
34f6a54330
|
|
@ -2,12 +2,14 @@ name: run_tests
|
|||
on: [push]
|
||||
jobs:
|
||||
all:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install Manta from Source
|
||||
run: |
|
||||
ls -lah
|
||||
pwd
|
||||
python -m pip install -U pip
|
||||
|
||||
# omitting the following commmand causes the version of setuptools
|
||||
|
|
@ -19,13 +21,13 @@ jobs:
|
|||
|
||||
python -m pip install ".[dev]"
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
# export tool paths
|
||||
export VIVADO=/tools/Xilinx/Vivado/2023.1/bin/vivado
|
||||
export YOSYS=/tools/oss-cad-suite/bin/yosys
|
||||
export NEXTPNR_ICE40=/tools/oss-cad-suite/bin/nextpnr_ice40
|
||||
export NEXTPNR_ICE40=/tools/oss-cad-suite/bin/nextpnr-ice40
|
||||
export ICEPACK=/tools/oss-cad-suite/bin/icepack
|
||||
export ICEPROG=/tools/oss-cad-suite/bin/iceprog
|
||||
|
||||
|
||||
- name: Run tests
|
||||
run: make test
|
||||
make test
|
||||
|
|
@ -237,6 +237,28 @@ class IOCore(Elaboratable):
|
|||
return self.max_addr
|
||||
|
||||
def set_probe(self, probe_name, value):
|
||||
# check that probe is an output probe
|
||||
if probe_name not in self.config["outputs"]:
|
||||
raise ValueError(f"Output probe '{probe_name}' not found.")
|
||||
|
||||
# check that value is an integer
|
||||
if not isinstance(value, int):
|
||||
raise ValueError("Value must be an integer.")
|
||||
|
||||
# get the width of the probe, make sure value isn't too large for the probe
|
||||
attrs = self.config["outputs"][probe_name]
|
||||
if isinstance(attrs, int):
|
||||
width = attrs
|
||||
|
||||
if isinstance(attrs, dict):
|
||||
width = attrs["width"]
|
||||
|
||||
if value > 0 and value > 2**width - 1:
|
||||
raise ValueError("Unsigned integer too large.")
|
||||
|
||||
if value < 0 and value < -(2 ** (width - 1)):
|
||||
raise ValueError("Signed integer too large.")
|
||||
|
||||
# set value in buffer
|
||||
addrs = self.mmap[probe_name + "_buf"]["addrs"]
|
||||
datas = value_to_words(value, len(addrs))
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ def words_to_value(data):
|
|||
if d > 0 and d > 2**16 - 1:
|
||||
raise ValueError("Unsigned integer too large.")
|
||||
|
||||
if d < 0 and d < -(2**15 - 1):
|
||||
if d < 0 and d < -(2**15):
|
||||
raise ValueError("Signed integer too large.")
|
||||
|
||||
return int("".join([f"{i:016b}" for i in data[::-1]]), 2)
|
||||
|
|
|
|||
Loading…
Reference in New Issue