Fixes clock cycle delay in propagation of ExiClockState
This commit is contained in:
parent
43fb4beb6e
commit
386602a63c
@ -31,14 +31,14 @@ class ExiClock(Elaboratable):
|
|||||||
|
|
||||||
with m.If(self.prevExiClkValid):
|
with m.If(self.prevExiClkValid):
|
||||||
with m.If(self.prevExiClkState == ClockState.FALLING):
|
with m.If(self.prevExiClkState == ClockState.FALLING):
|
||||||
m.d.sync += self.exiClkState.eq(ClockState.LOW)
|
m.d.comb += self.exiClkState.eq(ClockState.LOW)
|
||||||
with m.Elif(self.prevExiClkState == ClockState.RISING):
|
with m.Elif(self.prevExiClkState == ClockState.RISING):
|
||||||
m.d.sync += self.exiClkState.eq(ClockState.HIGH)
|
m.d.comb += self.exiClkState.eq(ClockState.HIGH)
|
||||||
with m.Else():
|
with m.Else():
|
||||||
with m.If(self.prevExiClk ^ self.exiClk):
|
with m.If(self.prevExiClk ^ self.exiClk):
|
||||||
m.d.sync += self.exiClkState.eq(Cat(1, self.exiClk))
|
m.d.comb += self.exiClkState.eq(Cat(1, self.exiClk))
|
||||||
with m.Else():
|
with m.Else():
|
||||||
m.d.sync += self.exiClkState.eq(Cat(0, self.exiClk))
|
m.d.comb += self.exiClkState.eq(Cat(0, self.exiClk))
|
||||||
|
|
||||||
m.d.sync += self.prevExiClkState.eq(self.exiClkState)
|
m.d.sync += self.prevExiClkState.eq(self.exiClkState)
|
||||||
|
|
||||||
@ -64,19 +64,14 @@ class TestBench:
|
|||||||
yield
|
yield
|
||||||
yield from self.FlipExiClock(dut)
|
yield from self.FlipExiClock(dut)
|
||||||
yield
|
yield
|
||||||
yield
|
|
||||||
assert (yield dut.exiClkState) == ClockState.RISING.value
|
assert (yield dut.exiClkState) == ClockState.RISING.value
|
||||||
yield
|
yield
|
||||||
yield
|
|
||||||
assert (yield dut.exiClkState) == ClockState.HIGH.value
|
assert (yield dut.exiClkState) == ClockState.HIGH.value
|
||||||
yield
|
yield
|
||||||
yield
|
|
||||||
yield from self.FlipExiClock(dut)
|
yield from self.FlipExiClock(dut)
|
||||||
yield
|
yield
|
||||||
yield
|
|
||||||
assert (yield dut.exiClkState) == ClockState.FALLING.value
|
assert (yield dut.exiClkState) == ClockState.FALLING.value
|
||||||
yield
|
yield
|
||||||
yield
|
|
||||||
assert (yield dut.exiClkState) == ClockState.LOW.value
|
assert (yield dut.exiClkState) == ClockState.LOW.value
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from amaranth import *
|
from amaranth import *
|
||||||
from amaranth.build import Platform
|
from amaranth.build import Platform
|
||||||
from amaranth.back import verilog
|
from amaranth.back import verilog
|
||||||
|
Loading…
Reference in New Issue
Block a user