cores/clock/create_clkout: rename clk_ce to ce, improve error reporting

This commit is contained in:
Florent Kermarrec 2020-01-24 09:06:35 +01:00
parent 7e08836062
commit 19ef19ce0d
1 changed files with 6 additions and 4 deletions

View File

@ -41,7 +41,7 @@ class XilinxClocking(Module, AutoCSR):
raise ValueError raise ValueError
self.clkin_freq = freq self.clkin_freq = freq
def create_clkout(self, cd, freq, phase=0, buf="bufg", margin=1e-2, with_reset=True, clk_ce=None): def create_clkout(self, cd, freq, phase=0, buf="bufg", margin=1e-2, with_reset=True, ce=None):
assert self.nclkouts < self.nclkouts_max assert self.nclkouts < self.nclkouts_max
clkout = Signal() clkout = Signal()
self.clkouts[self.nclkouts] = (clkout, freq, phase, margin) self.clkouts[self.nclkouts] = (clkout, freq, phase, margin)
@ -57,12 +57,14 @@ class XilinxClocking(Module, AutoCSR):
self.specials += Instance("BUFG", i_I=clkout, o_O=clkout_buf) self.specials += Instance("BUFG", i_I=clkout, o_O=clkout_buf)
elif buf == "bufr": elif buf == "bufr":
self.specials += Instance("BUFR", i_I=clkout, o_O=clkout_buf) self.specials += Instance("BUFR", i_I=clkout, o_O=clkout_buf)
elif buf == "bufgce" and clk_ce != None: elif buf == "bufgce":
self.specials += Instance("BUFGCE", i_I=clkout, o_O=clkout_buf, i_CE=clk_ce) if ce is None:
raise ValueError("BUFGCE requires user to provide a clock enable ce Signal")
self.specials += Instance("BUFGCE", i_I=clkout, o_O=clkout_buf, i_CE=ce)
elif buf == "bufio": elif buf == "bufio":
self.specials += Instance("BUFIO", i_I=clkout, o_O=clkout_buf) self.specials += Instance("BUFIO", i_I=clkout, o_O=clkout_buf)
else: else:
raise ValueError raise ValueError("Unsupported clock buffer: {}".format(buf))
def compute_config(self): def compute_config(self):
config = {} config = {}