• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Nic30 / hwt / 8b945dd2-6cbf-43b3-be54-881b32d4f5e4

10 Jun 2025 09:35PM UTC coverage: 84.734% (-2.6%) from 87.284%
8b945dd2-6cbf-43b3-be54-881b32d4f5e4

push

circleci

Nic30
test: fix call of unittestMain

3415 of 4468 branches covered (76.43%)

Branch coverage included in aggregate %.

11877 of 13579 relevant lines covered (87.47%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

69.05
/hwt/hdl/types/stringConst.py
1
from hwt.hdl.const import HConst
1✔
2
from hwt.hdl.operator import HOperatorNode
1✔
3
from hwt.hdl.operatorDefs import HwtOps
1✔
4
from hwt.hdl.types.defs import BOOL
1✔
5
from hwt.hdl.types.typeCast import toHVal
1✔
6
from hwt.synthesizer.rtlLevel.rtlSignal import RtlSignal
1✔
7

8

9
class HStringRtlSignal(RtlSignal):
1✔
10

11
    def _eq(self, other):
1✔
12
        other = toHVal(other, self._dtype)
×
13
        assert self._dtype == other._dtype, (self, self._dtype, other, other._dtype)
×
14
        return HOperatorNode.withRes(HwtOps.EQ, [self, other], BOOL)
×
15

16

17
class HStringConst(HConst):
1✔
18
    """
19
    Value class for hdl HString type
20
    """
21

22
    @classmethod
1✔
23
    def from_py(cls, typeObj, val, vld_mask=None):
1✔
24
        """
25
        :param val: python string or None
26
        :param typeObj: instance of HString HdlType
27
        :param vld_mask: if is None validity is resolved from val
28
            if is 0 value is invalidated
29
            if is 1 value has to be valid
30
        """
31
        assert isinstance(val, str) or val is None
1✔
32
        vld = 0 if val is None else 1
1✔
33
        if not vld:
1✔
34
            assert vld_mask is None or vld_mask == 0
1✔
35
            val = ""
1✔
36
        else:
37
            if vld_mask == 0:
1!
38
                val = ""
×
39
                vld = 0
×
40

41
        return cls(typeObj, val, vld)
1✔
42

43
    def to_py(self):
1✔
44
        if not self._is_full_valid():
×
45
            raise ValueError(f"Value of {self} is not fully defined")
×
46
        return self.val
×
47

48
    def _eq(self, other):
1✔
49
        other = toHVal(other, self._dtype)
1✔
50

51
        if isinstance(self, HConst):
1!
52
            eq = self.val == other.val
1✔
53
            vld = int(self.vld_mask and other.vld_mask)
1✔
54
            return BOOL.getConstCls()(BOOL, int(eq), vld)
1✔
55

56
        else:
57
            return HStringRtlSignal._eq(other)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc