Bluespec Systemverilog™ Training Lecture 10: Multiple Clock Domains
Bluespec Systemverilog™ Training Lecture 10: Multiple Clock Domains
Clock families
Making clocks
Synchronizing interfaces
Clock c = … ;
Reg# (Bool) b <- mkReg # (True, clocked_by c);
Example
Example:
If c is switched off:
f.enq, f.deq and f.clear are unready
f.first remains ready if the fifo was non-empty when
the clock was switched off
The notional clock for a rule may be calculated in the same way
Bool b = … ;
Clock c0 <- mkGatedClock ( b);
Bool b1 = …;
Clock c1 ();
mkGatedClock g1 (b1, c1, clocked_by c0);
mkClock
(Bit#(1) osc, Bool gate)
mkGatedClock
(Bool newCond)
mkClockDivider
#(Integer divider) ( Clock clkin )
clk
q Meta-stable data
Copyright © Bluespec Inc. 2005 20
Synchronizers
sClk dClk
sClk dClk
interface SyncBitIfc ;
method Action send ( Bit#(1) bitData ) ;
method Bit#(1) read () ;
endinterface
Pulse Synchronizer
Word Synchronizer
FIFO Synchronizer
Asynchronous RAM
Null Synchronizer
Reset Synchronizers
interface SyncPulseIfc ;
method Action send () ;
method Bool pulse() ;
endinterface
sClk
Send()
dClk
pulse()
interface WordCruncher ;
method Action crunch( Bit#(32) dataRead ) ;
...
endinterface
Designers instantiate a module having different
clocks for different methods, and connect it up
explicitly
E.g. a FIFO with enq and deq on different clocks
mkConverter converts an existing interface to
another one of the same type, but on different clock
In this style, more of the details are implicit
oldIfc is clocked by c0
newIfc is clocked by the current clock
“4” is a parameter for the conversion
(the depth of the FIFO)
newIfc can be used exactly as oldIfc,
but in the current clock domain
Copyright © Bluespec Inc. 2005 41
Synchronizing Interfaces