Commit 070baf8b authored by Robert Jordens's avatar Robert Jordens
Browse files

vivado/AsyncResetSync: constrain metastable path, fix false_path

parent 1a5cdd57
......@@ -75,16 +75,21 @@ class XilinxMultiReg:
class XilinxAsyncResetSynchronizerImpl(Module):
def __init__(self, cd, async_reset):
rst1 = Signal()
def __init__(self, cd, reset_in):
rst_async = Signal()
rst_meta = Signal()
self.specials += [
Instance("FDPE", p_INIT=1, i_D=0, i_PRE=async_reset,
i_CE=1, i_C=cd.clk, o_Q=rst1),
Instance("FDPE", p_INIT=1, i_D=rst1, i_PRE=async_reset,
Instance("FDPE", p_INIT=1, i_D=0, i_PRE=rst_async,
i_CE=1, i_C=cd.clk, o_Q=rst_meta),
Instance("FDPE", p_INIT=1, i_D=rst_meta, i_PRE=rst_async,
i_CE=1, i_C=cd.clk, o_Q=cd.rst)
]
rst1.attr.add("asr_false_path")
rst1.attr.add("async_reg")
self.comb += [
rst_async.eq(reset_in)
]
rst_async.attr.add("asr_false_path")
rst_meta.attr.add("asr_meta")
rst_meta.attr.add("async_reg")
cd.rst.attr.add("async_reg")
......
......@@ -130,6 +130,7 @@ class XilinxISEToolchain:
"no_retiming": ("register_balancing", "no"),
"async_reg": None,
"asr_false_path": None,
"asr_meta": None,
"no_shreg_extract": ("shreg_extract", "no")
}
......
......@@ -75,6 +75,7 @@ class XilinxVivadoToolchain:
"keep": ("dont_touch", "true"),
"no_retiming": ("dont_touch", "true"),
"async_reg": ("async_reg", "true"),
"asr_meta": ("asr_meta", "true"), # user-defined attribute
"asr_false_path": ("asr_false_path", "true"), # user-defined attribute
"no_shreg_extract": None
}
......@@ -147,9 +148,17 @@ class XilinxVivadoToolchain:
del self.false_paths
def _constrain(self, platform):
# The asychronous reset input to the AsyncResetSynchronizer is a false
# path
platform.add_platform_command(
"set_false_path -to [get_cells -of_objects "
"[get_nets -hier -filter {{asr_false_path==true}}]]"
"set_false_path -quiet -through "
"[get_nets -hier -filter {{asr_false_path==true}}]"
)
# clock_period-2ns to resolve metastability on the wire between the
# AsyncResetSynchronizer FFs
platform.add_platform_command(
"set_max_delay 2 -quiet -through "
"[get_nets -hier -filter {{asr_meta==true}}]"
)
def build(self, platform, fragment, build_dir="build", build_name="top",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment