Add signed/fixedpoint properties (#140)

* declared intwidth, fracwidth, and is_signed UDPs

* fix boolean type name in UDP definition

* generate hwif fields with fixedpoint indices

* make "counter" and "encode" properties mutualy exclusive with signed/fixedpoint

* add signed/unsigned to hwif

* improved fixedpoint error messages, added validation tests

* added fixedpoint tests

* fixedpoint/signed not allowed for signal components

* added signed/fixedpoint UDP docs

* handle single-bit fixedpoint numbers

* fix too many positional arguments lint

* changed spelling of fixedpoint to fixed-point

* use "logic" in place of "unsigned logic"

* split signed and fixedpoint docs, added examples

* allow enums with is_signed=false

* split signed and fixedpoint implementations

* assorted nits picked

* updated is_signed validation unit test
This commit is contained in:
Dana Sorensen
2025-05-15 09:48:44 -06:00
committed by GitHub
parent 62f66fb7ff
commit d2b4911d5f
20 changed files with 585 additions and 10 deletions

View File

@@ -89,3 +89,33 @@ class TestValidationErrors(BaseTestCase):
"unsynth_reset2.rdl",
"A field that uses an asynchronous reset cannot use a dynamic reset value. This is not synthesizable.",
)
def test_fixedpoint_counter(self) -> None:
self.assert_validate_error(
"fixedpoint_counter.rdl",
"Fixed-point representations are not supported for counter fields.",
)
def test_fixedpoint_enum(self) -> None:
self.assert_validate_error(
"fixedpoint_enum.rdl",
"Fixed-point representations are not supported for fields encoded as an enum.",
)
def test_fixedpoint_inconsistent_width(self) -> None:
self.assert_validate_error(
"fixedpoint_inconsistent_width.rdl",
r"Number of integer bits \(4\) plus number of fractional bits \(5\) must be equal to the width of the component \(8\).",
)
def test_signed_counter(self) -> None:
self.assert_validate_error(
"signed_counter.rdl",
"The property is_signed=true is not supported for counter fields.",
)
def test_signed_enum(self) -> None:
self.assert_validate_error(
"signed_enum.rdl",
"The property is_signed=true is not supported for fields encoded as an enum."
)