fhdl.structure: do not permit clock domain names that start with numbers

This commit is contained in:
Robert Jordens 2014-08-17 14:56:33 -06:00 committed by Sebastien Bourdeauducq
parent ac2e961618
commit bd232f3f61
1 changed files with 3 additions and 1 deletions

View File

@ -511,8 +511,10 @@ class ClockDomain:
self.name = tracer.get_obj_var_name(name) self.name = tracer.get_obj_var_name(name)
if self.name is None: if self.name is None:
raise ValueError("Cannot extract clock domain name from code, need to specify.") 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:] 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") self.clk = Signal(name_override=self.name + "_clk")
if reset_less: if reset_less:
self.rst = None self.rst = None