From 3168ce4c5f1c3e14c71543619353db77cfeeb159 Mon Sep 17 00:00:00 2001 From: Alex Mykyta Date: Wed, 2 Aug 2023 22:23:26 -0700 Subject: [PATCH] Fix missed check on valid assignment component for UDPs --- systemrdl/properties/user_defined.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/systemrdl/properties/user_defined.py b/systemrdl/properties/user_defined.py index 3f6d5f9..1a6e16f 100644 --- a/systemrdl/properties/user_defined.py +++ b/systemrdl/properties/user_defined.py @@ -58,6 +58,14 @@ def assign_value(self, comp_def: 'comp.Component', value: Any, src_ref: 'SourceR # As per 15.2.1-c. UDP is still "bound" to the component, so give # it the NoValue class as a value + # Check if property is allowed in this component + if type(comp_def) not in self.bindable_to: + self.env.msg.fatal( + "The property '%s' is not valid for '%s' components" + % (self.get_name(), type(comp_def).__name__.lower()), + src_ref + ) + # Circumvent the usual assignment function to avoid some pesky validation comp_def.properties[self.get_name()] = rdltypes.NoValue if src_ref is not None: