ShiftRegister is a usefull function to synchronize external signal with the main clock with two flip-flop :
sync_signal := ShiftRegister(ext_signal, 2)
That work well in this case. But is there a way to use it with an other clock like this :
slowClk = Clock(reset=Driver.implicitReset)
sync_signal := ShiftRegister(ext_signal, 2, clock=slowClk)
?
With Chisel3 it's now possible using withClock(){}
We just have to surround ShiftRegister() call with withClock :
withClock(clock) {
led := ShiftRegister(blinkled, 4)
}
See also multiple clocks domains chapter in Chisel3 wiki.