summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2017-10-23 12:47:28 -0700
committerEric Anholt <[email protected]>2017-10-30 13:31:12 -0700
commit443e1984d2ce42580856489a0adb987f6af64786 (patch)
treedf516b1ebbc4ee73ced2490469218a6336098133 /src
parente2f114b32b18a5576c311b0d740f514afa2e9da4 (diff)
broadcom/xml: Throw an #error in XML-based codegen for a >1bit bool
I've debugged two nasty errors now due to copy-and-pasting a bool type when writing a uint field. Make sure I don't do that again.
Diffstat (limited to 'src')
-rw-r--r--src/broadcom/cle/gen_pack_header.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/broadcom/cle/gen_pack_header.py b/src/broadcom/cle/gen_pack_header.py
index badcc2c587c..d458c2b1c40 100644
--- a/src/broadcom/cle/gen_pack_header.py
+++ b/src/broadcom/cle/gen_pack_header.py
@@ -111,6 +111,9 @@ class Field(object):
self.end = self.start + int(attrs["size"]) - 1
self.type = attrs["type"]
+ if self.type == 'bool' and self.start != self.end:
+ print("#error Field {} has bool type but more than one bit of size".format(self.name));
+
if "prefix" in attrs:
self.prefix = safe_name(attrs["prefix"]).upper()
else: