From bd232f3f61b21c3b38dd0c6b6e1e4c507d18471e Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Sun, 17 Aug 2014 14:56:33 -0600 Subject: [PATCH] fhdl.structure: do not permit clock domain names that start with numbers --- migen/fhdl/structure.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migen/fhdl/structure.py b/migen/fhdl/structure.py index 4525266e6..09342f544 100644 --- a/migen/fhdl/structure.py +++ b/migen/fhdl/structure.py @@ -511,8 +511,10 @@ class ClockDomain: self.name = tracer.get_obj_var_name(name) if self.name is None: raise ValueError("Cannot extract clock domain name from code, need to specify.") - if len(self.name) > 3 and self.name[:3] == "cd_": + if self.name.startswith("cd_"): self.name = self.name[3:] + if self.name[0].isdigit(): + raise ValueError("Clock domain name cannot start with a number.") self.clk = Signal(name_override=self.name + "_clk") if reset_less: self.rst = None