CRG: support reset inversion

This commit is contained in:
Sebastien Bourdeauducq 2013-03-15 10:49:18 +01:00
parent 24910173b7
commit 37d8029848
1 changed files with 6 additions and 2 deletions

View File

@ -10,7 +10,11 @@ class CRG(Module):
return r
class SimpleCRG(CRG):
def __init__(self, platform, clk_name, rst_name):
def __init__(self, platform, clk_name, rst_name, rst_invert=False):
self.cd = ClockDomain("sys")
platform.request(clk_name, None, self.cd.clk)
platform.request(rst_name, None, self.cd.rst)
if rst_invert:
rst_n = platform.request(rst_name)
self.comb += self.cd.rst.eq(~rst_n)
else:
platform.request(rst_name, None, self.cd.rst)